/* One-screen tabletop: page, map, commands and dossiers have separate scroll areas. */
html:has(body[data-ak-ui].in-game.table-game) { height: 100%; overflow: hidden; }
body[data-ak-ui].in-game.table-game { height: 100dvh; min-height: 0; overflow: hidden; margin: 0; }
body.table-game #app { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
body.table-game .topbar { flex: 0 0 46px; height: 46px; min-height: 46px; padding: 0 14px; }
body.table-game .game-hud { flex: 0 0 46px; height: 46px; padding: 0 16px; gap: 20px; }
#app .table-workspace { --dock-height: 52px; position: relative; flex: 1; min-height: 0; min-width: 0; width: 100%; display: grid; grid-template-columns: minmax(0,1fr) 304px; grid-template-rows: minmax(0,1fr) var(--dock-height); overflow: hidden; }
#app .table-playfield { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; height: auto; padding: 8px 14px 0; position: relative; overflow: hidden; }
#app .table-playfield .phasebar { flex: none; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 0 5px; }
#app .table-playfield .phasebar > div:first-child { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
#app .table-playfield .phasebar .eyebrow { display: none; }
#app .table-playfield .phase-title { font-size: 15px; line-height: 1.35; }
#app .table-playfield .phase-title span { display: block; font-size: 10px; margin: 2px 0 0; }
#app .table-playfield .phase-track { margin: 0; gap: 8px; flex: none; }
#app .table-playfield .phase-track li { font-size: 10px; gap: 4px; }
#app .table-playfield .round { font-size: 25px; line-height: 1; }
#app .table-playfield .round small { font-size: 10px; }
#app .table-playfield .turn-order { flex: none; margin: 0; padding: 2px 0; gap: 5px; min-height: 32px; overflow: auto; }
#app .table-playfield .turn-seat { min-height: 30px; padding: 4px 9px; white-space: nowrap; }
#app .table-playfield .turn-seat small { font-size: 9px; }
#app .table-playfield > .bot-status { display: none; }
#app .table-playfield .map-toolbar { flex: none; display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 36px; margin: 2px 0; font-size: 10px; }
#app .table-playfield .map-toolbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app .table-playfield .map-toolbar > div { display: flex; flex: none; }
#app .table-playfield .map-toolbar button { min-height: 32px; min-width: 34px; padding: 3px 8px; }
#app .table-playfield .map-viewport { flex: 1; min-height: 0; height: auto; max-height: none; overflow: auto; overscroll-behavior: contain; user-select: none; }
#app .table-playfield .map-viewport #map-scale { min-width: 0; min-height: 0; height: 100%; }
#app .table-playfield .map-viewport .map-svg.original-board { min-width: 0; width: 100%; height: 100%; display: block; }
#app .table-playfield .map-legend { flex: none; margin: 0; padding: 4px 0; min-height: 20px; font-size: 9px; }
#app .table-playfield > .help-bar { display: none; }
#app .table-playfield > .selected-info { position: absolute; z-index: 4; left: 22px; bottom: 32px; width: min(420px, calc(100% - 44px)); max-width: calc(100% - 44px); max-height: 140px; overflow: auto; margin: 0; padding: 10px 12px; background: #292620f0; border: 1px solid #b79b61; color: #f0e3c8; font-size: 12px; box-shadow: 0 5px 20px #0005; }
#app .table-playfield > .selected-info b { color: #ffe1a0; }
#app .table-commands { grid-column: 2; grid-row: 1; display: block; position: relative; top: auto; align-self: stretch; width: auto; min-height: 0; min-width: 0; height: auto; max-height: none; overflow: auto; overscroll-behavior: contain; padding: 12px; border-left: 1px solid #655740; background: #34302a; }
#app .table-commands .section-heading { margin: 12px 0; }
#app .table-commands .section-heading h3 { font-size: 17px; }
#app .table-commands .choice-list { overflow: visible; max-height: none; }
#app .table-commands .actions { display: grid; grid-template-columns: 1fr; gap: 7px; }
#app .table-commands .action-button { min-height: 48px; padding: 9px 10px; display: flex; flex-wrap: wrap; align-items: center; text-align: left; }
#app .table-commands .main-action { display: block; }
#app .table-commands .main-action strong { display: block; font-size: 13px; }
#app .table-commands .main-action small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; font-weight: 400; }
#app .table-commands .main-action.unavailable { opacity: 1; color: #bfb6a3; background: #2b2925; border-color: #5e574b; cursor: default; }
#app .table-commands .main-action.unavailable strong { color: #c3baa7; }
#app .table-commands .action-group h4 small { display: block; font-size: 10px; line-height: 1.5; }
#app .table-commands .action-conditions { border-top: 1px solid #76664d; margin-top: 14px; padding-top: 6px; font-size: 11px; }
#app .table-commands .action-conditions summary { padding: 10px 0; cursor: pointer; }
#app .table-commands .selection-preview { position: relative; margin: 10px 0; padding: 12px; }
#app .table-commands .preview-illustration { max-height: 130px; overflow: hidden; }
#app .table-commands .selection-preview .full-card-effect { max-height: none; overflow: visible; }
#app .table-commands .confirmation-bar { position: sticky; bottom: -12px; z-index: 3; display: grid; gap: 5px; padding: 10px 0 3px; background: #39342c; }
#app .table-commands .confirmation-bar button { min-height: 44px; width: 100%; margin: 0; }
#app .table-commands .action-form { padding: 12px 0; }
#app .table-commands .action-form > button[type="submit"] { position: sticky; bottom: 0; min-height: 44px; z-index: 3; width: 100%; }
#app .table-commands .card-field .card-row { display: flex; flex-direction: column; overflow: visible; }
#app .table-commands .card-radio { min-width: 0; width: 100%; }
#app .table-commands .card-radio .game-card { min-width: 0; width: 100%; }
#app .table-commands .other-players { margin-top: 16px; }
#app .table-dock { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: stretch; justify-content: center; gap: 4px; height: var(--dock-height); padding: 4px 12px; border-top: 1px solid #8d7852; background: #27241f; z-index: 12; overflow-x: auto; overscroll-behavior: contain; }
#app .table-dock button { flex: 0 1 126px; min-width: 60px; min-height: 44px; color: #eee0c5; background: #3a342b; border: 1px solid #695b43; border-radius: 3px; font-size: 12px; padding: 6px 10px; white-space: nowrap; }
#app .table-dock button[aria-expanded="true"] { border-color: #edc76e; color: #ffe19b; background: #51432d; }
#app .table-dock b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 10px; background: #d4b36d; color: #28241e; }
#app .table-dock .command-toggle, #app .mobile-command-close { display: none; }
#app .table-library { position: absolute; z-index: 10; left: 0; right: 304px; bottom: var(--dock-height); grid-area: auto; margin: 0; padding: 0; height: min(56dvh, 560px); max-height: calc(100% - var(--dock-height) - 40px); min-height: 0; display: none; flex-direction: column; overflow: hidden; border-top: 2px solid #b89b60; background: #e7decb; box-shadow: 0 -12px 38px #0008; }
#app .table-workspace[data-library-open="true"] .table-library { display: flex; }
#app .table-library .drawer-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex: none; min-height: 54px; padding: 5px 16px; background: #322d25; color: #f0e3ca; }
#app .table-library .drawer-heading strong { display: block; font-size: 14px; }
#app .table-library .drawer-heading small { display: block; font-size: 10px; color: #cbbd9f; margin-top: 2px; }
#app .table-library .drawer-heading button { min-height: 44px; min-width: 64px; padding: 6px 12px; color: #f5e2b5; border: 1px solid #a28b5d; background: #51442e; }
#app .table-library .library-content { display: block; position: static; flex: 1; min-height: 0; height: auto; max-height: none; overflow: auto; overscroll-behavior: contain; padding: 14px 18px 22px; border: 0; box-shadow: none; color: #302a22; background: #e7decb; }
#app .table-library .library-content[hidden] { display: none; }
#app .table-library .card-row { display: flex; flex-wrap: nowrap; gap: 14px; height: auto; max-height: none; overflow: visible; padding: 3px 0 14px; align-items: flex-start; }
#app .table-library .game-card { flex: 0 0 220px; width: 220px; max-height: none; height: auto; min-height: 310px; }
#app .table-library .game-card.role-card { flex-basis: 238px; width: 238px; min-height: 360px; height: auto; }
#app .table-library .game-card.company-choice-card { flex-basis: 310px; width: 310px; min-height: 0; }
#app .table-library .card-zone-heading { margin-bottom: 10px; flex-wrap: wrap; gap: 3px 12px; }
#app .table-library .card-zone-heading span, #app .table-library .board-subtitle, #app .table-library .muted { color: #66583f; }
#app .table-library .city-bench { min-height: 0; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(180px, 230px); gap: 16px; }
#app .table-library .city-layout { min-width: 0; gap: 6px; }
#app .table-library .city-cell { min-height: 82px; }
#app .table-library .expansion-workbench { min-width: 0; }
#app .table-library .company-grid { grid-template-columns: repeat(2,minmax(260px,1fr)); }
#app .table-library .company-level-effect { overflow: visible; max-height: none; }
@media (max-width: 1000px) and (min-width: 761px) {
  #app .table-workspace { grid-template-columns: minmax(0,1fr) 280px; }
  #app .table-library { right: 280px; }
  #app .table-playfield .phase-track { display: none; }
  #app .table-playfield .turn-seat small { display: none; }
}
@media (max-width: 760px) {
  body.table-game .topbar { flex-basis: 44px; height: 44px; min-height: 44px; padding: 0 8px; gap: 5px; }
  body.table-game .topbar .brand { min-width: 0; flex-shrink: 0; }
  body.table-game .topbar .brand-mark, body.table-game .topbar .brand b > span, body.table-game .topbar .room-id-label { display: none; }
  body.table-game .topbar .brand b { font-size: 12px; }
  body.table-game .topbar .top-meta { display: flex; flex-wrap: nowrap; gap: 2px; min-width: 0; overflow-x: auto; }
  body.table-game .topbar .top-meta button.ak-button { min-width: 44px; min-height: 44px; height: 44px; padding: 3px 5px; font-size: 11px; }
  body.table-game .game-hud { flex-basis: 72px; height: 72px; padding: 4px 10px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 22px 38px; gap: 2px 6px; }
  body.table-game .hud-player { grid-column: 1; grid-row: 1; font-size: 11px; }
  body.table-game .hud-player b { max-width: 110px; }
  body.table-game .hud-score { grid-column: 2; grid-row: 1; font-size: 10px; }
  body.table-game .hud-score > b { font-size: 16px; }
  body.table-game .hud-score span { margin-left: 5px; padding-left: 5px; }
  body.table-game .hud-resources { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: space-between; gap: 4px; }
  body.table-game .hud-resources .resource { display: flex; flex-direction: row; font-size: 9px; gap: 2px; }
  body.table-game .hud-resources .resource strong { font-size: 17px; }
  body.table-game .hud-resources .resource-icon { width: 22px; height: 22px; }
  #app .table-workspace { --dock-height: calc(56px + env(safe-area-inset-bottom,0px)); grid-template-columns: minmax(0,1fr); }
  #app .table-playfield { display: flex; padding: 5px 7px 0; }
  #app .table-playfield .phasebar { min-height: 38px; }
  #app .table-playfield .phasebar > div:first-child { display: block; }
  #app .table-playfield .phase-track { display: none; }
  #app .table-playfield .phase-title { font-size: 13px; }
  #app .table-playfield .phase-title span { font-size: 9px; }
  #app .table-playfield .round { font-size: 23px; }
  #app .table-playfield .turn-order { min-height: 28px; max-height: 32px; }
  #app .table-playfield .turn-order > small, #app .table-playfield .turn-seat small { display: none; }
  #app .table-playfield .turn-seat { font-size: 10px; padding: 4px 7px; min-height: 26px; }
  #app .table-playfield .map-toolbar { min-height: 44px; gap: 3px; }
  #app .table-playfield .map-toolbar > span { max-width: 120px; font-size: 9px; }
  #app .table-playfield .map-toolbar button { min-height: 44px; min-width: 44px; padding: 4px; }
  #app .table-playfield .map-legend { min-height: 24px; font-size: 8px; gap: 2px 7px; }
  #app .table-playfield .map-legend > span:nth-child(n+3) { display: none; }
  #app .table-commands { display: none; position: absolute; z-index: 11; grid-area: auto; right: 0; left: 0; bottom: var(--dock-height); top: auto; height: min(72dvh, 620px); max-height: calc(100% - var(--dock-height) - 24px); border-top: 2px solid #c5a465; border-left: 0; padding: 10px 14px; box-shadow: 0 -14px 40px #0009; }
  #app .table-workspace[data-mobile-tab="commands"] .table-commands { display: block; }
  #app .mobile-command-close { display: block; min-height: 44px; width: 100%; background: #4c412f; color: #f3deb0; border: 1px solid #a88e59; }
  #app .table-dock { padding: 4px 4px calc(4px + env(safe-area-inset-bottom,0px)); gap: 3px; justify-content: flex-start; }
  #app .table-dock button { flex: 1 0 44px; min-width: 44px; padding: 4px 3px; font-size: 11px; }
  #app .table-dock .command-toggle { display: block; flex-basis: 60px; color: #ffde8d; }
  #app .table-library { left: 0; right: 0; height: min(65dvh, 570px); max-height: calc(100% - var(--dock-height) - 20px); }
  #app .table-library .drawer-heading { padding: 5px 10px; }
  #app .table-library .drawer-heading strong { font-size: 13px; }
  #app .table-library .library-content { padding: 12px 12px 24px; }
  #app .table-library .game-card, #app .table-library .game-card.role-card { flex-basis: 238px; width: 238px; min-height: 320px; }
  #app .table-library .game-card.company-choice-card { flex-basis: 290px; width: 290px; }
  #app .table-library .city-bench { display: flex; flex-direction: column; min-width: 0; width: 100%; }
  #app .table-library .city-cell { min-height: 86px; }
  #app .table-library .company-grid { grid-template-columns: minmax(260px,1fr); }
}
@media (max-height: 620px) {
  #app .table-playfield .turn-order { display: none; }
  #app .table-library { height: calc(100% - var(--dock-height) - 10px); max-height: calc(100% - var(--dock-height) - 10px); }
}
@media (prefers-reduced-motion: reduce) {
  body.table-game *, body.table-game *::before, body.table-game *::after { scroll-behavior: auto; animation-duration: 0s; transition-duration: 0s; }
}

/* Card dossiers keep full-size text; explicit paging avoids repeated wheel panning. */
#app .table-library.company-drawer { height: min(65dvh, 660px); }
#app .table-library .card-pager { display: flex; gap: 5px; margin-left: auto; flex-shrink: 0; }
#app .table-library .card-pager button { min-height: 44px; min-width: 78px; padding: 5px 9px; }
#app .table-library .card-zone-heading { min-height: 18px; margin-bottom: 6px; }
#app .table-library .company-choice-card .company-level { padding: 7px 7px; gap: 7px; }
#app .table-library .company-choice-card .company-level-heading { margin-bottom: 3px; }
#app .table-library .company-choice-card .company-level-effect { line-height: 1.55; }
#app .table-commands [data-do="open-choices"] { display: block; min-height: 44px; width: 100%; margin-top: 12px; padding: 8px 12px; color: #f5dc9c; background: #51432e; border: 1px solid #bf9c53; border-radius: 3px; font-size: 13px; }
#app .table-commands [data-do="open-choices"]:hover { background: #685332; }
@media (max-width: 760px) {
  #app .table-library .drawer-heading { flex-wrap: wrap; gap: 4px 6px; }
  #app .table-library .drawer-heading > div:first-child { flex: 1 1 calc(100% - 82px); }
  #app .table-library .drawer-heading > button { order: 1; }
  #app .table-library .card-pager { order: 2; width: 100%; justify-content: space-between; margin-left: 0; }
  #app .table-library .card-pager button { flex: 1; }
}

#app .table-commands .confirmation-bar button:not(.primary) { color: #f2e6ca; background: #51483a; border-color: #b6a07a; }
#app .table-commands .confirmation-bar button:not(.primary):hover { background: #6a5941; }

/* Compact main choices leave quick actions within reach without shrinking their text. */
#app .table-commands .action-group.main > .actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
#app .table-commands .main-action { min-width: 0; padding: 8px; }
#app .table-commands .main-action.available { color: #30291f; }
#app .table-commands .main-action.available strong, #app .table-commands .main-action.available small { color: #30291f; }
#app .table-commands .main-action.available small { line-height: 1.45; }
#app .table-playfield .turn-seat { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; height: 30px; min-height: 30px; }
#app .table-playfield .turn-seat small { white-space: nowrap; flex-shrink: 0; }
#app .table-playfield .turn-seat small:empty { display: none; }

/* The city grid uses its real column count and stays inside the dossier width. */
#app .table-library[data-library-tab="city"] { height: min(65dvh,660px); }
#app .table-library[data-library-tab="city"] .library-content { padding-top: 10px; padding-bottom: 14px; }
#app .table-library .specimen-stage { min-width: 0; padding: 8px; }
#app .table-library .specimen-lintel { margin-bottom: 6px; padding-bottom: 6px; font-size: 10px; }
#app .table-library .city-cell { min-width: 0; min-height: 80px; display: flex; flex-direction: column; gap: 2px; padding: 5px; }
#app .table-library .city-cell small { font-size: 9px; line-height: 11px; }
#app .table-library .city-cell b { font-size: 11px; line-height: 14px; overflow-wrap: anywhere; }
#app .table-library .city-cell .city-facility-icon { height: 32px; min-height: 32px; padding: 0; margin: 0; flex: none; }
#app .table-library .sample-tray { margin-top: 8px; padding-top: 8px; gap: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  #app .table-library .city-layout { --city-cell-min: 0px; width: 100%; min-width: 0; gap: 4px; }
  #app .table-library[data-library-tab="city"] .library-content { padding: 8px; }
  #app .table-library .specimen-stage { padding: 6px; width: 100%; box-sizing: border-box; }
  #app .table-library .city-cell { padding: 4px; }
  #app .table-library .review-dock { min-width: 0; width: 100%; box-sizing: border-box; }
}
/* Resource text is content, even where the legacy mobile rule hides arrow spans. */
#app .table-commands .main-action .resource-inline { display: inline-flex; align-items: center; color: inherit; }
#app .table-commands .main-action .resource-inline > span { display: inline; color: inherit; }
