/* The landing page, "character select" (web/js/landing.js). The chosen
   character's portrait fills the screen with its sheet laid over it; the
   roster runs along the foot; the game's setup and the ways in stand in a
   glass column on the right. The art is dark in both themes, so the hero
   keeps light text; the column follows the theme. Display faces (Cinzel,
   EB Garamond, Oswald) are declared in cards.css. */

#view-landing {
    --font-display: "Cinzel", "Marcellus SC", serif;
    --side-w: clamp(22rem, 30vw, 30rem);
    --a-side: rgba(12, 12, 18, 0.8);
    --a-side-solid: #121218;
    --a-side-edge: rgba(196, 164, 78, 0.28);
    --a-ink: var(--text);
    --a-muted: #a29d8c;
    --a-tile: rgba(255, 255, 255, 0.04);
    --a-tile-edge: rgba(255, 255, 255, 0.1);
    --a-gold: #d8b85c;
    --a-nem: #b02a3a;
    --a-nem-ink: #e06a7a;
    --a-focus: #f2cf6c;
    --hero-ink: #efe9da;
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) #view-landing {
        --a-side: rgba(250, 248, 244, 0.92);
        --a-side-solid: #f6f4ef;
        --a-side-edge: rgba(138, 116, 48, 0.35);
        --a-muted: #5e5a50;
        --a-tile: rgba(138, 116, 48, 0.06);
        --a-tile-edge: rgba(138, 116, 48, 0.24);
        --a-gold: #7a6626;
        --a-nem: #a52234;
        --a-nem-ink: #a52234;
        --a-focus: #6a5a20;
    }
}
:root[data-theme="light"] #view-landing {
    --a-side: rgba(250, 248, 244, 0.92);
    --a-side-solid: #f6f4ef;
    --a-side-edge: rgba(138, 116, 48, 0.35);
    --a-muted: #5e5a50;
    --a-tile: rgba(138, 116, 48, 0.06);
    --a-tile-edge: rgba(138, 116, 48, 0.24);
    --a-gold: #7a6626;
    --a-nem: #a52234;
    --a-nem-ink: #a52234;
    --a-focus: #6a5a20;
}

#view-landing.sel {
    position: relative;
    height: 100vh; height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-w);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top side" "hero side" "roster side";
    isolation: isolate;
    overflow: hidden;
    background: #07070b;
    color: var(--a-ink);
}
#view-landing button { font: inherit; color: inherit; }
#view-landing :focus-visible { outline: 2px solid var(--a-focus); outline-offset: 2px; }
.sel-hero :focus-visible, .roster :focus-visible, .sel-top :focus-visible { outline-color: #f2cf6c; }

/* The art: a blurred copy fills the screen, the portrait stands on it. */
.sel-art { position: absolute; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.sel-backdrop, .sel-figure { position: absolute; background-repeat: no-repeat; }
.sel-backdrop {
    inset: 0; background-position: center; background-size: cover;
    filter: blur(28px) saturate(1.2) brightness(0.5); transform: scale(1.15);
}
.sel-figure {
    top: 0; bottom: 0; right: var(--side-w);
    width: min(62vw, calc(100vh * 1.02));
    background-position: center top; background-size: cover;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22%, #000 82%, transparent 100%), linear-gradient(to bottom, #000 62%, transparent 96%);
    -webkit-mask-composite: source-in; mask-composite: intersect;
    mask-image: linear-gradient(to right, transparent 0, #000 22%, #000 82%, transparent 100%), linear-gradient(to bottom, #000 62%, transparent 96%);
}
/* Shade: a strong one on the blurred backdrop (under the portrait), and a
   light one over the portrait where the sheet's text stands. */
.sel-backdrop { z-index: -1; }
.sel-art::before, .sel-art::after { content: ""; position: absolute; inset: 0; }
.sel-art::before {
    background:
        linear-gradient(90deg, rgba(7, 7, 11, 0.92) 0, rgba(7, 7, 11, 0.55) 30%, transparent 55%),
        linear-gradient(0deg, rgba(7, 7, 11, 0.95) 0, transparent 34%);
}
.sel-art::after {
    z-index: 1;
    background: linear-gradient(80deg, rgba(7, 7, 11, 0.5) 0, rgba(7, 7, 11, 0.2) 32%, transparent 50%);
}
.sel-figure.is-swapping, .sheet.is-swapping { animation: sel-swap 0.32s ease-out; }
@keyframes sel-swap { from { opacity: 0; transform: translateX(0.8rem); } to { opacity: 1; transform: none; } }

/* Top: title and the rejoin offer. */
.sel-top { grid-area: top; display: flex; align-items: center; gap: 1rem 1.5rem; padding: 1.4rem 2rem 0; flex-wrap: wrap; min-width: 0; }
.sel .brand { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.sel .brand .title {
    margin: 0; text-align: left; font: 700 clamp(2rem, 3.4vw, 3.2rem)/1 var(--font-display); letter-spacing: 0.22em; text-transform: uppercase;
    background: linear-gradient(180deg, #fff3cf 0, #e0c06a 45%, #9c7a26 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
.sel .brand .subtitle { margin: 0; text-align: left; font: 0.72rem/1.2 var(--font-sans); letter-spacing: 0.24em; text-transform: uppercase; color: #b9ad8c; }

.rejoin-banner {
    margin-left: auto; display: flex; align-items: center; gap: 0.75rem; min-width: 0;
    padding: 0.35rem 0.4rem 0.35rem 0.9rem; border-radius: 99px;
    background: rgba(12, 12, 18, 0.72); border: 1px solid rgba(216, 184, 92, 0.5);
    box-shadow: 0 0 0 4px rgba(216, 184, 92, 0.08), 0 6px 24px rgba(0, 0, 0, 0.4);
    color: #efe6cc; font-size: 0.85rem;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.rejoin-banner[hidden] { display: none; }
.rejoin-dot { flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #6fd17c; box-shadow: 0 0 8px #6fd17c; }
.rejoin-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rejoin-text b { font-family: var(--font-display); letter-spacing: 0.08em; color: #f6d98a; }
.rejoin-banner .btn-gold { padding: 0.45rem 1rem; font-size: 0.8rem; flex: none; }
.rejoin-forget { flex: none; color: #b5ac95; background: none; border: 0; cursor: pointer; font-size: 0.78rem; padding: 0.3rem 0.4rem; border-radius: 4px; }
.rejoin-forget:hover { color: #efe6cc; text-decoration: underline; }

/* Hero: the sheet, over the art. */
.sel-hero { grid-area: hero; position: relative; display: flex; align-items: flex-end; padding: 1rem 2rem 0.75rem; min-height: 0; min-width: 0; }
.sheet { max-width: 36rem; color: var(--hero-ink); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); min-height: 0; }
.sheet-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.tag {
    font: 600 0.66rem/1 var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase;
    padding: 0.3rem 0.5rem; border-radius: 3px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.16); color: #ddd4bc; text-shadow: none;
}
.tag--exp { border-color: rgba(176, 42, 58, 0.75); color: #f0b0b8; }
.tag--terra { border-color: rgba(214, 130, 50, 0.75); color: #f3c08a; }
.sheet h2 { margin: 0; font: 700 clamp(2.2rem, 4.4vw, 4.2rem)/0.95 var(--font-display); letter-spacing: 0.03em; color: #fbf3dc; text-wrap: balance; }
.sheet-sub { margin: 0.35rem 0 0.9rem; font: italic 1.05rem/1.2 "EB Garamond", Georgia, serif; color: #d6c79c; min-height: 1.2em; }
.stats { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: stretch; margin-bottom: 0.9rem; }
.stat {
    display: grid; justify-items: center; align-content: center; min-width: 4.6rem; padding: 0.45rem 0.6rem 0.4rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4)); border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 3px solid var(--c, #888); border-radius: 4px; text-shadow: none;
}
.stat b { font: 700 1.7rem/1 var(--font-display); color: #fff; }
.stat span { font: 600 0.6rem/1.2 var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: #c3baa2; margin-top: 0.2rem; white-space: nowrap; }
.stat--s { --c: #d04848; } .stat--w { --c: #5577dd; } .stat--c { --c: #d8b030; }
.stat--life { --c: #3aa55a; } .stat--lim { --c: #8a8778; }
.abilities { display: grid; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.abilities li { font-size: 0.9rem; line-height: 1.35; color: #e6dfce; padding-left: 0.8rem; border-left: 2px solid rgba(216, 184, 92, 0.6); }
.abilities b { color: #f6d98a; font-weight: 600; margin-right: 0.35rem; }
.sheet-more { margin: 0.45rem 0 0; font-size: 0.75rem; color: #b8ae94; }

.hero-nav {
    position: absolute; top: clamp(0.5rem, 16%, 7rem); width: 2.8rem; height: 2.8rem; border-radius: 50%; padding: 0;
    display: grid; place-items: center; cursor: pointer; line-height: 1;
    background: rgba(0, 0, 0, 0.5); color: #f2e6c2 !important; border: 1px solid rgba(216, 184, 92, 0.5); font-size: 1.6rem !important;
    transition: background 0.15s, transform 0.15s;
}
.hero-nav:hover { background: rgba(40, 32, 12, 0.75); transform: scale(1.06); }
.hero-nav--prev { left: 1rem; }
.hero-nav--next { right: 1rem; }

/* Roster along the foot. */
.roster { grid-area: roster; padding: 0.4rem 2rem 1.2rem; min-width: 0; }
.roster-head { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.2rem; color: #c2b693; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; }
.roster-head i { font-style: normal; letter-spacing: 0.02em; text-transform: none; color: #968d76; }
.roster-keys { margin-left: auto; letter-spacing: 0.02em; text-transform: none; color: #968d76; }
.roster-row { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.6rem 0.25rem 0.35rem; scrollbar-width: thin; scrollbar-color: rgba(216, 184, 92, 0.4) transparent; }
.pick {
    position: relative; flex: 1 1 0; min-width: 2.55rem; max-width: 5.4rem; aspect-ratio: 3 / 4;
    border-radius: 4px; overflow: hidden; cursor: pointer; padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18); background: #15151c center top / cover no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.pick:hover { transform: translateY(-3px); }
.pick[aria-pressed="true"] {
    transform: translateY(-6px); border-color: #f2cf6c;
    box-shadow: 0 0 0 2px #f2cf6c, 0 0 18px rgba(242, 207, 108, 0.55), 0 8px 18px rgba(0, 0, 0, 0.6);
}
.pick::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.7), transparent 45%); }
.pick:focus-visible { outline: 2px solid #fff !important; outline-offset: 3px; }
.pick-exp { position: absolute; z-index: 1; top: 3px; right: 3px; width: 0.95rem; height: 0.95rem; border-radius: 50%; font: 700 0.55rem/0.95rem var(--font-sans); text-align: center; color: #fff; }
.pick-exp--nemesis { background: #a0283a; }
.pick-exp--terra { background: #c46a20; }
.pick--nem { max-width: 4.8rem; }
.pick--nem[aria-pressed="true"] { border-color: #e04a5c; box-shadow: 0 0 0 2px #e04a5c, 0 0 18px rgba(224, 74, 92, 0.55), 0 8px 18px rgba(0, 0, 0, 0.6); }
.pick[aria-disabled="true"] { filter: grayscale(1) brightness(0.45); }
.pick[aria-disabled="true"]:hover { filter: grayscale(0.6) brightness(0.7); }
.pick-off { position: absolute; z-index: 1; left: 2px; right: 2px; bottom: 4px; font: 600 0.5rem/1.1 var(--font-sans); text-align: center; color: #ddd; letter-spacing: 0.03em; }
.roster-sep { flex: 0 0 1px; margin: 0.4rem 0.3rem; background: rgba(216, 184, 92, 0.35); }
/* Random: a gold question mark on the card back's colours. */
.pick--random { background: radial-gradient(circle at 50% 40%, #4b3a1c, #17120b 75%); display: grid; place-items: center; }
.pick-random { position: relative; z-index: 1; font: 700 1.7rem/1 var(--font-display); color: #f2cf6c; text-shadow: 0 2px 6px #000; }
/* House rules: the switches, on a dark parchment tile. */
.rule-tile { background-image: linear-gradient(160deg, #3a2f1c, #14100a); min-height: 4.4rem; }
.rule-tile:disabled { cursor: default; }

/* The side column: setup and the ways in. */
.side {
    grid-area: side; position: relative; z-index: 1;
    display: flex; flex-direction: column; gap: 0.8rem;
    max-height: 100vh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 1.2rem 1.3rem 1.1rem; color: var(--a-ink);
    background: var(--a-side); border-left: 1px solid var(--a-side-edge);
    backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
    scrollbar-width: thin;
}
.side section { min-width: 0; }
.side section[hidden] { display: none; }
.side h3 { margin: 0 0 0.45rem; font: 700 0.68rem/1.1 var(--font-sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--a-gold); display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.side h3 label { cursor: default; }
.side h3 small { font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--a-muted); font-size: 0.72rem; text-align: right; }

.name-field { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; border-radius: 6px; background: var(--a-tile); border: 1px solid var(--a-tile-edge); }
.name-field:focus-within { border-color: var(--a-gold); outline: 2px solid var(--a-focus); outline-offset: 2px; }
.name-field label { font-size: 0.72rem; color: var(--a-muted); white-space: nowrap; }
#view-landing .name-field input { flex: 1; min-width: 0; width: auto; padding: 0.1rem 0; border: 0; background: none; outline: none; color: var(--a-ink); font: 700 1.05rem/1.2 var(--font-display); letter-spacing: 0.04em; }
#view-landing .name-field input::placeholder { color: var(--a-muted); font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; font-size: 0.9rem; }

.house-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.rule-tile {
    position: relative; display: grid; align-content: end; min-height: 5.4rem; padding: 0.55rem 0.6rem; text-align: left; cursor: pointer;
    border-radius: 6px; overflow: hidden; color: #fff !important; border: 1px solid rgba(255, 255, 255, 0.18);
    background-color: #222; background-size: cover, cover; background-repeat: no-repeat; background-position: center 18%, center;
    transition: filter 0.15s, box-shadow 0.15s;
}
.rule-tile--terra { background-position: center 40%, center; }
.rule-tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.15) 70%); }
.rule-tile > * { position: relative; }
.rule-tile b { font: 700 0.88rem/1.1 var(--font-display); letter-spacing: 0.04em; }
.rule-tile span { font-size: 0.68rem; line-height: 1.25; color: #ddd3bb; margin-top: 0.15rem; }
.rule-tile[aria-pressed="false"] { filter: grayscale(0.9) brightness(0.62); }
.rule-tile[aria-pressed="false"]:hover { filter: grayscale(0.5) brightness(0.8); }
.rule-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--a-gold), 0 0 14px rgba(216, 184, 92, 0.35); border-color: transparent; }
.rule-tile .switch { position: absolute; top: 0.5rem; right: 0.5rem; width: 2.1rem; height: 1.2rem; border-radius: 99px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.35); margin: 0; }
.rule-tile .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: #bbb; transition: transform 0.15s; }
.rule-tile[aria-pressed="true"] > .switch { background: #c4a44e; border-color: #f2cf6c; }
.rule-tile[aria-pressed="true"] > .switch::after { transform: translateX(0.88rem); background: #fff; }

.scenario { position: relative; display: flex; align-items: center; gap: 0.7rem; padding: 0.4rem; border-radius: 6px; background: var(--a-tile); border: 1px solid var(--a-tile-edge); min-width: 0; }
.scenario:hover { border-color: var(--a-side-edge); }
.scenario:focus-within { outline: 2px solid var(--a-focus); outline-offset: 2px; }
.scenario-art { flex: 0 0 auto; width: 3.4rem; height: 3.4rem; border-radius: 4px; background: #2a2420 14% 30% / 300% no-repeat; border: 1px solid rgba(255, 255, 255, 0.2); }
.scenario-text { min-width: 0; flex: 1; }
.scenario-text b { display: block; font: 700 0.95rem/1.15 var(--font-display); }
.scenario-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.72rem; line-height: 1.3; color: var(--a-muted); }
.scenario i { font-style: normal; color: var(--a-gold); padding: 0 0.3rem; }
/* The real select lies over the whole card, invisible: native picking on every device. */
#view-landing .scenario select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; font-size: 1rem; }
#view-landing .scenario select:disabled { cursor: default; }
.scenario:has(select:disabled) i { visibility: hidden; }

.seats { display: grid; gap: 0.35rem; }
.seat { display: flex; align-items: center; gap: 0.55rem; padding: 0.22rem 0.45rem 0.22rem 0.3rem; border-radius: 6px; background: var(--a-tile); border: 1px solid var(--a-tile-edge); border-left: 3px solid var(--seat, var(--a-tile-edge)); min-width: 0; }
.seat-face { width: 1.9rem; height: 1.9rem; border-radius: 50%; flex: 0 0 auto; background: #333 center 12% / cover no-repeat; border: 1px solid rgba(255, 255, 255, 0.25); }
.seat-face--random { display: grid; place-items: center; background: #2a2a35; color: #c4a44e; font: 700 1rem/1 var(--font-display); }
.seat--nem .seat-face--random { color: #e06a7a; background: #2a1420; }
.seat-text { min-width: 0; flex: 1; display: grid; }
.seat-text b { display: block; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-text > span { display: block; font-size: 0.72rem; color: var(--a-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view-landing .seat-pick {
    width: auto; max-width: 100%; justify-self: start; min-width: 0; padding: 0 1rem 0 0; margin: 0; border: 0; border-radius: 3px; background: transparent; color: var(--a-muted); font-size: 0.72rem; line-height: 1.3; cursor: pointer;
    appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 0.45rem) 55%, calc(100% - 0.2rem) 55%; background-size: 0.25rem 0.25rem; background-repeat: no-repeat;
}
#view-landing .seat-pick:hover { color: var(--a-ink); }
#view-landing .seat-pick option { color: var(--text); background: var(--bg-panel); }
.lvl { display: inline-flex; flex: none; border-radius: 99px; overflow: hidden; border: 1px solid var(--a-tile-edge); }
.lvl button { padding: 0.2rem 0.45rem; border: 0; background: none; color: var(--a-muted) !important; font-size: 0.66rem !important; font-weight: 600; cursor: pointer; }
.lvl button[aria-pressed="true"] { background: var(--a-gold); color: #111 !important; }
.lvl button:focus-visible { outline-offset: -2px; }
.seat-x { flex: none; background: none; border: 0; color: var(--a-muted) !important; cursor: pointer; font-size: 1.05rem !important; line-height: 1; padding: 0.15rem 0.3rem; border-radius: 4px; }
.seat-x:hover { color: var(--danger) !important; }
.seat--nem { --seat: var(--a-nem); background: linear-gradient(90deg, rgba(176, 42, 58, 0.16), var(--a-tile)); }
.add-row { display: flex; gap: 0.35rem; margin-top: 0.35rem; }
.add-btn { flex: 1; padding: 0.45rem 0.3rem; border-radius: 6px; border: 1px dashed var(--a-side-edge); background: none; color: var(--a-gold) !important; font-size: 0.78rem !important; font-weight: 600; cursor: pointer; }
.add-btn:hover:not(:disabled) { background: var(--accent-dim); }
.add-btn--nem { color: var(--a-nem-ink) !important; border-color: rgba(176, 42, 58, 0.5); }
.add-btn--nem:hover:not(:disabled) { background: rgba(176, 42, 58, 0.12); }
.add-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.add-btn[hidden] { display: none; }

.role { display: grid; grid-template-columns: 1fr 1fr; border-radius: 6px; overflow: hidden; border: 1px solid var(--a-tile-edge); }
.role button { border: 0; padding: 0.45rem 0.3rem; background: var(--a-tile); font-size: 0.76rem !important; font-weight: 600; color: var(--a-muted) !important; cursor: pointer; }
.role button[aria-pressed="true"] { background: var(--a-gold); color: #111 !important; }
.role button[data-role="nemesis"][aria-pressed="true"] { background: var(--a-nem); color: #fff !important; }
.role button:focus-visible { outline-offset: -3px; }

/* The ways in stay in view at the column's foot when a long table makes it scroll. */
.actions { margin-top: auto; display: grid; gap: 0.5rem; padding-top: 0.3rem; }
@media (min-width: 761px) {
    .side.is-scrolling .actions {
        position: sticky; bottom: 0; z-index: 2; padding: 0.9rem 0 0.4rem;
        background: linear-gradient(to bottom, transparent, var(--a-side-solid) 0.8rem);
    }
}
.actions-problem { margin: 0; font-size: 0.75rem; color: var(--a-muted); text-align: center; }
.actions-problem:empty { display: none; }
#view-landing .btn-gold, #view-landing .btn-ghost {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem; cursor: pointer;
    border-radius: 6px; font: 700 0.95rem/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase;
}
#view-landing .btn-gold {
    color: #1b1406; border: 1px solid #f6dc8c;
    background: linear-gradient(180deg, #f5d87e 0, #d6ae4a 48%, #a8822e 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px rgba(196, 164, 78, 0.28);
}
#view-landing .btn-gold:hover:not(:disabled) { filter: brightness(1.08); }
#view-landing .btn-play { padding: 0.9rem 1rem; font-size: 1.15rem; flex-direction: column; gap: 0.25rem; }
.btn-play small { font: 500 0.7rem/1.2 var(--font-sans); letter-spacing: 0.02em; text-transform: none; opacity: 0.85; }
#view-landing .btn-ghost { padding: 0.7rem 0.6rem; background: var(--a-tile); border: 1px solid var(--a-side-edge); color: var(--a-ink); font-size: 0.8rem; }
#view-landing .btn-ghost:hover:not(:disabled) { background: var(--accent-dim); }
#view-landing .btn-gold:disabled, #view-landing .btn-ghost:disabled { filter: grayscale(0.8); opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem; }
.code { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.6rem; border-radius: 6px; border: 1px solid var(--a-side-edge); background: var(--a-tile); min-width: 0; }
.code:has(input:focus) { border-color: var(--a-gold); outline: 2px solid var(--a-focus); outline-offset: 2px; }
.join-label { font-size: 0.68rem; color: var(--a-muted); white-space: nowrap; letter-spacing: 0.04em; }
#view-landing .code input { flex: 1; width: 100%; min-width: 3.5rem; border: 0; background: none; outline: none; padding: 0.65rem 0; color: var(--a-ink); font: 600 1rem/1 "Oswald", var(--font-sans); letter-spacing: 0.3em; text-transform: uppercase; }
#view-landing .code input::placeholder { color: var(--a-muted); opacity: 0.6; }
.join-as { font-size: 0.7rem; color: var(--a-muted); white-space: nowrap; display: flex; align-items: center; gap: 0.2rem; }
#view-landing .join-as select { width: auto; padding: 0.2rem 0.1rem; border: 0; background: none; color: var(--a-gold); font-weight: 600; font-size: 0.74rem; cursor: pointer; }
#view-landing .join-as select option { color: var(--text); background: var(--bg-panel); }
#view-landing .join-open { display: none; }
.side-note { font-size: 0.7rem; color: var(--a-muted); text-align: center; margin: 0; }
.landing-demo[hidden] { display: none; }
#view-landing .btn-demo { width: 100%; border-style: dashed; font-family: var(--font-sans); letter-spacing: 0.04em; text-transform: none; padding: 0.5rem; }

/* Short laptop screens (1366×768): tighter, so it all fits on one screen. */
@media (max-height: 860px) and (min-width: 761px) {
    .side { gap: 0.45rem; padding-top: 0.8rem; padding-bottom: 0.7rem; }
    .side h3 { margin-bottom: 0.3rem; }
    .side-note { display: none; }
    .name-field { padding-top: 0.32rem; padding-bottom: 0.32rem; }
    .rule-tile { min-height: 3.9rem; padding-bottom: 0.45rem; }
    .rule-tile b { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .scenario { padding: 0.3rem; }
    .scenario-art { width: 2.4rem; height: 2.4rem; }
    .scenario-text span { -webkit-line-clamp: 1; }
    .seats { gap: 0.28rem; }
    .seat { padding-top: 0.1rem; padding-bottom: 0.1rem; }
    .seat-face { width: 1.55rem; height: 1.55rem; }
    .add-row { margin-top: 0.28rem; }
    .add-btn { padding-top: 0.35rem; padding-bottom: 0.35rem; }
    .role button { padding-top: 0.38rem; padding-bottom: 0.38rem; }
    #view-landing .btn-play { padding: 0.7rem 1rem; }
    #view-landing .btn-ghost { padding: 0.55rem 0.6rem; }
    #view-landing .code input { padding: 0.5rem 0; }
    .sel-top { padding-top: 1rem; }
    .sheet h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
    .sheet-sub { margin-bottom: 0.6rem; }
    .stats { margin-bottom: 0.6rem; }
    .stat { min-width: 4rem; padding: 0.35rem 0.5rem 0.3rem; }
    .stat b { font-size: 1.45rem; }
    .abilities { gap: 0.3rem; }
    .abilities li { font-size: 0.82rem; }
    .abilities li:nth-child(n+3) { display: none; }
    .roster { padding-bottom: 0.8rem; }
}

/* Phones: the art is a hero at the top, everything flows under it, and the
   ways in are pinned to the foot of the screen. */
@media (max-width: 760px) {
    #view-landing.sel { display: block; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; --hero-h: 82vh; --hero-h: 82svh; }
    .sel-art::before { background: linear-gradient(0deg, rgba(7, 7, 11, 1) 0, rgba(7, 7, 11, 0.4) 30%, transparent 55%); }
    .sel-art::after { background: linear-gradient(0deg, rgba(7, 7, 11, 0.55) 0, transparent 40%); }
    .sel-figure { right: 0; left: 0; width: 100%; height: var(--hero-h); bottom: auto; background-position: center 4%; -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 98%); mask-image: linear-gradient(to bottom, #000 55%, transparent 98%); }
    .sel-backdrop { height: var(--hero-h); bottom: auto; }
    .sel-art { bottom: auto; height: var(--hero-h); }
    .sel-top { padding: 0.9rem 1rem 0; gap: 0.6rem; }
    .sel .brand { flex-direction: column; gap: 0.25rem; }
    .sel .brand .subtitle { font-size: 0.6rem; }
    .sel .brand .title { font-size: 1.7rem; }
    .rejoin-banner { margin-left: 0; width: 100%; font-size: 0.78rem; padding: 0.25rem 0.3rem 0.25rem 0.75rem; }
    .rejoin-long { display: none; }
    .rejoin-banner .btn-gold { padding: 0.45rem 0.8rem; margin-left: auto; }
    .sel-hero { min-height: 58vh; min-height: 58svh; padding: 0 1rem 0.5rem; }
    .sheet h2 { font-size: 2.3rem; }
    .sheet-sub { margin-bottom: 0.6rem; }
    .stats { flex-wrap: nowrap; }
    .stat { min-width: 0; flex: 1; padding: 0.4rem 0.2rem; }
    .stat b { font-size: 1.35rem; }
    .stat span { font-size: 0.5rem; letter-spacing: 0.08em; }
    .stat--lim { display: none; }
    .abilities li { font-size: 0.8rem; }
    .abilities li:nth-child(n+3) { display: none; }
    .sheet-more { display: none; }
    .hero-nav { top: 18%; width: 2.4rem; height: 2.4rem; font-size: 1.4rem !important; }
    .hero-nav--prev { left: 0.5rem; }
    .hero-nav--next { right: 0.5rem; }
    .roster { padding: 0.2rem 1rem 0.6rem; position: relative; }
    .roster::before { content: ""; position: absolute; inset: 0 0 0 0; z-index: -1; background: linear-gradient(to bottom, transparent, #07070b 2.5rem); }
    .roster-keys { display: none; }
    .pick { flex: 0 0 3.9rem; max-width: none; }
    .side { backdrop-filter: none; -webkit-backdrop-filter: none; max-height: none; overflow: visible; border-left: 0; border-top: 1px solid var(--a-side-edge); padding: 1rem 1rem calc(8.5rem + env(safe-area-inset-bottom)); }
    .actions {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; margin: 0;
        padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
        background: var(--a-side); border-top: 1px solid var(--a-side-edge);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        grid-template-columns: 1fr 1fr;
    }
    .actions > * { grid-column: 1 / -1; }
    .actions #btn-create, .actions #btn-join-open { grid-column: auto; }
    #view-landing .btn-play { padding: 0.75rem; font-size: 1rem; }
    .actions .side-note, .landing-demo { display: none; }
    #view-landing .join-open { display: flex; }
    .join { display: none; order: -1; }
    .actions.is-joining .join { display: grid; }
    .actions.is-joining #btn-join-open { background: var(--accent-dim); }
    .join-label { display: none; }
}

/* Light theme on phones: the column under the hero follows the theme. */
@media (max-width: 760px) and (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) #view-landing.sel { background: var(--bg); }
}
@media (max-width: 760px) {
    :root[data-theme="light"] #view-landing.sel { background: var(--bg); }
}

@media (prefers-reduced-motion: reduce) {
    .sel-figure.is-swapping, .sheet.is-swapping { animation: none; }
    .pick, .rule-tile, .hero-nav, .rule-tile .switch::after { transition: none; }
    .pick:hover, .pick[aria-pressed="true"], .hero-nav:hover { transform: none; }
}
