:root {
  --bg: #f2eee6;
  --bg-strong: #e2d6c6;
  --surface: rgba(255, 251, 245, 0.82);
  --surface-strong: #fffaf2;
  --stroke: rgba(37, 45, 62, 0.14);
  --text: #1c2633;
  --muted: #5d6a76;
  --primary: #d56a3d;
  --primary-deep: #a34723;
  --accent: #1b5c68;
  --accent-soft: #d9ebe9;
  --success: #1f7a53;
  --warning: #c28a10;
  --danger: #a73f3a;
  --shadow: 0 24px 60px rgba(27, 34, 44, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-sans: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(213, 106, 61, 0.18), transparent 28%),
    radial-gradient(circle at right 20%, rgba(27, 92, 104, 0.12), transparent 26%),
    linear-gradient(180deg, #f7f1e7 0%, #ece6dc 52%, #f5efe7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(28, 38, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 38, 51, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 88%);
}

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 calc(48px + env(safe-area-inset-bottom));
}

.topbar,
.hero,
.panel,
.disclaimer-banner {
  backdrop-filter: blur(12px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  background: rgba(255, 248, 239, 0.78);
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker,
.hero-kicker {
  margin: 0 0 8px;
  color: var(--primary-deep);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-lockup h1,
.hero h2,
.panel h3 {
  margin: 0;
  line-height: 1.05;
}

.brand-lockup h1 {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
}

.view-switch,
.lang-toggle,
.hero-actions,
.form-actions,
.modal-actions,
.step-nav,
.summary-head,
.table-head,
.section-brand,
.mini-metrics,
.subhead {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.view-chip,
.lang-chip,
.text-button,
.secondary-button,
.primary-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.view-chip,
.lang-chip,
.text-button,
.secondary-button {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(28, 38, 51, 0.06);
  color: var(--text);
}

.view-chip.active,
.lang-chip.active {
  background: var(--text);
  color: #fff;
  box-shadow: 0 12px 28px rgba(28, 38, 51, 0.18);
}

.primary-button,
.secondary-button {
  padding: 12px 18px;
  border-radius: 999px;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  box-shadow: 0 16px 28px rgba(165, 71, 35, 0.26);
}

.primary-button-hero {
  min-width: 220px;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
}

.secondary-button {
  color: var(--accent);
  background: rgba(27, 92, 104, 0.1);
}

.text-button {
  padding: 0;
  background: none;
  color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-top: 18px;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.step-node {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(28, 38, 51, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
  cursor: pointer;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.quick-nav-shell {
  margin-top: 12px;
}

.collapsible-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collapsible-title {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.collapsible-toggle {
  flex: 0 0 auto;
  color: var(--accent);
}

.step-node.active {
  background: rgba(213, 106, 61, 0.12);
  color: var(--primary-deep);
}

.step-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(28, 38, 51, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
}

.step-node.active .step-index {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
}

.hero-copy,
.hero-stats {
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -10% -28% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 92, 104, 0.2) 0%, transparent 70%);
}

.hero h2 {
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  max-width: 12ch;
}

.hero-body,
.panel-copy,
.modal-card p,
#summary-brand-copy,
.review-card p {
  color: var(--muted);
  line-height: 1.65;
}

.role-note {
  margin: 4px 0 20px;
  max-width: 72ch;
}

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

.stat-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(28, 38, 51, 0.08);
}

.stat-card.accent {
  background: linear-gradient(135deg, rgba(31, 122, 83, 0.12), rgba(255, 255, 255, 0.8));
}

.stat-card.accent-alt {
  background: linear-gradient(135deg, rgba(194, 138, 16, 0.16), rgba(255, 255, 255, 0.78));
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  line-height: 1.2;
}

.stat-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.disclaimer-banner {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(28, 38, 51, 0.18);
  background: rgba(255, 252, 247, 0.7);
  color: var(--muted);
  line-height: 1.6;
}

.view-panel {
  display: none;
  margin-top: 18px;
}

.view-panel.active {
  display: block;
  animation: rise 240ms ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-two {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 18px;
}

.panel {
  padding: 26px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field-group {
  margin-top: 18px;
}

.field-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field-hint {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.smart-query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field-divider {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.page-actions-prominent {
  justify-content: flex-end;
  margin-top: 18px;
}

.page-actions-inline {
  margin-top: 12px;
}

.page-actions-bridge {
  margin-top: 18px;
  justify-content: flex-end;
}

.role-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.role-card.active {
  border-color: rgba(213, 106, 61, 0.45);
  box-shadow: 0 0 0 2px rgba(213, 106, 61, 0.16);
}

input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(28, 38, 51, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  color: inherit;
}

input:focus {
  outline: 2px solid rgba(213, 106, 61, 0.25);
  border-color: rgba(213, 106, 61, 0.6);
}

textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(28, 38, 51, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  color: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(213, 106, 61, 0.25);
  border-color: rgba(213, 106, 61, 0.6);
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-chip {
  padding: 11px 14px;
  border: 1px solid rgba(28, 38, 51, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.choice-chip.active {
  border-color: rgba(213, 106, 61, 0.45);
  background: rgba(213, 106, 61, 0.12);
  color: var(--primary-deep);
}

.parse-candidates {
  margin-top: 14px;
}

.parse-empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.autocomplete {
  position: relative;
}

.suggestions {
  position: absolute;
  inset: calc(100% + 8px) 0 auto;
  z-index: 10;
  display: none;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(28, 38, 51, 0.12);
  background: rgba(255, 252, 247, 0.96);
  box-shadow: 0 20px 34px rgba(28, 38, 51, 0.16);
}

.suggestions.show {
  display: block;
}

.suggestion-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.suggestion-item:hover {
  background: rgba(27, 92, 104, 0.08);
}

.selected-brand {
  display: inline-flex;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(27, 92, 104, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.inline-toast {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.92rem;
}

.recent-panel,
.summary-card,
.review-card,
.step-card,
.empty-card,
.debug-card,
.table-block,
.recommendation-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(28, 38, 51, 0.09);
  background: rgba(255, 255, 255, 0.56);
}

.recent-list,
.review-list,
.cards-grid,
.debug-sections {
  display: grid;
  gap: 14px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.entry-card {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(28, 38, 51, 0.09);
  background: rgba(255, 255, 255, 0.58);
}

.entry-card h4 {
  margin: 14px 0 10px;
  font-size: 1.4rem;
}

.entry-card p {
  color: var(--muted);
  line-height: 1.6;
}

.recommendation-card {
  background: linear-gradient(135deg, rgba(213, 106, 61, 0.08), rgba(27, 92, 104, 0.06));
}

.context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.upload-placeholder {
  padding: 16px;
  border: 1px dashed rgba(28, 38, 51, 0.18);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
}

.entry-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(213, 106, 61, 0.12);
  color: var(--primary-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

.entry-badge.alt {
  background: rgba(27, 92, 104, 0.12);
  color: var(--accent);
}

.recent-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(28, 38, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.recent-item span {
  color: var(--muted);
}

.summary-badge,
.metric-pill,
.section-brand .metric-pill,
.step-pill,
.table-chip,
.modal-status,
.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.summary-badge,
.metric-pill,
.step-pill,
.step-chip {
  background: rgba(28, 38, 51, 0.08);
  color: var(--text);
}

.table-chip {
  background: rgba(31, 122, 83, 0.12);
  color: var(--success);
}

.table-chip.alt {
  background: rgba(194, 138, 16, 0.14);
  color: var(--warning);
}

.review-card h4,
.step-card h4,
.debug-card h4,
.table-block h4,
.recent-panel h4 {
  margin: 0;
}

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

.step-card {
  position: relative;
  overflow: hidden;
}

.step-card::before,
.debug-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), rgba(27, 92, 104, 0.7));
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(213, 106, 61, 0.12);
  color: var(--primary-deep);
  font-weight: 800;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.step-visual {
  margin: 18px 0 14px;
}

.step-visual-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.step-visual-badge {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(213, 106, 61, 0.12);
  color: var(--primary-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

.step-visual-frame {
  border: 1px solid rgba(28, 38, 51, 0.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(213, 106, 61, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 239, 231, 0.88));
  padding: 12px;
}

.step-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.step-visual img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.step-visual figcaption {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.step-visual-page {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(27, 92, 104, 0.12);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.meta-list,
.bullet-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.debug-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-top: 18px;
}

.debug-card p {
  margin: 8px 0 0;
}

.debug-card .step-chip {
  margin-bottom: 12px;
}

.table-panel {
  display: grid;
  gap: 16px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.92rem;
  min-width: 640px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(28, 38, 51, 0.08);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 29, 36, 0.42);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(560px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 250, 243, 0.98);
  box-shadow: 0 30px 70px rgba(12, 18, 28, 0.28);
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.modal-card h3 {
  margin: 16px 0 10px;
  font-size: 1.8rem;
}

.modal-match,
.modal-disclaimer {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(28, 38, 51, 0.05);
  color: var(--muted);
  line-height: 1.55;
}

.modal-status {
  width: fit-content;
}

.status-compatible {
  background: rgba(31, 122, 83, 0.13);
  color: var(--success);
}

.status-theoretical {
  background: rgba(194, 138, 16, 0.15);
  color: var(--warning);
}

.status-not {
  background: rgba(167, 63, 58, 0.14);
  color: var(--danger);
}

.status-notfound {
  background: rgba(27, 92, 104, 0.12);
  color: var(--accent);
}

button:hover {
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .topbar,
  .hero,
  .grid-two,
  .debug-layout,
  .section-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    justify-items: start;
  }

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

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

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 16px, 100%);
    padding-top: 12px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .topbar,
  .hero-copy,
  .hero-stats,
  .panel,
  .modal-card {
    padding: 18px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }

  .brand-lockup h1 {
    font-size: 1rem;
    line-height: 1.2;
  }

  .lang-toggle {
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .lang-toggle::-webkit-scrollbar {
    display: none;
  }

  .lang-chip {
    flex: 0 0 auto;
    min-width: 58px;
    padding: 8px 12px;
  }

  .disclaimer-banner {
    margin-top: 12px;
    padding: 12px 16px;
  }

  .quick-nav-shell {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    background: rgba(255, 251, 245, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
  }

  .collapsible-head {
    display: flex;
  }

  .quick-nav-head {
    margin-bottom: 0;
  }

  .disclaimer-banner.mobile-collapsed #disclaimer-body,
  .quick-nav-shell.mobile-collapsed .quick-nav {
    display: none;
  }

  .disclaimer-banner.mobile-collapsed {
    padding-bottom: 12px;
  }

  .hero h2 {
    max-width: 100%;
    font-size: 2rem;
  }

  .hero-stats {
    display: none;
  }

  .disclaimer-banner,
  .panel-copy,
  .hero-body,
  .review-card p,
  .modal-card p {
    line-height: 1.5;
    font-size: 0.98rem;
  }

  .stepper,
  .quick-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .step-node,
  .quick-nav .view-chip {
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    padding: 8px 12px;
    font-size: 0.95rem;
  }

  .step-index {
    width: 20px;
    height: 20px;
    font-size: 0.72rem;
  }

  .page-actions,
  .form-actions,
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-actions > button,
  .form-actions > button,
  .modal-actions > button {
    width: 100%;
  }

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

  .page-actions-prominent {
    margin-top: 14px;
  }

  .smart-query-row {
    grid-template-columns: 1fr;
  }

  .primary-button-hero {
    min-width: 0;
  }

  .modal-backdrop {
    align-items: end;
    padding: 12px;
  }

  .modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 12px);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .modal-actions {
    position: sticky;
    bottom: calc(-18px - env(safe-area-inset-bottom));
    margin: 18px -18px calc(-18px - env(safe-area-inset-bottom));
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 250, 243, 0), rgba(255, 250, 243, 0.92) 18%, rgba(255, 250, 243, 1) 100%);
  }

  .table-block {
    overflow: hidden;
  }
}
