:root {
  color-scheme: light;
  --paper: #faf5fa;
  --card: #fff;
  --ink: #26142e;
  --muted: #65566e;
  --plum: #391c45;
  --berry: #9e205e;
  --berry-dark: #81154a;
  --rose: #ffb9d7;
  --soft: #f3eaf4;
  --line: #e4d6e7;
  --mono: "IBM Plex Mono", Consolas, monospace;
  background: var(--paper);
  color: var(--ink);
  font-family: "Rethink Sans", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.25; }
a { color: inherit; text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 3px solid #b43f88; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { width: min(1220px, calc(100% - 76px)); margin-inline: auto; }
.topbar { min-height: 74px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { font-size: 1.25rem; font-weight: 850; text-decoration: none; letter-spacing: -.045em; display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand-mark { width: 33px; height: 33px; border-radius: 9px; color: #fff; background: var(--plum); position: relative; }
.brand-mark::before { content: ""; position: absolute; left: 10px; right: 10px; top: 7px; bottom: 7px; border: solid var(--rose); border-width: 0 2px; transform: rotate(-16deg); }
.brand-mark::after { content: ""; position: absolute; left: 10px; right: 10px; top: 11px; height: 2px; background: var(--rose); box-shadow: 0 8px var(--rose); transform: rotate(-16deg); }
.topbar nav { display: flex; align-items: center; gap: clamp(10px,3vw,26px); font-size: .91rem; font-weight: 760; }
.topbar nav a { text-decoration: none; white-space: nowrap; }
.topbar nav a:hover { text-decoration: underline; }
.nav-admin { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; }
main { padding: clamp(22px,4vw,46px) 0 50px; }

.hero {
  display: grid; grid-template-columns: 1.05fr minmax(0, .85fr); align-items: center; gap: 35px;
  padding: clamp(27px,5vw,58px); overflow: hidden; border-radius: 25px;
  background: radial-gradient(ellipse at 84% 12%, #6b315d, transparent 65%), var(--plum);
  color: #fff;
}
.hero h1 { font-size: clamp(34px,5.3vw,70px); font-weight: 850; line-height: 1.1; letter-spacing: -.075em; word-break: keep-all; }
.hero em { color: var(--rose); font-style: normal; }
.hero p { color: #f5e6f1; max-width: 34ch; margin-block: 16px 20px; word-break: keep-all; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 42px; padding: 8px 13px;
  border: 1px solid var(--berry); border-radius: 9px; background: var(--berry); color: #fff; text-decoration: none;
  font-weight: 800; line-height: 1.27; text-align: center; overflow-wrap: anywhere;
}
.button:not(:disabled):hover { background: var(--berry-dark); }
.button.secondary { border-color: #d1b7cd; background: #fff; color: var(--berry-dark); }
.button.secondary:not(:disabled):hover { background: #fbecf4; }
.button.mini { min-height: 34px; padding: 5px 8px; font-size: .84rem; }
.hero .button { background: var(--rose); color: #4a153a; border-color: var(--rose); }
.hero .button:not(:disabled):hover { background: #ffd4e6; }
.hero .button.secondary { background: transparent; color: #fff; border-color: #d8a8c8; }
.hero .button.secondary:not(:disabled):hover { background: #6c355f; }
.hero-picture {
  max-width: 330px; width: 100%; justify-self: center; padding: 14px; background: #f6eaf5;
  border: 1px solid #fff8; color: var(--plum); border-radius: 15px;
  box-shadow: 11px 12px 0 #25132d85; transform: rotate(4deg);
}
.picture-head, .picture-end { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; text-align: center; font-size: .84rem; font-weight: 800; }
.picture-head span, .picture-end span { padding: 5px; border-radius: 5px; background: #fff; }
.picture-head span:first-child, .picture-end span:nth-child(2) { color: #72123e; background: var(--rose); }
.picture-ladder { height: clamp(95px,16.4vw,218px); position: relative; margin-block: 4px; }
.picture-ladder i, .picture-ladder b { position: absolute; background: #a78ba9; border-radius: 4px; }
.picture-ladder i { top: 0; bottom: 0; width: 2px; }
.picture-ladder i:nth-child(1) { left: 16.67%; }
.picture-ladder i:nth-child(2) { left: 50%; }
.picture-ladder i:nth-child(3) { left: 83.33%; }
.picture-ladder b { height: 2px; width: 33.33%; }
.picture-ladder b:nth-child(4) { top: 18%; left: 16.67%; }
.picture-ladder b:nth-child(5) { top: 43%; left: 50%; }
.picture-ladder b:nth-child(6) { top: 65%; left: 16.67%; }
.picture-ladder b:nth-child(7) { top: 83%; left: 50%; }
.picture-ladder strong { position: absolute; inset: 0; background: #b72e74; clip-path: polygon(16.1% 0%, 17.3% 0%, 17.3% 17.3%, 50.7% 17.3%, 50.7% 42.4%, 84% 42.4%, 84% 83.6%, 50.7% 83.6%, 50.7% 100%, 49.4% 100%, 49.4% 82.5%, 82.8% 82.5%, 82.8% 43.6%, 49.4% 43.6%, 49.4% 18.8%, 16.1% 18.8%); }

.card { border: 1px solid var(--line); border-radius: 17px; background: var(--card); padding: clamp(15px,2.5vw,25px); min-width: 0; }
.card h2 { font-size: 1.18rem; letter-spacing: -.035em; }
.join { margin-top: 15px; display: grid; grid-template-columns: minmax(0,1fr) minmax(110px,190px) auto; gap: 12px; align-items: center; }
.join p, .guide p, .page-head p, .edit-panel p, .waiting p { color: var(--muted); font-size: .93rem; margin-top: 5px; }
.code-field input { font-family: var(--mono); letter-spacing: .09em; }
.guide { margin-top: clamp(32px,5vw,58px); }
.guide > h2 { font-size: clamp(1.25rem,2.6vw,1.95rem); letter-spacing: -.045em; }
.guide ol { list-style: none; margin: 15px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.guide li { display: flex; align-items: start; gap: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: #fff; }
.guide li > span { display: grid; place-items: center; flex: 0 0 27px; width: 27px; height: 27px; border-radius: 50%; background: var(--soft); color: var(--berry-dark); font: 800 .85rem var(--mono); }
.guide h3 { font-size: 1rem; }

.page-head { margin-bottom: 19px; }
.page-head h1 { font-size: clamp(1.85rem,4.5vw,3rem); letter-spacing: -.06em; }
.page-head p { margin-top: 5px; }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid #d5c2d7; border-radius: 8px; background: #fdf9fc; color: var(--ink); padding: 8px 10px; }
input, select { min-height: 42px; }
input::placeholder, textarea::placeholder { color: #76677e; }
textarea { min-height: 134px; resize: vertical; line-height: 1.65; }
.editor-title { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; }
.editor label { font-weight: 800; }
.editor>.pair-editor{grid-column:1/-1;min-width:0;margin-block:12px}
.pair-editor h2{margin:0;font-size:1.15rem}
.pair-editor>p{margin:8px 0 14px;color:var(--muted);line-height:1.55}
.pair-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:8px;align-items:center}
.pair-row+.pair-row{margin-top:7px}
.pair-columns{margin-bottom:6px;font-weight:750}
.pair-row input{min-height:44px;font-size:1rem}
.pair-row .pair-remove{min-width:44px;min-height:44px;padding:0;font-size:1.2rem}
.pair-add{margin-top:10px;min-height:44px}
.pair-add span{font-size:1.2em;margin-inline-end:4px}
.form-cols { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 12px; margin-top: 12px; }
.edit-heading, .card-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px; }
.edit-heading span, .card-heading span { font-size: .84rem; font-weight: 750; color: var(--berry-dark); }
.edit-panel textarea { display: block; margin-top: 9px; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.team-preset { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #f4eaf2; }
.team-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.team-controls .team-select { display: grid; flex: 0 1 10rem; gap: 5px; min-inline-size: 0; }
.team-select select { inline-size: 100%; min-height: 40px; padding: 4px 9px; font-size: .94rem; }
.team-controls .button { min-height: 40px; }
.team-preset p { margin: 7px 0 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.team-preset p[data-unavailable] { color: #95244d; font-weight: 750; }
.editor > .outcome-settings { grid-column: 1 / -1; min-inline-size: 0; margin: 12px 0; }
.outcome-settings legend { padding: 0 6px; font-weight: 800; }
.outcome-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.outcome-option { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.outcome-option:has(:checked) { border-color: #ad5486; background: #f6eafa; }
.outcome-option input { inline-size: 1.1rem; block-size: 1.1rem; min-height: 0; margin: .2em 0 0; padding: 0; flex: none; accent-color: var(--berry-dark); }
.outcome-option small { display: block; margin-top: 3px; color: var(--muted); font-size: .9rem; font-weight: 500; line-height: 1.5; }
@media (max-width: 660px) { .outcome-options { grid-template-columns: minmax(0, 1fr); } }
.editor-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-block: 5px; }
#input-status { font-size: .88rem; color: var(--muted); }
.form-error { color: #992453; font-size: .9rem; font-weight: 820; max-width: 55ch; }
.recent { margin-top: 15px; }
.recent ul { margin: 8px 0 0; padding: 0; list-style: none; }
.recent a { text-decoration: none; display: flex; justify-content: space-between; gap: 9px; padding-block: 6px; }
.recent a:hover { text-decoration: underline; }
.recent a span { font: 700 .83rem var(--mono); white-space: nowrap; color: var(--berry-dark); }

.draw-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 11px; }
.page-head .phase { width: fit-content; padding: 3px 8px; border-radius: 99px; color: var(--berry-dark); background: var(--soft); font-size: .8rem; font-weight: 800; margin: 0 0 4px; }
.room-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.room-code { display: grid; padding: 4px 9px; border: 1px solid var(--line); width: fit-content; border-radius: 8px; background: #fff; }
.room-code span { font-size: .72rem; color: var(--muted); }
.room-code strong { font: 800 1.1rem var(--mono); letter-spacing: .11em; }
.connection { font-size: .82rem; color: var(--muted); font-weight: 700; }
.connection.online::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #a72e68; }
.stage-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(255px, .85fr); gap: 13px; align-items: start; }
.stage-side { min-width: 0; display: grid; gap: 13px; }
.rung-editor { min-width: 0; margin-block: 14px; }
.nickname-entry form { display: grid; gap: 10px; margin-block-start: 18px; }
.nickname-entry form p { margin: 0; }
.nickname-entry form button { justify-self: start; }
.player-nickname { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.participant-results { margin-block-start: 18px; }
.participant-results .result-list { max-block-size: 26rem; overflow: auto; }
.participant-results li > div { display: grid; gap: 3px; min-inline-size: 0; overflow-wrap: anywhere; }
.participant-results li > div span { color: var(--muted); }
.rung-editor h2 { margin: 0 0 10px; font-size: 1.12rem; }
.rung-editor p { margin: 8px 0 12px; color: var(--muted); }
.rung-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.rung-modes button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 13px; color: var(--berry-dark); background: white; font: inherit; cursor: pointer; }
.rung-modes button[aria-pressed=true] { background: var(--berry-dark); color: white; }
.rung-modes .preview-toggle { margin-inline-start: auto; border-color: #b195ae; }
.rung-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  direction: ltr;
  margin-block: 14px;
  border: 1px solid #dbc2d6;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 10%,#fffdfa,#f2e6f1);
}
.rung-sheet, .board {
  inline-size: min(100%, calc(var(--lanes) * 152px + 76px));
  margin-inline: auto;
}
.rung-sheet { min-width: calc(var(--lanes) * 72px); padding-block: 8px; }
.rung-names { display: grid; grid-template-columns: repeat(var(--lanes),minmax(0,1fr)); gap: 6px; margin-inline: 5px; }
.rung-names span { text-align: center; font-size: .95rem; font-weight: 700; padding: 6px 4px; overflow-wrap: anywhere; background:#fff9fd; border:1px solid #dbc2d6; border-radius:7px; }
.rung-outcomes span { background:#efdfec; }
.rung-canvas { display: block; inline-size: 100%; block-size: clamp(360px,51svh,580px); }
.rung-canvas[data-rung-draw] { touch-action: none; cursor: crosshair; }
.rung-canvas :is(line,path) { vector-effect: non-scaling-stroke; }
.rung-rail { stroke: #a890ac; stroke-width: 2; pointer-events: none; }
.rung-sample { fill: none; stroke: #895273; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.rung-drawn, .rung-preview { stroke: var(--berry-dark); stroke-width: 4; stroke-linecap: round; }
.rung-drawn { cursor: pointer; }
.rung-drawn:is(:hover,:focus-visible) { stroke: #bf3475; stroke-width: 7; }
.rung-preview { pointer-events: none; stroke-dasharray: 6 5; }
.rung-preview[hidden] { display: none; }
.rung-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.rung-tools label { display: grid; gap: 4px; min-inline-size: 0; max-inline-size: 100%; }
.rung-tools input { inline-size: 8rem; max-inline-size: 100%; }
.stage-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 12px; }
.share .button { font-size: .88rem; }
.board-card { overflow: hidden; }
.board-scroll { overflow-x: auto; overscroll-behavior-inline: contain; margin-top: 10px; padding: 3px 3px 8px; }
.board {
  min-width: calc(var(--lanes) * 76px); display: grid; border: 1px solid var(--line);
  border-radius: 11px; padding-block: 6px; background: #fbf6fa;
}
.lanes { display: grid; grid-template-columns: repeat(var(--lanes), minmax(0,1fr)); min-width: 0; }
.lane, .outcome { margin-inline: 3px; min-width: 0; display: grid; place-items: center; gap: 1px; padding: 4px 3px; overflow-wrap: anywhere; text-align: center; border-radius: 7px; font-size: .84rem; font-weight: 800; line-height: 1.3; }
.lane { border: 1px solid #e1cfe2; background: #fff; color: var(--ink); }
.lane:disabled { opacity: 1; }
.outcome.previewed { border-color: #bd91b7; background: #f4e5f3; color: var(--berry-dark); }
.shuffle-dots { display: inline-flex; gap: 4px; padding-block: 1px; }
.shuffle-dots i { inline-size: 5px; block-size: 5px; border-radius: 50%; background: #80516f; }
@media (prefers-reduced-motion: no-preference) {
  .outcome.just-landed { animation: ladder-landing 550ms ease-out; }
  .outcome.previewed.outcome-entering { animation: ladder-preview-tile 380ms ease-out var(--outcome-delay) both; }
  .outcome-entering .shuffle-dots i { animation: ladder-shuffle-dot 240ms ease-in-out var(--outcome-delay) 3 alternate; }
  .outcome-entering .shuffle-dots i:nth-child(2) { animation-delay: calc(var(--outcome-delay) + 50ms); }
  .outcome-entering .shuffle-dots i:nth-child(3) { animation-delay: calc(var(--outcome-delay) + 100ms); }
}
@keyframes ladder-landing { 35% { box-shadow: 0 0 0 3px var(--route-ink, var(--berry-dark)); transform: translateY(-2px) scale(1.02); } }
@keyframes ladder-preview-tile { from { opacity: .55; transform: translateY(4px); } }
@keyframes ladder-shuffle-dot { to { opacity: .45; transform: translateY(-3px); } }
.lane:not(:disabled):hover { border-color: var(--berry); }
.lane small, .outcome small { font: 700 .69rem var(--mono); color: var(--muted); }
.outcome { color: #74667c; border: 1px dashed #d9c8dc; background: #fbf7fb; }
.outcome.revealed { border-style: solid; color: var(--ink); background: #fff; }
.lane.active, .outcome.active { background: #ffd5e7; border-color: #d375a5; color: #651339; }
#ladder { width: 100%; height: clamp(370px,54svh,620px); display: block; }
.path-label { padding: 8px 9px; background: var(--soft); border-radius: 7px; font-size: .9rem; color: var(--muted); text-align: center; margin-top: 6px; }
.path-label strong { color: var(--route-ink, var(--berry-dark)); }
.scroll-hint { color: var(--muted); font-size: .79rem; margin-top: 3px; }
.reveal-actions, .result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.result-actions { margin-top: 10px; }
.reveal-actions .button { flex: 1 1 0; white-space: nowrap; }
.result-list { margin: 9px 0 0; padding: 0; list-style: none; }
.result-list li { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); align-items: center; min-height: 38px; gap: 8px; border-top: 1px solid var(--line); }
.result-list li > * { overflow-wrap: anywhere; padding-block: 4px; }
.result-list li > :last-child { text-align: right; }
.result-list strong { color: var(--berry-dark); }
.plain { justify-self: end; font-weight: 800; color: var(--berry-dark); border: 0; background: transparent; padding-inline: 5px; min-height: 38px; }
.plain:not(:disabled):hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .87rem; }
.waiting { max-width: 620px; }
.waiting a { margin-top: 12px; }
.notice { position: fixed; z-index: 5; left: 50%; bottom: 15px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); padding: 9px 12px; background: var(--plum); color: #fff; border-radius: 9px; box-shadow: 0 4px 15px #2a152a55; }

@container game-viewport (max-width: 875px) {
  .shell { width: calc(100% - 44px); }
  .hero { gap: 19px; }
  .stage-grid { grid-template-columns: minmax(0,1fr); }
}
@container game-viewport (max-width: 620px) {
  .shell { width: calc(100% - 28px); }
  .topbar { min-height: 57px; }
  .brand { font-size: 1.07rem; }
  .brand-mark { width: 29px; height: 29px; }
  .topbar nav { gap: 8px; font-size: .81rem; }
  main { padding-top: 14px; }
  .hero { padding: 17px; gap: 12px; grid-template-columns: minmax(0,1.3fr) minmax(0,.72fr); border-radius: 16px; }
  .hero h1 { font-size: clamp(22px,6vw,36px); }
  .hero p { font-size: .82rem; margin-block: 8px 10px; }
  .hero .button { min-height: 35px; padding: 5px 7px; font-size: .8rem; }
  .hero-picture { padding: 5px; border-radius: 8px; box-shadow: 5px 6px 0 #25132d85; }
  .picture-head, .picture-end { font-size: .55rem; gap: 2px; }
  .picture-head span, .picture-end span { padding: 2px 1px; }
  .join { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; margin-top: 9px; }
  .join > div { grid-column: 1 / -1; margin-bottom: 3px; }
  .join .button { font-size: .85rem; padding-inline: 5px; }
  .guide ol, .form-cols { grid-template-columns: minmax(0,1fr); gap: 7px; }
  .editor-title { grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
  .editor-title label { grid-column: 1 / -1; }
  .editor-title .button { padding-inline: 6px; font-size: .85rem; }
  .stage-grid, .stage-side { gap: 8px; }
  .board { min-width: calc(var(--lanes) * 69px); }
  #ladder, .rung-canvas { block-size: clamp(280px,43svh,400px); }
  .rung-modes .preview-toggle { margin-inline-start: 0; }
}
@container game-viewport (max-width: 350px) {
  .hero { grid-template-columns: minmax(0,1.4fr) minmax(0,.75fr); padding: 13px; gap: 8px; }
  .topbar nav a:first-child { display: none; }
}

/* Content follows the game flow; secondary guidance stays below primary actions. */
.hero h1{font-size:clamp(1.75rem,3.5vw,2.75rem);word-break:keep-all}
.content-guide,.content-faq{margin-top:32px;scroll-margin-top:20px}
.content-intro{max-width:76ch;margin-bottom:16px}
.content-guide h2,.content-faq h2{font-size:1.4rem;line-height:1.35;letter-spacing:-.03em}
.content-intro>p:not(.content-eyebrow){margin-top:8px;color:var(--muted);font-size:.95rem;line-height:1.65}
.content-eyebrow{color:var(--berry-dark);font-size:.8rem;font-weight:750;margin-bottom:5px}
.content-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.content-grid article{padding:20px;border:1px solid var(--line);border-radius:14px;background:#fff;min-width:0}
.content-grid h3{font-size:1rem;margin-bottom:8px}
.content-grid p,.content-note p,.context-help{font-size:.9rem;line-height:1.65;color:var(--muted)}
.content-step{display:inline-block;margin-bottom:12px;color:var(--berry-dark);font-size:.8rem;font-weight:750}
.content-note{margin-top:14px;border-left:3px solid var(--berry-dark);padding:16px 20px;background:var(--soft);border-radius:0 12px 12px 0}
.content-note strong{display:block;margin-bottom:5px;font-size:.95rem}
.content-note .watch-entry{margin:12px 0 0;background:#fff;border-radius:10px;padding:12px 16px}
.content-note .watch-entry p{margin:10px 0}
.content-note .watch-entry form{max-width:420px}
.content-faq{display:grid;grid-template-columns:1fr 2fr;gap:24px;padding-top:24px;border-top:1px solid var(--line)}
.content-faq details{border-bottom:1px solid var(--line);padding:14px 0}
.content-faq summary,.context-help summary{font-weight:700;cursor:pointer;color:var(--ink);line-height:1.5}
.content-faq details p{font-size:.95rem;line-height:1.7;color:var(--muted);margin-top:9px}
.context-help{margin-top:12px}
.context-help p,.context-help ul{margin-top:8px}
.audience-guide .watch-entry{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px 18px}
.audience-guide .watch-entry summary{font-weight:700;cursor:pointer;color:var(--ink);line-height:1.5}
.audience-guide .join{margin:14px 0 0;padding:0;border:0;box-shadow:none}
@container game-viewport (max-width:760px){.content-grid,.content-faq{grid-template-columns:minmax(0,1fr);gap:10px}.content-guide,.content-faq{margin-top:24px}.content-grid article{padding:16px}.content-guide h2,.content-faq h2{font-size:1.25rem}.content-step{margin-bottom:7px}.content-note{padding:14px}.content-faq details{padding:12px 0}}

.field-lesson { margin-block: 14px; }
.field-lesson a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; min-height: 46px; text-decoration: none; border: 1px solid currentColor; border-radius: 10px; }
.field-lesson small { display: block; margin-top: 3px; font-size: .85rem; line-height: 1.5; font-weight: 400; }
.field-lesson a:is(:hover,:focus-visible) strong { text-decoration: underline; text-underline-offset: .18em; }
[dir="rtl"] .field-lesson [aria-hidden="true"] { transform: scaleX(-1); }


.board-scroll, .picture-ladder { direction: ltr; }
html[dir="rtl"] input[autocomplete="off"][maxlength="6"], input[type="url"] { direction: ltr; }

/* Homepage help uses the same native disclosures as the room guides. */
.help-topics { margin-block: clamp(24px, 4vw, 48px); }
.help-topics > h2 { margin: 0 0 14px; font-size: clamp(1.25rem, 2vw, 1.55rem); }
.help-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.faq-topic { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.faq-topic h3 { margin: 0; padding: 12px 16px; font-size: 1rem; background: var(--soft); color: var(--berry-dark); }
.faq-answer { margin-inline: 16px; padding-block: 14px; }
.faq-answer + .faq-answer { border-block-start: 1px solid var(--line); }
.faq-answer h4 { margin: 0 0 6px; font-size: 1rem; line-height: 1.5; }
.faq-answer p { margin: 0; max-width: 65ch; color: var(--muted); font-size: .93rem; line-height: 1.65; overflow-wrap: anywhere; }
@container game-viewport (max-width: 700px) { .help-columns { grid-template-columns: minmax(0, 1fr); gap: 10px; } }

.ladder-walkthrough { display: grid; grid-template-columns: minmax(220px,.9fr) minmax(0,1.3fr); gap: clamp(16px,3vw,32px); align-items: center; margin-top: 14px; }
.ladder-route-example { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.ladder-route-example img { display: block; margin: 0 auto; width: min(100%, 328px); height: auto; }
.ladder-route-example figcaption { margin-top: 10px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.ladder-guide-steps ol { grid-template-columns: minmax(0,1fr); margin: 0; gap: 0; }
.ladder-guide-steps li { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 14px 0; }
.ladder-guide-steps > a { margin-top: 14px; }
.hero-content .field-lesson a { color: var(--ink); border-color: var(--line); background: var(--card); }
@container game-viewport (max-width: 690px) { .ladder-walkthrough { grid-template-columns: 1fr; } }

/* Studio materials: rose-gold rails on mulberry glass. */
body { background:radial-gradient(75% 32rem at 65% 0%,#f0e1ed,transparent 100%),#faf7fa; }
.home .hero {
 position:relative; isolation:isolate; overflow:hidden; grid-template-columns:minmax(0,1fr);
 padding:clamp(24px,4.5vw,60px); min-height:340px; border:1px solid #46213e; border-radius:22px;
 background:linear-gradient(132deg,#341329,#27172d 64%,#522540); box-shadow:0 17px 42px -27px #542540a6;
}
.ladder-studio-scene { position:absolute; inset-block:0; inset-inline-end:0; width:53%; height:100%; object-fit:cover; object-position:center; mask-image:linear-gradient(to right,transparent,#000 27%); z-index:-1; pointer-events:none; }
:where([dir=rtl]) .ladder-studio-scene { --studio-fade:to left; mask-image:linear-gradient(to left,transparent,#000 27%); }
.home .hero-content { width:52%; min-width:0; }
.home .hero-content h1 { font-size:clamp(30px,4vw,54px); }
.home .hero-content em { color:#ffd6ac; }
.home .hero-content .field-lesson a { color:#ffeff5; background:#472138e8; border-color:#aa748a; }
.home .hero-content .field-lesson small { color:#ecd5df; }
.home .hero-content .button:not(.secondary) { color:#3c172b; background:linear-gradient(145deg,#ffdfc8,#efaeb8); border-color:#eeb5bb; box-shadow:inset 0 1px #ffedde,0 4px 12px #18071155; }
.stage-grid .card,.editor .card { box-shadow:inset 0 1px #fff,0 10px 25px -18px #4e224b77; }
.board-card { border-color:#d0b4c6; }
.stage-grid .board-card > .card-heading { padding:11px 14px; border-radius:10px; color:#fff2ef; background:linear-gradient(115deg,#381d36,#673752); }
.stage-grid .board-card > .card-heading :is(span,small) { color:#f1cdcb; }
.stage-grid .results .card-heading { border-bottom:1px solid #d9bacd; padding-bottom:8px; }
.board-scroll .board { background:radial-gradient(ellipse at 50% 0,#fffdfa,#f5ebf5); border-color:#dbc2d6; box-shadow:inset 0 1px 5px #75516818; }
.board :is(.lane,.outcome)[style*="--route-ink"] {
  border-color: color-mix(in srgb, var(--route-ink) 65%, white);
  border-block-end: 3px solid var(--route-ink);
  background: color-mix(in srgb, var(--route-ink) 8%, white);
  color: var(--route-ink);
}
.board :is(.lane,.outcome).active[style*="--route-ink"] {
  background: color-mix(in srgb, var(--route-ink) 15%, white);
}
.path-label[style*="--route-ink"] { color:var(--route-ink); }
@container game-viewport (max-width:660px) {
 .home .hero { grid-template-columns:minmax(0,1fr) minmax(0,1fr); min-height:0; padding:18px; gap:9px; }
 .home .hero-content { display:contents; }
 .ladder-studio-scene { position:relative; grid-area:1/2; width:calc(100% + 18px); height:auto; aspect-ratio:1.46; object-fit:cover; mask-image:linear-gradient(var(--studio-fade,to right),transparent,#000 24%),linear-gradient(to bottom,transparent,#000 16%,#000 73%,transparent); mask-composite:intersect; }
 .home .hero-content h1 { grid-area:1/1; font-size:clamp(27px,6.8cqw,35px); }
 .home .hero-content p { grid-column:1/-1; max-width:none; margin:0; font-size:14px; }
 .home .hero-content .field-lesson { grid-column:1/-1; margin:0; }
 .home .hero-content .actions { grid-column:1/-1; gap:8px; }
}

/* An illustrated draw programme, with a separate work surface for the editor. */
.topbar { border-block-end:1px solid #bf9bab; }
.home :is(.hero h1,.service-detail h2,.guide h2,.content-intro h2),.page-head h1 { font-family:Georgia,"Batang",serif; letter-spacing:-.045em; line-height:1.2; }
.home .guide { border-block:1px solid #d0b6c5; padding-block:clamp(20px,3cqw,38px); }
.home .guide ol { gap:0; }
.home .guide li { border:0; border-inline-start:2px solid #bf8ea3; border-radius:0; background:transparent; padding:12px 16px; }
.home .guide li > span { color:#fff4ea; background:#693952; }
.home .content-grid article p,.home .detail-cards p { line-height:1.68; max-width:59ch; }
.editor>.editor-title,.page-head.draw-head { padding:clamp(16px,2.3cqw,30px); background:#f3e9ee; border:1px solid #d5bbc8; border-inline-start:4px solid #834466; border-radius:8px; }
.stage-side .results { border-block-start:3px solid #966477; }
.stage-side .results li { padding-block:11px; }
.editor .editor-bottom { margin-top:0; padding-top:14px; border-top:1px solid #d5bdc8; }
@container game-viewport (min-width:960px) {
 .editor { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); align-items:start; gap:18px; }
 .editor>.editor-title,.editor>.editor-bottom { grid-column:1/-1; }
 .editor>.form-cols { grid-column:1/-1; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; align-items:stretch; margin:0; }
 .editor>.rung-editor { grid-column:1/-1; min-width:0; margin:0; }
 .rung-layout[data-few-lanes] {
   display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.85fr);
   grid-template-areas:"summary board" "tools board"; grid-template-rows:auto 1fr;
   gap:12px 24px; align-items:start;
 }
 .rung-layout[data-few-lanes] .rung-summary { grid-area:summary; }
 .rung-layout[data-few-lanes] .rung-modes .preview-toggle { margin-inline-start:0; }
 .rung-layout[data-few-lanes] .rung-scroll { grid-area:board; margin:0; }
 .rung-layout[data-few-lanes] .rung-sheet { inline-size:min(100%,calc(var(--lanes) * 180px + 96px)); }
 .rung-layout[data-few-lanes] .rung-tools { grid-area:tools; }
 .home .service-detail { display:grid; grid-template-columns:minmax(180px,.45fr) minmax(0,1.55fr); align-items:start; gap:24px; padding-block:25px; }
 .home .service-detail .detail-cards { margin:0; }
 .stage-grid { grid-template-columns:minmax(0,3.2fr) minmax(245px,1fr); gap:20px; }
}

.home .hero .field-lesson .lesson-action { display:inline-flex; width:fit-content; max-width:100%; padding:8px 12px; min-height:42px; align-items:center; gap:6px; border-radius:7px; font-weight:700; }
.home .hero .field-lesson small { display:block; margin-top:6px; }
#app:has(> .home) > section { margin-block:clamp(18px,2cqw,28px) 0; }
#app:has(> .home) > .service-detail { display:block; padding-block:0; }
#app:has(> .home) > .service-detail .detail-cards { margin-top:10px; }
#app:has(> .home) > .help-topics { padding-block:0; }
.context-help h3 { font-size:1rem; margin:0 0 4px; }
.language-control:has(select:focus-visible) { outline:2px solid #844265; outline-offset:1px; }
.language-control select:focus-visible { outline:none; }

.board-card .path-label { text-align:start; margin:8px 0; padding:8px 12px; overflow-wrap:anywhere; }
.path-label[data-revealed="true"] { border-inline-start:4px solid var(--route-ink, var(--berry-dark)); font-size:clamp(1.14rem,2.2cqw,1.55rem); line-height:1.4; }
.result-list .plain,.board-card [data-action="skip-trace"] { padding:6px 12px; min-height:40px; border:1px solid #ad8ca6; border-radius:7px; color:#60234f; background:#fff7fc; }

/* Keep the room identity readable while only the named action is interactive. */
.saved-room { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.6rem 1rem; padding-block:.65rem; }
.saved-room > div { display:grid; gap:.15rem; min-width:0; overflow-wrap:anywhere; }
.saved-room small { width:fit-content; font-variant-numeric:tabular-nums; }
.saved-room a.button { display:inline-flex; flex:0 0 auto; width:auto; min-height:2.75rem; align-items:center; padding:.45rem .85rem; }
label.backup-picker { position:relative; max-inline-size:100%; min-inline-size:0; white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
label.backup-picker input[type=file] { position:absolute; inline-size:1px; block-size:1px; padding:0; margin:0; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
label.backup-picker:has(input:focus-visible) { outline:2px solid currentColor; outline-offset:3px; }
.owned-empty { margin-block:1rem; }
.owned-empty h2 { font-size:1.05rem; line-height:1.45; margin:0 0 .3rem; }
.owned-empty p { margin:0; max-inline-size:55ch; }

/* Draw preparation, audience entry and reference use separate visual surfaces. */
[aria-labelledby="draw-rules-title"] .content-grid article {
  padding:clamp(1rem,1.5cqw,1.4rem); border:1px solid #d9c8d1; border-block-start:4px solid #81526c;
  border-radius:.8rem; background:#fcf5f9;
}
[aria-labelledby="draw-rules-title"] .content-grid article:nth-child(2) { background:#fff6e6; border-color:#decaac; border-block-start-color:#98692c; }
[aria-labelledby="draw-rules-title"] .content-grid article:nth-child(3) { background:#edf2f5; border-color:#c5d4d8; border-block-start-color:#547480; }
[aria-labelledby="draw-rules-title"] .content-grid h3 { color:#30202d; }
[aria-labelledby="draw-rules-title"] .content-grid p { color:#453c46; }
#app .audience-guide {
  padding:clamp(1rem,2.4cqw,2rem); border:1px solid #452439; border-radius:1rem;
  background:linear-gradient(105deg,#392138,#552c49); color:#fff5ed;
}
#app .audience-guide .content-intro { margin:0; }
#app .audience-guide :is(.content-intro,.join) :is(h2,h3) { color:#fff5ed; }
#app .audience-guide :is(.content-intro,.join) p { color:#f3e4ed; max-inline-size:62ch; }
#app .audience-guide .watch-entry { background:transparent; border:0; border-block-start:1px solid #9a7288; border-radius:0; padding:1rem 0 0; margin-block-start:1rem; }
#app .audience-guide .join { display:grid; grid-template-columns:minmax(0,1fr) minmax(7rem,12rem) auto; align-items:center; gap:.75rem; padding:0; margin:0; background:transparent; }
#app .audience-guide .join h2 { font-size:1.12rem; margin:0; }
#app .audience-guide .join input { width:100%; background:#fffcfe; color:#36253c; border-color:#dac6d5; }
#app .audience-guide .join .button { background:#f8dea8; border-color:#f6dfa9; color:#3f2436; }
#app .audience-guide :is(.button,input):focus-visible { outline:3px solid white; outline-offset:2px; }
.help-topics .faq-topic { align-self:stretch; border-color:#d6c6d0; background:#fffdfa; }
.help-topics .faq-topic > h3 { background:#593149; color:#fff5e9; }
.help-topics .faq-topic:nth-child(2) > h3 { background:#ead8af; color:#422d19; }
.help-topics .faq-answer h4 { color:#342532; }
.help-topics .faq-answer p { color:#4c444b; line-height:1.7; }
@container game-viewport (max-width:760px) {
  #app .audience-guide .join { grid-template-columns:minmax(0,1fr); }
  #app .audience-guide .join > div { grid-column:auto; }
  #app .audience-guide .code-field { max-width:none; width:100%; }
}

.stage-grid, .form-cols { align-items:stretch; }

.page-head.draw-ended { padding:clamp(16px,2.3cqw,30px); border:1px solid #d5bbc8; border-inline-start:4px solid #834466; border-radius:12px; background:#f3e9ee; }
.draw-ended .phase { margin-block:0 .35rem; font-size:1rem; }
.draw-ended h1 { margin-block:0 .5rem; overflow-wrap:anywhere; }
.draw-ended .actions, .draw-ended > .button { margin-block-start:1rem; }
.draw-ended[data-phase="cancelled"] { border-inline-start-color:#9a6251; }
#app:has(.draw-ended) + pf-room-chat { display:none; }
.audience-capacity { display:inline-block; margin:.65rem 0 0; border:1px solid var(--line); border-radius:.55rem; padding:.3rem .65rem; font-weight:700; font-variant-numeric:tabular-nums; background:#fff9fc; }
.home .hero .home-capacity { margin-block:.45rem .65rem; color:#ffdfc8; font-size:1rem; line-height:1.45; font-weight:750; }
.selection-summary { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem .85rem; margin:.65rem 0; padding:.65rem .8rem; border-radius:.65rem; background:#f5eaf3; color:#542447; line-height:1.45; }
.selection-summary p { flex-basis:100%; margin:0; }
.selection-summary:lang(ko) { word-break:keep-all; }
.lane[data-choice] { min-block-size:70px; }
.lane .lane-count { display:block; margin-block-start:.2rem; color:#693d61; font-size:.875rem; }
.lane[data-choice][aria-pressed="true"] { background:#ffdce9; border-color:#992a61; box-shadow:inset 0 0 0 1px #992a61; }
.lane[data-choice]:enabled:hover { border-color:#992a61; background:#fff0f6; }
.ended-results .result-list { margin-block-start:.65rem; }
.record-tools { margin-block:1rem; }
.record-tools summary { cursor:pointer; font-weight:700; }
.record-tools p { margin-block:.8rem; }
.record-tools .record-delete { border-block-start:1px solid var(--line); margin-block-start:1.25rem; }
.record-delete button { border-color:#a56b64; color:#803d36; }
.draw-head .room-summary { min-inline-size:0; max-inline-size:100%; }
.draw-head .room-summary .button, .stage-toolbar .button { min-block-size:48px; }
