:root {
  color-scheme: light;
  --bg: #f3f8fd;
  --bg-soft: #edf6ff;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --panel-mint: #e6f7f1;
  --edge: #dceaf7;
  --edge-strong: #b9d9f8;
  --edge-soft: #e6eef6;
  --primary: #2f80ed;
  --primary-deep: #1768d5;
  --primary-soft: #e8f2ff;
  --cyan: #27c5d9;
  --mint: #e6f7f1;
  --mint-strong: #239f81;
  --text: #18304f;
  --muted: #7186a1;
  --dim: #9aacc2;
  --danger: #d95b64;
  --radius-lg: 24px;
  --radius-md: 16px;
  --bottom-height: 80px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 420px 360px at 94% -70px, #dcecff 0, transparent 72%),
    linear-gradient(180deg, #f8fbff 0, var(--bg) 42%, #f4f9fd 100%);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, textarea { font: inherit; }

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #8dc4ff;
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 8px 12px;
  border-radius: 10px;
  color: #fff;
  background: var(--primary);
  font-size: 13px;
  text-decoration: none;
  transition: transform .18s ease;
}

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

.shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom) + 18px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 68px;
  padding: 0 18px;
  border-bottom: 1px solid #ffffffc7;
  background: #f8fbffdc;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.brandmark {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #68adff, var(--primary));
  box-shadow: 0 7px 16px #2f80ed33;
  font: 23px/1 Georgia, serif;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 0;
  flex: 1;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .6px;
  line-height: 1.5;
}

.brand-label {
  color: var(--primary);
  font-size: 10px;
  letter-spacing: 1.2px;
  white-space: nowrap;
}

#app { padding: 0 16px; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 30px 8px 22px;
}

.hero::after {
  position: absolute;
  top: -68px;
  right: 0;
  color: #b8d7f51c;
  content: "字";
  font: 205px/1 Georgia, serif;
  pointer-events: none;
}

.eyebrow {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.hero h1,
.round-header h1 {
  position: relative;
  z-index: 1;
  margin: 8px 0 7px;
  color: var(--text);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: .1px;
  line-height: 1.35;
}

.hero p,
.round-summary {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.home-subtitle {
  margin: 16px 7px 12px;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .6px;
}

.round-entry {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 88px;
  margin: 0 0 12px;
  padding: 18px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-align: left;
  background: var(--panel);
  box-shadow: 0 9px 24px #3778a412;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.round-entry:hover {
  border-color: var(--edge-strong);
  box-shadow: 0 12px 28px #3778a41c;
}

.round-entry:active { transform: scale(.992); }

.round-entry__number {
  display: grid;
  flex: 0 0 43px;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  font: 700 18px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.round-entry__copy { min-width: 0; flex: 1; }

.round-entry__title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.round-entry__summary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.round-entry__arrow {
  flex-shrink: 0;
  color: var(--primary);
  font-size: 25px;
  line-height: 1;
}

.notice,
.empty-state {
  margin: 16px 0 13px;
  padding: 14px 16px;
  border: 1px solid #cfeee3;
  border-radius: var(--radius-md);
  color: #217d6a;
  font-size: 12px;
  line-height: 1.8;
  background: var(--panel-mint);
}

.empty-state {
  border-style: dashed;
  border-color: var(--edge-strong);
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
}

.round-header { padding: 17px 8px 12px; }

.back-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 5px 0;
  border: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  background: transparent;
}

.round-header h1 { margin-top: 8px; font-size: 26px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  margin-top: 12px;
  padding: 3px 11px;
  border: 1px solid #b9d9f8;
  border-radius: 40px;
  color: var(--primary-deep);
  font-size: 10px;
  font-weight: 700;
  background: var(--primary-soft);
}

.round-progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 3px 0 10px;
  padding: 8px 0 13px;
}

.round-progress::before {
  position: absolute;
  top: 25px;
  right: 9%;
  left: 9%;
  height: 2px;
  border-radius: 2px;
  background: var(--edge);
  content: "";
}

.round-progress__item {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  background: transparent;
}

.round-progress__number {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  color: var(--muted);
  background: #f8fbff;
  font-size: 11px;
  font-weight: 750;
}

.round-progress__item.is-current { color: var(--primary); font-weight: 750; }

.round-progress__item.is-current .round-progress__number {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 5px #e5f1ff;
}

.section-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px 13px;
  scrollbar-width: none;
}

.section-chips::-webkit-scrollbar { display: none; }

.section-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--edge);
  border-radius: 30px;
  color: var(--primary-deep);
  font-size: 11px;
  font-weight: 650;
  background: #f8fbff;
}

.section-chip:hover { border-color: var(--edge-strong); background: var(--primary-soft); }

.stage {
  margin: 16px 0 25px;
  scroll-margin-top: 84px;
}

.stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 1px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.7;
}

.stage-title::before {
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--primary), var(--cyan));
  content: "";
}

.selector {
  margin-bottom: 12px;
  padding: 17px;
  border: 1px solid #cfeee3;
  border-radius: var(--radius-lg);
  background: var(--panel-mint);
}

.selector-title {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

.selector-help {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.selector-options { display: grid; gap: 9px; }

.selector-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  background: #fff;
  transition: border-color .16s ease, background .16s ease;
}

.selector-option.is-selected {
  border-color: #75b2fa;
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.selector-dot {
  display: grid;
  flex: 0 0 17px;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid #9bbbe0;
  border-radius: 50%;
  background: #fff;
}

.selector-option.is-selected .selector-dot {
  border-color: var(--primary);
  background: var(--primary);
}

.selector-option.is-selected .selector-dot::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.script-card {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 9px 24px #3778a410;
}

.card-content { padding: 19px 17px 14px; }

.card-kicker {
  color: var(--primary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1px;
  line-height: 1.5;
}

.card-title {
  margin: 5px 0 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

.script-text {
  overflow-wrap: anywhere;
  color: #243c5a;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-line;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
  padding: 11px 13px 13px;
  border-top: 1px solid var(--edge-soft);
  background: #fcfdff;
}

.edit-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--edge-strong);
  border-radius: 13px;
  color: var(--primary-deep);
  font-size: 12px;
  background: transparent;
}

.edit-button:hover,
.restore-button:hover { background: var(--primary-soft); }

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  max-width: 180px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid #7cb9ff;
  border-radius: 24px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 750;
  background: #fff;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.copy-button::before {
  color: currentColor;
  content: "▣";
  font-size: 17px;
  line-height: 1;
}

.copy-button.is-copied {
  border-color: #a9e5d0;
  color: #16866c;
  background: var(--panel-mint);
}

.copy-button.is-copied::before { content: "✓"; }
.copy-button:disabled { border-color: #d7e0e9; color: #98a8ba; background: #f1f5f8; }

.editor {
  padding: 14px 15px 15px;
  border-top: 1px solid #d5e8fa;
  background: var(--bg-soft);
}

.editor.is-hidden { display: none; }

.editor-label {
  display: block;
  margin-bottom: 7px;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.editor textarea {
  display: block;
  width: 100%;
  min-height: 115px;
  padding: 11px;
  resize: vertical;
  border: 1px solid var(--edge-strong);
  border-radius: 13px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
  background: #fff;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
}

.restore-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 650;
  background: #fff;
}

.restore-button:active { background: var(--primary-soft); }

.editor-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.footer-note {
  padding: 22px 12px 6px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.9;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: min(100%, 480px);
  min-height: var(--bottom-height);
  padding: 10px 16px calc(9px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid #dceaf7e8;
  background: #ffffffed;
  box-shadow: 0 -8px 24px #3778a40d;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.bottom-nav:empty { display: none; }

.bottom-button {
  flex: 1;
  min-height: 47px;
  border: 1px solid var(--edge-strong);
  border-radius: 15px;
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 700;
  background: #fff;
}

.bottom-button.is-primary {
  border-color: transparent;
  color: #fff;
  font-weight: 750;
  background: linear-gradient(110deg, var(--primary), var(--cyan));
  box-shadow: 0 8px 18px #2f80ed2b;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-height) + 8px + env(safe-area-inset-bottom));
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 38px);
  padding: 10px 17px;
  transform: translateX(-50%);
  border: 1px solid #cfeee3;
  border-radius: 13px;
  color: #217d6a;
  font-size: 13px;
  background: #f2fffa;
  box-shadow: 0 10px 28px #3778a41c;
  pointer-events: none;
}

.toast.is-error {
  border-color: #f3c7cc;
  color: #b33e49;
  background: #fff5f6;
}

.toast.is-hidden { display: none; }

@media (min-width: 600px) {
  body {
    padding-top: 24px;
    background: radial-gradient(ellipse 600px 600px at 75% 0, #dcecff 0, transparent 70%), #eef6fc;
  }

  .shell {
    min-height: calc(100dvh - 24px);
    overflow: clip;
    border: 1px solid #d8e8f6;
    border-bottom: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 20px 80px #3778a41c;
  }

  .bottom-nav {
    border-right: 1px solid var(--edge);
    border-left: 1px solid var(--edge);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skip-link, .round-entry { transition: none; }
  .round-entry:active { transform: none; }
}
