/*
 * fuse. interface styles.
 * Visual language: a handheld block game meets a hand-made homepage. Flat colour,
 * hard offset shadows, stepped corners, monospace labels and tetromino colours.
 *
 * Sections: tokens, base, controls, panels, home, game (compact), game (cabinet),
 * dialogs, small-screen game tuning, motion.
 */

/* Tokens */
:root {
    color-scheme: dark;
    --bg: #0f0c1f;
    --well: #0a0818;
    --panel: #1b172f;
    --panel-2: #28213f;
    --bar: #30284f;
    --edge: #4c416d;
    --edge-hi: #897ab6;
    --shadow: #05030d;
    --ink: #f3eedf;
    --muted: #bbb2d1;
    --dim: #978db1;
    --yellow: #ffd23f;
    --cyan: #5fe0ff;
    --pink: #ff6fb0;
    --green: #58d66a;
    --red: #ff5a6a;
    --purple: #c06cf2;
    --accent: var(--yellow);
    --danger: var(--red);
    --mono:
        ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", "Courier New",
        monospace;
    --sans:
        ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        sans-serif;
    --stripe: linear-gradient(
        90deg,
        #3ed8f0 0 14.28%,
        #4b6ff0 0 28.57%,
        #f59a2e 0 42.85%,
        #f5d33b 0 57.14%,
        #58d66a 0 71.42%,
        #c06cf2 0 85.71%,
        #ee4d5a 0
    );
    --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg opacity='.09'%3E%3Cpath fill='%233ed8f0' d='M12 18h8v8h-8zM20 18h8v8h-8z'/%3E%3Cpath fill='%23f5d33b' d='M100 52h8v8h-8zM108 52h8v8h-8zM100 60h8v8h-8zM108 60h8v8h-8z'/%3E%3Cpath fill='%23c06cf2' d='M36 112h8v8h-8zM44 112h8v8h-8zM52 112h8v8h-8zM44 104h8v8h-8z'/%3E%3Cpath fill='%2358d66a' d='M124 124h8v8h-8zM132 124h8v8h-8zM116 132h8v8h-8zM124 132h8v8h-8z'/%3E%3Cpath fill='%23ee4d5a' d='M132 12h8v8h-8zM140 12h8v8h-8zM140 20h8v8h-8z'/%3E%3C/g%3E%3C/svg%3E");
}

/* Base */
* {
    box-sizing: border-box;
}
html {
    background: var(--bg);
    scrollbar-gutter: stable;
}
html:has(body.playing) {
    scrollbar-gutter: auto;
}
body {
    isolation: isolate;
    margin: 0;
    min-height: 100svh;
    color: var(--ink);
    font: 14px/1.5 var(--sans);
    background: var(--bg);
}
.background-blocks {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.background-blocks:before {
    content: "";
    position: absolute;
    inset: -160px;
    opacity: 0.7;
    background: var(--tile);
    /* One tile per loop makes the reset seamless; only a transform is animated. */
    animation: background-drift 96s linear infinite;
}
button,
input,
select {
    font: inherit;
}
button {
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    touch-action: manipulation;
}
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}
button,
svg {
    -webkit-user-select: none;
    user-select: none;
}
h1,
h2,
h3,
p {
    margin: 0;
}
h1,
h2,
h3 {
    line-height: 1.15;
}
a {
    color: var(--cyan);
}
mark {
    color: inherit;
    background: none;
}
[hidden] {
    display: none !important;
}
svg.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: square;
    stroke-linejoin: miter;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
    white-space: nowrap;
}
kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 4px 2px;
    font: 700 10px var(--mono);
    text-align: center;
    color: var(--ink);
    background: var(--panel-2);
    border: 2px solid var(--edge);
    border-bottom-width: 4px;
}
.eyebrow {
    font: 700 10px var(--mono);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--muted);
}
.muted {
    color: var(--muted);
}

/* Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    font: 700 12px var(--mono);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ink);
    background: var(--panel-2);
    border: 2px solid var(--shadow);
    box-shadow:
        inset 0 2px 0 #ffffff1c,
        inset 0 -3px 0 #0006,
        3px 3px 0 var(--shadow);
}
.btn:hover:not(:disabled) {
    background: #2e2756;
}
.btn:active:not(:disabled),
.drop-btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow:
        inset 0 2px 0 #0004,
        1px 1px 0 var(--shadow);
}
.btn.primary,
.drop-btn {
    color: #1a1230;
    background: var(--yellow);
    box-shadow:
        inset 0 2px 0 #fff3a8,
        inset 0 -4px 0 #c79a00,
        3px 3px 0 var(--shadow);
}
.btn.primary:hover:not(:disabled),
.drop-btn:hover:not(:disabled) {
    background: #ffe174;
}
.btn.quiet {
    color: var(--muted);
    background: transparent;
    border-color: var(--edge);
    box-shadow: none;
}
.btn.danger {
    color: var(--red);
}
.btn.small {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 11px;
}
.icon-button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--ink);
    background: var(--panel-2);
    border: 2px solid var(--edge);
    box-shadow: 2px 2px 0 var(--shadow);
}
.icon-button:hover:not(:disabled) {
    color: var(--yellow);
    background: #2e2756;
    border-color: var(--edge-hi);
}
.icon-button:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: none;
}
input {
    min-width: 0;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--well);
    border: 2px solid var(--edge);
    border-radius: 0;
    box-shadow: inset 2px 2px 0 #0008;
}
input:focus {
    border-color: var(--cyan);
}
.setting select {
    flex-shrink: 0;
    max-width: 45%;
    padding: 6px;
    font: 11px var(--mono);
    color: var(--ink);
    background: var(--well);
    border: 2px solid var(--edge);
}
.switch {
    appearance: none;
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: var(--well);
    border: 2px solid var(--edge);
    box-shadow: none;
}
.switch:after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: var(--dim);
    transition: transform 0.12s steps(3);
}
.switch:checked {
    border-color: var(--green);
}
.switch:checked:after {
    transform: translateX(20px);
    background: var(--green);
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
}
.connection {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 6px;
    font: 700 10px var(--mono);
    letter-spacing: 0.6px;
    color: var(--muted);
}
.connection.off,
.connection.off .dot {
    color: var(--red);
    background: none;
}
.connection.off .dot {
    background: var(--red);
}
.avatar {
    --avatar-color: var(--cyan);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: var(--avatar-color);
    background: color-mix(in srgb, var(--avatar-color) 14%, var(--well));
    border: 2px solid var(--avatar-color);
}
.avatar .icon {
    width: 20px;
    height: 20px;
}
.avatar.tiny {
    width: 20px;
    height: 20px;
    border-width: 1px;
}
.avatar.tiny .icon {
    width: 13px;
    height: 13px;
}

/* Panels: a small window with a title bar */
.panel {
    padding: 12px 14px 14px;
    background: var(--panel);
    border: 2px solid var(--edge);
    box-shadow: 4px 4px 0 var(--shadow);
}
.panel > h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -12px -14px 12px;
    padding: 5px 10px;
    font: 700 11px var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--bar);
}
.panel > h2:before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--yellow);
}
.stat,
.key-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 9px 0;
    font-size: 12px;
    color: var(--muted);
}
.stat:first-of-type,
.key-row:first-of-type {
    margin-top: 0;
}
.stat:last-child,
.key-row:last-child {
    margin-bottom: 0;
}
.stat strong {
    font: 700 13px var(--mono);
    color: var(--ink);
}
.key-row div {
    display: flex;
    gap: 3px;
}
.milestone-number {
    font: 800 30px/1.1 var(--mono);
    color: var(--yellow);
    text-shadow: 3px 3px 0 var(--shadow);
}
.milestone-copy {
    margin: 6px 0 10px;
    font-size: 11px;
    color: var(--muted);
}
.progress-track {
    height: 10px;
    background: var(--well);
    border: 2px solid var(--shadow);
    outline: 1px solid var(--edge);
}
.progress-track > div {
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--green) 0 6px, #3fa955 6px 8px);
    transition: width 0.3s steps(6);
}
.merge-ladder {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}
.rung {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px 1px;
    font: 700 10px var(--mono);
    color: var(--dim);
    background: var(--well);
    border: 1px solid var(--edge);
    opacity: 0.65;
}
.rung.unlocked {
    opacity: 1;
    color: var(--ink);
    background: var(--panel-2);
}
.rung.current {
    color: var(--yellow);
    border-color: var(--yellow);
}
.rung canvas {
    display: block;
    width: 100%;
    max-width: 32px;
    height: 28px;
    border-bottom: 3px solid var(--edge);
}
.rung.current canvas {
    border-color: var(--yellow);
}
.feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 74px;
    overflow: hidden;
}
.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    min-height: 17px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    color: var(--ink);
}
.feed-item .icon {
    width: 14px;
    height: 14px;
    color: var(--yellow);
}
.feed-item time {
    margin-left: auto;
    font: 9px var(--mono);
    color: var(--dim);
}
.perf {
    font: 9px var(--mono);
    color: var(--dim);
}
.diagnostics {
    margin-top: 16px;
    color: var(--muted);
}
.diagnostics pre {
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 10px/1.5 var(--mono);
}
.text-link {
    padding: 3px;
    font-size: 11px;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Frame: title bar, content, status bar */
.app {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 100svh;
}
.topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 48px;
    padding: 6px 14px 10px;
    background: var(--well);
    border-bottom: 2px solid var(--shadow);
}
.topbar:after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--stripe);
}
.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
    padding: 0;
}
.brandmark {
    display: block;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    color: var(--cyan);
    transform: rotate(-7deg);
}
.wordmark {
    font: 900 32px/0.9 var(--sans);
    letter-spacing: -2px;
}
.brand:hover .wordmark {
    color: var(--cyan);
}
.top-actions,
.session-left,
.session-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.session-bar {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    margin: 0 0 0 10px;
}
.session-left {
    min-width: 0;
}
.session-left .eyebrow {
    color: var(--cyan);
}
#sessionCount {
    font: 10px var(--mono);
}
.room-code {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
    font: 700 11px var(--mono);
    letter-spacing: 2px;
    color: var(--yellow);
    white-space: nowrap;
    background: var(--panel);
    border: 2px dashed var(--edge-hi);
}
.room-code .icon {
    width: 13px;
    height: 13px;
}
.footbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 14px;
    font: 10px var(--mono);
    color: var(--dim);
    background: var(--well);
    border-top: 2px solid var(--edge);
}
.footbar .right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.footbar button {
    padding: 0;
    font: 700 10px var(--mono);
    color: var(--muted);
    text-transform: uppercase;
}
.footbar button:hover {
    color: var(--yellow);
}

/* Home: the title screen */
.home {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px 28px;
}
.ticker {
    margin: 0 -20px 30px;
    overflow: hidden;
    font: 700 10px var(--mono);
    letter-spacing: 1.5px;
    color: var(--muted);
    white-space: nowrap;
    background: var(--well);
    border-bottom: 2px solid var(--edge);
}
.ticker-track {
    display: flex;
    width: max-content;
    padding: 5px 0;
    animation: ticker 40s linear infinite;
}
.ticker-track span {
    padding-right: 0.5em;
}
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
}
.edition {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 5px 10px;
    font: 700 10px var(--mono);
    letter-spacing: 1px;
    color: var(--pink);
    background: var(--panel);
    border: 1px solid var(--edge);
}
.hero-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}
.hero-brand .brandmark {
    width: 66px;
    height: 66px;
}
.hero-brand .wordmark {
    font-size: clamp(76px, 8vw, 112px);
    letter-spacing: -6px;
}
.hero h1 {
    font: 800 clamp(22px, 2.6vw, 32px) / 1.3 var(--sans);
    letter-spacing: -0.3px;
}
.hero h1 mark {
    display: inline-block;
    padding: 0 8px;
    margin-top: 6px;
    color: #1a1230;
    background: var(--yellow);
    box-shadow: 4px 4px 0 var(--shadow);
}
.hero .lead {
    max-width: 440px;
    margin: 22px 0 26px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--muted);
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}
.hero-actions .btn {
    min-height: 50px;
    padding: 12px 24px;
    font-size: 14px;
}
.hero-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    font: 11px var(--mono);
    color: var(--dim);
}
.hero-art {
    min-width: 0;
}
.window {
    background: var(--well);
    border: 2px solid var(--edge);
    box-shadow: 6px 6px 0 var(--shadow);
}
.window-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    font: 700 10px var(--mono);
    letter-spacing: 1.3px;
    background: var(--bar);
}
.window-bar i {
    width: 9px;
    height: 9px;
    background: var(--red);
    box-shadow:
        -14px 0 var(--yellow),
        -28px 0 var(--green);
}
.hero-art canvas {
    display: block;
    width: 100%;
    height: min(54vh, 520px);
    object-fit: contain;
}
.home-index {
    margin-top: 34px;
}
.home-powers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.power-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    background: var(--well);
    border: 1px solid var(--edge);
}
.feature-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 34px;
    height: 34px;
    background: var(--well);
    border: 2px solid currentColor;
}
.power-feature strong {
    display: block;
    font: 700 11px var(--mono);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink);
}
.power-feature small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--muted);
}
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}
.badges span {
    display: grid;
    place-items: center;
    min-width: 88px;
    height: 31px;
    padding: 0 8px;
    font: 800 9px var(--mono);
    letter-spacing: 0.6px;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--edge);
}

/* Game: shared parts */
.score-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--panel);
}
.score-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    border-right: 2px solid var(--shadow);
}
.score-cell:last-child {
    border-right: 0;
}
.score-cell small {
    display: block;
    font: 10px var(--mono);
    color: var(--dim);
}
.score-cell strong {
    font: 700 20px var(--mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.score-cell.accent {
    background: var(--well);
}
.score-cell.accent strong {
    color: var(--yellow);
    text-shadow: 2px 2px 0 #7a5a00;
}
.boss-panel {
    display: grid;
    min-width: 0;
    background: #1f1233;
    border-bottom: 2px solid var(--shadow);
}
.boss-portrait {
    image-rendering: pixelated;
    touch-action: manipulation;
}
.boss-portrait.charging[aria-disabled="false"] {
    cursor: pointer;
    box-shadow: inset 0 0 0 2px #ff465f;
}
.boss-portrait:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: -2px;
}
.boss-summary {
    min-width: 0;
}
.boss-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.boss-heading h2 {
    overflow: hidden;
    font: 800 14px var(--mono);
    color: var(--pink);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.boss-level {
    flex-shrink: 0;
    font: 700 10px var(--mono);
    color: var(--purple);
}
.boss-health {
    height: 14px;
    overflow: hidden;
    background: var(--well);
    border: 2px solid var(--shadow);
    outline: 1px solid #6a3a7c;
}
.boss-health > div {
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--red) 0 8px, #c93a4b 8px 10px);
    transition: width 0.15s steps(5);
}
.boss-detail {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font: 10px var(--mono);
    color: var(--muted);
    white-space: nowrap;
}
.boss-detail strong {
    color: var(--pink);
}
.boss-contributors {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.boss-contributor {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    font: 9px var(--mono);
    color: var(--muted);
    white-space: nowrap;
}
.boss-alerts {
    font: 10px/1.5 var(--mono);
    color: #e9d3ff;
}
.boss-help {
    font-size: 10px;
    color: var(--muted);
}
.connection-banner {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 10px;
    font: 700 11px var(--mono);
    color: #ffe3a3;
    background: #3b2a12;
    border-bottom: 2px solid #c98a22;
}
.connection-banner button {
    font: 700 11px var(--mono);
    color: var(--yellow);
    text-decoration: underline;
}
.pause-banner {
    color: #c8f4ff;
    background: #12303a;
    border-bottom-color: var(--cyan);
}
.board-card {
    --player: var(--cyan);
    position: relative;
    min-width: 0;
    background: var(--panel);
    border: 2px solid var(--edge);
    box-shadow: 4px 4px 0 var(--shadow);
}
.board-card.mine {
    border-color: var(--player);
}
.board-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.player-info {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.player-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font: 700 11px var(--mono);
}
.player-name .name {
    min-width: 0;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.you-tag {
    padding: 0 4px;
    font: 800 8px var(--mono);
    color: #1a1230;
    background: var(--player);
}
.player-state {
    margin-top: 1px;
    font: 8px var(--mono);
    letter-spacing: 0.6px;
    color: var(--dim);
}
.player-score {
    min-width: 40px;
    font: 800 14px var(--mono);
    color: var(--player);
    text-align: right;
}
.player-score small {
    display: block;
    font: 7px var(--mono);
    letter-spacing: 0.7px;
    color: var(--dim);
}
.board-shell {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--board-bg, #253159);
    border: 3px solid var(--shadow);
    outline: 2px solid var(--player);
    outline-offset: -2px;
}
.board-shell:after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 2px, #0000000f 2px 3px);
}
.board-shell.warning {
    outline-color: var(--red);
}
.board-shell.attacked {
    outline-color: var(--purple);
}
.board-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    outline: none;
    cursor: default;
    touch-action: none;
}
.mine .board-canvas {
    cursor: crosshair;
}
.board-canvas:focus-visible {
    box-shadow: inset 0 0 0 2px var(--cyan);
}
.effect-canvas,
.effect-labels {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.board-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    background: #0a0818e8;
}
.board-overlay h3 {
    margin: 8px 0;
    font: 800 15px var(--mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--yellow);
}
.board-overlay p {
    max-width: 205px;
    margin: auto;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
}
.board-overlay .icon {
    width: 30px;
    height: 30px;
    color: var(--player);
}
.power-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    overflow: hidden;
    font: 9px var(--mono);
    color: var(--muted);
}
.power-state > span {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.power-state .icon {
    width: 13px;
    height: 13px;
}
.power-state .combo {
    flex-shrink: 0;
    color: var(--yellow);
}
.piece-row {
    display: flex;
    align-items: center;
    gap: 4px;
    border-top: 2px solid var(--edge);
}
.next-label {
    max-width: 26px;
    font: 700 8px/1.4 var(--mono);
    letter-spacing: 0.5px;
    color: var(--dim);
}
.mini-slot {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    background: var(--well);
    border: 2px solid var(--edge);
}
.mini-slot canvas {
    display: block;
}
.mini-slot span {
    font: 9px var(--mono);
    color: var(--muted);
}
.hold-slot {
    flex: 1.3;
    padding: 0 4px;
    border-style: dashed;
}
.hold-slot .icon {
    width: 13px;
    height: 13px;
    color: var(--dim);
}
.hold-slot:hover:not(:disabled) {
    border-color: var(--yellow);
}
.tray-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font: 700 8px var(--mono);
    letter-spacing: 1px;
    color: var(--dim);
}
.tray-label button {
    padding: 0;
    font: 8px var(--mono);
    color: var(--yellow);
    text-decoration: underline;
}
.power-tray {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}
.power-slot {
    --power: var(--dim);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    color: var(--power);
    background: var(--well);
    border: 2px solid var(--edge);
}
.power-slot .power-name {
    max-width: 100%;
    overflow: hidden;
    font: 700 8px/1.1 var(--mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.power-slot.empty {
    font-size: 16px;
    color: var(--edge);
    border-style: dashed;
    cursor: default;
}
.power-slot:hover:not(:disabled):not(.empty) {
    border-color: var(--power);
}
.power-slot.selected {
    border-color: var(--power);
    background: color-mix(in srgb, var(--power) 18%, var(--well));
    box-shadow: 0 0 0 2px var(--shadow);
}
.power-slot .sender-badge {
    position: absolute;
    top: 2px;
    right: 2px;
}
.power-slot .hotkey {
    position: absolute;
    top: 2px;
    left: 4px;
    font: 8px var(--mono);
    color: var(--dim);
}
.power-slot .charges {
    position: absolute;
    right: 3px;
    bottom: 2px;
    font: 700 9px var(--mono);
    color: var(--power);
}
.arena-actions {
    display: grid;
    gap: 5px;
}
.rotate {
    display: grid;
    place-items: center;
    background: var(--panel-2);
    border: 2px solid var(--edge);
    box-shadow: 2px 2px 0 var(--shadow);
}
.rotate:hover:not(:disabled) {
    border-color: var(--edge-hi);
}
.drop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    font: 800 11px var(--mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 2px solid var(--shadow);
}
.drop-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.remote-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: 9px var(--mono);
    color: var(--muted);
    background: var(--well);
    border: 2px solid var(--edge);
}
.remote-footer .icon {
    width: 14px;
    height: 14px;
    color: var(--green);
}
.board-foot {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    overflow: hidden;
    font: 8px var(--mono);
    color: var(--dim);
    white-space: nowrap;
}
.team-tabs {
    display: none;
}
.info-rail {
    display: none;
}
.background-picker {
    flex: 0 0 24px;
    width: 24px;
    min-width: 24px;
    height: 24px;
    padding: 1px;
    cursor: pointer;
    background: var(--well);
    border: 2px solid var(--edge);
    box-shadow: none;
}
.background-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.background-picker::-webkit-color-swatch,
.background-picker::-moz-color-swatch {
    border: 0;
}
.background-picker:hover {
    border-color: var(--yellow);
}
.background-setting {
    flex-basis: 46px;
    width: 46px;
    height: 34px;
}
.background-presets {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: -4px 0 12px;
}
.background-presets button {
    width: 28px;
    height: 28px;
    background: var(--swatch);
    border: 2px solid var(--shadow);
    outline: 1px solid var(--edge);
}
.background-presets button[aria-pressed="true"] {
    outline: 2px solid var(--yellow);
}

/* Game: compact layout (phones, short windows). Gameplay owns the viewport. */
body.playing {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.playing .app {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) 24px;
}
.playing main {
    min-width: 0;
    min-height: 0;
    overflow: clip;
}
.playing .topbar {
    min-height: 40px;
    padding: 4px 8px 8px;
}
.playing .brand {
    gap: 6px;
}
.playing .brandmark {
    width: 22px;
    height: 22px;
}
.playing .wordmark {
    font-size: 26px;
    letter-spacing: -1.5px;
}
.playing .footbar {
    padding: 2px 8px;
    font-size: 8px;
}
.playing .footbar .right {
    gap: 12px;
}
.playing .footbar button {
    font-size: 9px;
}
.playing .game-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.playing .hud {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
}
.playing .score-strip {
    flex: 0 0 38px;
    border-bottom: 2px solid var(--shadow);
}
.playing .score-cell {
    padding: 3px 10px;
}
.playing .score-cell .eyebrow {
    font-size: 7px;
    letter-spacing: 0.6px;
}
.playing .score-cell small {
    font-size: 8px;
}
.playing .boss-panel {
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: 44px 22px;
    gap: 2px 8px;
    padding: 4px 8px;
}
.playing .boss-portrait {
    width: auto;
    max-width: 100%;
    height: 44px;
    aspect-ratio: 69 / 53;
    object-fit: contain;
}
.playing .boss-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 22px 18px;
    gap: 2px 12px;
    align-items: center;
}
.playing .boss-heading h2 {
    font-size: 12px;
}
.playing .boss-level {
    font-size: 9px;
}
.playing .boss-health {
    grid-column: 1;
    grid-row: 2;
    height: 12px;
}
.playing .boss-detail {
    grid-column: 2;
    grid-row: 2;
    font-size: 9px;
}
.playing .boss-contributors {
    grid-column: 2;
    grid-row: 1;
    max-width: 400px;
}
.playing .boss-help {
    display: none;
}
.playing .boss-alerts {
    grid-column: 1 / -1;
    height: 22px;
    padding: 2px 0 0;
    overflow: auto hidden;
    line-height: 18px;
    white-space: nowrap;
    scrollbar-width: none;
}
.playing .connection-banner {
    font-size: 10px;
}
.playing .arena-layout {
    flex: 1;
    min-height: 0;
    padding: 6px;
}
.playing .boards {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
}
.playing .board-card {
    flex: 0 1 var(--board-width, 280px);
    width: var(--board-width, 280px);
    padding: 6px;
}
.playing .board-head {
    height: 28px;
    margin-bottom: 4px;
}
.playing .board-head .avatar {
    width: 24px;
    height: 24px;
}
.playing .board-head .avatar .icon {
    width: 16px;
    height: 16px;
}
.playing .player-name {
    font-size: 10px;
}
.playing .player-state {
    font-size: 7px;
}
.playing .player-score {
    min-width: 30px;
    font-size: 12px;
}
.playing .player-score small {
    font-size: 6px;
}
.playing .power-state {
    height: 18px;
    margin: 3px 0 2px;
    font-size: 8px;
}
.playing .piece-row {
    height: 34px;
    padding-top: 3px;
}
.playing .mini-slot {
    height: 30px;
}
.playing .mini-slot canvas {
    width: 26px;
    height: 26px;
}
.playing .mini-slot span,
.playing .hold-slot.empty .hold-text {
    display: none;
}
.playing .tray-label {
    height: 10px;
    margin: 4px 0 3px;
    font-size: 7px;
}
.playing .power-tray,
.playing .power-slot {
    height: 36px;
}
.playing .power-slot .power-symbol {
    width: 17px;
    height: 17px;
}
.playing .power-slot .power-name {
    font-size: 7px;
}
.playing .arena-actions,
.playing .remote-footer {
    height: 32px;
    margin-top: 5px;
}
.playing .arena-actions {
    grid-template-columns: 32px 32px minmax(0, 1fr);
}
.playing .rotate {
    height: 32px;
}
.playing .board-foot {
    height: 10px;
    margin-top: 3px;
    font-size: 7px;
}

/*
 * Game: cabinet layout. Status on the left, the well in the middle, notes on the right.
 * The client adds .cabinet when the window is big enough for the current player count.
 */
.playing .game-view.cabinet {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0 14px;
    padding: 12px 14px;
}
.playing .cabinet .hud {
    grid-column: 1;
    grid-row: 1 / -1;
    gap: 12px;
    min-height: 0;
    contain: size;
    overflow-y: auto;
    scrollbar-width: thin;
}
.playing .cabinet .connection-banner {
    grid-column: 2;
    margin-bottom: 10px;
    border: 2px solid #c98a22;
}
.playing .cabinet .pause-banner {
    border-color: var(--cyan);
}
.playing .cabinet .score-strip {
    display: flex;
    flex: none;
    flex-direction: column;
    border: 2px solid var(--edge);
    box-shadow: 4px 4px 0 var(--shadow);
}
.playing .cabinet .score-cell,
.playing .cabinet .score-cell:nth-child(n + 3) {
    min-height: 34px;
    padding: 4px 12px;
    border-right: 0;
    border-bottom: 2px solid var(--shadow);
}
.playing .cabinet .score-cell:last-child {
    border-bottom: 0;
}
.playing .cabinet .score-cell small {
    display: none;
}
.playing .cabinet .score-cell .eyebrow {
    font-size: 9px;
}
.playing .cabinet .score-cell strong {
    font-size: 17px;
}
.playing .cabinet .score-cell.accent {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px 10px;
}
.playing .cabinet .score-cell.accent small {
    display: block;
}
.playing .cabinet .score-cell.accent strong {
    font-size: 34px;
    line-height: 1.1;
    text-align: right;
}
.playing .cabinet .boss-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 2px solid #6a3a7c;
    box-shadow: 4px 4px 0 var(--shadow);
}
.playing .cabinet .boss-portrait {
    align-self: center;
    width: min(100%, calc(22vh * 69 / 53));
    height: auto;
    background: #170c27;
    border: 2px solid var(--shadow);
    outline: 1px solid #6a3a7c;
}
.playing .cabinet .boss-summary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}
.playing .cabinet .boss-heading h2 {
    font-size: 14px;
}
.playing .cabinet .boss-health {
    height: 16px;
}
.playing .cabinet .boss-contributors {
    flex-wrap: wrap;
    max-width: none;
}
.playing .cabinet .boss-help {
    display: block;
}
.playing .cabinet .boss-alerts {
    height: 92px;
    padding: 6px 8px;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    background: var(--well);
    border: 2px solid var(--shadow);
    outline: 1px solid #6a3a7c;
}
.playing .cabinet .arena-layout {
    display: grid;
    grid-column: 2;
    grid-row: 3;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-rows: minmax(0, 1fr);
    gap: 14px;
    padding: 0;
}
.playing .cabinet .info-rail .panel {
    flex-shrink: 0;
}
.playing .cabinet.three .arena-layout,
.playing .cabinet.four .arena-layout {
    grid-template-columns: minmax(0, 1fr);
}
.playing .cabinet.three .info-rail,
.playing .cabinet.four .info-rail {
    display: none;
}
.playing .cabinet .info-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding-right: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.playing .cabinet .boards {
    align-items: center;
    padding: 12px;
    background: var(--tile), var(--well);
    border: 2px solid var(--edge);
    box-shadow: inset 4px 4px 0 #0006;
}
.playing .cabinet .board-card {
    padding: 8px;
}
.playing .cabinet .board-card.mine {
    box-shadow: 4px 4px 0 var(--shadow);
}
.playing .cabinet .board-head {
    height: 30px;
}
.playing .cabinet .power-state {
    height: 20px;
}
.playing .cabinet .piece-row {
    height: 38px;
}
.playing .cabinet .mini-slot {
    height: 34px;
}
.playing .cabinet .mini-slot canvas {
    width: 30px;
    height: 28px;
}
.playing .cabinet .power-tray,
.playing .cabinet .power-slot {
    height: 42px;
}
.playing .cabinet .power-slot .power-name {
    font-size: 8px;
}
.playing .cabinet .arena-actions,
.playing .cabinet .remote-footer,
.playing .cabinet .rotate {
    height: 36px;
}
.playing .cabinet .arena-actions {
    grid-template-columns: 36px 36px minmax(0, 1fr);
}
.playing .cabinet .drop-btn {
    font-size: 12px;
}

/* Medium-height windows trade the extra notes for room to breathe. */
@media (max-height: 820px) {
    .playing .cabinet .info-rail .feed-panel,
    .playing .cabinet .boss-help {
        display: none;
    }
}

/* Dialogs: each one is a small window with a file name in the title bar */
.modal-shade {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: repeating-linear-gradient(0deg, #05030dcc 0 2px, #05030de6 2px 4px);
}
.modal {
    position: relative;
    width: 480px;
    max-width: 100%;
    max-height: calc(100svh - 40px);
    overflow: auto;
    background: var(--panel);
    border: 2px solid var(--edge-hi);
    box-shadow: 6px 6px 0 var(--shadow);
    animation: appear 0.15s steps(3);
}
.modal.wide {
    width: 600px;
}
.modal-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 4px 12px;
    font: 700 11px var(--mono);
    letter-spacing: 1.3px;
    background: var(--bar);
}
.modal-close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--ink);
    background: var(--red);
    border: 2px solid var(--shadow);
}
.modal-close:hover {
    background: #ff7d8a;
}
.modal-close .icon {
    width: 14px;
    height: 14px;
    stroke-width: 3;
}
.modal-body {
    padding: 22px 26px 26px;
}
.modal-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    color: var(--yellow);
    background: var(--well);
    border: 2px solid var(--yellow);
    box-shadow: 3px 3px 0 var(--shadow);
}
.modal h2 {
    margin-bottom: 10px;
    font: 800 26px/1.15 var(--sans);
    letter-spacing: -0.5px;
}
.modal-lead {
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--muted);
}
.modal h3,
.details-heading {
    margin: 18px 0 10px;
    font: 700 11px var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--yellow);
}
.help-controls {
    padding: 14px;
    background: var(--well);
    border: 1px solid var(--edge);
}
.help-controls h3 {
    margin-top: 0;
}
.help-controls p {
    font-size: 12px;
    line-height: 1.65;
    color: var(--muted);
}
.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin-top: 16px;
}
.controls-grid .key-row {
    margin: 0;
    font-size: 11px;
}
.controls-grid kbd {
    font-size: 9px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}
.modal-actions .btn {
    flex: 1;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0;
}
.field label {
    font: 700 11px var(--mono);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
}
.input-row {
    display: flex;
    gap: 8px;
}
.input-row input {
    flex: 1;
    width: 100%;
}
.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.avatar-option {
    padding: 2px;
    border: 2px solid transparent;
}
.avatar-option.selected {
    border-color: var(--yellow);
}
.avatar-option .avatar {
    width: 36px;
    height: 36px;
}
.modal-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font: 10px var(--mono);
    text-transform: uppercase;
    color: var(--dim);
}
.modal-divider:before,
.modal-divider:after {
    content: "";
    flex: 1;
    height: 2px;
    background: var(--edge);
}
.error-message {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ffb7c0;
    background: #3a1320;
    border: 2px solid var(--red);
}
.inline-note {
    margin-top: 14px;
    font-size: 11px;
    line-height: 1.65;
    color: var(--muted);
}
.copy-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 18px;
}
.big-code {
    flex: 1;
    min-width: 0;
    padding: 10px;
    font: 800 26px var(--mono);
    letter-spacing: 5px;
    color: var(--yellow);
    text-align: center;
    background: var(--well);
    border: 2px dashed var(--edge-hi);
}
.copy-row .btn {
    flex-direction: column;
    gap: 4px;
    padding: 6px 12px;
    font-size: 10px;
}
.lobby-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.lobby-seat {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px;
    background: var(--well);
    border: 2px solid var(--edge);
}
.lobby-seat strong {
    display: block;
    max-width: 140px;
    overflow: hidden;
    font: 700 12px var(--mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lobby-seat small {
    display: block;
    margin-top: 2px;
    font: 10px var(--mono);
    color: var(--muted);
}
.lobby-seat .ready {
    color: var(--green);
}
.lobby-seat.empty {
    color: var(--dim);
    border-style: dashed;
}
.lobby-seat.empty .icon {
    width: 26px;
    height: 26px;
    margin: 3px;
}
.room-rules {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--muted);
    background: var(--well);
    border-left: 4px solid var(--yellow);
}
.room-rules .icon {
    margin-top: 2px;
    color: var(--yellow);
}
.room-rules p {
    line-height: 1.6;
}
.setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 2px dotted var(--edge);
}
.setting label {
    font: 700 12px var(--mono);
    text-transform: uppercase;
}
.setting small {
    display: block;
    margin-top: 3px;
    font: 400 11px/1.5 var(--sans);
    text-transform: none;
    color: var(--muted);
}
.volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.volume-row input {
    width: 100px;
    padding: 0;
    accent-color: var(--yellow);
    box-shadow: none;
}
.volume-row output {
    min-width: 32px;
    white-space: nowrap;
    font: 10px var(--mono);
    color: var(--muted);
}
.rule {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}
.rule > .icon {
    margin-top: 2px;
    color: var(--yellow);
}
.rule strong {
    display: block;
    margin-bottom: 3px;
    font: 700 12px var(--mono);
    text-transform: uppercase;
}
.rule p {
    font-size: 12px;
    line-height: 1.65;
    color: var(--muted);
}
.power-help {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}
.power-help .rule {
    margin: 0;
}
.result-score {
    margin: 8px 0 16px;
    font: 800 56px/1.1 var(--mono);
    color: var(--yellow);
    text-shadow: 4px 4px 0 var(--shadow);
}
.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.result-grid > div {
    padding: 12px 4px;
    text-align: center;
    background: var(--well);
    border: 2px solid var(--edge);
}
.result-grid strong {
    display: block;
    margin-bottom: 4px;
    font: 800 18px var(--mono);
}
.result-grid span {
    font: 10px var(--mono);
    text-transform: uppercase;
    color: var(--muted);
}
.log-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.log-controls select {
    min-width: 0;
    max-width: 100%;
    padding: 6px;
    color: var(--ink);
    background: var(--well);
    border: 2px solid var(--edge);
}
#logsSearch {
    width: 100%;
}
.room-log {
    max-height: 40dvh;
    margin: 12px 0;
    padding: 0;
    overflow: auto;
    font: 11px/1.5 var(--mono);
    list-style: none;
    background: var(--well);
    border: 2px solid var(--edge);
}
.room-log li {
    padding: 8px;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--edge);
}
.room-log time,
.room-log code {
    display: block;
    font-size: 9px;
    color: var(--muted);
}
.room-log pre {
    margin: 4px 0 0;
    font: inherit;
    white-space: pre-wrap;
}
.toast-stack {
    position: fixed;
    bottom: 36px;
    left: 50%;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 30px);
    transform: translateX(-50%);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    padding: 9px 14px;
    font: 700 12px var(--mono);
    background: var(--panel);
    border: 2px solid var(--yellow);
    box-shadow: 4px 4px 0 var(--shadow);
    animation: appear 0.2s steps(3);
}
.toast .icon {
    width: 18px;
    height: 18px;
    color: var(--yellow);
}
.toast .text {
    min-width: 0;
}
.toast.error {
    border-color: var(--red);
}
.toast.error .icon {
    color: var(--red);
}
.notifications-off .toast-stack {
    display: none;
}

/* Game: small-screen tuning, from large to small */
@media (max-width: 1100px) {
    .playing #sessionCount,
    .playing .connection {
        display: none;
    }
}
@media (max-width: 900px) {
    .playing .session-left > .eyebrow {
        display: none;
    }
    .playing .cooperative .board-card:not(.selected-board) {
        display: none;
    }
    .playing .team-tabs {
        display: flex;
        flex: 0 0 32px;
        gap: 3px;
        min-height: 0;
        padding: 2px 4px;
        overflow: hidden;
        background: var(--well);
        border-bottom: 2px solid var(--edge);
    }
    .playing .team-tabs button {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        padding: 2px 4px;
        font: 700 10px var(--mono);
        color: var(--muted);
        background: var(--panel-2);
        border: 2px solid var(--edge);
    }
    .playing .team-tabs button[aria-pressed="true"] {
        color: var(--ink);
        border-color: var(--yellow);
    }
    .playing .team-tabs button > span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .playing .team-tabs .avatar {
        flex-shrink: 0;
        width: 18px;
        height: 18px;
    }
    .playing .team-tabs .avatar .icon {
        width: 12px;
        height: 12px;
    }
}
@media (max-width: 800px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }
    .hero-art canvas {
        height: min(46vh, 420px);
    }
    .home-powers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    .home {
        padding: 0 14px 22px;
    }
    .ticker {
        margin: 0 -14px 22px;
    }
    .hero-actions .btn {
        flex: 1;
        padding: 12px 14px;
    }
    .topbar {
        gap: 4px;
        padding: 4px 6px 8px;
    }
    .top-actions,
    .session-right {
        gap: 3px;
    }
    .connection {
        display: none;
    }
    .icon-button {
        width: 28px;
        height: 28px;
    }
    .playing .brandmark {
        width: 18px;
        height: 18px;
    }
    .playing .wordmark {
        font-size: 22px;
    }
    .controls-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
    .power-feature {
        gap: 8px;
        padding: 8px;
    }
    .feature-icon {
        width: 28px;
        height: 28px;
    }
    .power-feature strong {
        font-size: 10px;
    }
    .playing .top-actions #helpButton,
    .playing .top-actions #notificationsButton,
    .playing .session-left {
        display: none;
    }
    .playing .session-bar {
        justify-content: flex-end;
    }
    .playing .score-strip {
        flex-basis: 34px;
    }
    .playing .score-cell {
        gap: 2px;
        padding: 2px 5px;
    }
    .playing .score-cell .eyebrow {
        font-size: 6px;
        letter-spacing: 0;
    }
    .playing .score-cell strong {
        font-size: 14px;
    }
    .playing .score-cell small {
        display: none;
    }
    .playing .boss-panel {
        padding: 3px 5px;
        column-gap: 5px;
    }
    .playing .boss-summary {
        column-gap: 6px;
    }
    .playing .boss-heading {
        grid-column: 1 / -1;
    }
    .playing .boss-heading h2 {
        font-size: 12px;
    }
    .playing .boss-contributors,
    .playing .boss-detail > span:last-child {
        display: none;
    }
    .playing .boss-detail {
        font-size: 8px;
    }
    .playing .boss-alerts {
        font-size: 9px;
    }
    .playing .arena-layout {
        padding: 3px;
    }
    .playing .footbar > span {
        display: none;
    }
    .playing .footbar .right {
        justify-content: space-around;
        width: 100%;
    }
    .modal-shade {
        padding: 12px;
    }
    .modal {
        max-height: calc(100svh - 24px);
    }
    .modal-body {
        padding: 18px 16px 20px;
    }
    .modal h2 {
        font-size: 22px;
    }
    .lobby-seat {
        gap: 7px;
        padding: 8px;
    }
    .lobby-seat strong {
        max-width: 93px;
        font-size: 11px;
    }
    .big-code {
        font-size: 22px;
        letter-spacing: 3px;
    }
    .toast {
        padding: 8px 12px;
        font-size: 11px;
    }
}
@media (max-height: 700px) {
    .playing .board-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 76px;
        grid-template-rows: 32px 23px 66px 38px 69px minmax(10px, 1fr);
        column-gap: 5px;
    }
    .playing .board-head {
        grid-column: 1 / -1;
    }
    .playing .board-shell {
        grid-column: 1;
        grid-row: 2 / -1;
    }
    .playing .power-state {
        grid-column: 2;
        grid-row: 2;
    }
    .playing .power-state .combo {
        display: none;
    }
    .playing .piece-row {
        display: grid;
        grid-column: 2;
        grid-row: 3;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
        height: 64px;
    }
    .playing .next-label,
    .playing .tray-label {
        display: none;
    }
    .playing .piece-row .mini-slot {
        gap: 0;
        padding: 0;
    }
    .playing .mini-slot canvas {
        width: 18px;
        height: 24px;
    }
    .playing .hold-slot .icon {
        width: 11px;
    }
    .playing .power-tray {
        grid-column: 2;
        grid-row: 4;
        gap: 3px;
        align-self: start;
        height: 34px;
    }
    .playing .power-slot {
        height: 30px;
    }
    .playing .power-slot .power-name,
    .playing .power-slot .hotkey {
        display: none;
    }
    .playing .arena-actions,
    .playing .remote-footer {
        grid-column: 2;
        grid-row: 5;
        height: 64px;
        margin: 0;
    }
    .playing .arena-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, 30px);
        gap: 4px;
    }
    .playing .rotate {
        height: 30px;
    }
    .playing .drop-btn {
        grid-column: 1 / -1;
    }
    .playing .drop-btn {
        padding: 0 2px;
        font-size: 9px;
        letter-spacing: 0;
    }
    .playing .drop-btn .icon {
        display: none;
    }
    .playing .remote-footer {
        flex-direction: column;
        padding: 2px;
        font-size: 8px;
        text-align: center;
    }
    .playing .board-foot {
        flex-direction: column;
        justify-content: flex-start;
        grid-column: 2;
        grid-row: 6;
        height: auto;
        margin: 0;
        white-space: normal;
    }
}
@media (max-height: 500px) {
    .playing .topbar {
        min-height: 34px;
        padding-block: 2px 7px;
    }
    .playing .topbar .icon-button {
        height: 24px;
    }
    .playing .score-strip {
        flex-basis: 28px;
    }
    .playing .score-cell small {
        display: none;
    }
    .playing .score-cell strong {
        font-size: 14px;
    }
    .playing .boss-panel {
        grid-template-columns: 34px minmax(0, 1fr);
        grid-template-rows: 26px 18px;
        row-gap: 0;
        padding-block: 2px;
    }
    .playing .boss-portrait {
        height: 26px;
    }
    .playing .boss-summary {
        grid-template-rows: 14px 10px;
        row-gap: 1px;
    }
    .playing .boss-heading h2 {
        font-size: 10px;
    }
    .playing .boss-health {
        height: 8px;
    }
    .playing .boss-alerts {
        height: 18px;
        padding: 0;
        font-size: 8px;
    }
    .playing .team-tabs {
        flex-basis: 28px;
    }
    .playing .arena-layout {
        padding: 3px;
    }
    .playing .board-card {
        grid-template-rows: 28px 18px 48px 29px 56px minmax(10px, 1fr);
        padding: 4px;
    }
    .playing .board-head {
        height: 24px;
    }
    .playing .piece-row {
        height: 46px;
        padding-top: 0;
    }
    .playing .piece-row .mini-slot {
        height: 22px;
    }
    .playing .mini-slot canvas {
        height: 20px;
    }
    .playing .power-tray,
    .playing .power-slot {
        height: 26px;
    }
    .playing .arena-actions,
    .playing .remote-footer {
        height: 52px;
    }
    .playing .arena-actions {
        grid-template-rows: repeat(2, 24px);
    }
    .playing .rotate {
        height: 24px;
    }
    .playing .board-foot {
        font-size: 6px;
    }
}
@media (max-height: 360px) {
    .playing .app {
        grid-template-rows: auto minmax(0, 1fr) 20px;
    }
    .playing .topbar {
        min-height: 28px;
        padding: 2px 6px 6px;
    }
    .playing .topbar:after {
        height: 3px;
    }
    .playing .topbar .icon-button {
        height: 20px;
    }
    .playing .board-card,
    .playing .board-shell,
    .playing .boss-panel,
    .playing .score-strip {
        border-width: 1px;
    }
    .playing .board-card .board-head {
        margin-bottom: 1px;
    }
    .playing .score-strip {
        flex-basis: 24px;
    }
    .playing .boss-panel {
        grid-template-columns: 24px minmax(0, 1fr);
        grid-template-rows: 18px 14px;
        padding-block: 1px;
    }
    .playing .boss-portrait {
        height: 18px;
    }
    .playing .boss-summary {
        grid-template-rows: 10px 7px;
    }
    .playing .boss-heading h2,
    .playing .boss-level,
    .playing .boss-detail {
        font-size: 7px;
        line-height: 1;
    }
    .playing .boss-health {
        height: 6px;
    }
    .playing .boss-contributors {
        display: none;
    }
    .playing .boss-alerts {
        height: 14px;
        font-size: 7px;
        line-height: 14px;
    }
    .playing .team-tabs {
        flex-basis: 24px;
    }
    .playing .board-card {
        grid-template-rows: 22px 0 42px 24px 48px minmax(0, 1fr);
        padding: 2px;
    }
    .playing .board-head {
        height: 20px;
        margin-bottom: 2px;
    }
    .playing .board-head .avatar,
    .playing .background-picker {
        height: 20px;
    }
    .playing .power-state,
    .playing .board-foot {
        display: none;
    }
    .playing .piece-row {
        height: 40px;
    }
    .playing .piece-row .mini-slot,
    .playing .mini-slot canvas {
        height: 18px;
    }
    .playing .power-tray,
    .playing .power-slot {
        height: 22px;
    }
    .playing .arena-actions,
    .playing .remote-footer {
        height: 46px;
    }
    .playing .arena-actions {
        grid-template-rows: repeat(2, 21px);
    }
    .playing .rotate {
        height: 21px;
    }
}

/* Motion */
@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes ticker {
    to {
        transform: translateX(-50%);
    }
}
@keyframes background-drift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(160px, 160px, 0);
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .ticker-track,
    .background-blocks:before {
        animation: none;
    }
}
body.reduced *,
body.reduced *:before,
body.reduced *:after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
}
body.reduced .ticker-track,
body.reduced .background-blocks:before {
    animation: none;
}
