:root {
  color-scheme: light;
  --page-base: #f8d6b8; --paper: #49291c; --muted: #704832; --apricot: #8e431f;
  --gold: #8b4d12; --line: #ad62374d; --panel: #fff6e9;
  --panel-raised: #ffead5; --panel-inset: #fffdf8; --warm-border: #c27e536e;
  --scene-tone: var(--scene-shadow-filter, brightness(1)) brightness(var(--scene-brightness, 125%));
  --stage-background:
    radial-gradient(ellipse at 14% 8%, #fff5e5d9, transparent 58%),
    radial-gradient(ellipse at 92% 36%, #f6b88280, transparent 59%),
    radial-gradient(ellipse at 50% 100%, #efa16746, transparent 65%),
    linear-gradient(150deg, #63391f, #f9d0ac 53%, #f3bb90);
  --ui-font: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-family: var(--ui-font);
  background: var(--page-base); color: var(--paper);
  scrollbar-width: none;
}
:root::-webkit-scrollbar { display: none }
[data-tint="blue"] { --identity-paper: #e3f0f6; --identity-dark: #315c74; --identity-border: #96b5c5 }
[data-tint="pink"] { --identity-paper: #fae6ee; --identity-dark: #84415b; --identity-border: #c99cae }
* { box-sizing: border-box; -webkit-user-select: none; user-select: none }
textarea, input:not([type="range"]) { -webkit-user-select: text; user-select: text }
body { margin: 0; min-width: 300px }
[hidden] { display: none !important }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden }
button, input, select, textarea { font: inherit }
button { color: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff7eac4; border-radius: 9px; padding: .65em 1em }
button:hover:not(:disabled) { background: #fff9f1; border-color: #bf774d }
button:disabled { opacity: .42; cursor: default }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px }
.stage {
  --unit: min(1vw, 1.6svh);
  position: relative; isolation: isolate; min-height: 100svh; overflow: hidden;
  display: grid; grid-template-rows: auto auto 1fr auto auto; align-items: center;
  gap: clamp(9px, calc(var(--unit)*1.1), 26px);
  padding: clamp(14px, calc(var(--unit)*1.75), 46px) clamp(20px, 5vw, 112px);
  background: var(--stage-background);
}
.sky, .horizon { position: absolute; inset: 0; pointer-events: none; overflow: hidden }
.sky, .horizon { z-index: -1 }
.sky i { position: absolute; left: var(--x); top: var(--y); width: var(--s); aspect-ratio: 1; background: #fffaf1; opacity: var(--o); border-radius: 50%; box-shadow: 0 0 8px #ffd5a5; }
.horizon { --ring-spacing: 11%; mask-image: var(--journey-ring-mask, none) }
.horizon::before {
  content: ""; position: absolute; inset: 0;
  opacity: calc(.68 * (1 - var(--award-rings-blend, 0)));
  background: repeating-radial-gradient(circle at 50% 112%, transparent 0 5.3%, #a8552840 5.4% 5.49%, transparent 5.6% var(--ring-spacing));
  mask-image: linear-gradient(transparent 52%, #000);
}
#award-rings {
  position: absolute; inset: 0; width: 100%; height: 100%;
  mask-image: linear-gradient(transparent 12%, #000 66%);
}
.top, .bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px }
.brand { display: flex; align-items: center; min-width: 0; gap: .65em; letter-spacing: .06em; font-size: clamp(12px, 1.18vw, 22px); color: #542f20; font-weight: 660 }
.brand-logos { display: flex; gap: .28em; flex: none }
.brand-logos img {
  width: 2.12em; height: 2.12em; object-fit: contain; padding: .16em; border-radius: 50%;
  background: #fff2e7; border: 1px solid #f1c398; box-shadow: 0 0 10px #ffcda02e;
}
.quiet { color: #63351f; background: #fff3e1c7; font-size: .87rem; white-space: nowrap }
.demo-tag { color: var(--gold); font-size: .8rem; white-space: nowrap }
.intro { text-align: center }
h1 { font-size: clamp(34px, calc(var(--unit)*4.45), 98px); line-height: 1.1; margin: .2em 0 .15em; letter-spacing: .11em; text-shadow: 0 3px 28px #fff7e6a8 }
.intro p { color: var(--muted); font-size: clamp(12px, calc(var(--unit)*1.05), 22px); margin: 0; letter-spacing: .12em }
.board {
  width: min(100%, 83em); justify-self: center; align-self: center;
  display: grid; grid-template-columns: minmax(0, 1fr) 27% minmax(0, 1fr); align-items: center;
  perspective: 1000px;
}
.slot { min-width: 0; position: relative }
.slot-label { text-align: center; margin-bottom: .75em; color: #63391f; font-size: clamp(12px, calc(var(--unit)*1.15), 22px); letter-spacing: .1em }
.card {
  --card-border: #ce885d;
  --card-surface: radial-gradient(ellipse at 50% 20%, #fffdf8aa, transparent 64%), linear-gradient(150deg,#fffdf7,#fff0dc 75%);
  --card-shadow: 0 12px 38px #9a4d2338, inset 0 0 24px #ffce9c30;
  position: relative;
  width: 100%; height: clamp(130px, calc(var(--unit)*18), 345px);
  border-radius: 17px; transform-style: preserve-3d;
}
.right .card, .sender-face {
  text-align: center; display: grid; place-content: center; justify-items: center;
  padding: .7em; border: 1px solid var(--card-border);
  background: var(--card-surface); box-shadow: var(--card-shadow);
}
.right .card::before, .sender-face::before { content: ""; position: absolute; inset: 7px; border: 1px solid #d091625b; border-radius: 11px; pointer-events: none }
.right .card { --card-surface: radial-gradient(ellipse at 50% 20%, #fffaf0aa, transparent 64%), linear-gradient(150deg,#fffaf1,#ffe7cc 75%) }
.card.teacher { --card-border: #bd863c }
.card.gold-card {
  --card-border: #cb963d;
  --card-surface: radial-gradient(ellipse at 50% 18%, #fffbeb, #ffe7ad 59%, #ffd887);
  --card-shadow: 0 0 46px #da943a4a, inset 0 0 35px #fff9df80;
  color: #593417;
}
.sender-card { perspective: 900px }
.sender-turn { position: absolute; inset: 0; border-radius: inherit; transform-style: preserve-3d; pointer-events: none }
.sender-card:has(.sender-flip:not([hidden])) .sender-turn { transition: transform .55s cubic-bezier(.25,.7,.3,1) }
.sender-card.is-flipped .sender-turn { transform: rotateY(180deg) }
.sender-face { position: absolute; inset: 0; border-radius: inherit; backface-visibility: hidden; -webkit-backface-visibility: hidden }
.sender-flip, .sender-flip:hover:not(:disabled) { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent }
.sender-card:has(.sender-flip:not([hidden])):hover .sender-face {
  border-color: color-mix(in srgb, var(--card-border), #b96732 40%);
  box-shadow: var(--card-shadow), 0 0 18px #fff5d981;
}
.sender-back {
  transform: rotateY(180deg); place-content: stretch; align-items: center;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: clamp(9px, calc(var(--unit)*1.05), 20px);
  gap: clamp(4px, calc(var(--unit)*.55), 10px);
}
.sender-back .stamp { width: clamp(20px, calc(var(--unit)*2.3), 42px); margin: 0 }
.sender-message {
  align-self: stretch; width: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain;
  align-content: safe center; padding: .36em .58em; border: 1px solid #b9764e55; border-radius: 6px;
  background: #f6cda936; color: inherit; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: clamp(11px, calc(var(--unit)*1.15), 21px); line-height: 1.4;
}
.sender-card:has(.sender-flip:not([hidden])).is-flipped .sender-message { pointer-events: auto; cursor: pointer }
.sender-serial { color: #764329; font-size: clamp(9px, calc(var(--unit)*.83), 15px); letter-spacing: .09em; max-width: 100%; overflow-wrap: anywhere; font-variant-numeric: tabular-nums }
.gold-card .sender-serial { color: #744410 }
.stamp { width: clamp(32px, calc(var(--unit)*4.6), 86px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: var(--apricot); border: 1px solid currentColor; box-shadow: 0 0 25px #e5a57442; margin-bottom: .6em; background: #fbdcb865 }
.stamp svg { width: 56%; height: 56% }
.right .stamp { color: #914817 }
.sender-card .stamp { color: var(--apricot) }
.sender-card[data-tint="blue"] .stamp { color: #2f5d78; background: #e7f1f6 }
.sender-card[data-tint="pink"] .stamp { color: #8c3f64; background: #fae6ed }
.card.teacher .stamp, .gold-card .stamp { color: var(--gold) }
.card-name { font-size: clamp(17px, calc(var(--unit)*3.1), 64px); font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.card-meta { color: #75503a; font-size: clamp(10px, calc(var(--unit)*1), 19px); margin-top: .65em; overflow-wrap: anywhere; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.gold-card .card-meta { color: #744410 }
.journey { --rail-tip: #9d4b25; position: relative; margin: 2em 3% 0; height: 4em; color: #863d1d }
.rail {
  position: absolute; top: 43%; left: 0; right: 4%; height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg,#b462382c,#b6653e 60%,var(--rail-tip)); box-shadow: 0 0 12px #ffead580;
}
.rail::before {
  content: ""; position: absolute; top: 50%; right: 1px; z-index: 1; width: 11px; height: 11px; box-sizing: border-box;
  transform: translateY(-50%) rotate(45deg);
  border: solid var(--rail-tip); border-width: 2px 2px 0 0;
}
.rail::after {
  content: ""; position: absolute; inset: -1px 0; border-radius: 4px;
  background: repeating-linear-gradient(90deg, transparent 0 18px, #fff6d5b8 26px, #fffdf3 30px, transparent 34px);
  background-size: 34px 100%; animation: delivery-flow .95s linear infinite;
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 90%, transparent);
}
@keyframes delivery-flow { to { background-position: 34px 0 } }
.journey-caption { position: absolute; top: calc(43% + clamp(16px, calc(var(--unit)*1.85), 33px) + 7px); width: 100%; text-align: center; white-space: nowrap; font-size: clamp(9px, calc(var(--unit)*.85), 16px); color: var(--muted); letter-spacing: .13em }
.traveler { position: absolute; top: 43%; left: 50%; display: grid; place-items: center; width: clamp(31px, calc(var(--unit)*3.7), 66px); aspect-ratio: 1; transform: translate(-50%,-50%); background: #fff4df; border: 1px solid #bf794e; border-radius: 50%; box-shadow: 0 0 23px #fff1ceaa }
.traveler svg { width: 60%; height: 60% }
.controls {
  --status-size: clamp(13px, calc(var(--unit)*1.55), 32px);
  --status-lines: 2;
  --action-size: clamp(14px, calc(var(--unit)*1.37), 25px);
  --action-width: calc(var(--action-size) * 9);
  text-align: center; min-width: 0;
}
/* Keep the board centered in the same space as the caption and music controls change. */
.stage:not(.completed) .controls {
  display: grid; justify-items: center;
  grid-template-rows: calc(var(--status-size) * (1.25 * var(--status-lines) + .55)) auto auto;
}
.stage:not(.completed) .status { align-self: end }
.stage.completed .board { display: none }
.stage.completed .controls { grid-row: 3; align-self: center }
.stage.completed .award-controls { display: none }
.stage.completed .bottom { grid-row: 5 }
.stage.completed .status { margin-bottom: .9em; color: #713d24; font-weight: 650 }
.status { min-height: 1.5em; margin: 0 0 .55em; font-size: var(--status-size); line-height: 1.25; color: #5d3522; overflow-wrap: anywhere }
.won .status { color: #75440f; font-weight: 700 }
.buttons { display: flex; justify-content: center; gap: .65em; flex-wrap: wrap }
.primary { background: linear-gradient(135deg,#ffdfae,#f7a456); color: #371b0f; border-color: #ffecbf; font-weight: 760 }
.primary:hover:not(:disabled) { background: #ffe5b6; border-color: #fff6df; box-shadow: 0 0 21px #ffd48c4f }
.controls .primary { padding: .67em 1.7em; font-size: var(--action-size); min-width: var(--action-width) }
.controls .secondary { font-size: clamp(11px, calc(var(--unit)*.95), 18px) }
.music-controls {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  width: var(--action-width); max-width: 100%; gap: .44em; margin-top: .6em;
  padding: .24em .4em; border: 1px solid #f3d2b835; border-radius: 9px;
  background: #fff3dfec; color: #623a24; font-size: clamp(11px, calc(var(--unit)*.9), 15px);
}
@media (hover: hover) {
  .music-controls {
    opacity: 0;
    transition: opacity .22s ease;
  }
  .music-controls:hover,
  .music-controls.is-visible,
  .music-controls:not(.using-pointer):has(:focus-visible) { opacity: 1 }
  .music-controls:not(:hover, .is-visible, :has(:focus-visible)) > * { pointer-events: none }
}
@media (prefers-reduced-motion: reduce) {
  .music-controls { transition: none }
}
.music-controls[inert] { visibility: hidden }
.award-volume-icon { display: grid; place-items: center; color: #a9572b }
.award-controls svg { display: block; width: 1.55em; height: 1.55em }
.award-volume-icon [data-wave], .award-mute { display: none }
.award-volume-icon[data-level="0"] .award-mute,
.award-volume-icon:not([data-level="0"]) [data-wave="1"],
.award-volume-icon:is([data-level="2"], [data-level="3"]) [data-wave="2"],
.award-volume-icon[data-level="3"] [data-wave="3"] { display: inline }
:is(.music-controls input, .effects-volume-control input) {
  --award-fill: 45%;
  --thumb-size: 13px;
  --track-size: 4px;
  --volume-track: linear-gradient(to right, #a9572b 0 var(--award-fill), #ecc6a6 var(--award-fill) 100%);
  appearance: none; -webkit-appearance: none;
  min-width: 0; width: 100%; height: 22px; margin: 0;
  background: transparent; cursor: pointer;
}
:is(.music-controls input, .effects-volume-control input)::-webkit-slider-runnable-track { height: var(--track-size); border-radius: 4px; background: var(--volume-track) }
:is(.music-controls input, .effects-volume-control input)::-moz-range-track { height: var(--track-size); border-radius: 4px; background: var(--volume-track) }
:is(.music-controls input, .effects-volume-control input)::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: var(--thumb-size); height: var(--thumb-size); margin-top: calc((var(--track-size) - var(--thumb-size)) / 2);
  border: 1px solid #ffebd3; border-radius: 50%; background: #a9572b;
}
:is(.music-controls input, .effects-volume-control input)::-moz-range-thumb {
  box-sizing: border-box; width: var(--thumb-size); height: var(--thumb-size);
  border: 1px solid #ffebd3; border-radius: 50%; background: #a9572b;
}
.award-controls button { display: grid; place-items: center; padding: .2em .26em; border-radius: 6px }
.award-wave-controls {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .56em; border-top: 1px solid #f3d2b82a; padding-top: .2em;
  font-size: clamp(9px, calc(var(--unit)*.83), 13px); color: #694028;
}
.award-wave-controls label { display: flex; align-items: center; gap: .25em; white-space: nowrap }
.award-wave-controls input { --thumb-size: 10px; --track-size: 3px; height: 19px }
.award-wave-controls input:disabled { opacity: .45 }
.award-ring-controls { grid-template-columns: minmax(0, 1fr); gap: .15em }
.award-ring-row {
  display: grid; grid-template-columns: 2.5em repeat(2, minmax(0, 1fr));
  align-items: center; gap: .48em;
}
.award-ring-row > span { font-weight: 680 }
#award-toggle:not([data-playing]) .award-pause, #award-toggle[data-playing] .award-play { display: none }
.bottom { color: var(--muted); font-size: clamp(10px, calc(var(--unit)*.9), 17px) }
.progress { display: flex; gap: .9em; align-items: center; white-space: nowrap }
progress { accent-color: #ab592d; width: clamp(45px, 11vw, 250px); height: .45em; border: 0; background: #b86d4433; border-radius: 5px }
progress::-webkit-progress-bar { background: #b86d4433; border-radius: 5px }
progress::-webkit-progress-value { background: #ab592d; border-radius: 5px }
.deck-button {
  display: inline-flex; align-items: center; gap: .85em; padding: 3px .35em 3px .55em;
  border: 1px solid transparent; background: transparent; border-radius: 9px; color: var(--muted); white-space: nowrap;
  transition: color .22s, background-color .22s, border-color .22s;
}
.deck-button:hover:not(:disabled), .deck-button:focus-visible, .deck-button.deck-receiving {
  color: #6c391f; border-color: #d6b67563; background: #b48e3320;
}
.deck-stack { display: grid; place-items: center; position: relative; width: clamp(65px, 8.5vw, 138px); height: clamp(37px, 4.6vw, 63px) }
.deck-stack i {
  --deck-paper: #fff9eb;
  --deck-wash: #ffd9b3;
  position: absolute; width: 57%; aspect-ratio: 1.72; border-radius: 4px;
  border: 1px solid #b97650;
  background: repeating-linear-gradient(135deg,#b9663611 0 1px,transparent 1px 4px),
    linear-gradient(145deg,var(--deck-paper),var(--deck-wash));
  box-shadow: inset 0 0 0 2px #fffdf680, 0 3px 7px #9b4d2936;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.deck-stack i:nth-child(1) { transform: translate(-26%,-10%) rotate(-23deg) }
.deck-stack i:nth-child(2) { transform: translate(21%,12%) rotate(20deg) }
.deck-stack i:nth-child(3) { transform: translate(-14%,21%) rotate(9deg); --deck-wash: #f5c39e }
.deck-stack i:nth-child(4) { transform: translate(25%,-14%) rotate(-13deg) }
.deck-stack i:nth-child(5) { transform: translate(4%,10%) rotate(-28deg); border-color: #a9956e }
.deck-stack i:last-child { transform: translate(-5%,-7%) rotate(8deg); display: grid; place-items: center; --deck-wash: #ffe9ce; color: #8d4726 }
.deck-stack svg { width: 43%; height: 72% }
.deck-button:hover:not(:disabled) .deck-stack i, .deck-button:focus-visible .deck-stack i, .deck-receiving .deck-stack i { border-color: #ad5b30; box-shadow: 0 2px 16px #fff4d8cc }
.deck-button:hover:not(:disabled) .deck-stack i:last-child { transform: translate(-5%,-15%) rotate(8deg) }
.deck-button:disabled { opacity: .84 }
.choose-receiver {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end;
  width: 100%; border: 1px solid #ffcb997b; border-radius: inherit;
  padding: .55em; padding-bottom: clamp(11px,2.35vmin,22px); background: transparent;
  font-size: clamp(10px, calc(var(--unit)*.83), 15px);
}
.choose-receiver span { color: #653618; background: #ffecd5; border: 1px solid var(--warm-border); border-radius: 4px; padding: .2em .62em }
.choose-receiver:hover:not(:disabled) { border-color: #b37142; background: #ffc69a24 }
.right .card:has(.choose-receiver:not([hidden])) {
  align-content: safe center;
  padding-bottom: calc(.7em + clamp(0px, 200px - var(--unit) * 18, 34px));
}
.mode-picker { min-width: 0; margin: 0; border: 0; padding: 0 }
.mode-picker legend { padding: 0; font-size: 1.17em; font-weight: 700 }
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-width: 420px; margin-top: .65em }
.mode-options label { position: relative; min-width: 0; cursor: pointer }
.mode-option {
  display: flex; align-items: center; gap: clamp(5px, 1.1vw, 11px); padding: .66em clamp(7px, 1.3vw, 13px);
  border: 1px solid var(--warm-border); border-radius: 8px; background: var(--panel-raised); color: #694027;
  font-size: clamp(.76rem, 1.6vw, .93rem); font-weight: 650; white-space: nowrap;
  transition: border-color .2s, color .2s, background-color .2s;
}
.mode-option svg { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round }
.mode-dot { margin-left: auto; flex: none; width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%; opacity: .55 }
.mode-options label:hover .mode-option { border-color: #f9c59a9c }
.mode-options input:checked + .mode-option { border-color: #e2b971ad; background: #ca9d4d1b; color: #6c3a12 }
.mode-options input:checked + .mode-option .mode-dot { background: currentColor; box-shadow: 0 0 8px #ffd67b8c; opacity: 1 }
.mode-options input:focus-visible + .mode-option { outline: 2px solid var(--gold); outline-offset: 3px }
.mode-options input:disabled + .mode-option { opacity: .56; cursor: default }
.audio-group { min-width: 0; max-width: 580px; margin: .65em 0 0; padding: 0; border: 0 }
.audio-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px }
.paired-audio-options { grid-template-columns: repeat(2, minmax(0,1fr)); max-width: 385px }
.single-audio-option { grid-template-columns: minmax(0, 1fr); max-width: 188px }
.audio-options label { position: relative; min-width: 0; cursor: pointer }
.effects-volume-control {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 4ch; align-items: center; gap: .7em;
  max-width: 385px; padding: .55em clamp(6px,1.2vw,12px); border: 1px solid var(--warm-border);
  border-radius: 8px; background: var(--panel-raised); color: #694027; font-size: clamp(.72rem,1.8vw,.9rem);
}
.effects-volume-control span:last-child { text-align: right; font-variant-numeric: tabular-nums }
.effects-cue-settings {
  padding: .65em clamp(8px,1.3vw,13px); border: 1px solid var(--warm-border);
  border-radius: 8px; background: var(--panel-raised); color: #694027;
  font-size: clamp(.78rem,1.8vw,.94rem);
}
.effects-cue-settings summary { cursor: pointer; font-weight: 650 }
.effects-cue-settings fieldset { min-width: 0; margin: .8em 0 0; padding: 0; border: 0 }
.effects-cue-settings legend { margin-bottom: .3em; padding: 0; color: var(--muted); font-size: .85em }
.effects-cue-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 12px }
.effects-cue-grid .effects-volume-control {
  grid-template-columns: 7em minmax(0,1fr) 4ch; max-width: none;
  padding: .12em .25em; border: 0; background: transparent;
}
@media (max-width: 620px) {
  .effects-cue-grid { grid-template-columns: minmax(0,1fr) }
}
.audio-option {
  display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 6px; padding: .64em clamp(6px,1.2vw,12px);
  border: 1px solid var(--warm-border); border-radius: 8px; background: var(--panel-raised); color: #694027; font-size: clamp(.72rem,1.8vw,.9rem);
}
.audio-settings label:hover .audio-option { border-color: #f9c59a9c }
.audio-switch { width: 2.2em; height: 1.25em; flex: none; position: relative; border-radius: 1em; border: 1px solid #e9b2859a; background: var(--panel-inset); transition: background .22s,border-color .22s }
.audio-switch::after { content: ""; position: absolute; width: .71em; aspect-ratio: 1; top: .17em; left: .18em; border-radius: 50%; background: #a57a60; transition: transform .22s,background .22s }
.audio-settings input:checked + .audio-option .audio-switch { background: #e3b97438; border-color: #bd7d3d; }
.audio-settings input:checked + .audio-option .audio-switch::after { transform: translateX(.98em); background: #a4531e }
.audio-settings input:focus-visible + .audio-option { outline: 2px solid var(--gold); outline-offset: 3px }
#receiver-dialog { max-height: 75svh }
#receiver-dialog[open] { display: flex; flex-direction: column }
.receiver-options { display: grid; gap: 7px; padding: .9em 1.25em; overflow-y: auto }
.receiver-options button { text-align: left }
dialog { background: var(--panel); color: var(--paper); border: 1px solid var(--warm-border); border-radius: 16px; padding: 0; box-shadow: 0 20px 90px #000a }
dialog::backdrop { background: #5e321f65; backdrop-filter: blur(6px) }
dialog.modal-entering::backdrop { animation: modal-shade-in .46s both ease-out }
dialog.modal-closing::backdrop { animation: modal-shade-out .38s both ease-in }
dialog.modal-closing { pointer-events: none }
@keyframes modal-shade-in { from { opacity: 0 } }
@keyframes modal-shade-out { to { opacity: 0 } }
.route-flights { position: fixed; inset: 0; width: auto; height: auto; margin: 0; padding: 0; border: 0; background: none; pointer-events: none; overflow: visible }
.route-flights::backdrop { pointer-events: none }
.route-flight {
  position: absolute; left: 0; top: 0; display: grid; place-items: center;
  width: clamp(55px, 8vw, 114px); aspect-ratio: 1.72; border-radius: 6px;
  border: 1px solid #bd8058; color: #894a2b;
  background: repeating-linear-gradient(138deg,#b9663611 0 1px,transparent 1px 5px), linear-gradient(145deg,#fffaf0,#ffdfbf 78%);
  box-shadow: inset 0 0 0 3px #fffdf680, 0 5px 16px #9b4d2942;
}
.route-flight.to { background: linear-gradient(145deg,#fff5e6,#f8cfaa 78%) }
.route-flight.gold { color: #714316; border-color: #c59545; background: linear-gradient(145deg,#fff7da,#ffdf9a) }
.route-flight svg { width: 32%; height: 62% }
.route-row.reveal-pending { visibility: hidden }
.route-person.flight-pending { opacity: 0 }

#settings { width: min(860px, 94vw); max-height: 92svh; overflow: clip }
#settings[open] { display: flex; flex-direction: column }
#settings > :is(.panel-header, .panel-footer) { flex: none }
.panel-header, .panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: 1em 1.4em }
.panel-header { border-bottom: 1px solid var(--line) }
.panel-footer { border-top: 1px solid var(--line); justify-content: flex-end }
.panel-header h2, .mini-form h2 { margin: .2em 0 0 }
.panel-body {
  position: relative; flex: 1 1 auto; min-height: 0; padding: 0 1.4em 1.4em;
  overflow: hidden auto; overscroll-behavior: contain;
}
.panel-body section { margin-top: 1.35em }
.panel-body h3 { margin: 0 }
.panel-body p, .mini-form p { font-size: .88rem; color: var(--muted); line-height: 1.65; white-space: pre-line }
.panel-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55em; margin-top: .65em; font-size: .85rem }
.panel-body textarea, .mini-form textarea, .mini-form input, .mini-form select { width: 100%; background: var(--panel-inset); color: var(--paper); border: 1px solid var(--warm-border); border-radius: 7px; padding: .65em; resize: vertical }
.roster-line { display: flex; gap: .7em; align-items: center; padding: .5em 0; border-bottom: 1px solid var(--line) }
.roster-line > span { flex: 1; overflow-wrap: anywhere; min-width: 0 }
.roster-line small { display: block; color: var(--muted); margin-top: .2em; white-space: pre-wrap }
.roster-line button { font-size: .76rem; flex-shrink: 0 }
.roster-line .teacher-label { color: var(--gold) }
.danger, .error { color: #a12820 !important }
.notice { margin-top: 1em; padding: .8em; background: #efb58343; border-radius: 8px; font-size: .88rem; white-space: pre-line }
#records { padding-left: 1.6em }
#records li { padding: .25em; overflow-wrap: anywhere }
.small-dialog { width: min(500px, 92vw) }
.mini-form { padding: 1.3em; display: grid; gap: .8em }
.mini-form label { display: grid; gap: .3em; font-size: .86rem; min-width: 0 }
.mini-form .panel-actions { justify-content: flex-end }
.form-grid { display: grid; gap: .65em; grid-template-columns: minmax(0,1fr) minmax(0,1.6fr) minmax(0,1fr) }
@media (max-width: 420px) { .form-grid { grid-template-columns: minmax(0,1fr) minmax(0,1.55fr) } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
@media (max-width: 620px) {
  .stage { padding-inline: 12px; min-height: 100svh }
  .controls { --status-lines: 3 }
  .brand { font-size: clamp(10px, 2.75vw, 13px); line-height: 1.4 }
  .audio-options { gap: 5px }
  .audio-options .audio-option { flex-direction: column; justify-content: center; text-align: center; height: 100%; font-size: .67rem; padding-inline: .18em }
  .audio-options.single-audio-option .audio-option { flex-direction: row; justify-content: space-between; padding-inline: .65em }
  .board { grid-template-columns: minmax(0,1fr) 16% minmax(0,1fr) }
  .slot-label { letter-spacing: 0; font-size: 10px }
  .journey-caption { display: none }
  .right .card, #sender-front { padding-inline: .38em }
}
@media (max-height: 650px) and (min-width: 621px) {
  .stage { padding-block: 10px; gap: 7px }
  .card { height: max(95px, calc(var(--unit)*17)) }
  h1 { font-size: max(27px, calc(var(--unit)*4.45)) }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important }
  .sender-card:has(.sender-flip:not([hidden])) .sender-turn { transition: none }
  .rail::after { animation: none }
}
