:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #eef4f3;
  --surface-warm: #fff8ed;
  --ink: #111827;
  --muted: #5e6b7a;
  --line: #d8e0ea;
  --line-strong: #b7c3d1;
  --accent: #0f766e;
  --accent-strong: #0a4f49;
  --accent-soft: #dff3f0;
  --warning: #b35a13;
  --danger: #b8463d;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 20px 54px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 52%, #e9f0f7 100%),
    repeating-linear-gradient(90deg, rgba(17, 24, 39, 0.025) 0 1px, transparent 1px 24px);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
  max-width: 100%;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 20;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  padding: 10px 14px;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.app-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-size: 22px;
  font-weight: 900;
}

.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.app-header h1,
.screen-head h2,
.output-head h2 {
  margin: 0;
  line-height: 1.16;
}

.app-header h1 {
  font-size: 32px;
}

.status-pill {
  min-width: 172px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--danger);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.08);
}

.status-pill.ready {
  border-left-color: var(--accent);
  color: var(--accent-strong);
}

.workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.68fr);
  gap: 16px;
  align-items: start;
}

.wizard-card,
.output-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.wizard-card {
  overflow: hidden;
}

.output-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  background: #e9eef6;
}

.step-tab {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.step-tab span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font-family: var(--mono);
  font-size: 12px;
}

.step-tab[aria-current="step"] {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
}

.step-tab.is-complete span {
  background: var(--accent);
  color: white;
}

.progress-track {
  height: 4px;
  background: #dde6ef;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.wizard-form {
  padding: 18px;
}

.wizard-step {
  display: none;
}

.wizard-step.is-active {
  display: block;
}

.screen-head {
  margin-bottom: 16px;
}

.screen-head h2 {
  font-size: 28px;
}

.screen-head p:last-child {
  max-width: 58ch;
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.step-error {
  margin: 0 0 14px;
  border: 1px solid rgba(184, 70, 61, 0.32);
  border-left: 5px solid var(--danger);
  border-radius: var(--radius);
  background: #fff1f0;
  color: #8f2e28;
  padding: 12px;
  font-weight: 800;
  line-height: 1.55;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
}

label span,
legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

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

textarea {
  min-height: 300px;
  resize: vertical;
  font-size: 17px;
  line-height: 1.72;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.screen-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.ghost-button,
.copy-button,
.plain-button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-weight: 900;
  white-space: nowrap;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  background: var(--ink);
  color: white;
}

.secondary-button {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--accent);
  color: white;
}

.ghost-button,
.copy-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.plain-button {
  width: 100%;
  margin-top: 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.copy-button:hover,
.plain-button:hover,
.style-card:hover,
.type-button:hover,
.step-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.1);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.copy-button:active,
.plain-button:active,
.style-card:active,
.type-button:active {
  transform: translateY(0);
}

.primary-button[disabled] {
  cursor: wait;
  opacity: 0.68;
}

.native-mode-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.style-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.style-card,
.type-button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.style-card {
  min-height: 116px;
  padding: 14px;
}

.style-name,
.type-name {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
}

.style-note,
.type-use {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.style-card[aria-pressed="true"],
.type-button[aria-pressed="true"] {
  border-color: rgba(15, 118, 110, 0.58);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}

.style-card[aria-pressed="true"] .style-name,
.type-button[aria-pressed="true"] .type-name {
  color: var(--accent-strong);
}

.type-selector {
  margin: 0 0 14px;
  border: 0;
  padding: 0;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.type-button {
  min-height: 116px;
  padding: 14px;
}

.type-button:nth-child(2n) {
  background: #fbfcff;
}

.type-guide {
  border: 1px solid #ead8c0;
  border-left: 5px solid var(--warning);
  border-radius: var(--radius);
  background: var(--surface-warm);
  overflow: hidden;
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #ead8c0;
}

.guide-head span {
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
}

.guide-head strong {
  color: var(--ink);
  font-size: 17px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-item {
  min-width: 0;
  padding: 14px 15px;
}

.guide-item + .guide-item {
  border-left: 1px solid #ead8c0;
}

.guide-item dt {
  margin-bottom: 7px;
  color: var(--warning);
  font-size: 13px;
  font-weight: 900;
}

.guide-item dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.68;
}

.guide-example {
  white-space: pre-wrap;
}

.review-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.review-list div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 12px;
}

.review-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.review-list strong {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.advanced-options,
.key-settings {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.key-settings {
  margin-bottom: 12px;
  background: var(--surface-soft);
}

.advanced-options summary,
.key-settings summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  color: var(--accent-strong);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}

.advanced-grid {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.split-row,
.settings-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-strip {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 0 14px 14px;
}

.settings-strip label:first-child {
  grid-column: 1 / -1;
}

.key-note {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.recommendation-state,
.recommendation-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 14px;
}

.recommendation-state {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.recommendation-state strong {
  color: var(--ink);
  font-size: 18px;
}

.recommendation-state span {
  color: var(--muted);
  line-height: 1.65;
}

.recommendation-result {
  margin-top: 12px;
  border-left: 5px solid var(--accent);
}

.recommendation-result.hidden {
  display: none;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.recommendation-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.recommendation-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.recommendation-grid strong {
  color: var(--accent-strong);
  line-height: 1.45;
}

.recommendation-result p {
  margin: 12px 0 0;
  color: var(--ink);
  line-height: 1.65;
}

.recommendation-result p + p {
  color: var(--muted);
}

.rule-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.rule-strip span {
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  background: #fff8ed;
  color: #6d3d12;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.output-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.output-head h2 {
  font-size: 24px;
}

.result-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 18px;
  color: var(--muted);
  line-height: 1.72;
}

.result-state.hidden {
  display: none;
}

.state-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.result-state p:last-child {
  margin-bottom: 0;
}

.results {
  display: grid;
  gap: 12px;
}

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

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
  padding: 10px 12px;
}

.result-index {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
}

.result-text {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.78;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .app-header,
  .app-layout {
    display: block;
  }

  .app-header h1 {
    font-size: 25px;
  }

  .status-pill {
    width: 100%;
    margin-top: 12px;
  }

  .output-panel {
    position: static;
    max-height: none;
    margin-top: 12px;
  }

  .style-cards,
  .type-grid,
  .guide-grid,
  .recommendation-grid,
  .split-row,
  .settings-strip,
  .rule-strip {
    grid-template-columns: 1fr;
  }

  .guide-item + .guide-item {
    border-left: 0;
    border-top: 1px solid #ead8c0;
  }

  .settings-strip {
    align-items: stretch;
  }

  textarea {
    min-height: 250px;
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .app-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    font-size: 19px;
  }

  .app-header h1 {
    font-size: 22px;
  }

  .stepper {
    gap: 4px;
    padding: 8px;
  }

  .step-tab {
    min-height: 52px;
    display: grid;
    gap: 4px;
    font-size: 12px;
  }

  .step-tab span {
    margin: 0 auto;
  }

  .wizard-form,
  .output-panel {
    padding: 14px;
  }

  .screen-head h2 {
    font-size: 23px;
  }

  .screen-actions {
    grid-template-columns: 1fr;
  }

  .review-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
