:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --surface: #fffdf8;
  --surface-2: #f8faf7;
  --ink: #24211d;
  --muted: #6f6a60;
  --line: #ded7ca;
  --teal: #116a67;
  --teal-dark: #0b4f4c;
  --amber: #a86420;
  --red: #a33c2f;
  --shadow: 0 18px 45px rgba(58, 47, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #ebe6da;
  padding: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  letter-spacing: 0;
}

.brand p,
.topbar p {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.panel {
  background: rgba(255, 253, 248, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
}

.panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 10px 0 0;
}

.compact {
  display: grid;
  gap: 10px;
}

.work-log {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-log li,
.empty-log {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 9px;
}

.work-log strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 106, 103, 0.13);
}

.panel label + label {
  margin-top: 12px;
}

.workspace {
  padding: 26px clamp(18px, 3vw, 42px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: 28px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.source-box textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.65;
}

.steps {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.step-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.step-head > div:first-child {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.step-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #ead7bd;
  color: #60370c;
  font-weight: 700;
}

.step-head h3 {
  font-size: 17px;
  letter-spacing: 0;
}

.step-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.output {
  display: block;
  min-height: 230px;
  border: 0;
  border-radius: 0;
  resize: vertical;
  line-height: 1.7;
  background: var(--surface);
}

.primary {
  background: var(--teal);
  color: #fff;
}

.primary:hover {
  background: var(--teal-dark);
}

.secondary {
  background: #fff8ec;
  color: var(--amber);
  border: 1px solid #e0c7a0;
}

.secondary:hover {
  background: #fff1dc;
}

.danger {
  background: #fff5f2;
  color: var(--red);
  border: 1px solid #e2b7ad;
}

.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: 62px;
  }

  .workspace,
  .sidebar {
    padding: 18px;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .step-head,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .brand {
    margin-bottom: 14px;
  }

  .mark {
    width: 44px;
    height: 44px;
    font-size: 26px;
  }

  h1 {
    font-size: 19px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .panel {
    padding: 14px;
  }

  .source-box textarea {
    min-height: 260px;
  }

  .output {
    min-height: 260px;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(17, 106, 103, 0.22);
    border-radius: 10px;
    background: rgba(255, 253, 248, 0.96);
    box-shadow: 0 12px 28px rgba(36, 33, 29, 0.18);
    backdrop-filter: blur(10px);
  }

  .mobile-nav a {
    display: grid;
    place-items: center;
    min-height: 38px;
    border-radius: 7px;
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
  }

  .mobile-nav a:active,
  .mobile-nav a:focus {
    background: #e7f0ed;
    outline: none;
  }
}
