/* Spider Solitaire — painted cards, one celestial table, every screen. */
:root {
  color-scheme: dark;
  --paper: #211828; --paper-deep: #17121f; --ink: #f6ebd2; --muted: #baa9bc;
  --line: #c1a66c32; --forest: #493355; --forest-dark: #24192e;
  --gold: #e8ca80; --gold-deep: #c6a45e; --card-paper: #161221;
  --red: #e78993; --black: #dbe0ed;
  --sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html { min-width: 0; }
body { margin: 0; min-width: 0; color: var(--ink); background-color: #17101e; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a, select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, .pile:focus-visible, .card:focus-visible { outline: 3px solid #f3d58b; outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
img { display: block; max-width: 100%; }
.ui-icon { width: 19px; height: 19px; flex-shrink: 0; object-fit: contain; }
.app-shell { max-width: 1200px; margin: 0 auto; padding: 0 42px; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 102px; border-bottom: 1px solid var(--line); gap: 20px; }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: inherit; }
.brand-mark { width: 49px; height: 52px; flex-shrink: 0; object-fit: contain; filter: drop-shadow(0 2px 8px #b9974730); }
.brand-name { font-family: var(--serif); font-weight: 400; font-size: 29px; letter-spacing: -.7px; line-height: 1.05; color: #f4deb0; text-shadow: 0 2px 12px #0008; }
.brand-caption { display: block; margin-top: 7px; font-size: 9px; font-weight: 500; letter-spacing: 2.4px; text-transform: uppercase; color: #c2ad8d; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; background: #29202fbd; color: var(--ink); border: 1px solid #bca17052; border-radius: 10px; box-shadow: inset 0 1px #f5db9210, 0 3px 12px #0002; transition: background .18s, border-color .18s, box-shadow .18s; }
.icon-button .ui-icon { width: 23px; height: 23px; }
.icon-button:hover { background: #493452; border-color: #dcbd7c; box-shadow: 0 0 18px #d1ab4220; }
.primary-button, .new-game-button, .dialog-actions .primary, .button-primary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 20px; border: 1px solid #d5b671; border-radius: 8px; background: #5b3a50; color: #ffedc5; font-size: 12px; font-weight: 600; box-shadow: inset 0 1px #fff0b71c, 0 3px 15px #0003; transition: background .18s, border-color .18s, box-shadow .18s; }
.primary-button .ui-icon, .new-game-button .ui-icon { width: 18px; height: 18px; }
.primary-button:hover, .new-game-button:hover, .button-primary:hover { background: #75495e; border-color: #f4d991; box-shadow: inset 0 1px #fff0b728, 0 0 20px #d7ad4820; }
.intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 20px; padding: 34px 0 24px; }
.eyebrow { flex-basis: 100%; margin: 0 0 11px; font-size: 10px; font-weight: 500; letter-spacing: 2.3px; text-transform: uppercase; color: #d8b979; }
.intro-title { margin: 0; font-family: var(--serif); font-size: 39px; font-weight: 400; letter-spacing: -1.35px; line-height: 1.15; color: #f7e5bf; text-shadow: 0 2px 15px #0008; }
.intro-copy { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: #c3b2bd; }
.intro-ornament { display: flex; align-items: center; gap: 18px; opacity: .88; }
.intro-ornament img { width: 28px; height: 28px; object-fit: contain; }
.intro-ornament .ornament-star { width: 22px; height: 22px; }
.control-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 0 20px; }
.mode-control { display: inline-flex; padding: 4px; background: #15101ddd; border: 1px solid #ad926448; border-radius: 8px; gap: 2px; box-shadow: inset 0 1px 5px #0004; }
.mode-option { border: 0; border-radius: 5px; min-height: 35px; padding: 0 17px; background: transparent; color: #b3a0b3; font-size: 11px; font-weight: 600; transition: background .18s, color .18s, box-shadow .18s; }
.mode-option.active { background: #5b3e57; color: #ffdf9c; box-shadow: inset 0 0 0 1px #c4a36962, 0 2px 5px #0003; }
.mode-option:hover { color: #f9dfa8; }
.stats { display: flex; align-items: center; gap: 30px; }
.stat { display: flex; align-items: baseline; gap: 9px; }
.stat-label { color: #bca5b2; text-transform: uppercase; letter-spacing: 1.5px; font-size: 9px; font-weight: 500; }
.stat-value { font-family: var(--serif); color: #f6dfac; font-size: 19px; font-weight: 400; font-variant-numeric: tabular-nums; min-width: 24px; letter-spacing: -.4px; }
.table-shell { position: relative; padding: 23px 29px 0; border: 1px solid #d4b47066; border-radius: 12px; background-color: #073f36; background-image: url('assets/table-celestial.webp'); background-size: cover; background-position: center; background-repeat: no-repeat; background-blend-mode: normal; box-shadow: 0 20px 55px #0008, inset 0 0 0 4px #cbb77709, inset 0 1px #f4d79220; }
.table-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 23px; }
.table-tag { display: inline-flex; align-items: center; color: #e2c796; font-size: 9px; letter-spacing: 2px; font-weight: 500; text-transform: uppercase; }
.live-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; background: url('assets/ui/star.png') center / contain no-repeat; }
.table-note { color: #c5b4c9; font-size: 10px; letter-spacing: .35px; }
.table-scroll { min-width: 0; max-width: 100%; }
.mobile-table-controls, .mobile-pan-controls { display: none; }
.game-board { position: relative; container-type: inline-size; --gap: 10px; --card-width: calc((100cqw - var(--gap) * 9) / 10); --card-height: calc(var(--card-width) * 272 / 192); isolation: isolate; }
.top-piles, .tableau { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--gap); }
.top-piles { height: var(--card-height); margin-bottom: 27px; }
.pile { position: relative; min-width: 0; border-radius: 7px; }
.pile.stock, .pile.waste, .pile.foundation { height: var(--card-height); }
.tableau { align-items: start; }
.tableau-pile { min-height: 330px; }
.pile-placeholder { position: absolute; top: 0; left: 0; width: 100%; height: var(--card-height); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 7px; color: #d4bf9d; background: url('assets/ui/slot.webp') center / 100% 100% no-repeat; transition: box-shadow .18s, background-color .18s; }
.placeholder-symbol { display: block; width: clamp(22px, 4cqw, 43px); height: clamp(22px, 4cqw, 43px); object-fit: contain; opacity: .55; }
.placeholder-symbol .ui-icon { width: 100%; height: 100%; }
.placeholder-label { color: #d3bfa9; font-size: 8px; text-transform: uppercase; letter-spacing: 1.5px; text-align: center; opacity: .75; }
.waste .placeholder-label { max-width: 65px; line-height: 1.7; text-transform: none; letter-spacing: .3px; font-size: 10px; }
.tableau-pile .placeholder-symbol { width: 28px; height: 28px; opacity: .28; }
.stock { cursor: pointer; }
.stock:hover .face-down { box-shadow: 0 0 0 1px #f0d486, 0 5px 18px #e3bd3830; }
.stock:hover .pile-placeholder { background-color: #cdb27310; }
.stock-count { position: absolute; right: 6px; bottom: 6px; z-index: 3; display: grid; place-items: center; min-width: 23px; height: 23px; padding: 0 5px; border: 1px solid #d7b974; border-radius: 6px; background: #231831e8; color: #ffe5aa; box-shadow: 0 1px 5px #0005; font-size: 10px; font-weight: 600; }
/* Complete raster frames contain the artwork, gilded rim and rank marks. */
.card { position: absolute; top: var(--offset, 0px); left: 0; width: 100%; height: var(--card-height); padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--ink); box-shadow: 0 1px 3px #0005, 0 4px 10px #0006; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; overflow: hidden; transition: box-shadow .15s; }
.card-sprite { position: absolute; inset: 0; display: block; background-size: 500% 400%; background-repeat: no-repeat; pointer-events: none; }
.card:hover:not(.face-down) { box-shadow: 0 0 0 1px #f1d690, 0 5px 15px #0008; }
.card.face-down { cursor: default; }
.card.selected { box-shadow: 0 0 0 3px #f2d38a, 0 0 22px #e8c57565, 0 5px 15px #0008; z-index: 60; }
.card.hinted { box-shadow: 0 0 0 3px #ffe3a2, 0 0 26px #f4ce795e; }
.pile.landing-hint .pile-placeholder, .card.landing-hint, .pile-placeholder.landing-hint { background-color: #e8cf841a; box-shadow: 0 0 0 2px #e8cf84b3; }
.pile.landing-hint .card:last-child { box-shadow: 0 0 0 2px #ffe0a1, 0 0 20px #e8cf844d; }
.pile.drop-target .pile-placeholder { background-color: #e8cf842b; box-shadow: 0 0 0 2px #e8cf84; }
.card.drag-source { opacity: .25; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 200; container-type: normal; transform: none; filter: drop-shadow(0 10px 10px #0007); }
.drag-ghost .card { transition: none; width: 100%; }
body[data-table-theme='midnight'] .game-window { border-color: #c3cce1aa; }
body[data-table-theme='burgundy'] .game-window { border-color: #e4ad7bbb; }
body[data-table-theme='midnight'] .in-game-menu-button { background-color: #172d3beb; border-color: #bdc8dda0; }
body[data-table-theme='burgundy'] .in-game-menu-button { background-color: #472a36eb; border-color: #d9ab82a0; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
body.reduce-motion .celebration { display: none; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 57px; margin-top: 14px; border-top: 1px solid #d1b68b24; }
.table-tip { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 10px; line-height: 1.6; color: #d0bdd3; }
.tip-icon { display: block; flex-shrink: 0; width: 16px; height: 16px; object-fit: contain; }
.tip-icon .ui-icon { width: 100%; height: 100%; }
.progress-count { white-space: nowrap; color: #d2bd9e; font-size: 10px; font-variant-numeric: tabular-nums; }
.action-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 19px; }
.action-divider { height: 20px; width: 1px; margin: 0 3px; background: #bda27244; }
.tool-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; color: #ecdac0; border: 1px solid #b69a6766; background: #2b2135dc; border-radius: 7px; font-size: 11px; font-weight: 500; box-shadow: inset 0 1px #f4ddb510, 0 3px 12px #0003; transition: background .18s, border-color .18s, box-shadow .18s; }
.tool-button:hover:not(:disabled) { background: #4a3450; border-color: #ddbd7b; box-shadow: 0 0 17px #cfb46618; }
.tool-button:disabled { opacity: .4; }
.tool-icon { display: block; width: 18px; height: 18px; flex-shrink: 0; object-fit: contain; }
.shortcut { margin-left: 6px; color: #c6b397; font-family: var(--sans); font-size: 9px; border: 1px solid #a892613e; border-radius: 3px; min-width: 16px; height: 16px; line-height: 14px; text-align: center; }
.status-line { margin: 11px 0 0; min-height: 18px; text-align: center; font-size: 11px; color: #c3aec6; line-height: 1.5; }
.below-board { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 0 28px; }
.below-board > span { font-size: 8px; font-weight: 500; letter-spacing: 1.8px; color: #b7a18b; }
.howto-link { display: inline-flex; align-items: center; gap: 6px; padding: 3px; background: transparent; border: 0; color: #c5b3bd; font-size: 10px; text-decoration: none; }
.howto-link:hover { color: #ffe0a0; }
.howto-link > span { color: #e5c78b; border-bottom: 1px solid #bca16c70; padding-bottom: 2px; }
.howto-link .ui-icon { width: 15px; height: 15px; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 22px 0 25px; border-top: 1px solid var(--line); font-size: 9px; color: #baa58d; letter-spacing: .4px; }
.site-footer p { margin: 0; line-height: 1.7; }
.footer-suits, .win-ornament { display: flex; align-items: center; justify-content: center; gap: 12px; }
.footer-suits img { width: 18px; height: 18px; object-fit: contain; }
.modal { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 30px; border: 1px solid #d4b4778c; border-radius: 14px; background: #211a2bef; color: var(--ink); box-shadow: 0 25px 80px #000a, inset 0 0 0 4px #e1ba6608; }
.modal::backdrop { background: #110b19c9; backdrop-filter: blur(5px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-header .icon-button { width: 36px; height: 36px; min-width: 36px; }
.modal-title { margin: 0; font-family: var(--serif); font-size: 29px; font-weight: 400; letter-spacing: -.7px; color: #f7dfaf; }
.modal-title + .modal-copy { margin-top: 14px; }
.modal-copy { margin: 0 0 20px; color: #c2b0c7; font-size: 13px; line-height: 1.7; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.dialog-actions button { min-height: 44px; padding: 0 18px; border: 1px solid #a9916870; border-radius: 6px; font-size: 12px; background: #2a2135; color: #e9d4b2; }
.dialog-actions .primary, .dialog-actions .primary-button, .dialog-actions .button-primary { background: #5b3a50; color: #ffedc5; border-color: #d5b671; }
.rules-list { list-style: none; padding: 0; margin: 0; counter-reset: rules; }
.rules-item { position: relative; padding: 15px 0 15px 37px; border-top: 1px solid var(--line); color: #c8b6cc; font-size: 12px; line-height: 1.65; }
.rules-item::before { counter-increment: rules; content: '0' counter(rules); position: absolute; left: 0; top: 17px; color: #d5b677; font-size: 10px; font-weight: 600; }
.rules-item strong { color: #f1dab4; }
.rules-item > span { display: block; margin-top: 3px; }
.small-copy { margin-top: 18px; font-size: 11px; color: #b39cba; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 0; border-top: 1px solid var(--line); font-size: 12px; }
.setting-label { color: var(--ink); line-height: 1.7; }
.setting-label small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.setting-row select { min-height: 40px; max-width: 165px; padding: 0 27px 0 12px; color: #f1dba9; background: #181120; border: 1px solid #ae926466; border-radius: 6px; font-size: 12px; }
.checkbox-row { display: flex; align-items: center; min-height: 40px; gap: 10px; font-size: 12px; color: var(--ink); }
.checkbox-row input { width: 17px; height: 17px; accent-color: #8e627f; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; padding: 13px 21px; border: 1px solid #d4b677; border-radius: 8px; background: #2a1d35f5; color: #ffdf9e; box-shadow: 0 8px 28px #0007; z-index: 300; font-size: 12px; line-height: 1.6; text-align: center; }
.celebration { position: fixed; inset: 0; z-index: 100; overflow: hidden; pointer-events: none; }
.celebration span { position: absolute; top: -20px; width: 18px; height: 18px; background: url('assets/ui/star.png') center / contain no-repeat; animation: starlight-fall 2.8s ease-in forwards; }
.win-ornament { margin: 17px 0; gap: 18px; }
.win-ornament img { width: 38px; height: 38px; object-fit: contain; }
@keyframes starlight-fall { to { transform: translateY(105vh); opacity: .1; } }
@media (min-width: 1440px) { .app-shell { padding-inline: 30px; } .intro { padding-top: 41px; } }
@media (min-width: 851px) and (max-height: 820px) {
  .app-shell { max-width: 860px; padding-inline: 42px; }
  .site-header { min-height: 60px; }
  .brand-name { font-size: 24px; }
  .brand-caption { margin-top: 4px; font-size: 8px; }
  .brand-mark { width: 34px; height: 38px; }
  .intro { padding: 12px 0 11px; }
  .intro .eyebrow { display: none; }
  .intro-title { font-size: 30px; line-height: 1.1; letter-spacing: -.8px; }
  .intro-copy { margin-top: 5px; font-size: 11px; line-height: 1.4; }
  .intro-ornament { gap: 13px; }
  .intro-ornament img { width: 23px; height: 23px; }
  .control-bar { padding-bottom: 11px; }
  .mode-control { padding: 3px; }
  .mode-option { min-height: 30px; font-size: 10px; padding-inline: 14px; }
  .stat-value { font-size: 17px; }
  .table-shell { padding: 14px 18px 0; }
  .table-topline { margin-bottom: 12px; }
  .table-tag { font-size: 8px; }
  .table-note { font-size: 9px; }
  .game-board { --gap: 12px; }
  .top-piles { margin-bottom: 14px; }
  .tableau-pile { min-height: 210px; }
  .table-footer { min-height: 37px; margin-top: 7px; }
  .table-tip, .progress-count { font-size: 9px; }
  .action-bar { margin-top: 10px; }
  .status-line { margin-top: 7px; font-size: 10px; }
  .below-board { padding: 10px 0 15px; }
  .site-footer { padding: 14px 0 17px; }
}
@media (max-width: 850px) {
  .app-shell { padding-inline: 25px; }
  .site-header { min-height: 90px; }
  .intro { padding-top: 29px; gap: 11px 16px; }
  .intro-title { font-size: 34px; }
  .intro-copy { font-size: 12px; }
  .intro-ornament { display: none; }
  .stats { gap: 20px; }
  .stat { gap: 7px; }
  .table-shell { padding: 21px 23px 0; }
  .game-board { --gap: 12px; }
  .tableau-pile { min-height: 290px; }
  .pile-placeholder { gap: 7px; }
  .placeholder-label { font-size: 7px; letter-spacing: 1px; }
}
@media (max-width: 600px) {
  body { background-attachment: scroll; }
  .app-shell { padding: 0 16px; }
  .site-header { min-height: 68px; gap: 10px; }
  .brand { gap: 8px; flex-shrink: 0; }
  .brand-mark { width: 31px; height: 38px; flex-shrink: 0; }
  .brand-name { font-size: 23px; letter-spacing: -.7px; white-space: nowrap; }
  .brand-caption { font-size: 7px; letter-spacing: 1.7px; margin-top: 6px; white-space: nowrap; }
  .header-actions { gap: 6px; flex-shrink: 0; }
  .header-actions #rules-button { display: none; }
  .header-actions .icon-button { width: 40px; height: 44px; border: 0; background: transparent; box-shadow: none; }
  .new-game-button, .header-actions .primary-button { padding-inline: 13px; font-size: 11px; gap: 6px; white-space: nowrap; }
  .intro { display: block; padding: 14px 0 12px; }
  .intro .eyebrow { display: none; }
  .eyebrow { font-size: 8px; letter-spacing: 1.7px; margin-bottom: 10px; }
  .intro-title { font-size: 28px; letter-spacing: -.8px; line-height: 1.12; }
  .intro-copy { margin-top: 6px; font-size: 10px; line-height: 1.5; }
  .intro-ornament { display: none; }
  .control-bar { gap: 10px; padding-bottom: 10px; }
  .mode-control { padding: 3px; }
  .mode-option { min-height: 38px; padding: 0 11px; font-size: 10px; }
  .stats { gap: 16px; }
  .stat { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .stat-label { font-size: 7px; letter-spacing: 1px; }
  .stat-value { font-size: 17px; text-align: right; }
  .table-shell { padding: 12px 13px 0; border-radius: 9px; }
  .table-topline { margin-bottom: 10px; }
  .table-tag { font-size: 7px; letter-spacing: 1.3px; }
  .live-dot { width: 8px; height: 8px; margin-right: 5px; }
  .table-note { font-size: 8px; }
  .mobile-table-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: -3px 0 8px; padding-bottom: 7px; border-bottom: 1px solid #d1b68b24; }
  .mobile-table-controls > span, .mobile-view-label { color: #d7bd93; font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; }
  .mobile-view-options { display: inline-flex; gap: 4px; }
  .mobile-table-controls button { min-height: 44px; padding: 0 12px; border: 1px solid #b59a6659; border-radius: 6px; background: #241a31; color: #cbb8cc; font-size: 10px; font-weight: 600; }
  .mobile-table-controls button[aria-pressed='true'] { border-color: #d8b879; background: #604255; color: #ffe2a0; box-shadow: inset 0 1px #f6dcac18; }
  .table-scroll { width: 100%; overflow-x: auto; overflow-y: hidden; padding: 4px 3px 12px; scrollbar-width: thin; scrollbar-color: #bd9b68 #1c1427; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .table-scroll::-webkit-scrollbar { height: 6px; }
  .table-scroll::-webkit-scrollbar-track { background: #1c1427; border-radius: 4px; }
  .table-scroll::-webkit-scrollbar-thumb { background: #bd9b68; border-radius: 4px; }
  .game-board { --gap: 6px; }
  body:not([data-mobile-cards='fit']) .game-board { width: max(100%, 774px); min-width: 774px; --gap: 6px; }
  body[data-mobile-cards='fit'] .game-board { width: 100%; min-width: 0; }
  .mobile-pan-controls { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 2px; }
  .mobile-pan-controls button { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; border: 1px solid #bca1706b; border-radius: 7px; color: #ffe2a5; background: #34243cdc; box-shadow: inset 0 1px #ffe5ae10; }
  .mobile-pan-controls button .ui-icon { width: 23px; height: 23px; }
  .mobile-pan-controls button:disabled { opacity: .35; }
  #mobile-pan-label { flex: 1; margin: 0; color: #ceb8cf; font-size: 10px; line-height: 1.5; text-align: center; }
  body[data-mobile-cards='fit'] .mobile-pan-controls { display: none; }
  .top-piles { margin-bottom: 14px; }
  .tableau-pile { min-height: 265px; }
  .card, .pile, .pile-placeholder { border-radius: 4px; }
  .placeholder-symbol { width: clamp(20px, 5.4cqw, 28px); height: clamp(20px, 5.4cqw, 28px); }
  .placeholder-label { font-size: 5px; letter-spacing: .3px; }
  .waste .placeholder-label { padding: 0 3px; max-width: 40px; font-size: 7px; letter-spacing: 0; line-height: 1.5; }
  .tableau-pile .placeholder-symbol { width: 18px; height: 18px; }
  .stock-count { right: 3px; bottom: 3px; min-width: 17px; height: 17px; padding: 0 3px; font-size: 8px; border-radius: 4px; }
  body:not([data-mobile-cards='fit']) .placeholder-symbol { width: 28px; height: 28px; }
  body:not([data-mobile-cards='fit']) .placeholder-label { font-size: 8px; letter-spacing: .6px; }
  body:not([data-mobile-cards='fit']) .waste .placeholder-label { max-width: 58px; font-size: 9px; }
  body:not([data-mobile-cards='fit']) .tableau-pile .placeholder-symbol { width: 25px; height: 25px; }
  body:not([data-mobile-cards='fit']) .stock-count { min-width: 22px; height: 22px; font-size: 10px; }
  .table-footer { min-height: 48px; margin-top: 12px; gap: 8px; }
  .table-tip { font-size: 8px; gap: 5px; max-width: 75%; }
  .tip-icon { width: 13px; height: 13px; }
  .progress-count { font-size: 8px; }
  .action-bar { margin-top: 15px; gap: 7px; }
  .action-divider { display: none; }
  .tool-button { flex: 1; min-height: 45px; padding: 0 8px; gap: 6px; font-size: 10px; }
  .tool-icon, .tool-button .ui-icon { width: 16px; height: 16px; }
  .shortcut { display: none; }
  .status-line { font-size: 10px; margin-top: 10px; }
  .below-board { padding: 12px 0 24px; }
  .below-board > span { font-size: 6px; letter-spacing: 1.1px; }
  .howto-link { font-size: 8px; gap: 4px; }
  .site-footer { padding: 18px 0 23px; font-size: 8px; }
  .footer-suits { gap: 8px; }
  .footer-suits img { width: 14px; height: 14px; }
  .modal { padding: 23px; }
  .modal-title { font-size: 26px; }
}
@media (max-width: 440px) {
  .brand { min-width: 0; flex-shrink: 1; }
  .brand-name { display: block; font-size: 21px; white-space: normal; max-width: 100px; }
  .brand-mark { width: 26px; }
  .brand-caption { display: none; }
  .header-actions { gap: 2px; }
  .header-actions .icon-button { width: 44px; }
  .new-game-button, .header-actions .primary-button { padding-inline: 8px; font-size: 10px; gap: 5px; }
  .new-game-button .ui-icon { width: 14px; height: 14px; }
}
@media (max-width: 380px) {
  .app-shell { padding-inline: 10px; }
  .stats { gap: 11px; }
  .mode-option { padding-inline: 9px; }
  .table-shell { padding-inline: 9px; }
  .game-board { --gap: 5px; }
  .table-note { font-size: 7px; }
  .table-footer .tip-icon { display: none; }
  .tool-button { padding-inline: 5px; }
  .site-footer { gap: 9px; font-size: 7px; letter-spacing: .1px; }
  .footer-suits { gap: 4px; }
  .footer-suits img { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } .celebration { display: none; } }
@media (pointer: coarse) { .mode-option { min-height: 44px; } .modal-header .icon-button { width: 44px; height: 44px; } }

/* Everything belongs to the bordered game window, including its menus. */
:root {
  --window-top: max(6px, env(safe-area-inset-top, 0px));
  --window-right: max(6px, env(safe-area-inset-right, 0px));
  --window-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  --window-left: max(6px, env(safe-area-inset-left, 0px));
}
html, body { width: 100%; height: 100%; height: 100dvh; min-height: 0; overflow: hidden; overscroll-behavior: none; }
.app-shell { width: 100%; max-width: none; height: 100%; height: 100dvh; min-height: 0; margin: 0; padding: var(--window-top) var(--window-right) var(--window-bottom) var(--window-left); display: flex; overflow: hidden; }
.app-shell > .game-window { position: relative; flex: 1 1 0; width: 100%; height: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; overflow: hidden; border: 1px solid #e2c183ba; border-radius: 12px; background-color: #073f36; background-image: url('assets/table-celestial.webp'); background-position: center; background-size: cover; background-repeat: no-repeat; background-blend-mode: normal; box-shadow: inset 0 0 0 3px #cbb7770b, inset 0 1px #f4d79235, 0 3px 18px #0008; }
.game-chrome { flex: 0 0 44px; min-width: 0; min-height: 44px; height: 44px; display: flex; align-items: center; gap: 14px; }
.in-game-menu-button { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; min-height: 44px; padding: 0 13px; border: 1px solid #c5a97488; border-radius: 7px; background: #281c35eb; color: #f5dba6; box-shadow: inset 0 1px #fff0b715; font-size: 11px; font-weight: 600; }
.in-game-menu-button:hover { background: #49314f; border-color: #f0cf89; }
.in-game-menu-button .ui-icon { width: 23px; height: 23px; }
.in-game-status { flex: 1; min-width: 0; max-height: 32px; margin: 0; overflow: hidden; color: #d7c1d2; font-size: 10px; line-height: 1.5; text-align: right; }
.game-window > .table-scroll { --table-inset: clamp(22px, 3.1vw, 44px); flex: 1 1 0; min-width: 0; min-height: 0; width: calc(100% - var(--table-inset) - var(--table-inset)); margin-inline: var(--table-inset); overflow: auto; padding: 4px 0 8px; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #bd9b68 #1c1427; }
.table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: #1c1427; }
.table-scroll::-webkit-scrollbar-thumb { background: #bd9b68; border-radius: 4px; }
.game-board { min-height: 100%; margin-inline: auto; }
.top-piles { margin-bottom: 12px; }
.tableau-pile { min-height: 0; }
.card:focus-visible { outline-width: 2px; outline-offset: 1px; }
.game-window > .mobile-pan-controls { position: static; flex: 0 0 44px; width: 100%; height: 44px; min-height: 44px; margin: 0; }
.game-window > .site-header, .game-window > .intro, .game-window > .control-bar, .game-window > .action-bar, .game-window > .below-board, .game-window > .site-footer { display: none; }

/* Native dialogs and their dimming layer leave the outer gold border visible. */
.game-window .modal { position: fixed; inset: var(--window-top) var(--window-right) var(--window-bottom) var(--window-left); width: min(440px, calc(100dvw - var(--window-left) - var(--window-right) - 20px)); max-width: calc(100dvw - var(--window-left) - var(--window-right) - 20px); max-height: calc(100dvh - var(--window-top) - var(--window-bottom) - 20px); margin: auto; padding: 16px; overflow-x: hidden; overflow-y: auto; background: #211a2bf5; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bd9b68 #211a2b; }
.game-window .modal::backdrop { position: fixed; inset: max(8px, calc(env(safe-area-inset-top, 0px) + 2px)) max(8px, calc(env(safe-area-inset-right, 0px) + 2px)) max(8px, calc(env(safe-area-inset-bottom, 0px) + 2px)) max(8px, calc(env(safe-area-inset-left, 0px) + 2px)); border-radius: 10px; background: #110b19bb; backdrop-filter: blur(3px); }
.game-window .modal-header { position: sticky; top: 0; z-index: 2; min-height: 44px; padding: 4px 0; background: #211a2b; }
.game-window .modal-header .eyebrow { margin-bottom: 0; }
.game-window .modal-header .icon-button { width: 44px; min-width: 44px; height: 44px; }
.game-window .dialog-actions { position: sticky; bottom: 0; z-index: 2; flex-wrap: wrap; margin-top: 12px; padding: 10px 0 0; background: #211a2b; }
.game-window .dialog-actions button { min-height: 44px; }
.game-window .setting-row { gap: 10px; }
.game-window .setting-row select { min-width: 0; width: 50%; max-width: 160px; min-height: 44px; padding-left: 8px; }
.game-window .checkbox-row { min-height: 44px; }
.game-menu .menu-header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 0; padding: 4px 0 12px; border-bottom: 1px solid var(--line); background: #211a2b; }
.game-menu .menu-header .brand { flex: 1; min-width: 0; gap: 10px; }
.game-menu .brand-mark { width: 42px; height: 44px; max-height: none; }
.game-menu .brand-name { display: block; max-width: none; margin: 0; color: #f4deb0; font-size: 26px; line-height: 1.1; white-space: normal; }
.game-menu .brand-caption { display: block; margin-top: 5px; font-size: 7px; line-height: 1.5; letter-spacing: 1.25px; white-space: normal; }
.game-menu .menu-header .icon-button { flex-shrink: 0; width: 44px; min-width: 44px; height: 44px; }
.game-menu .menu-stats, .game-menu .stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.game-menu .menu-stats .stats { width: 100%; padding: 0; }
.game-menu .stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.game-menu .stat-label { font-size: 8px; letter-spacing: 1.3px; }
.game-menu .stat-value { font-size: 20px; text-align: left; }
.game-menu #deal-label { display: block; margin: 0 0 12px; color: #baa5c2; font-size: 10px; line-height: 1.5; letter-spacing: .6px; }
.game-menu .menu-controls { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.game-menu #new-game-button { width: 100%; min-height: 44px; padding: 0 16px; gap: 8px; font-size: 12px; }
.game-menu #new-game-button .ui-icon { width: 18px; height: 18px; }
.game-menu .action-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; height: auto; min-height: 0; margin: 0; padding: 0; }
.game-menu .action-divider, .game-menu .shortcut { display: none; }
.game-menu .tool-button { display: flex; flex-direction: row; align-items: center; justify-content: center; width: 100%; min-width: 0; height: 44px; min-height: 44px; padding: 0 8px; gap: 6px; font-size: 11px; line-height: 1.3; }
.game-menu .tool-icon, .game-menu .tool-button .ui-icon { width: 18px; height: 18px; }
.game-menu .menu-options { display: flex; flex-direction: column; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.game-menu .menu-section { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.game-menu .menu-section > label, .game-menu .menu-section > h2, .game-menu .menu-section > h3, .game-menu .menu-section > .menu-section-label { margin: 0; color: #d8bc8c; font-size: 10px; font-weight: 500; line-height: 1.4; letter-spacing: .7px; }
.game-menu .mode-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; padding: 3px; gap: 4px; }
.game-menu .mode-option { height: 44px; min-height: 44px; padding: 0 10px; font-size: 11px; }
.game-menu .mobile-table-controls { display: none; margin: 0; padding: 0; border: 0; height: auto; min-height: 0; gap: 6px; }
.game-menu .mobile-table-controls button { min-width: 0; height: 44px; min-height: 44px; padding: 0 10px; white-space: nowrap; font-size: 11px; }
.game-menu .menu-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 0 0; }
.game-menu .menu-links button { min-width: 0; min-height: 44px; padding: 0 8px; border: 1px solid #b59a6659; border-radius: 6px; background: #2a2035; color: #ead2a7; font-size: 11px; }
.game-menu .menu-links button:hover { background: #49324e; border-color: #d8b879; }
.game-menu .menu-links .character-menu-button { grid-column: 1 / -1; color: #ffe1a4; background: #45304b; border-color: #cfad74a6; }
.game-menu .menu-tip { margin: 12px 0 4px; color: #bfa9c5; font-size: 10px; line-height: 1.5; }
.game-menu .menu-progress { margin: 0; color: #d1b88b; font-size: 9px; line-height: 1.5; }
.game-menu #resume-button { position: static; width: 100%; min-height: 44px; margin: 0; }
.game-window .toast { bottom: calc(var(--window-bottom) + 8px); max-width: calc(100dvw - var(--window-left) - var(--window-right) - 24px); max-height: calc(100dvh - var(--window-top) - var(--window-bottom) - 24px); overflow: auto; }
.celebration { inset: calc(var(--window-top) + 2px) calc(var(--window-right) + 2px) calc(var(--window-bottom) + 2px) calc(var(--window-left) + 2px); border-radius: 10px; }

@media (min-width: 601px) {
  .game-menu .menu-section:has(.mobile-table-controls) { display: none; }
}
@media (max-width: 600px) {
  :root { --window-top: max(4px, env(safe-area-inset-top, 0px)); --window-right: max(4px, env(safe-area-inset-right, 0px)); --window-bottom: max(4px, env(safe-area-inset-bottom, 0px)); --window-left: max(4px, env(safe-area-inset-left, 0px)); }
  .app-shell > .game-window { gap: 4px; padding: 6px; border-radius: 9px; background-image: url('assets/table-celestial-mobile.webp'); }
  .game-window .modal::backdrop { inset: max(6px, calc(env(safe-area-inset-top, 0px) + 2px)) max(6px, calc(env(safe-area-inset-right, 0px) + 2px)) max(6px, calc(env(safe-area-inset-bottom, 0px) + 2px)) max(6px, calc(env(safe-area-inset-left, 0px) + 2px)); }
  .game-chrome { gap: 10px; }
  .in-game-menu-button { padding-inline: 11px; }
  .in-game-status { font-size: 9px; }
  .game-window > .mobile-pan-controls { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
  body[data-mobile-cards='fit'] .game-window > .mobile-pan-controls { display: none; }
  .game-menu .mobile-table-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-menu .brand-name { font-size: 23px; }
  .game-menu .brand-mark { width: 35px; }
}
@media (max-height: 480px) {
  .app-shell > .game-window { gap: 4px; padding-block: 5px; }
  .game-window > .table-scroll { padding-top: 2px; padding-bottom: 2px; }
  .top-piles { margin-bottom: 4px; }
  .game-window .modal { padding: 12px; }
  .game-menu .brand-mark { width: 34px; height: 38px; }
  .game-menu .brand-name { font-size: 23px; }
  .game-menu .brand-caption { font-size: 6px; }
}

/* Board shortcuts and voice captions stay within the carved table border. */
.in-game-characters-button { padding-inline: 11px; }
.in-game-ai-button { min-width: 93px; border-color: #e2c283b0; background-color: #3c304beb; color: #ffe7ad; }
.in-game-ai-button[aria-pressed='true'] { border-color: #fff0bd; background-color: #63513deb; box-shadow: 0 0 15px #e8c97b40, inset 0 1px #fff1b51c; }
.in-game-ai-button:disabled { opacity: .5; }
.in-game-training-button { min-width: 130px; }
.in-game-flybys-button { padding-inline: 10px; }
.game-menu #ai-menu-button { color: #ffe2a3; border-color: #d7b673a6; background: #493451; }
.game-menu #training-menu-button { color: #ffe2a3; border-color: #d7b673a6; background: #493451; }
.game-menu #blessing-button { color: #e0d0f5; }
.in-game-music-button { padding-inline: 11px; min-width: 60px; }
.in-game-music-button[aria-pressed='false'] { color: #bba9bf; border-color: #95817c66; background: #19121eea; }
.character-banter { position: absolute; z-index: 85; bottom: 12px; left: clamp(20px, 4vw, 48px); right: clamp(20px, 4vw, 48px); max-width: 720px; margin: 0 auto; padding: 9px 14px; border: 1px solid #c5a57590; border-radius: 8px; background: #21172bea; box-shadow: 0 3px 15px #0007; color: #f3dfb7; font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; pointer-events: none; }
.character-banter:empty { display: none; }
.audio-volume-setting { gap: 10px; }
.audio-volume-setting input { min-width: 0; flex: 1 1 100px; max-width: 155px; accent-color: #cfad74; }
.audio-volume-setting output { flex-shrink: 0; min-width: 32px; color: #e2c48c; font-size: 11px; text-align: right; }
@media (max-width: 600px) {
  .in-game-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .in-game-ai-button { min-width: 0; padding-inline: 7px; gap: 4px; font-size: 10px; }
  .in-game-ai-button .ui-icon { width: 18px; height: 18px; }
  .in-game-characters-button { padding-inline: 9px; gap: 5px; }
  .in-game-characters-button .ui-icon { width: 19px; height: 23px; }
  .in-game-music-button { min-width: 52px; padding-inline: 8px; font-size: 10px; }
  .in-game-status { font-size: 8px; max-height: 30px; }
  .character-banter { bottom: 62px; left: 13px; right: 13px; padding: 7px 10px; font-size: 11px; }
  body[data-mobile-cards='fit'] .character-banter { bottom: 13px; }
}
@media (max-width: 850px) {
  .game-chrome { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; height: 93px; min-height: 93px; flex-basis: 93px; }
  .in-game-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .game-chrome .in-game-menu-button { min-width: 0; width: 100%; padding-inline: 5px; gap: 5px; font-size: 10px; }
  .game-chrome .ui-icon { width: 18px; height: 18px; }
}
@media (max-height: 480px) and (min-width: 650px) {
  .game-chrome { grid-template-columns: repeat(6, minmax(0, 1fr)); height: 44px; min-height: 44px; flex-basis: 44px; }
}

/* The character screen keeps its header and voice controls inside the table. */
.game-window .character-dialog {
  width: min(940px, calc(100dvw - var(--window-left) - var(--window-right) - 20px));
  height: min(680px, calc(100dvh - var(--window-top) - var(--window-bottom) - 20px));
  padding: 20px;
  overflow: hidden;
  background-color: #211a2bf5;
  background-image: url('assets/table-celestial.webp');
  background-size: cover;
  background-position: center;
}
.game-window .character-dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.game-window .character-dialog .character-header { position: static; flex-shrink: 0; align-items: flex-start; margin: 0; padding: 0; background: transparent; }
.character-header > div { min-width: 0; }
.character-header .eyebrow { margin: 0 0 7px; font-size: 9px; letter-spacing: 1.8px; }
.character-header .modal-title { font-size: 31px; line-height: 1.15; }
.character-header .icon-button { flex-shrink: 0; }
.character-gallery-copy { flex-shrink: 0; margin: 0; color: #ecd7b3; font-size: 13px; line-height: 1.6; }
.character-gallery-body { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bd9b68 #211a2b; padding: 5px; }
.character-roster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-content: center; min-height: 100%; }
.character-choice { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; min-height: 44px; padding: 13px 8px; border: 1px solid #cfb27a70; border-radius: 11px; background: #171521e8; color: #fae4b8; box-shadow: inset 0 1px #ffe9b31a, 0 6px 16px #0005; }
.character-choice:hover, .character-choice.selected { border-color: #f5d28a; background: #302339ed; box-shadow: 0 0 15px #ebbb543b; }
.character-art { display: block; position: relative; flex-shrink: 0; width: 100%; aspect-ratio: 192 / 272; overflow: hidden; border-radius: 8px; box-shadow: 0 6px 15px #0008; }
.character-choice-art { width: min(100%, 168px); }
.character-poster { width: 100%; height: 100%; object-fit: contain; }
.character-art .card-sprite[data-art-status='error'], .character-art .card-sprite[data-art-status='loading'] { visibility: hidden; }
.character-choice-name { font-family: var(--serif); font-size: 20px; line-height: 1.2; }
.character-choice-title { color: #d2bc98; font-size: 10px; line-height: 1.4; text-align: center; }
.character-stage { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 28px; align-items: center; margin-bottom: 18px; }
.character-hero { min-width: 0; width: 100%; max-width: 240px; margin: 0 auto; }
.character-hero-art { box-shadow: 0 10px 28px #000a, 0 0 24px #edd09125; }
.character-story { min-width: 0; padding: 17px 20px; border: 1px solid #c5ab765c; border-radius: 12px; background: #191421ed; }
.character-title { margin: 0 0 6px; color: #d7b67c; font-size: 10px; line-height: 1.4; letter-spacing: 1.3px; text-transform: uppercase; }
.character-name { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; color: #ffe4b0; }
.character-name:focus { outline: none; }
.character-description { margin: 0 0 15px; color: #c3b0c5; font-size: 12px; line-height: 1.6; }
.character-introduction { margin: 0 0 18px; color: #f1dfc7; font-family: var(--serif); font-size: 16px; line-height: 1.65; }
.character-voice-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.character-voice-controls button, .character-footer button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 13px; border: 1px solid #cfb2787a; border-radius: 7px; background: #3b2940; color: #f6deae; font-size: 11px; }
.character-voice-controls button:disabled { opacity: .5; }
.character-audio-progress { display: block; width: 100%; height: 5px; margin-top: 13px; accent-color: #e6c17a; border: 0; border-radius: 5px; overflow: hidden; }
.character-audio-progress::-webkit-progress-bar { background: #090912; }
.character-audio-progress::-webkit-progress-value { background: #e6c17a; }
.character-audio-status { min-height: 30px; margin: 8px 0 0; color: #d3ba99; font-size: 10px; line-height: 1.5; }
.has-character .character-roster { min-height: 0; gap: 10px; }
.has-character .character-choice { display: grid; grid-template-columns: 45px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 9px; row-gap: 2px; padding: 8px; text-align: left; }
.has-character .character-choice-art { grid-row: 1 / 3; width: 45px; border-radius: 4px; }
.has-character .character-choice-name { font-size: 14px; align-self: end; }
.has-character .character-choice-title { font-size: 9px; text-align: left; align-self: start; }
.character-footer { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 12px; border-top: 1px solid #c8ad7359; }
.character-narration-setting { display: flex; align-items: center; gap: 8px; min-height: 44px; color: #e9d3ac; font-size: 12px; cursor: pointer; }
.character-narration-setting input { width: 18px; height: 18px; margin: 0; accent-color: #caab74; }
.character-narration-setting input:focus-visible { outline: 3px solid #f3d58b; outline-offset: 3px; }
@media (max-width: 700px) {
  .game-window .character-dialog { width: calc(100dvw - var(--window-left) - var(--window-right) - 12px); max-width: calc(100dvw - var(--window-left) - var(--window-right) - 12px); height: calc(100dvh - var(--window-top) - var(--window-bottom) - 12px); max-height: calc(100dvh - var(--window-top) - var(--window-bottom) - 12px); padding: 12px; }
  .game-window .character-dialog[open] { gap: 10px; }
  .character-header .modal-title { font-size: 25px; }
  .character-header .eyebrow { font-size: 8px; letter-spacing: 1.2px; }
  .character-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-height: 0; }
  .character-choice { padding: 9px 6px; }
  .character-choice-art { width: min(100%, 142px); }
  .character-choice-name { font-size: 18px; }
  .character-choice-title { font-size: 9px; }
  .character-stage { display: flex; flex-direction: column; gap: 15px; margin-bottom: 14px; }
  .character-hero { width: min(58%, 204px); }
  .character-story { width: 100%; padding: 15px; }
  .character-name { font-size: 30px; }
  .character-introduction { font-size: 15px; line-height: 1.6; }
  .has-character .character-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .has-character .character-choice { grid-template-columns: 38px minmax(0, 1fr); }
  .has-character .character-choice-art { width: 38px; }
  .has-character .character-choice-name { font-size: 14px; }
  .character-footer { gap: 6px; padding-top: 6px; }
  .character-footer button { padding-inline: 9px; }
  .character-narration-setting { font-size: 11px; }
}
@media (max-height: 500px) and (min-width: 550px) {
  .character-roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .character-choice-art { width: min(100%, 106px); }
  .character-stage { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: start; gap: 18px; }
  .character-hero { width: 160px; }
  .has-character .character-roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Ten columns retain 72px cards on phones; all scrolling stays within the table. */
.pile.completed-pile { height: var(--card-height); pointer-events: none; }
.completed-pile .placeholder-label { letter-spacing: .6px; }
.completed-pile .placeholder-symbol { width: 28px; height: 28px; }
.game-board { display: flex; flex-direction: column; }
.game-board .tableau { flex: 1; }
.game-board .top-piles { position: relative; flex-shrink: 0; margin-top: 26px; margin-bottom: 5px; }
.completed-summary { position: absolute; top: -19px; left: 0; margin: 0; color: #ecd5a7; font-size: 9px; line-height: 12px; letter-spacing: .5px; }
.completed-pile .pile-placeholder { background: #17102035; border: 1px dashed #d3b88166; color: #d4bf9d; }
.completed-pile .card { box-shadow: 2px 2px 0 #8e764a, 4px 4px 0 #3e304d, 0 4px 10px #0006; }
.completed-badge { position: absolute; bottom: 5px; left: 5px; right: 5px; z-index: 3; padding: 4px 1px; border: 1px solid #d7b97488; border-radius: 4px; background: #231831ed; color: #ffe5aa; font-size: clamp(8px, .8cqw, 11px); text-align: center; }
.game-menu .mode-control { grid-template-columns: repeat(3,minmax(0,1fr)); }
.game-menu .mode-option { min-width: 0; padding-inline: 7px; }
@media (max-width:600px) {
  body:not([data-mobile-cards='fit']) .game-board { width:774px; min-width:774px; --gap:6px; }
  body[data-mobile-cards='fit'] .game-board { width:100%; min-width:0; --gap:3px; }
}
