/* A playmat first: cards in the middle, the hand and deck within reach. */
.playtest-page { height: 100dvh; min-height: 0; overflow: hidden; background: var(--canvas); }
.playtest-shell { --pt-card-width: 112px; --pt-card-height: 156px; --pt-green: var(--focus); height: calc(100dvh - 3.6rem - env(safe-area-inset-top)); padding: 1.25rem 0 max(.75rem, env(safe-area-inset-bottom)); }
#playtest-app { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
.playtest-shell [hidden] { display: none !important; }
.playtest-shell .button, :is(#pt-help-dialog, #pt-restart-dialog) .button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.25rem; padding: .4rem .7rem; font-size: .75rem; white-space: nowrap; }
.playtest-shell input, .playtest-shell select { min-width: 0; min-height: 2.25rem; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: .35rem; color: var(--text); background: var(--surface); box-shadow: none; }
.playtest-shell input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.playtest-shell input::-webkit-inner-spin-button, .playtest-shell input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pt-topbar, .pt-heading, .pt-utility-bar, .pt-game-stats, .pt-primary-actions, .pt-topbar-actions, .pt-life-control, .pt-life-value, .pt-dialog-heading, .pt-dialog-actions, .pt-opening-actions { display: flex; align-items: center; }
.pt-topbar { align-items: flex-start; min-width: 0; gap: 1.25rem; padding-bottom: .5rem; }
.pt-heading { align-items: flex-start; flex: 1; min-width: 0; gap: .65rem; }
.pt-title-group { display: flex; min-width: 0; align-items: baseline; gap: .7rem; }
.pt-title-group h1 { overflow: hidden; margin: 0; font-family: var(--font-ui); font-size: clamp(1.6rem, 3.6vw, 2.1rem); font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.pt-title-group > span { color: var(--muted); font-size: .6875rem; }
.pt-utility-bar { align-self: center; flex-shrink: 0; gap: 1.25rem; }
.pt-game-stats { gap: 1rem; }
.pt-turn-indicator { display: flex; align-items: baseline; gap: .4rem; font-variant-numeric: tabular-nums; }
.pt-turn-indicator > span { color: var(--muted); font-size: .75rem; }
.pt-turn-indicator strong { font-size: 1rem; font-weight: 650; }
.pt-life-control { gap: .2rem; padding: .1rem; border: 1px solid var(--line); border-radius: .45rem; }
.pt-life-control > button { display: grid; flex: 0 0 2rem; width: 2rem; height: 2rem; padding: .35rem; place-items: center; border: 0; border-radius: .3rem; color: var(--muted); background: transparent; }
.pt-life-control > button:hover { color: var(--text); background: var(--surface-muted); }
.pt-life-value { justify-content: center; gap: .3rem; }
.pt-life-value svg { color: var(--muted); }
.playtest-shell .pt-life-value input { width: 4.5ch; min-width: 4.5ch; min-height: 2rem; padding: .15rem 0; border-color: transparent; background: transparent; font-size: 1.2rem; font-weight: 600; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.playtest-shell .pt-life-value input:hover { border-color: var(--line); }
.playtest-shell .pt-life-value input:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.pt-primary-actions { gap: .4rem; }
.pt-topbar-actions { align-self: center; gap: .1rem; padding-left: .8rem; border-left: 1px solid var(--line); }
.playtest-shell .pt-toolbar-icon { width: 2rem; min-height: 2rem; padding: .4rem; }
.pt-next-turn { border-color: var(--focus); color: var(--surface); background: var(--focus); }
.pt-next-turn:hover { border-color: color-mix(in srgb, var(--focus) 85%, var(--text)); background: color-mix(in srgb, var(--focus) 85%, var(--text)); }
:root[data-theme="dark"] .pt-next-turn { color: var(--canvas); }
.pt-table { display: grid; grid-template-rows: minmax(0, 1fr) auto 176px 40px; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); }
.pt-game-layout, .pt-battlefield-panel { min-width: 0; min-height: 0; }
.pt-game-layout { grid-row: 1; }
.pt-battlefield-panel { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 32px minmax(0, 1fr); height: 100%; background: color-mix(in srgb, var(--focus) 3%, var(--canvas)); }
.pt-board-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem 1rem; color: var(--muted); }
.pt-board-heading h2 { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 550; }
.pt-board-tools { display: flex; flex: 0 0 auto; align-items: center; gap: .75rem; }
.pt-board-hint { font-size: .6875rem; opacity: .8; }
.playtest-shell .pt-board-tools .button { min-height: 1.75rem; padding: .15rem .4rem; border-color: transparent; color: var(--muted); font-size: .6875rem; line-height: 1.2; }
.pt-battlefield { grid-column: 1; grid-row: 2; position: relative; z-index: 0; min-width: 0; min-height: 0; overflow: auto; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--surface) 65%, transparent), transparent 75%); }
.pt-battlefield-canvas { position: relative; width: 100%; min-height: 100%; }
.pt-battlefield-empty { position: absolute; inset: 0; display: grid; padding: 1rem; place-items: center; color: var(--muted); pointer-events: none; }
.pt-battlefield-empty p { margin: 0; font-family: var(--font-display); font-size: 1.1rem; opacity: .65; }
.pt-battlefield.is-drop-target, .pt-hand-cards.is-drop-target { box-shadow: inset 0 0 0 2px var(--focus); background-color: color-mix(in srgb, var(--focus) 6%, var(--surface)); }
.is-browsing .pt-battlefield { display: none; }
.pt-detail-panel { grid-column: 1; grid-row: 2; position: relative; z-index: 1; display: flex; justify-self: end; width: calc(280px - .75rem); min-width: 0; min-height: 0; flex-direction: column; gap: 1rem; overflow-y: auto; padding: .75rem 1rem 1rem; border-left: 1px solid var(--line); background: var(--surface); }
#playtest-app:is([data-detail-mode="player"], [data-detail-mode="card"], [data-detail-mode="token"]) .pt-detail-panel { align-self: start; max-height: calc(100% - 1.25rem); margin: .5rem .75rem .75rem 0; padding: .9rem; gap: .8rem; border: 1px solid var(--line); border-radius: .65rem; }
#playtest-app:is([data-detail-mode="player"], [data-detail-mode="card"], [data-detail-mode="token"]) .pt-detail-heading { padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.pt-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pt-detail-heading h2 { margin: 0; font-size: .8125rem; font-weight: 650; }
.pt-detail-heading .pt-panel-close { flex: 0 0 2rem; width: 2rem; min-height: 2rem; padding: .4rem; }
.pt-counter-card-name { margin: 0 0 .6rem; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.pt-add-counter { display: grid; gap: .45rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.pt-add-counter > label, .pt-add-counter .field-group > label { font-size: .6875rem; color: var(--muted); }
.pt-add-counter-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.playtest-shell .pt-add-counter select, .playtest-shell .pt-add-counter input, .playtest-shell .pt-add-counter .button { width: 100%; min-height: 2rem; font-size: .75rem; }
.pt-token-panel > summary { display: none; }
.pt-token-panel .form-stack { gap: .75rem; }
.pt-token-panel label { color: var(--muted); font-size: .6875rem; font-weight: 500; }
.playtest-shell .pt-token-panel input, .playtest-shell .pt-token-panel .button { min-height: 2rem; font-size: .75rem; }
.pt-token-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pt-zone-panel { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: .65rem; min-width: 0; min-height: 0; padding: .5rem 1rem 1rem; background: var(--surface); }
.pt-zone-panel .pt-dialog-heading { justify-content: space-between; margin: 0; }
.pt-zone-panel h2 { margin: 0; font-size: .875rem; font-weight: 600; }
.pt-zone-panel .icon-button { display: grid; width: 2rem; height: 2rem; min-height: 0; padding: .4rem; place-items: center; border-color: transparent; background: transparent; }
#pt-zone-search { display: block; width: 100%; min-height: 2.25rem; font-size: .8125rem; }
.pt-zone-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .8rem; align-content: start; min-height: 0; overflow-y: auto; padding: .3rem; }
.pt-zone-cards .pt-card { width: 100%; height: auto; aspect-ratio: 5 / 7; }
.pt-zone-cards > p { grid-column: 1 / -1; padding: 1rem; color: var(--muted); font-size: .8125rem; text-align: center; }
.pt-card-panel { grid-row: 2; display: flex; align-items: center; gap: 1rem; min-width: 0; min-height: 48px; overflow: hidden; padding: .4rem 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-muted) 45%, var(--surface)); }
#playtest-app:not(.has-selection) .pt-card-panel { display: none; }
.pt-card-panel > h2 { flex: 0 0 auto; margin: 0; padding-right: .9rem; border-right: 1px solid var(--line); color: var(--muted); font-size: .6875rem; font-weight: 550; }
.pt-card-actions { display: flex; flex: 1; align-items: center; justify-content: flex-start; min-width: 0; gap: .35rem; overflow-x: auto; }
.pt-card-actions:empty { display: none; }
.pt-card-actions > * { flex-shrink: 0; }
.playtest-shell .pt-card-actions .button { min-height: 2.25rem; padding: .35rem .65rem; border-color: transparent; background: transparent; font-size: .75rem; }
.playtest-shell .pt-card-actions .button:hover { background: var(--surface-muted); }
.playtest-shell .pt-card-actions .pt-card-primary { color: var(--focus); background: var(--accent-soft); }
.playtest-shell .pt-card-actions [data-action="magnify"][aria-pressed="true"] { color: var(--focus); background: var(--accent-soft); }
.playtest-shell .pt-deselect-card { flex: 0 0 2rem; width: 2rem; min-height: 2rem; padding: .4rem; border-color: transparent; color: var(--muted); background: transparent; }
.playtest-shell .pt-deselect-card:hover { color: var(--text); background: var(--surface-muted); }
.pt-hand-dock { grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; min-width: 0; min-height: 0; padding: 0 1rem; }
.pt-hand-shelf { display: grid; grid-template-rows: 20px minmax(0, 1fr); min-width: 0; min-height: 0; }
.pt-hand-heading { display: flex; align-items: center; height: 34px; padding-block: 5px; }
.pt-hand-heading h2 { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .75rem; font-weight: 600; }
.pt-hand-stage { position: relative; min-width: 0; min-height: 0; }
.pt-hand-cards { position: relative; isolation: isolate; display: flex; align-items: center; justify-content: flex-start; height: 100%; min-width: 0; min-height: 0; padding: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.pt-hand-cards::-webkit-scrollbar { display: none; }
/* Give the empty spacers height so they contribute to Firefox's scrollable area. */
.pt-hand-cards::before, .pt-hand-cards::after { content: ""; flex: 0 0 calc(50% - 48px); align-self: stretch; }
.pt-hand-navigation { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); }
.pt-hand-navigation[data-direction="-1"] { left: .25rem; }
.pt-hand-navigation[data-direction="1"] { right: .25rem; }
.pt-card { position: relative; display: block; flex: 0 0 var(--pt-card-width); width: var(--pt-card-width); height: var(--pt-card-height); padding: 0; border: 0; border-radius: 6px; background: #202722; box-shadow: 0 3px 9px #0002; cursor: pointer; text-align: left; transition: transform .16s ease, box-shadow .16s ease; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pt-card img, .pt-card-image { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; pointer-events: none; }
.pt-card img { user-select: none; -webkit-user-drag: none; }
.pt-card-fallback { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; flex-direction: column; gap: .5rem; padding: .6rem; border: 5px solid #273b2e; border-radius: inherit; color: var(--text); background: var(--surface-muted); font-family: var(--font-display); font-size: .85rem; text-align: center; overflow-wrap: anywhere; }
.pt-card-fallback > span { color: var(--muted); font-family: var(--font-ui); font-size: .625rem; }
.pt-card:focus-visible, .pt-card.is-selected { outline: 3px solid var(--focus); outline-offset: 3px; }
:is(.pt-hand-cards, .pt-opening-cards) > .pt-card { border-radius: 4px; }
:is(.pt-hand-cards, .pt-opening-cards) > .pt-card:is(:focus-visible, .is-selected) { outline: 2px solid var(--focus); outline-offset: 1px; }
.pt-card-counter-badges { position: absolute; right: -.25rem; bottom: .5rem; display: flex; align-items: flex-end; flex-direction: column; gap: .15rem; max-width: calc(100% + .5rem); pointer-events: none; }
.pt-card-preview { position: fixed; z-index: 500; aspect-ratio: 488 / 680; overflow: hidden; border: 1px solid var(--line-strong); border-radius: .65rem; background: var(--surface); box-shadow: 0 1rem 3rem #0006; pointer-events: none; }
.pt-card-preview[hidden] { display: none; }
.pt-card-preview.is-magnified { pointer-events: auto; cursor: zoom-out; }
.pt-card-preview > img { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: contain; }
.pt-card-preview .pt-card-fallback { font-size: 1.4rem; }
.pt-card-preview .pt-card-fallback > span { font-size: .875rem; }
.pt-card-counter { display: block; min-width: 0; min-height: 0; max-width: 100%; overflow: hidden; padding: .15rem .4rem; font: 700 .625rem/1.35 var(--font-ui); text-overflow: ellipsis; white-space: nowrap; }
.pt-token-badge { position: absolute; top: .4rem; left: .35rem; padding: .15rem .35rem; border: 1px solid var(--line); border-radius: .3rem; color: var(--text); background: var(--surface); font-size: .5rem; font-weight: 700; pointer-events: none; }
.pt-battlefield .pt-card { position: absolute; top: var(--card-y, 24px); left: var(--card-x, 24px); z-index: 1; transform: rotate(0deg); }
.pt-battlefield .pt-card.is-tapped { transform: rotate(90deg); }
.pt-battlefield .pt-card:hover, .pt-battlefield .pt-card:focus-visible { z-index: 5; box-shadow: 0 7px 22px #0003; }
.pt-hand-cards > .pt-card { flex-basis: 96px; width: 96px; height: 134px; z-index: var(--fan-z, 1); transform: translateY(min(var(--fan-y, 0px), 6px)) rotate(clamp(-5deg, var(--fan-angle, 0deg), 5deg)); transform-origin: center 120%; }
.pt-hand-cards > .pt-card + .pt-card { margin-left: -18px; }
.pt-hand-cards > .pt-card:hover, .pt-hand-cards > .pt-card:focus-visible, .pt-hand-cards > .pt-card.is-selected { z-index: 20; transform: translateY(-5px) rotate(0deg); box-shadow: 0 9px 24px #0003; }
.pt-hand-cards.is-large-hand, .pt-opening-cards.is-large-hand { justify-content: safe center; }
.pt-hand-cards.is-large-hand > .pt-card + .pt-card { margin-left: .5rem; }
.pt-card.is-dragging { z-index: 100; opacity: .45; }
.pt-zone-dock { display: flex; align-items: flex-start; gap: 1rem; min-width: 0; padding-block: 5px; }
.pt-library-cluster { display: grid; grid-template-columns: repeat(3, 86px); grid-template-rows: 116px 28px; column-gap: .75rem; row-gap: 8px; align-items: start; padding-left: 1rem; border-left: 1px solid var(--line); }
.pt-zone { display: flex; flex-shrink: 0; align-items: center; justify-content: flex-start; flex-direction: column; gap: 8px; min-width: 0; padding: 0; border: 0; border-radius: .35rem; color: var(--text); background: transparent; font-size: .6875rem; }
.pt-zone:hover, .pt-zone.is-active { border-color: transparent; background: transparent; }
.pt-zone-heading, .pt-library-heading { display: flex; align-items: center; justify-content: center; gap: .3rem; min-height: 24px; white-space: nowrap; }
.pt-zone-count { display: inline-grid; min-width: 1rem; height: 1rem; place-items: center; border-radius: .2rem; color: var(--muted); background: var(--surface-muted); font-size: .625rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.pt-zone-preview { display: grid; width: 60px; height: 84px; overflow: hidden; place-items: center; border: 0; border-radius: .3rem; outline: 1px dashed var(--line); color: var(--muted); }
.pt-zone-preview .pt-card { width: 100%; height: 100%; border-radius: inherit; box-shadow: none; }
.pt-zone-preview .pt-card.is-selected { outline: none; }
.pt-zone-empty { color: var(--muted); font-size: .625rem; }
.pt-command-zone { align-self: flex-start; margin-right: .15rem; }
.pt-command-zone .pt-zone-preview { width: 96px; height: 134px; border: 0; outline: 1px dashed color-mix(in srgb, var(--focus) 45%, var(--line)); }
.pt-graveyard-zone, .pt-exile-zone { display: grid; grid-template-rows: 24px 84px; justify-items: center; width: 86px; }
.pt-library-well { display: grid; grid-template-rows: 116px 28px; justify-items: center; gap: 8px; grid-row: 1 / 3; width: 86px; }
.pt-library-search { display: grid; grid-template-rows: 24px 84px; justify-items: center; width: 86px; }
.pt-library-heading { flex-direction: row; min-height: 24px; padding: 0; }
.pt-library-heading svg { color: var(--muted); }
.pt-library-stack { position: relative; display: block; width: 60px; height: 84px; border-radius: .3rem; outline: 1px solid var(--line); }
.pt-card-back { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; border: 1px solid #858a92; border-radius: inherit; background: linear-gradient(145deg, #353a42, #22252a 55%, #181a1d); box-shadow: inset 0 1px 0 #ffffff24; }
.pt-card-back::before { position: absolute; inset: 5px; border: 1px solid #c7cbd126; border-radius: .15rem; content: ""; }
.pt-card-back img { width: 28px; height: 28px; }
.pt-card-back > span { position: absolute; bottom: 9px; color: #e5e8ec; font-family: var(--font-display); font-size: .36rem; }
.pt-library-controls { display: flex; gap: 4px; width: 86px; }
.playtest-shell .pt-library-controls .button { min-height: 28px; padding: .2rem .25rem; font-size: .6875rem; }
.playtest-shell .pt-library-controls .pt-draw-caption { gap: .2rem; width: 54px; border-color: color-mix(in srgb, var(--focus) 35%, var(--line)); color: var(--focus); background: var(--accent-soft); }
.pt-library-controls [data-action="shuffle"] { flex: 0 0 28px; width: 28px; height: 28px; padding: .25rem; }
.pt-sideboard-zone { grid-column: 2 / 4; grid-row: 2; flex-direction: row; align-self: stretch; align-items: center; justify-content: center; justify-self: center; min-height: 28px; padding: .2rem .5rem; color: var(--muted); font-size: .6875rem; }
.pt-sideboard-zone:hover, .pt-sideboard-zone.is-active { color: var(--text); background: var(--surface-muted); }
.pt-zone:has(.pt-zone-preview):focus-visible, .pt-library-search:focus-visible { outline: none; }
.pt-zone:hover .pt-zone-preview, .pt-zone.is-active .pt-zone-preview, .pt-zone.is-drop-target .pt-zone-preview,
.pt-library-search:hover .pt-library-stack, .pt-library-search.is-active .pt-library-stack, .pt-library-well.is-drop-target .pt-library-stack { outline: 1px solid var(--focus); }
.pt-zone:focus-visible .pt-zone-preview, .pt-library-search:focus-visible .pt-library-stack { outline: 2px solid var(--focus); outline-offset: 2px; }
.pt-counters-panel { grid-row: 4; display: flex; align-items: center; gap: .75rem; min-width: 0; overflow: hidden; padding: 0 1rem; border-top: 1px solid var(--line); }
.playtest-shell .pt-mana-label, .playtest-shell .pt-player-counters-action { flex: 0 0 auto; min-height: 1.8rem; padding: .2rem .3rem; color: var(--muted); font-size: .6875rem; }
.pt-counters { display: flex; flex: 1; align-items: center; gap: .5rem; height: 100%; min-width: 0; overflow-x: auto; }
.pt-counter-row { display: grid; grid-template-columns: minmax(0, 1fr) 1.75rem 2.5rem 1.75rem; align-items: center; gap: .2rem; min-width: 0; }
.pt-counter-row label { display: flex; align-items: center; gap: .4rem; font-size: .75rem; }
.playtest-shell .pt-counter-row > button { display: grid; width: 1.75rem; height: 2rem; min-height: 0; padding: .1rem; place-items: center; border-color: transparent; background: transparent; font-size: 1rem; }
.playtest-shell .pt-counter-row > button:hover { background: var(--surface-muted); }
.playtest-shell .pt-counter-row > input { width: 100%; min-height: 2rem; padding: .2rem; font-size: .75rem; text-align: center; font-variant-numeric: tabular-nums; }
:is(#pt-player-counters, #pt-card-counters) { display: flex; flex-direction: column; gap: .25rem; }
:is(#pt-player-counters, #pt-card-counters) .pt-counter-row { grid-template-columns: minmax(0, 1fr) 2rem 2.75rem 2rem; gap: .2rem; min-height: 44px; }
:is(#pt-player-counters, #pt-card-counters) .pt-counter-label { font-size: .8125rem; overflow-wrap: anywhere; }
.playtest-shell :is(#pt-player-counters, #pt-card-counters) .pt-counter-row > button { width: 2rem; height: 2rem; font-size: 1rem; }
.playtest-shell :is(#pt-player-counters, #pt-card-counters) .pt-counter-row > input { min-height: 2rem; height: 2rem; padding: .2rem; border-radius: .4rem; font-size: .8125rem; }
.playtest-shell :is(#pt-player-counters, #pt-card-counters) input:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.pt-counters .pt-counter-row { flex: 0 0 auto; grid-template-columns: auto 1.1rem 1.5rem 1.1rem; gap: .1rem; }
.pt-counters .pt-counter-row > button { width: 1.1rem; height: 1.75rem; font-size: .875rem; }
.pt-counters .pt-counter-row > input { min-height: 1.75rem; padding: .1rem; border-color: transparent; background: transparent; font-size: .75rem; }
.pt-counters .pt-counter-row > input:hover, .pt-counters .pt-counter-row > input:focus-visible { border-color: var(--line); }
.pt-counters .pt-counter-label { position: relative; margin-right: .2rem; white-space: nowrap; }
.pt-counters .pt-mana-counter .pt-counter-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.pt-counters .ms { font-size: .875rem; }
.pt-counters > .button { flex: 0 0 auto; min-height: 1.8rem; padding: .2rem .4rem; border-color: transparent; background: transparent; font-size: .6875rem; }
.pt-battlefield, .pt-detail-panel, .pt-zone-cards, .pt-counters, .pt-card-actions, .pt-zone-dock { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.pt-opening-panel { display: flex; min-height: 100%; align-items: center; justify-content: center; flex-direction: column; padding: 2rem 1rem; overflow-x: hidden; text-align: center; }
.pt-opening-heading h2 { margin: 0; font-family: var(--font-display); font-size: 1.8rem; font-weight: 400; }
.pt-opening-heading p { margin: .6rem 0 0; color: var(--muted); font-size: .8125rem; }
.pt-opening-stage { position: relative; flex: 0 0 auto; width: 100%; min-width: 0; margin: 1rem 0 .1rem; }
.pt-opening-cards { position: relative; isolation: isolate; display: flex; justify-content: flex-start; width: 100%; min-height: 227px; padding: 2.3rem 0 3rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.pt-opening-cards::-webkit-scrollbar { display: none; }
.pt-opening-cards::before, .pt-opening-cards::after { content: ""; flex: 0 0 calc(50% - 63px); }
.pt-opening-cards .pt-card { flex-shrink: 0; width: 126px; height: 176px; flex-basis: 126px; transform: translateY(var(--fan-y, 0px)) rotate(var(--fan-angle, 0deg)); }
.pt-opening-cards .pt-card + .pt-card { margin-left: -9px; }
.pt-opening-cards .pt-card:hover, .pt-opening-cards .pt-card:focus-visible, .pt-opening-cards .pt-card.is-selected { z-index: 5; transform: translateY(-10px); }
.pt-opening-bottom-status { min-height: 1.4rem; margin: .5rem 0 1rem; color: var(--pt-green); font-size: .8125rem; font-weight: 600; }
.pt-opening-actions { justify-content: center; gap: .6rem; }
.pt-opening-actions .button { min-height: 2.5rem; font-size: .8125rem; }
.pt-button-count { display: grid; min-width: 1.3rem; height: 1.3rem; padding-inline: .2rem; place-items: center; border-radius: .3rem; background: var(--surface-muted); font-size: .6875rem; }
.is-opening .pt-table { display: block; overflow-y: auto; }
.is-opening :is(.pt-utility-bar, .pt-game-layout, .pt-card-panel, .pt-hand-dock, .pt-counters-panel) { display: none; }
.pt-dialog-heading { justify-content: space-between; gap: .75rem; margin: -.3rem -.3rem .6rem 0; }
.pt-dialog-description { margin: .25rem 0 1.4rem; color: var(--muted); font-size: .8125rem; }
.pt-dialog-actions { justify-content: flex-end; gap: .6rem; margin-top: 1.5rem; }
.pt-popup-body { padding: 1.25rem; }
.pt-keyboard-help { display: flex; flex-wrap: wrap; gap: .65rem 1rem; color: var(--muted); font-size: .6875rem; }
.pt-keyboard-help > p { flex-basis: 100%; margin: 0; line-height: 1.5; }
.pt-keyboard-help > span { display: inline-flex; align-items: center; gap: .4rem; }
.pt-keyboard-help kbd { display: inline-grid; min-width: 1.5rem; height: 1.5rem; padding: .15rem .35rem; place-items: center; border: 1px solid var(--line); border-radius: .25rem; background: var(--surface-muted); color: var(--text); font: .625rem var(--font-ui); }
.pt-session-note { margin: 1.3rem 0 0; color: var(--muted); font-size: .6875rem; text-align: center; }
.pt-empty-deck { display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 1.5rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); text-align: center; }
.pt-empty-deck h2 { margin: 0; font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; }
.pt-empty-deck p { margin: .6rem 0 1.5rem; color: var(--muted); font-size: .8125rem; }
.pt-notice { padding: 1rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); font-size: .8125rem; }
@media (min-width: 90rem) { .playtest-shell { --pt-card-width: 128px; --pt-card-height: 179px; } }
@media (max-width: 64rem) {
    .pt-topbar { gap: .65rem; }
    .pt-title-group > span { display: none; }
    .pt-utility-bar { gap: .65rem; }
    .pt-game-stats { gap: .5rem; }
    .pt-topbar-actions { padding-left: .35rem; }
    .pt-hand-dock { gap: .75rem; }
    .pt-zone-dock { gap: .5rem; }
    .pt-library-cluster { grid-template-columns: repeat(3, 86px); column-gap: .4rem; padding-left: .65rem; }
    .pt-zone { font-size: .625rem; }
}
@media (max-width: 52rem) {
    .pt-detail-panel { justify-self: stretch; width: auto; }
    #playtest-app:is([data-detail-mode="player"], [data-detail-mode="card"], [data-detail-mode="token"]) .pt-detail-panel { max-height: calc(100% - 1rem); margin: .5rem .65rem; }
    .is-editing .pt-battlefield, .is-editing .pt-zone-panel { display: none; }
}
@media (max-width: 48rem) {
    .playtest-shell { --pt-card-width: 102px; --pt-card-height: 142px; }
    .pt-primary-actions { gap: .15rem; }
}
@media (max-width: 47.99rem) {
    .pt-heading { align-items: center; }
}
@media (max-width: 37.5rem), (pointer: coarse) {
    .playtest-shell .pt-card:not([data-context="pile"]):is(:focus-visible, .is-selected) { outline: 2px solid var(--focus); outline-offset: 0; }
    .pt-card-actions { scrollbar-width: none; }
    .pt-card-actions::-webkit-scrollbar { display: none; }
}
@media (max-width: 37.5rem) {
    .playtest-shell { --pt-card-width: 91px; --pt-card-height: 127px; padding-bottom: max(.4rem, env(safe-area-inset-bottom)); }
    .pt-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px minmax(44px, auto); column-gap: .4rem; row-gap: 0; }
    .pt-topbar-actions { grid-column: 2; grid-row: 1; padding-left: 0; border-left: 0; }
    .pt-utility-bar { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; justify-content: space-between; gap: .2rem; }
    .pt-game-stats { gap: .2rem; }
    .pt-turn-indicator > span { font-size: .6875rem; }
    .playtest-shell .pt-life-value input { width: 3ch; min-width: 3ch; font-size: 1.1rem; }
    .pt-primary-actions { gap: .1rem; }
    .playtest-shell .pt-primary-actions .button { min-height: 2rem; padding: .3rem .5rem; }
    .playtest-shell .pt-primary-actions .button:not(.pt-toolbar-icon) { padding-inline: .2rem; }
    .pt-table { border-radius: .6rem; }
    .pt-board-heading { padding-inline: .7rem; }
    .pt-board-heading h2 { font-size: .6875rem; }
    .pt-board-hint { display: none; }
    .pt-detail-panel { padding: .65rem .8rem; border-left: 0; }
    .pt-card-panel { gap: 0; min-height: 44px; padding: .3rem .6rem; }
    .pt-card-panel > h2 { display: none; }
    .pt-card-actions { justify-content: flex-start; min-height: 2rem; gap: .2rem; padding-bottom: .1rem; }
    .playtest-shell .pt-card-actions .button { padding: .3rem .5rem; font-size: .6875rem; }
    .pt-zone-panel { padding: .5rem .65rem .65rem; }
    .pt-zone-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
    .pt-hand-dock { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 76px; grid-template-rows: minmax(0, 1fr); gap: .75rem; padding: 0 .5rem; }
    #playtest-app:not(.is-commander) .pt-hand-dock { grid-template-columns: minmax(0, 1fr); }
    .pt-hand-shelf { grid-template-rows: var(--icon-tap-size) minmax(0, 1fr); }
    .pt-hand-heading { height: auto; padding-block: 0; }
    .pt-hand-heading h2 { font-size: .6875rem; }
    .pt-hand-cards::before, .pt-hand-cards::after { flex-basis: calc(50% - 38px); }
    .pt-hand-cards > .pt-card { flex-basis: 76px; width: 76px; height: 106px; }
    .pt-hand-cards > .pt-card + .pt-card { margin-left: -30px; }
    .pt-hand-cards.is-large-hand > .pt-card + .pt-card { margin-left: .5rem; }
    .pt-zone-dock { display: contents; }
    .pt-zone-dock .pt-zone { display: flex; flex-direction: row; gap: .3rem; width: auto; min-height: 2rem; padding: .3rem .5rem; font-size: .625rem; }
    .pt-library-cluster .pt-zone:hover, .pt-library-cluster .pt-zone.is-active { background: var(--surface-muted); }
    .pt-library-cluster .pt-zone:focus-visible, .pt-library-cluster .button:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
    .pt-zone-preview, .pt-library-stack { display: none; }
    .pt-zone-dock .pt-command-zone { grid-column: 2; grid-row: 1; align-self: end; justify-content: flex-end; flex-direction: column; gap: 0; width: 76px; height: calc(100% - var(--icon-tap-size)); margin: 0; padding: 0 0 10px; border: 0; }
    .pt-command-zone .pt-zone-preview { display: grid; width: 76px; height: 106px; }
    .pt-command-zone .pt-zone-heading { min-height: 16px; font-size: .5625rem; }
    .pt-zone-heading { gap: .25rem; }
    .pt-library-cluster :is(.pt-zone-heading, .pt-library-heading) { min-height: 0; }
    .pt-library-cluster { position: absolute; top: 0; right: .5rem; left: 5.5rem; display: flex; align-items: center; gap: .4rem; height: var(--icon-tap-size); min-width: 0; overflow-x: auto; padding: 0; border-left: 0; scrollbar-width: none; }
    .pt-library-cluster::-webkit-scrollbar { display: none; }
    .pt-library-well { display: flex; flex-shrink: 0; align-items: center; gap: .25rem; width: auto; }
    .pt-library-well.is-drop-target { border-radius: .3rem; background: var(--accent-soft); }
    .pt-library-heading svg { display: none; }
    .pt-library-controls { display: flex; gap: .2rem; width: auto; }
    .playtest-shell .pt-library-controls .button { min-height: 2rem; padding: .3rem .5rem; font-size: .625rem; }
    .pt-sideboard-zone { align-self: center; margin-left: .2rem; }
    .pt-counters-panel { gap: .35rem; padding-inline: .5rem; }
    .playtest-shell .pt-mana-label { padding-inline: 0; font-size: .625rem; }
    .pt-player-counters-action span { display: none; }
    .playtest-shell .pt-player-counters-action { flex: 0 0 var(--icon-tap-size); width: var(--icon-tap-size); padding: .2rem; }
    .pt-counters { gap: .3rem; }
    .pt-opening-panel { padding: 1.5rem .5rem; }
    .pt-opening-heading h2 { font-size: 1.65rem; }
    .pt-opening-heading p { padding-inline: .5rem; font-size: .75rem; }
    .pt-opening-cards { min-height: 181px; padding: 1.5rem 0 1rem; }
    .pt-opening-cards::before, .pt-opening-cards::after { flex-basis: calc(50% - 44px); }
    .pt-opening-cards .pt-card { width: 88px; height: 123px; flex-basis: 88px; }
    .pt-opening-cards .pt-card + .pt-card { margin-left: -43px; }
    .pt-opening-bottom-status { font-size: .75rem; }
    .pt-opening-actions { gap: .45rem; }
    .pt-opening-actions .button { padding-inline: .65rem; font-size: .75rem; }
}
@media (max-width: 63.99rem), (pointer: coarse) {
    .playtest-shell :is(.pt-toolbar-icon, .pt-panel-close, .pt-deselect-card), .pt-zone-panel .icon-button,
    .playtest-shell .pt-library-controls [data-action="shuffle"], .pt-life-control > button {
        flex: 0 0 var(--icon-tap-size);
        width: var(--icon-tap-size);
        min-width: var(--icon-tap-size);
        height: var(--icon-tap-size);
        min-height: var(--icon-tap-size);
    }
    .playtest-shell .pt-player-counters-action { min-width: var(--icon-tap-size); height: var(--icon-tap-size); min-height: var(--icon-tap-size); }
    .pt-table { grid-template-rows: minmax(0, 1fr) auto 176px 45px; }
    .pt-counters .pt-counter-row { grid-template-columns: auto var(--icon-tap-size) 28px var(--icon-tap-size); }
    .playtest-shell .pt-counters .pt-counter-row > button,
    .playtest-shell :is(#pt-player-counters, #pt-card-counters) .pt-counter-row > button { width: var(--icon-tap-size); min-width: var(--icon-tap-size); height: var(--icon-tap-size); min-height: var(--icon-tap-size); }
    :is(#pt-player-counters, #pt-card-counters) .pt-counter-row { grid-template-columns: minmax(0, 1fr) var(--icon-tap-size) 44px var(--icon-tap-size); }
    .pt-library-cluster, .pt-library-well { grid-template-rows: 116px var(--icon-tap-size); row-gap: 6px; }
    .playtest-shell .pt-library-controls .pt-draw-caption { width: 38px; }
}
@media (max-width: 37.5rem) {
    .playtest-shell .pt-library-controls .pt-draw-caption { width: auto; }
}
@media (max-width: 24rem) {
    .pt-utility-bar, .pt-primary-actions { gap: 0; }
    .pt-game-stats { align-items: flex-start; flex-direction: column; gap: 0; }
    .pt-turn-indicator { gap: .2rem; line-height: 1; }
    .pt-turn-indicator strong { font-size: .75rem; }
    .pt-life-control { gap: 0; padding: 0; }
    .pt-life-value { gap: .15rem; }
    .playtest-shell .pt-life-value input { min-height: 1.75rem; font-size: 1rem; }
    .playtest-shell .pt-primary-actions .pt-toolbar-icon { padding: .3rem; }
    .playtest-shell .pt-primary-actions .button:not(.pt-toolbar-icon) { font-size: .6875rem; }
}
@media (prefers-reduced-motion: reduce) { .pt-card { transition: none; } }
@media (max-height: 34rem) {
    .playtest-page { height: auto; min-height: 100dvh; overflow: auto; }
    .playtest-shell { height: auto; min-height: calc(100dvh - 3.6rem - env(safe-area-inset-top)); }
    #playtest-app { height: auto; }
    .pt-table { grid-template-rows: minmax(12rem, 1fr) auto 176px 45px; }
}
