/* EDH Table interface. Game-specific card rotation and layout stay in styles.css. */
:root { color-scheme: dark; --font-display: Georgia, 'Times New Roman', serif; }
body { -webkit-font-smoothing: antialiased; }
.bg-art.active { opacity: .2; }
button, input, summary, a { touch-action: manipulation; }
button { color: inherit; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
input, textarea { user-select: text; }
input::placeholder, textarea::placeholder { color: #81928a; opacity: 1; }
.field input, .search-input { background: #111c18; border-color: var(--line); }
.btn { min-height: 46px; box-shadow: none; }
.btn-primary:hover { background: #c8eed0; filter: none; }
.chip.is-active { color: #14291b; font-weight: 700; }
.link-btn { color: var(--muted); text-decoration: none; min-height: 44px; }
.link-btn:hover { color: var(--ink); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 700; }
.fine { line-height: 1.6; }
.field > span { text-transform: none; letter-spacing: 0; color: #d8e1d8; font-size: 13px; font-weight: 600; }
.field > span small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* Welcome: two real choices and a preview of what comes next. */
.landing { max-width: 1240px; padding: 36px 40px 20px; gap: 0; }
.lp-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.lp-brand { justify-content: flex-start; gap: 12px; padding: 0; }
.lp-brand .brand-mark { display: block; flex: none; width: 44px; height: 44px; object-fit: cover; border-radius: 10px; filter: none; }
.lp-brand h1 { font-size: 25px; line-height: 1.2; font-weight: 750; letter-spacing: -.7px; }
.lp-brand h1 span { color: var(--ink); font-weight: 400; }
.lp-brand h1 small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .06em; }
.header-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.header-note i, .preview-turn i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); }
.lp-hero { grid-template-columns: .92fr 1.08fr; gap: 64px; padding: 76px 0 66px; }
.hero-pitch .eyebrow { margin: 0 0 20px; }
.hero-pitch h2 { font-family: var(--font-display); font-size: clamp(44px, 4.6vw, 65px); line-height: 1.06; font-weight: 400; letter-spacing: -2.5px; margin-bottom: 23px; text-align: left; }
.hero-pitch h2 em { color: var(--accent); font-weight: 400; }
.lp-sub { font-size: 16px; line-height: 1.7; max-width: 370px; margin-bottom: 28px; text-align: left; }
.hero-pitch .field { margin-bottom: 14px; }
.hero-pitch .field input { font-size: 15px; padding: 14px 15px; border-radius: 10px; }
.home-actions { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 0; }
.home-actions .btn-big { align-items: stretch; text-align: left; padding: 17px 15px; gap: 8px; border-radius: 10px; font-size: 16px; }
.home-actions .btn span { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.home-actions .btn b { font-weight: 400; font-size: 21px; }
.home-actions .btn small { font-size: 10px; opacity: .8; }
.home-reassurance { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.6; margin: 17px 0 0; }
.home-reassurance > span { color: var(--accent); }
.table-preview { min-width: 0; transform: rotate(-1.5deg); }
.preview-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 9px; letter-spacing: .12em; color: var(--muted); margin: 0 10px 14px; }
.preview-live { color: var(--accent); letter-spacing: 0; }
.preview-board { background: #101a16; border: 1px solid #3b4d42; border-radius: 20px; padding: 17px; box-shadow: 0 22px 80px #0004, 9px 10px 0 -2px #18211d, 10px 11px 0 -2px #3b4d4244; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; font-size: 9px; padding: 0 2px 15px; }
.preview-toolbar > b { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink); }
.preview-brand-icon { display: block; flex: none; width: 16px; height: 16px; border-radius: 4px; }
.preview-toolbar > span { margin-left: auto; color: var(--muted); }
.preview-toolbar i { font-style: normal; color: var(--muted); }
.preview-turn { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #1b2820; border-radius: 7px; font-size: 9px; padding: 10px; margin-bottom: 13px; color: var(--muted); }
.preview-turn > span:first-child { color: #d7e4d9; }
.preview-turn i { margin-right: 6px; }
.preview-turn b { margin-left: 10px; padding: 5px 8px; background: var(--accent); color: #152c1c; border-radius: 4px; font-weight: 600; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview-seat { --preview-color: #9bdbaf; background: linear-gradient(135deg, color-mix(in srgb, var(--preview-color) 12%, #16211c), #19251f); border: 1px solid color-mix(in srgb, var(--preview-color) 30%, transparent); border-radius: 12px; padding: 14px 12px 11px; overflow: hidden; }
.preview-seat.blue { --preview-color: #9db4e1; background: #202934; }
.preview-seat.coral { --preview-color: #dea795; background: #332623; }
.preview-seat.gold { --preview-color: #ddc17c; background: #302d21; }
.preview-seat.active { border-color: var(--preview-color); }
.preview-seat > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 600; font-size: 12px; color: var(--preview-color); }
.preview-seat small { font-size: 7px; letter-spacing: .1em; opacity: .75; }
.preview-seat section { display: flex; justify-content: space-between; align-items: center; padding: 20px 0 19px; }
.preview-seat section b { font-size: clamp(38px, 4.2vw, 58px); line-height: 1; font-weight: 600; letter-spacing: -2px; }
.preview-seat section i { font-style: normal; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: #ffffff08; border: 1px solid #ffffff12; color: var(--preview-color); font-size: 19px; font-weight: 300; }
.preview-seat footer { font-size: 8px; color: var(--preview-color); border-top: 1px solid #ffffff12; padding-top: 10px; }
.preview-seat footer span { float: right; }
.preview-note { text-align: center; margin: 24px 0 0; color: var(--muted); font-size: 11px; }
.preview-note span { color: var(--accent); font-size: 19px; margin-right: 5px; }
.value-props { grid-template-columns: repeat(3, 1fr); gap: 35px; margin: 0; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.value-props li { align-items: flex-start; gap: 13px; background: none; border: none; border-radius: 0; padding: 0; font-size: 12px; line-height: 1.7; }
.value-props li b { color: var(--ink); font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.vp-ico { display: grid; place-items: center; flex: 0 0 35px; height: 35px; color: var(--accent); font-size: 27px; border: 1px solid var(--line); border-radius: 9px; }
.lp-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.footer-links { display: flex; align-items: center; gap: 21px; }
.lp-foot .link-btn { padding: 0; font-size: 11px; }
.lp-foot .btn-install { width: auto; margin: 0; }
.lp-foot .fine { margin: 0; font-size: 10px; }
body[data-screen="home"] .games-pill { position: static; transform: none; z-index: auto; display: block; margin: 0; background: #19291f; border-color: var(--line); box-shadow: none; min-height: 42px; font-size: 11px; flex: none; }

/* Setup: the normal choices first, optional rules tucked underneath. */
body[data-screen="host-setup"] .screen, body[data-screen="join"] .screen, body[data-screen="seat"] .screen { overflow-y: auto; }
.setup-card { max-width: 580px; height: auto; min-height: 100%; padding: 34px 36px; justify-content: center; }
.setup-card .back { color: var(--muted); min-height: 44px; margin: 0 0 25px; padding: 0; align-self: flex-start; }
.setup-card .eyebrow { margin: 0 0 12px; }
.setup-card h2 { font-family: var(--font-display); font-size: 38px; font-weight: 400; letter-spacing: -1px; margin: 0 0 12px; }
.setup-intro { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 15px; }
.setup-intro b { color: var(--ink); font-weight: 500; }
.setup-card > .field { margin: 17px 0; }
#format-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { min-height: 44px; border-radius: 9px; padding: 10px; font-size: 12px; }
.setup-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.setup-numbers .field { margin: 13px 0 22px; }
.setup-numbers .stepper { display: flex; width: 100%; justify-content: space-between; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.setup-numbers .stepper output { font-size: 32px; min-width: 42px; text-align: center; }
.setup-numbers .step { flex: 0 0 44px; width: 44px; height: 44px; background: #ffffff07; border: 1px solid var(--line); border-radius: 9px; font-size: 22px; }
.setup-advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px 0; }
.setup-advanced summary { cursor: pointer; font-size: 13px; padding: 17px 0; color: var(--ink); }
.setup-advanced summary span { float: right; color: var(--muted); font-size: 11px; padding-top: 2px; }
.setup-advanced .toggle-row { font-size: 13px; }
.setup-ready { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 17px 0 7px; font-size: 12px; }
.setup-ready > span { color: var(--accent); }
.setup-ready p { margin: 8px 0; }
.setup-card #btn-create { margin-top: 9px; }
.code-input { min-height: 74px; font-size: 30px !important; letter-spacing: .3em; }

/* At the table: life totals lead; controls keep a stable, labeled place. */
.table-top { gap: 16px; padding: 18px 24px 13px; flex-wrap: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.table-brand { flex: 1 1 auto; text-shadow: none; min-width: 0; }
.table-brand .tb-logo { display: flex; align-items: center; gap: 7px; }
.table-brand-icon { display: block; flex: none; width: 26px; height: 26px; object-fit: cover; border-radius: 6px; }
.tb-logo { color: var(--ink); text-shadow: none; font-size: 20px; letter-spacing: -.4px; }
.table-format { font-size: 10px; text-transform: none; letter-spacing: .02em; margin-top: 6px; }
.join-badge { border-radius: 11px; border-color: #accdaf30; background: #203426; box-shadow: none; padding: 8px 12px; gap: 9px; min-height: 48px; flex: 0 1 auto; }
.join-meta { gap: 3px; align-items: flex-start; }
.join-code { font-size: 20px; text-shadow: none; color: var(--accent); letter-spacing: .04em; }
.join-label { display: block; color: #afc9b4; font-size: 10px; letter-spacing: 0; text-transform: none; }
.join-qr { flex: none; }
.join-qr:has(img:not([src])) { display: none; }
.join-qr img { width: 48px; height: 48px; border-radius: 6px; }
.table-tools { width: auto; order: initial; flex: none; gap: 7px; padding: 0; overflow: visible; }
.table-tools .icon-btn { min-height: 46px; height: 46px; padding: 0 12px; border-radius: 9px; background: #294437; border-color: #94b69e; color: #fff9e8; font-size: 14px; transform: none; }
.table-tools #table-tools-menu { color: #fff9e8; border-color: #b3d5bb; background: #365841; }
.turn-bar { padding: 0 24px 12px; gap: 10px; flex-wrap: wrap; }
.tb-turn { background: transparent; border: none; padding: 5px 0; gap: 12px; flex: 1; }
.tb-holder { font-size: 16px; font-weight: 600; }
.tb-timer { font-size: 17px; color: var(--muted); font-weight: 500; }
.tb-label { font-size: 10px; letter-spacing: .04em; }
.tb-storm { padding: 3px 5px; border-radius: 9px; background: #ffffff03; gap: 7px; }
.tb-storm-val { font-size: 12px; color: var(--muted); font-weight: 500; }
.tb-s-btn, .tb-ico { min-width: 44px; height: 44px; background: #294437; border-color: #94b69e; color: #fff9e8; border-radius: 8px; }
.tb-ico.wide { width: auto; padding: 0 10px; font-size: 14px; white-space: nowrap; }
.tb-pass, .turn-banner.mine .tbn-btn { background: var(--accent); color: #14291b; box-shadow: none; font-size: 13px; min-height: 46px; border-radius: 9px; }
.table-grid { gap: 14px; padding: 0 24px 20px; }
.pcard { border: 1px solid color-mix(in srgb, var(--seat) 42%, transparent); border-radius: 17px; box-shadow: none; background: linear-gradient(130deg, color-mix(in srgb, var(--seat) 18%, #18211e), #18211e); }
.pcard:hover { transform: none; box-shadow: none; }
.pcard::after { border-radius: 17px; box-shadow: none; background: linear-gradient(calc(180deg + var(--rot, 0deg)), #08110d0a 25%, #08110d70 100%); }
.pcard.has-art::before { opacity: .45; }
.pcard.has-art .life-num { text-shadow: 0 2px 14px #000a; }
.pcard.is-turn { animation: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pcard-head { padding: 14px 83px 2px 17px; min-height: 43px; }
.pname { font-size: clamp(14px, 2vw, 21px); text-shadow: none; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-admin { top: 9px; right: 10px; width: auto; min-width: 58px; height: 36px; padding: 0 9px; font-size: 11px; background: #00000020; border-color: #ffffff18; }
.pcard-life { padding: 0 18px; gap: 6px; min-height: 44px; }
button.life-num, button.me-life-num { background: transparent; color: inherit; border: none; padding: 0; border-radius: 8px; }
.life-num { font-weight: 650; font-size: clamp(32px, 37cqh, 115px); text-shadow: none; letter-spacing: -3px; min-width: 44px; }
.life-btn { width: clamp(44px, 22cqh, 68px); height: clamp(44px, 22cqh, 68px); background: #ffffff07; border: 1px solid #ffffff20; box-shadow: none; font-weight: 400; }
.life-help { display: none; }
.pcard .stat-row { gap: 5px; padding: 3px 16px; }
.stat { border-radius: 7px; }
button.stat { min-height: 30px; }
.pcard-turn { padding: 2px 17px 6px; font-size: 10px; }
.turn-tot { font-size: 10px; }
.turn-flag { color: var(--accent); font-size: 9px; letter-spacing: .04em; }
button.pcard-cmdr { width: 100%; text-align: left; background: #00000014; border: none; border-top: 1px solid #ffffff0d; border-radius: 0; color: var(--ink); min-height: 40px; padding: 9px 16px; font-size: 12px; }
.pcard-cmdr .cmdr-names.empty { color: #ced9cf; font-style: normal; }
.pcard-cmdr .cmdr-tap { font-size: 10px; }
.conn.offline { background: #203426; border-color: #abc9ac40; color: var(--accent); }
body[data-screen="table"] .conn.offline { display: none; }
.featured { max-width: 180px; opacity: .85; }

/* Shared sheets and player controls. */
.modal-backdrop { background: #050c09b3; backdrop-filter: blur(7px); }
.modal-card { max-width: 540px; padding: 26px; max-height: min(88dvh, 840px); border-color: #cfe8d633; background: #19251f; overscroll-behavior: contain; }
.modal-card h3 { font-size: 23px; letter-spacing: -.5px; }
.modal-dismiss { position: sticky; top: 0; float: right; z-index: 3; width: 44px; height: 44px; margin: -6px -5px 5px 12px; border: 1px solid #94b69e; border-radius: 50%; background: #294437; color: #fff9e8; font-size: 26px; line-height: 1; }
.modal-card .muted { line-height: 1.6; font-size: 15px; }
.modal-card .btn { font-size: 16px; }
.modal-card .btn:not(.btn-primary) { background: #2b4436; border-color: #89a791; }
.modal-card .btn.danger { background: #432b29; border-color: #e79b90; color: #ffb3aa; }
.table-tool-groups { display: grid; gap: 17px; margin: 20px 0; }
.table-tool-group { display: grid; gap: 7px; }
.table-tool-group h4 { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 3px; }
.table-tool { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; min-height: 58px; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #ffffff03; text-align: left; }
.table-tool:hover { background: #b3e5bf0d; border-color: #b3e5bf40; }
.tool-copy { display: flex; flex-direction: column; gap: 4px; font-size: 16px; font-weight: 600; }
.tool-description { color: var(--muted); font-size: 14px; font-weight: 400; line-height: 1.5; }
.table-tool.danger .tool-copy { color: #f5a6a0; }
button.manage-name { background: transparent; color: var(--ink); border: none; min-height: 44px; text-align: left; padding: 0; }
button.manage-life-num { background: transparent; color: var(--ink); border: none; border-radius: 8px; padding: 0; }
.invite-modal { text-align: center; }
.invite-qr { display: block; width: 210px; height: 210px; background: white; border: 10px solid white; border-radius: 14px; margin: 22px auto 17px; image-rendering: pixelated; }
.invite-code { display: block; font-size: 42px; letter-spacing: .2em; font-weight: 700; color: var(--accent); user-select: text; margin: 12px 0; }
.invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 10px; }
.invite-actions > :only-child { grid-column: 1 / -1; }
.invite-modal > .btn:last-child { width: 100%; margin-top: 8px; }
.player-root { max-width: 760px; margin: auto; padding: 18px 18px 26px; height: calc(100% - 70px - env(safe-area-inset-bottom)); }
.player-tabs { height: calc(70px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #18241ef5; backdrop-filter: blur(12px); }
.ptab { font-size: 14px; }
.ptab.is-active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); background: #b3e5bf08; }
.me-life-num { font-weight: 650; letter-spacing: -3px; }
.me-name { min-height: 44px; padding: 4px 8px; border: 0; background: #06120fe8; border-radius: 8px; color: #fff9e8; font-size: 28px; }
.me-zone { background: #294437; border: 2px solid #e5dcad; color: #fff3ce; }
.me-zone span { opacity: 1; font-weight: 500; }
.me-quick .q { background: #f3e4b6; border: 1px solid #fff9e8; color: #19251b; }
.rename-modal .field input { font-size: 18px; min-height: 48px; }
.rename-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
/* Commander damage is a focused, repeatable action: choose the source and tap. */
.modal-card:has(.commander-damage-modal) { max-width: 640px; overflow: hidden; }
.modal-card:has(.commander-damage-modal) .modal-dismiss { position: absolute; top: 16px; right: 16px; float: none; margin: 0; }
.commander-damage-modal { display: flex; flex-direction: column; max-height: calc(min(88dvh, 840px) - 56px); }
.commander-damage-modal > :not(.damage-sources) { flex: none; }
.commander-damage-modal h2 { margin: 0 42px 12px 0; color: #fff9e8; font-size: 26px; line-height: 1.15; letter-spacing: -.4px; }
.damage-summary { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.damage-life { display: inline-block; flex: none; white-space: nowrap; padding: 7px 11px; border: 1px solid #cfbb80; border-radius: 8px; background: #102219; color: #fff2ce; font-size: 20px; font-weight: 700; }
.damage-help { margin: 0; color: #d9e5db; font-size: 16px; line-height: 1.4; }
.damage-sources { display: grid; flex: 1 1 auto; min-height: 0; gap: 8px; max-height: min(56dvh, 540px); overflow-y: auto; padding: 2px; overscroll-behavior: contain; }
.damage-source { display: grid; grid-template-columns: minmax(0,1fr) 52px; align-items: center; gap: 8px 12px; padding: 10px; border: 1px solid #89a68f; border-left: 4px solid var(--seat, #d5bd7f); border-radius: 10px; background: #263b2e; }
.damage-source-name { min-width: 0; }
.damage-source-name strong { display: block; color: #fff9e8; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.damage-source-name small { display: block; margin-top: 3px; color: #d4e0d4; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.damage-total { display: grid; place-items: center; min-height: 44px; border: 1px solid #d5bd7f; border-radius: 8px; background: #102219; color: #fff2ce; font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; }
.damage-source.is-lethal { border-color: #f6aa91; }
.damage-source.is-lethal .damage-total { background: #582b23; border-color: #f6aa91; }
.damage-controls { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.damage-step { min-height: 44px; border: 1px solid #fff9e8; border-radius: 8px; background: #f3e4b6; color: #19251b; font-size: 18px; font-weight: 750; }
.damage-step:last-child { background: #f5cb75; }
.damage-step:hover { background: #fff9e8; }
.damage-step:disabled { opacity: .45; cursor: default; }
.damage-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.damage-actions button { min-height: 46px; padding: 10px 12px; border: 1px solid #92ad9a; border-radius: 9px; background: #294437; color: #fff9e8; font-size: 17px; font-weight: 650; }
.damage-actions .damage-done { background: #b3e5bf; border-color: #b3e5bf; color: #14291b; }
.damage-status { margin: 7px 0 0; color: #d6e6d8; font-size: 15px; line-height: 1.4; }
.damage-status:empty { display: none; }
.me-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.me-card-actions .btn { min-height: 48px; padding: 10px 6px; font-size: 16px; }
.me-top .me-name { margin-left: 54px; max-width: calc(100% - 54px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-top .me-view-btn { top: 0; left: 0; width: 44px; height: 44px; background: #294437; border-color: #94b69e; }
.board-title { margin: 0 0 8px; font-size: 26px; color: #fff9e8; }
.board-sharing-help { color: #d9e5db; font-size: 16px; line-height: 1.45; margin: 0 0 16px; }
.board-add-row { margin-bottom: 20px; }
.board-add-row .btn { min-height: 48px; font-size: 16px; }
.board-name { min-width: 0; font-size: 21px; overflow-wrap: anywhere; }
.board-count { flex: none; font-size: 16px; color: #fff9e8; }
.board-seat-scan { flex: none; min-height: 44px; font-size: 16px; padding: 8px 12px; }
.board-sec { padding: 14px 0; border-top: 1px solid #526859; }
.board-empty { margin: 0; font-size: 16px; }
.bf-name { font-size: 15px; }
.board-search-instead, .board-done { margin-top: 12px; width: 100%; min-height: 46px; }
.board-scan-row { min-height: 58px; font-size: 17px; }
.board-scan-row input { width: 26px; height: 26px; }
.bss-existing { display: block; font-size: 14px; color: #d9e5db; margin-top: 4px; }
.shared-cards-modal .board-title { padding-right: 40px; }
.modal-card:has(.shared-cards-modal) { max-width: 780px; }
.modal-card:has(.scan-modal) { max-width: 860px; max-height: min(94dvh, 900px); padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); overflow: hidden; }
.modal-card:has(.scan-modal) .modal-dismiss { position: absolute; top: 12px; right: 12px; margin: 0; float: none; }
.scan-modal { display: flex; flex-direction: column; gap: 10px; max-height: calc(min(94dvh, 900px) - 42px - env(safe-area-inset-bottom)); }
.scan-modal > :not(.scan-stage):not(.board-scan-results) { flex: none; }
.scan-modal h3 { padding-right: 44px; margin: 0; }
.scan-modal > .board-sharing-help { margin: 0; font-size: 16px; line-height: 1.4; }
.scan-modal .scan-stage { flex: 1 1 auto; min-height: 100px; height: 36dvh; max-height: 440px; aspect-ratio: auto; margin: 0; }
.scan-modal .scan-stage video, .scan-modal .scan-stage img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.scan-modal .scan-status { margin: 0; font-size: 15px; line-height: 1.4; text-align: left; }
.scan-photo-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.scan-modal .scan-photo-actions .btn, .scan-modal .modal-row .btn, .scan-modal .board-search-instead { min-height: 48px; padding: 10px 12px; font-size: 16px; line-height: 1.25; }
.scan-modal .modal-row, .scan-modal .board-search-instead { margin: 0; }
.scan-modal .board-scan-results { flex: 1 1 auto; min-height: 0; max-height: 45dvh; overflow-y: auto; overscroll-behavior: contain; }
.scan-modal .board-scan-results:empty { display: none; }
.cmdr-add, .btn-cmdr-set, .cmdr-chip { min-height: 44px; }
.cb-btn, .cmd-mini, .storm-btn, .spot-btn { min-width: 44px; min-height: 44px; }
.cmd-mini, .storm-btn, .cb-btn { background: #f3e4b6; border-color: #fff9e8; color: #19251b; }
.bf-x { min-width: 36px; min-height: 36px; }
.storm-label { color: var(--muted); }
.toast { max-width: calc(100vw - 32px); width: max-content; border: 1px solid var(--line); border-radius: 12px; background: #243b2b; color: var(--ink); text-align: center; line-height: 1.5; }

@media (min-width: 1440px) {
  .landing { padding-top: 50px; }
  .lp-hero { padding-top: 75px; padding-bottom: 65px; }
}
@media (max-width: 1020px) {
  .lp-hero { gap: 34px; }
  .hero-pitch h2 { font-size: 49px; }
  .home-actions { grid-template-columns: 1fr; }
  .home-actions .btn-big { padding: 13px 15px; gap: 4px; }
  .home-actions .btn small { font-size: 11px; }
  .table-top { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .table-tools { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .table-brand { flex: 1; }
  .tb-logo { font-size: 18px; }
  .table-tools .icon-btn { width: 100%; }
  .turn-bar { padding: 0 16px 10px; }
  .table-grid { padding: 0 16px 16px; }
}
@media (max-width: 680px) {
  .landing { padding: 23px 23px 15px; }
  .lp-brand h1 { font-size: 23px; }
  .lp-brand h1 small { font-size: 9px; }
  body[data-screen="home"] .games-pill { font-size: 9px; padding: 9px 10px; min-height: 38px; }
  .header-note { font-size: 0; }
  .header-note i { width: 7px; height: 7px; }
  .lp-hero { display: flex; flex-direction: column; align-items: stretch; padding: 43px 0 28px; gap: 35px; }
  .hero-pitch h2 { font-size: clamp(41px, 10vw, 58px); letter-spacing: -1.7px; margin-bottom: 16px; }
  .hero-pitch .eyebrow { margin-bottom: 14px; }
  .lp-sub { font-size: 14px; margin-bottom: 22px; max-width: none; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  .home-actions .btn-big { font-size: 14px; padding: 14px 12px; gap: 7px; }
  .home-actions .btn small { font-size: 9px; }
  .home-reassurance { font-size: 10px; margin-top: 13px; }
  .table-preview { transform: none; max-width: 490px; width: 100%; align-self: center; }
  .preview-caption { margin-bottom: 10px; font-size: 8px; }
  .preview-board { padding: 13px; border-radius: 15px; }
  .preview-seat { padding: 12px 10px 10px; }
  .preview-seat section { padding: 18px 0; }
  .preview-seat section b { font-size: 45px; }
  .preview-seat footer { font-size: 7px; }
  .preview-seat section i { width: 26px; height: 26px; }
  .preview-note { font-size: 10px; margin-top: 15px; }
  .value-props { grid-template-columns: 1fr; gap: 22px; padding: 24px 0; }
  .value-props li { font-size: 12px; }
  .lp-foot { justify-content: center; gap: 3px; }
  .footer-links { gap: 18px; }
  .lp-foot .app-version { width: 100%; text-align: center; }
  .setup-card { padding: 22px; }
  .setup-card h2 { font-size: 33px; }
  .setup-card .back { margin-bottom: 22px; }
  .setup-numbers { gap: 12px; }
  .setup-numbers .stepper { padding: 5px; }
  .table-top { padding: 10px 12px; gap: 9px; margin-bottom: 9px; }
  .table-brand .tb-logo { font-size: 17px; }
  .join-badge { padding: 7px 9px; max-width: 62%; }
  .join-code { font-size: 16px; }
  .join-label { max-width: 175px; font-size: 9px; text-align: left; line-height: 1.35; }
  .join-qr img { width: 42px; height: 42px; }
  .table-tools { gap: 6px; }
  .table-tools .icon-btn { padding: 0 6px; min-height: 44px; height: 44px; font-size: 11px; }
  .turn-bar { padding: 0 12px 10px; gap: 7px; }
  .tb-turn { flex: 1 1 calc(100% - 108px); gap: 7px; }
  .tb-holder { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-timer { font-size: 13px; min-width: 40px; }
  .tb-label { font-size: 8px; }
  .tb-storm { margin-right: auto; }
  .tb-pass { margin-left: 0; padding: 10px 16px; }
  .table-grid { gap: 9px; padding: 0 12px 12px; }
  .pcard { border-radius: 12px; }
  .pcard::after { border-radius: 12px; }
  .pcard-head { padding-left: 10px; padding-right: 61px; }
  .pname { font-size: 13px; }
  .pcard-admin { right: 5px; min-width: 49px; padding: 0 6px; font-size: 10px; }
  .pcard-life { padding: 0 8px; gap: 1px; }
  .pcard .life-num { letter-spacing: -2px; font-size: clamp(30px, 28cqw, 64px); }
  .pcard .life-btn { width: 44px; height: 44px; font-size: 24px; flex: none; }
  .pcard .life-help { font-size: 8px; margin-bottom: 4px; }
  .pcard .stat-row { padding: 2px 8px; }
  .pcard .stat { font-size: 10px; padding: 3px 6px; }
  .pcard-cmdr .cmdr-tap { display: none; }
  button.pcard-cmdr { padding: 7px 9px; font-size: 10px; }
  .pcard .pcard-turn { padding: 2px 10px 4px; }
  .turn-tot { font-size: 8px; }
  .modal-card { padding: 21px 18px calc(21px + env(safe-area-inset-bottom)); }
  .chaos-panel { position: relative; left: auto; bottom: auto; width: auto; margin: 0 12px 12px; flex: none; max-height: 150px; }
  .featured { display: none; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .table-top { flex-wrap: nowrap; padding: 7px 12px; gap: 9px; margin-bottom: 6px; }
  .table-tools { display: flex; width: auto; gap: 5px; }
  .table-tools .icon-btn { width: auto; padding: 0 8px; }
  .join-label { display: none; }
  .join-code { font-size: 15px; }
  .join-qr img { width: 36px; height: 36px; }
  .turn-bar { flex-wrap: nowrap; padding-bottom: 7px; }
  .tb-turn { flex: 1; }
  .table-grid { padding-bottom: 10px; }
}
@media (max-width: 360px) {
  .pcard-life { padding: 0 4px; gap: 0; }
  .pcard .life-num { font-size: 36px; min-width: 0; }
  .lp-brand { gap: 5px; }
  .lp-brand .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .lp-brand h1 { font-size: 20px; }
  .lp-brand h1 small { font-size: 8px; }
  body[data-screen="home"] .games-pill { font-size: 8px; padding: 8px; }
}
/* The current player and clock sit above the table, with readable controls
   on either side. Zero-state details do not compete with the life totals. */
.table-tools .icon-btn { font-size: 14px; }
.turn-bar { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 10px; }
.tb-turn { grid-column: 2; grid-row: 1; justify-content: center; min-width: 0; gap: 10px; }
.tb-ctrls { grid-column: 1; grid-row: 1; justify-self: start; }
.tb-storm { grid-column: 3; grid-row: 1; justify-self: start; margin: 0; }
.tb-pass { grid-column: 3; grid-row: 1; justify-self: end; margin: 0; min-height: 44px; padding: 10px 14px; font-size: 15px; }
.tb-holder { font-size: 18px; }
.tb-timer { font-size: 22px; color: var(--ink); }
.tb-label { font-size: 12px; }
.tb-storm-val { font-size: 14px; }
.turn-bar[data-has-turn="false"] .tb-label,
.turn-bar[data-has-turn="false"] .tb-timer,
.turn-bar[data-has-turn="false"] .tb-limit { display: none; }
.tb-storm[data-storm-count="0"] .tb-s-btn:first-child { display: none; }
@media (max-width: 1100px) {
  .turn-bar { grid-template-columns: auto minmax(0,1fr) auto auto; }
  .tb-ctrls { grid-column: 1; }
  .tb-turn { grid-column: 2; }
  .tb-storm { grid-column: 3; }
  .tb-pass { grid-column: 4; }
  .tb-turn .tb-label { display: none; }
}
@media (max-width: 680px) {
  .table-format, .join-label { display: none; }
  .board-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bf-thumb { min-width: 0; min-height: 144px; display: grid; grid-template-rows: minmax(76px,1fr) auto; aspect-ratio: auto; }
  .bf-name { position: static; grid-row: 2; align-self: end; padding: 8px; background: #07110ced; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
  .table-tools .icon-btn { font-size: 13px; }
  .turn-bar { grid-template-columns: auto minmax(0,1fr) auto; grid-template-rows: auto auto; gap: 5px 8px; }
  .tb-turn { grid-column: 2; grid-row: 1; padding: 0; }
  .tb-ctrls { display: contents; }
  .tb-ctrls .tb-ico:first-child { grid-column: 1; grid-row: 1; justify-self: start; }
  .tb-ctrls .tb-ico:last-child { grid-column: 3; grid-row: 1; justify-self: end; }
  .tb-storm { grid-column: 1 / 3; grid-row: 2; justify-self: start; padding: 0 3px; gap: 5px; }
  .tb-pass { grid-column: 3; grid-row: 2; padding: 10px; }
  .tb-holder { font-size: 16px; }
  .tb-timer { font-size: 20px; }
  .tb-ico.wide { font-size: 13px; padding: 0 8px; }
  .turn-bar[data-has-turn="false"] .tb-turn { display: none; }
  .turn-bar[data-has-turn="false"] { grid-template-rows: auto; }
  .turn-bar[data-has-turn="false"] .tb-ctrls .tb-ico { grid-column: 1; grid-row: 1; justify-self: start; }
  .turn-bar[data-has-turn="false"] .tb-storm { grid-column: 2; grid-row: 1; justify-self: center; }
  .turn-bar[data-has-turn="false"] .tb-pass { grid-row: 1; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .player-tabs { width: 64px; height: 100%; padding-bottom: 0; }
  .player-tabs .ptab { flex: 1; min-height: 44px; padding: 8px 4px; font-size: 14px; }
  .player-root { width: calc(100% - 64px); height: 100%; max-width: none; margin: 0; padding: 8px; overflow-y: auto; }
  .me-wrap { height: 100%; min-height: 340px; }
  .me-top { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 6px; }
  .me-top .me-view-btn { position: static; grid-column: 1; grid-row: 1; }
  .me-top .me-name { grid-column: 2; grid-row: 1; margin: 0; max-width: none; font-size: 24px; text-align: left; }
  .me-top .spot-row { grid-column: 3; grid-row: 1; margin: 0; gap: 6px; }
  .me-top .me-take-btn { grid-column: 2; grid-row: 2; justify-self: start; margin: 0; min-height: 44px; }
  .me-top .turn-banner { grid-column: 1 / -1; margin: 0; }
  .me-life-col { min-height: 0; }
  .me-life { min-height: 80px; }
  .me-quick, .me-card-actions { flex: none; }
  .me-extra { overflow-x: hidden; }
  .modal-card:has(.scan-modal) { padding: 14px 18px; }
  .scan-modal { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: auto auto auto auto auto auto; gap: 7px 14px; max-height: calc(94dvh - 30px); }
  .scan-modal h3 { grid-column: 1 / -1; margin: 0; font-size: 22px; }
  .scan-modal > .board-sharing-help { grid-column: 2; grid-row: 2; font-size: 14px; line-height: 1.3; }
  .scan-modal .scan-stage, .scan-modal .board-scan-results { grid-column: 1; grid-row: 2 / 7; min-height: 0; height: auto; max-height: 100%; margin: 0; }
  .scan-modal .scan-status { grid-column: 2; grid-row: 3; font-size: 14px; line-height: 1.3; }
  .scan-modal .scan-photo-actions { grid-column: 2; grid-row: 4; }
  .scan-modal > .modal-row { grid-column: 2; grid-row: 5; }
  .scan-modal .board-search-instead { grid-column: 2; grid-row: 6; }
  .scan-modal .scan-photo-actions .btn, .scan-modal .modal-row .btn, .scan-modal .board-search-instead { min-height: 44px; padding: 8px; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .table-top { padding: 4px 10px; margin-bottom: 4px; }
  .table-format, .join-label { display: none; }
  .join-badge { min-height: 40px; padding: 4px 7px; }
  .table-tools .icon-btn { min-height: 44px; height: 44px; padding: 0 7px; font-size: 13px; }
  .turn-bar { padding: 0 10px 4px; gap: 6px; }
  .tb-holder { font-size: 16px; }
  .tb-turn { padding: 0; gap: 7px; }
  .tb-timer { font-size: 20px; min-width: 42px; }
  .tb-storm { padding: 0 3px; }
  .table-grid { padding: 0 10px 8px; gap: 8px; }
  .modal-card:has(.commander-damage-modal) { padding: 16px 18px; }
  .commander-damage-modal { max-height: calc(88dvh - 36px); }
  .commander-damage-modal h2 { font-size: 22px; margin-bottom: 8px; }
  .damage-summary { display: inline-flex; margin-right: 10px; margin-bottom: 6px; }
  .damage-life { padding: 4px 8px; font-size: 17px; }
  .damage-help { display: inline; font-size: 14px; }
  .damage-sources { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 8px; max-height: calc(88dvh - 180px); }
  .damage-source { padding: 8px; }
  .damage-source-name strong { font-size: 17px; }
  .damage-actions { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
