:root {
  --bg: #f4fbff;
  --ink: #1f3444;
  --muted: #658091;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(243, 251, 252, 0.92);
  --line: rgba(94, 149, 179, 0.16);
  --line-strong: rgba(94, 149, 179, 0.28);
  --accent: #63a9d8;
  --accent-strong: #3d83b8;
  --accent-soft: #dff2ff;
  --mint: #8fd5c0;
  --mint-soft: #e7f8f2;
  --danger: #d56c7a;
  --danger-soft: rgba(213, 108, 122, 0.12);
  --shadow: 0 18px 34px rgba(83, 136, 171, 0.12);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(225, 246, 255, 0.95), transparent 34%),
    radial-gradient(circle at top right, rgba(231, 248, 242, 0.85), transparent 28%),
    linear-gradient(180deg, #fcfeff 0%, var(--bg) 56%, #eef8fd 100%);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.toast {
  position: fixed;
  inset: auto 16px 18px;
  z-index: 40;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(40, 70, 92, 0.92);
  color: #f7fcff;
  box-shadow: var(--shadow);
}

.shell {
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

.shell-home,
.shell-templates,
.result-shell {
  display: grid;
  gap: 20px;
  align-content: start;
}

.layout-columns {
  display: grid;
  gap: 20px;
}

.template-workbench {
  align-items: start;
}

.hero {
  padding: 12px 4px;
}

.hero-fresh {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  min-height: 240px;
  padding: 12px 6px 4px;
}

.hero-template {
  grid-template-columns: 1fr;
  min-height: auto;
  padding-bottom: 0;
}

.hero-copy-block {
  max-width: 560px;
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.hero-orbit {
  position: relative;
  min-height: 200px;
}

.hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(0.2px);
}

.hero-orb-blue {
  inset: 12px auto auto 10%;
  width: 168px;
  height: 168px;
  background: radial-gradient(circle at 30% 30%, #ffffff, rgba(120, 201, 229, 0.92));
  box-shadow: 0 18px 40px rgba(99, 169, 216, 0.18);
}

.hero-orb-mint {
  inset: auto 8% 14px auto;
  width: 126px;
  height: 126px;
  background: radial-gradient(circle at 35% 35%, #ffffff, rgba(143, 213, 192, 0.9));
  box-shadow: 0 18px 36px rgba(143, 213, 192, 0.16);
}

.hero-orb-soft {
  inset: 38% auto auto 36%;
  width: 82px;
  height: 82px;
  background: radial-gradient(circle at 30% 30%, #ffffff, rgba(196, 233, 255, 0.88));
}

.hero h1,
.panel h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: -0.04em;
}

.hero-copy,
.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel {
  border-radius: 24px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.panel-soft {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.96)),
    var(--panel);
}

.subpanel {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.panel-subsection {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
}

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

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(250, 255, 255, 0.96);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 2px solid rgba(99, 169, 216, 0.3);
  outline-offset: 2px;
}

.toolbar {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

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

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

.button,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #79c6d6);
  color: #f8fdff;
}

.button-secondary {
  background: rgba(247, 253, 255, 0.92);
  color: var(--ink);
  border: 1px solid var(--line);
}

.button-ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(213, 108, 122, 0.2);
}

.text-link {
  min-height: auto;
  padding: 0;
  color: var(--accent-strong);
}

.stack {
  display: grid;
  gap: 16px;
}

.hidden {
  display: none !important;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(99, 169, 216, 0.12);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.complete-zone {
  width: 100%;
  min-height: 46vh;
  border: 1px solid rgba(99, 169, 216, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(224, 245, 255, 0.94), rgba(250, 255, 255, 0.98)),
    var(--panel);
  box-shadow: var(--shadow);
  font-size: 18px;
  display: grid;
  gap: 10px;
  align-content: center;
  justify-items: center;
  padding: 24px;
  color: var(--ink);
}

.complete-zone[disabled] {
  opacity: 0.65;
}

.complete-zone-paused {
  background:
    linear-gradient(135deg, rgba(239, 250, 255, 0.94), rgba(242, 251, 247, 0.98)),
    var(--panel);
}

#question-name {
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 700;
  text-align: center;
}

#live-timer {
  font-size: clamp(3rem, 8vw, 5rem);
  color: var(--accent-strong);
}

.session-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 250, 255, 0.96)),
    var(--panel);
}

.session-context-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.session-meta {
  display: grid;
  justify-items: end;
  align-content: space-between;
}

.drawer {
  margin-top: 16px;
}

.alert-banner {
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(239, 250, 255, 0.95), rgba(237, 249, 244, 0.98));
}

.question-row,
.question-row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.question-row-current {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.question-row-actions {
  flex-wrap: wrap;
  justify-content: end;
}

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

.stat-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(247, 253, 255, 0.94);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.stat-card strong {
  font-size: 1.4rem;
  color: var(--accent-strong);
}

.segment-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.segment-details summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.compact-toolbar {
  margin-top: 0;
}

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

.template-stat-row,
.template-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.template-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 251, 255, 0.94)),
    var(--panel-soft);
}

.template-section-row {
  gap: 14px;
}

.template-section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.template-section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 600;
}

.template-section-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 140px;
}

.guide-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(252, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(83, 136, 171, 0.06);
}

.result-hero {
  gap: 18px;
}

.result-inline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.result-question-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.96)),
    var(--panel);
}

.drawer-summary {
  margin-top: 8px;
}

.drawer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.legend-dot-active {
  background: linear-gradient(135deg, var(--accent), #79c6d6);
  border-color: transparent;
}

.legend-dot-done {
  background: var(--mint);
  border-color: transparent;
}

.legend-dot-pending {
  background: #ffffff;
  border-color: rgba(99, 169, 216, 0.34);
}

.legend-dot-skipped {
  background: #ffffff;
  border: 2px solid rgba(143, 213, 192, 0.82);
}

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px 10px;
  margin-top: 18px;
}

.drawer-node {
  min-width: 0;
  aspect-ratio: 1;
  min-height: 56px;
  border-radius: 999px;
  border: 1.5px solid rgba(99, 169, 216, 0.24);
  background: linear-gradient(180deg, #ffffff, #f8fdff);
  color: var(--ink);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 6px;
  box-shadow: 0 10px 18px rgba(128, 183, 214, 0.08);
}

.drawer-node:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(99, 169, 216, 0.42);
}

.drawer-node:disabled {
  cursor: default;
  opacity: 1;
}

.drawer-node-index {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.drawer-node-meta {
  font-size: 0.62rem;
  line-height: 1;
  color: var(--muted);
}

.drawer-node-active,
.drawer-node-current {
  background: linear-gradient(135deg, var(--accent), #7ac8dc);
  border-color: transparent;
  color: #f8fdff;
}

.drawer-node-active .drawer-node-meta,
.drawer-node-current .drawer-node-meta {
  color: rgba(248, 253, 255, 0.88);
}

.drawer-node-done {
  background: linear-gradient(135deg, var(--mint), #a9e2d2);
  border-color: transparent;
  color: #1f4f52;
}

.drawer-node-done .drawer-node-meta {
  color: rgba(31, 79, 82, 0.72);
}

.drawer-node-pending {
  background: linear-gradient(180deg, #ffffff, #f5fbff);
}

.drawer-node-skipped_pending {
  background: linear-gradient(180deg, #ffffff, #f6fdfb);
  border: 2px solid rgba(143, 213, 192, 0.84);
  color: #2c6a62;
}

.drawer-node-skipped_pending .drawer-node-meta {
  color: rgba(44, 106, 98, 0.72);
}

.drawer-node-paused,
.drawer-node-suspended {
  background: linear-gradient(180deg, #f4f9fd, #eef6fb);
  border-color: rgba(116, 156, 181, 0.28);
}

@media (min-width: 900px) {
  .shell {
    padding: 28px;
  }

  .layout-columns {
    grid-template-columns: 1.2fr 0.8fr;
  }

  .template-workbench {
    grid-template-columns: 0.86fr 1.14fr;
  }

  .toolbar-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .panel-heading,
  .question-row {
    display: grid;
  }

  .toolbar-two,
  .toolbar-four,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .session-header {
    display: grid;
  }

  .session-meta {
    justify-items: start;
  }

  .drawer-grid {
    gap: 12px 8px;
  }

  .drawer-node {
    min-height: 50px;
  }

  .hero-fresh,
  .home-guide-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-orbit {
    min-height: 150px;
  }
}
