:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #2b2622;
  --muted: #6b625a;
  --line: #e3ddd4;
  --accent: #a8322d;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6e2;
  --shadow: 0 1px 2px rgb(43 38 34 / 0.08), 0 4px 16px rgb(43 38 34 / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1816;
    --surface: #262220;
    --ink: #ede7e0;
    --muted: #aaa198;
    --line: #3b3531;
    --accent: #e57b70;
    --accent-ink: #1b1816;
    --accent-soft: #35231f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

h1,
h2,
h3 {
  line-height: 1.35;
  font-weight: 800;
}

h1 {
  font-size: 26px;
  margin: 20px 0 8px;
}

h2 {
  font-size: 21px;
  margin: 40px 0 12px;
}

h3 {
  font-size: 18px;
  margin: 28px 0 8px;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--accent);
}

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

button {
  cursor: pointer;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.eyebrow + h1 {
  margin-top: 4px;
}

.lead {
  color: var(--muted);
}

.signed-in-view,
html.signed-in .signed-out-view {
  display: none;
}

html.signed-in .signed-in-view {
  display: block;
}

.home h1 {
  margin-top: 32px;
}

.home .eyebrow + h1 {
  margin-top: 4px;
}

.signin-form {
  display: grid;
  gap: 16px;
  margin: 24px 0 8px;
  padding: 20px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field[hidden] {
  display: none;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
}

.field input,
.select select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 17px;
}

.select {
  position: relative;
}

.select select {
  appearance: none;
  padding-right: 44px;
}

.select select:disabled {
  color: var(--muted);
}

.select .icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.field input:focus-visible,
.select select:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.form-error {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 800;
}

.primary:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: default;
}

.place {
  color: var(--muted);
  font-weight: 700;
}

.features {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}

.feature > .icon:first-child {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.feature > .icon:last-child {
  color: var(--muted);
}

.feature-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.feature-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
}

.feature-note {
  color: var(--muted);
  font-size: 15px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.text-button .icon {
  width: 18px;
  height: 18px;
}

.site-foot {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

html.leaving body {
  visibility: hidden;
}

html {
  scroll-padding-top: 16px;
}

.back {
  margin: 12px 0 0;
}

.back a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin-left: -6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.handbook-head h1 {
  margin-top: 4px;
}

.byline,
.audience {
  color: var(--muted);
  font-size: 15px;
}

.byline {
  margin-bottom: 4px;
}

.handbook .contents ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.contents a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.handbook ul,
.handbook ol {
  padding-left: 1.3em;
}

.handbook li + li {
  margin-top: 6px;
}

.handbook .contents li + li {
  margin-top: 0;
}

.title-part {
  display: inline-block;
}

.note {
  color: var(--muted);
  font-size: 15px;
}

.flow {
  width: 100%;
  margin: 0 0 12px;
  border-collapse: collapse;
  font-size: 16px;
}

.flow th,
.flow td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.flow th {
  color: var(--muted);
  font-size: 14px;
}

.flow td:first-child {
  width: 6.5em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.how-to strong {
  font-weight: 800;
}

.say {
  margin: 12px 0 16px;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 4px 14px 14px 4px;
  background: var(--accent-soft);
  font-size: 19px;
  line-height: 1.8;
}

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

.cite {
  color: var(--muted);
  font-size: 15px;
}

.topic {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.topic-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 15px;
}

.question {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.5;
}

.prompts-lead {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.prompts {
  margin: 0 0 8px;
}

.topic .note {
  margin: 12px 0 0;
}

.scenes {
  display: grid;
  gap: 12px;
  margin: 12px 0 16px;
}

.scene-group {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.scene-group h4 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 15px;
}

.handbook .scene-group ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.handbook .scene-group li + li {
  margin-top: 2px;
}

.scene-group li {
  display: flex;
  gap: 8px;
}

.scene-n {
  flex: none;
  min-width: 1.6em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.handbook {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.start-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.start-bar .primary {
  max-width: 528px;
  margin: 0 auto;
}

.start-bar .icon {
  fill: currentColor;
  stroke: none;
}

html.live-open body {
  overflow: hidden;
}

.live {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}

.live-top {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
}

.icon-button .icon {
  width: 24px;
  height: 24px;
}

.live-lengths {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--line);
}

.live-length {
  min-width: 64px;
  min-height: 36px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.live-length[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.live-choose,
.live-run {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.live-choose h2 {
  margin-top: 24px;
  font-size: 24px;
}

.live-choose p {
  color: var(--muted);
}

.choose-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

.live-run {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.live-clock {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.live-clock p {
  margin: 0;
}

.segment-time {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.live-clock.over .segment-time {
  color: var(--accent);
}

.total-time {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.live-steps li {
  padding-top: 8px;
  border-top: 4px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.live-steps li.done {
  border-top-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.live-steps li[aria-current="step"] {
  border-top-color: var(--accent);
  color: var(--ink);
}

.live-segment-head {
  margin: 20px 0 12px;
}

.live-label {
  margin: 0;
  color: var(--accent);
  font-size: 17px;
}

.live-label:focus {
  outline: none;
}

.live-what {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.live-minutes {
  margin-right: 0.8em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.say-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.live .say {
  font-size: 22px;
  line-height: 1.75;
}

.live .question {
  font-size: 26px;
  line-height: 1.45;
}

.live .prompts {
  font-size: 18px;
}

.live .prompts li + li {
  margin-top: 8px;
}

.live-cheat {
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.live-cheat summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 8px 16px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.live-cheat summary::-webkit-details-marker {
  display: none;
}

.live-cheat summary .icon {
  color: var(--muted);
  transition: transform 0.2s;
}

.live-cheat[open] summary .icon {
  transform: rotate(180deg);
}

.live-cheat[open] summary {
  border-bottom: 1px solid var(--line);
}

.live-cheat .scenes,
.live-cheat .note {
  margin: 12px 16px;
}

.live-cheat .scene-group {
  padding: 0;
  border: 0;
  background: none;
}

.live-cheat .scene-group ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.live-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.live-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 800;
}

.live-prev {
  border: 1px solid var(--line);
  background: var(--surface);
}

.live-prev:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: default;
}

.live-next.finish .icon {
  display: none;
}

.live-next {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
}
