#backdrop, #cover, #screen, #hud, #windows, #overlays { position: fixed; inset: 0; }
#backdrop { z-index: 0; opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s;
  background: #0c0a08 url("../assets/skin/login_scene.png") center / cover no-repeat; }
#backdrop.on { opacity: 1; visibility: visible; transition: none; }
/* A wash and a vignette so the cards read against the painting. */
#backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, #0b090733 30%, #050403b3 100%); }
#cover { z-index: 1; background: #000; opacity: 0; pointer-events: none; transition: opacity .25s ease-out; }
#cover.on { opacity: 1; }
#cover.instant { transition: none; }
#screen { z-index: 2; top: var(--navbar-h); overflow: hidden; }
#hud { z-index: 3; pointer-events: none; }
#windows { z-index: 4; pointer-events: none; }
#windows > * { pointer-events: auto; }
#overlays { z-index: 6; pointer-events: none; }
#overlays > * { pointer-events: auto; }
body[data-screen="world"] #screen, body[data-screen="world"] #chrome { display: none; }

/* ── Title band ── */
#chrome { position: fixed; inset: 0 0 auto 0; height: var(--navbar-h); z-index: 5; display: flex; align-items: stretch;
  background: linear-gradient(#241d15, #15110c); border-bottom: 1px solid var(--border-dark); box-shadow: 0 1px 0 #000, 0 2px 8px #0008; }
.chrome-title { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; font: 20px var(--font-title); color: var(--gold); }
.winbtns { display: flex; align-items: stretch; }
.winbtn { width: 46px; background: none; border: 0; color: var(--text-muted); display: grid; place-items: center; }
.winbtn:hover { background: var(--bg-hover); color: var(--text); }
.winbtn.close:hover { background: #8f241c; color: #fff; }
.winbtn:focus-visible { outline-offset: -3px; }

/* ── Shared pre-game layout ── */
.pregame { position: absolute; inset: 0; zoom: var(--fit); display: flex; flex-direction: column; align-items: center; }
.pregame.centered { justify-content: center; gap: 10px; padding-bottom: 3vh; }
.center-items { align-items: center; }
.center-row { justify-content: center; }
.login-status, .status { min-height: 44px; margin: 0; text-align: center; font-size: var(--size-small); display: flex; align-items: center; justify-content: center; }
[data-kind="error"] { color: #ff9c8f; }
[data-kind="error"]:not(:empty)::before { content: "⚠\00a0"; }
[data-kind="good"] { color: var(--good); }
.bar.indeterminate > i { width: 35%; background: var(--gold-dim); animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { from { left: 0; } to { left: 65%; } }

/* ── Overlays ── */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; }
.scrim { background: #000000a6; }
.overlay-card { width: min(460px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.overlay-card .bar { width: 100%; }
.connect { background: #000000cc; }

/* ── Update ── */
.update-card { width: 600px; display: flex; flex-direction: column; gap: 10px; }
.update-card .versions { font-size: 20px; }
.update-card .file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes { max-height: 300px; padding: 4px 10px; user-select: text; -webkit-user-select: text; }
.note + .note { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.note h3 { font: 19px var(--font-title); }
.note ul { margin: 4px 0 0; padding-left: 20px; color: var(--text); font-size: 16px; }
.news-card { width: min(620px, 92vw); }
.news-card .notes { max-height: 55vh; }

/* ── Login ── */
.crest { filter: drop-shadow(0 3px 6px #000a); }
.brand { font: 40px/1.1 var(--font-title); color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 18px #000c; margin-bottom: 8px; }
.login-card { width: 440px; display: flex; flex-direction: column; gap: 10px; }
.login-card .primary { width: 220px; min-height: 40px; }
.lang-row { gap: 4px; }
.lang-row .chip { min-width: 40px; min-height: 26px; padding: 0 4px; font-size: var(--size-small); }

/* ── Character select ── */
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, #00000059 100%); }
.select { padding: 26px 0 18px; gap: 14px; }
.select-foot { margin-top: auto; }
.select header { text-shadow: 0 2px 4px #000, 0 0 12px #000; }
.cards { display: flex; align-items: center; justify-content: center; gap: 14px; height: 324px; padding: 12px; }
.card {
  width: 178px; height: 252px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  color: var(--text);
  filter: brightness(.78); opacity: .92; transition: width .15s, height .15s, filter .15s, opacity .15s;
}
.card:hover:not(:disabled) { filter: brightness(.95); }
.card[aria-selected="true"] { width: 212px; height: 300px; filter: none; opacity: 1; box-shadow: 0 0 0 1px var(--accent), 0 0 22px #efcd7655; }
.card:disabled { cursor: var(--cursor); }
.card-stage { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14px; min-height: 0; }
.card .char-sprite { position: relative; transform-origin: 50% 100%; transition: transform .15s; }
.card[aria-selected="true"] .char-sprite { transform: scale(1.175); }
.plinth { position: absolute; bottom: 6px; left: 50%; width: 84px; height: 22px; margin-left: -42px; border-radius: 50%; background: radial-gradient(ellipse, #000a 0%, #0005 55%, transparent 72%); }
.aura { position: absolute; left: 50%; bottom: -6px; width: 170px; height: 170px; margin-left: -85px; border-radius: 50%; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(circle, #efcd7666 0%, #efcd7626 38%, transparent 68%); }
.card[aria-selected="true"] .aura { opacity: 1; animation: aura 2.6s ease-in-out infinite; }
@keyframes aura { 0%, 100% { transform: scale(.82); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .card[aria-selected="true"] .aura { animation: none; } }
.card-name { font: 21px/1.2 var(--font-title); color: var(--gold); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card[aria-selected="true"] .card-name { color: var(--accent); }
.card .playing { display: flex; align-items: center; gap: 4px; }
.empty-card { justify-content: center; color: var(--text-dim); }
.empty-card .card-stage { flex: none; height: 80px; align-items: center; padding: 0; }
.empty-card:hover:not(:disabled) { color: var(--gold-dim); }
.menu { gap: 8px; align-items: center; }
.menu-btn { width: 352px; min-height: 54px; font-size: 20px; }
.select-foot { width: min(720px, 90%); }
.select-panes { display: grid; grid-template-columns: 300px auto 300px; gap: 26px; align-items: start; }
/* Narrower than the verbs on purpose: this screen is about choosing a character. */
.stream-pane { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; background: #0d0b08a8; border: 1px solid var(--border); border-radius: 4px; }
.stream-pane p { margin: 0; }
.stream-pane .rule { margin: 0; }
.stream-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.stream-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Character creation ── */
.create-card { width: 940px; display: flex; flex-direction: column; gap: 8px; }
.create-cols { display: flex; gap: 20px; }
.create-left { width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; }
.stage { position: relative; height: 330px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 70px;
  background: radial-gradient(ellipse at 50% 75%, #3a2f1f 0%, transparent 62%); }
.stage .plinth { bottom: 62px; width: 130px; height: 34px; margin-left: -65px; }
.stage .char-sprite { position: relative; }
.create-left .num { min-width: 120px; text-align: center; }
.icon-btn.round { border-radius: 50%; }
.create-form { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.form-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: start; }
.form-row > .lbl { padding-top: 7px; color: var(--gold-dim); font-size: 17px; }
.chips { display: grid; gap: 5px; }
.chips.six { grid-template-columns: repeat(6, 1fr); }
.chips.four { grid-template-columns: repeat(4, 1fr); }
.chips.two { grid-template-columns: repeat(2, 120px); }
.chips.six .chip { font-size: 15px; }
.chips .chip { padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips .chip[aria-checked="true"]::before { content: none; }
.chips .chip[aria-checked="true"] { text-decoration: underline; text-underline-offset: 3px; }
.class-text { min-height: 2.6em; }
.create-card .back { width: 190px; min-height: 44px; }
.create-card .create { width: 220px; min-height: 44px; }

/* The note on diagnostics under the sign-in form. */
.login-privacy { margin: 8px 0 0; max-width: 360px; text-align: center; line-height: 1.35; }

/* ── Map editor (screens/editor.js): the engine's world shows through the middle ── */
.editor { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 360px; grid-template-rows: auto 1fr auto;
  grid-template-areas: "bar bar" "world side" "status side"; }
.editor-bar { grid-area: bar; display: flex; align-items: center; gap: 12px; padding: 6px 10px; flex-wrap: wrap; border-radius: 0; }
.editor-title { font-size: 20px; margin-right: 4px; }
.editor-group { gap: 4px; padding-left: 12px; border-left: 1px solid var(--border-dim); }
.editor-brush { min-width: 18px; text-align: center; }
.editor-world { grid-area: world; cursor: crosshair; background: transparent; touch-action: none; }
.editor-side { grid-area: side; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; border-radius: 0; }
/* The side scrolls rather than squeezing the palette when the options run long. */
.editor-side > * { flex-shrink: 0; }
.editor-status { grid-area: status; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; padding: 6px 10px; min-height: 34px; border-radius: 0; }
/* Rows as tall as their square swatches: auto rows in a box of capped height shrink under them. */
.editor-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); grid-auto-rows: max-content; gap: 4px; max-height: 330px; overflow-y: auto;
  background: var(--bg-sunken); padding: 4px; }
.editor-swatch { aspect-ratio: 1; display: grid; place-items: center; background: #0006; border: 1px solid var(--border-dim); padding: 2px; overflow: hidden; }
.editor-swatch img { max-width: 100%; max-height: 100%; }
.editor-swatch:hover { border-color: var(--border-light); }
.editor-swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.editor-grh { width: 48px; height: 48px; object-fit: contain; background: #0006; }
.editor-num { width: 84px; }
.editor-label { min-width: 64px; }
.editor-message { min-height: 1.2em; margin: 0; }
.editor .row.wrap { flex-wrap: wrap; }
.editor-flags { border: 1px solid var(--border-dim); margin: 0; padding: 2px 8px 6px; min-width: 0; }
.editor-flags legend { padding: 0 4px; }
.editor-flags .row.wrap { gap: 2px 10px; }
/* One choice of several (how an area fights): round, and a dot when chosen. */
.editor .check input[type="radio"] { border-radius: 50%; }
.editor .check input[type="radio"]:checked::after { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--accent); transform: none; }
[data-theme="vanguard"] .editor .check input[type="radio"]:checked::after { background: var(--accent-ink); }
/* The layer painted, among the chosen ones. */
.editor-bar .chip.primary { box-shadow: inset 0 -3px 0 var(--accent); }
.editor-more { grid-column: 1 / -1; }
/* A sheet laid out as it is: pieces placed where they are on it, at half size. */
.editor-palette.sheet { display: block; overflow: auto; }
.editor-sheet { position: relative; }
.editor-sheet-grh { position: absolute; padding: 0; aspect-ratio: auto; background: transparent; border-color: #ffffff14; }
.editor-sheet-grh img { width: 100%; height: 100%; object-fit: contain; }
.editor-sheet-band { position: absolute; border: 2px solid var(--accent); background: #ffffff18; pointer-events: none; }
.editor-palette-bar { gap: 4px; }
.editor-color { width: 44px; height: 26px; padding: 0; border: 1px solid var(--border-dim); background: none; }
.editor-checks { gap: 4px; }
.editor-check-kind summary { cursor: pointer; }
.editor-check-kind > .btn { display: block; width: 100%; text-align: left; margin-top: 2px; white-space: normal; height: auto; }
.editor-hour-slide { flex: 1; min-width: 80px; }
.editor-hour { min-width: 38px; text-align: right; }
/* Walking: the tools are out of reach until the walk ends. */
.editor.walking .editor-side, .editor.walking .editor-bar .editor-group:not(:has(.btn[aria-pressed="true"])) { opacity: 0.45; pointer-events: none; }
.editor-edge-styles { max-height: 160px; }
.editor-pick-list { gap: 2px; max-height: 200px; overflow-y: auto; }
.editor-pick { text-align: left; justify-content: flex-start; }
.editor-patrols, .editor-points { gap: 3px; max-height: 220px; overflow-y: auto; }
.editor-patrol-row { text-align: left; justify-content: flex-start; }
.editor-point { justify-content: space-between; gap: 4px; }
.editor-point > span { flex: 1; }
.editor-pace { width: auto; padding-inline: 4px; }
.editor-point-block { gap: 3px; padding: 4px 0 6px; border-bottom: 1px solid var(--border-dim); }
.editor-points:has(.editor-point-block) { max-height: 420px; }
.editor-point-block > .row > .editor-pace { flex: 1; }
.editor-point-block > .input { width: 100%; }
.editor-line-when > summary { cursor: pointer; }
.editor-line-when > .row { margin-top: 3px; }
.editor-chips { gap: 3px; }
.editor-set-grhs { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); grid-auto-rows: max-content; gap: 3px; }
