/* Viewport-sized play surface. Details live in a modal side drawer. */
.view-tool { display: grid; place-items: center; width: 38px; height: 38px; background: transparent; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-size: 23px; letter-spacing: 0; }
.mobile-seats { display: none; }
.chapel-icon { display: block; width: 64px; height: 62px; filter: drop-shadow(0 3px 2px #061c1c66); }
.penalty-visual.stage-5 { height: 66px; }
.sticks:has(.stage-5) .penalty-label { color: #ffe0a3; font-weight: 800; }
.guide-stage .chapel-icon { height: 55px; }
.table-menu { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(420px,100%); height: 100%; height: 100dvh; max-height: 100%; max-width: 100%; border-radius: 16px 0 0 16px; padding: max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom)); overflow: hidden; }
.table-menu[open] { display: flex; flex-direction: column; }
.menu-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.menu-heading h2 { margin: 0; font-size: 26px; }
.menu-heading button { width: 44px; height: 44px; background: transparent; color: var(--ink); font-size: 28px; }
.menu-tabs { display: grid; grid-template-columns: .8fr 1.2fr .8fr; gap: 5px; margin: 12px 0; flex-shrink: 0; }
.menu-tabs button { min-height: 44px; padding: 7px; border-radius: 7px; background: #e8e9dd; color: #49604d; font-size: 11px; letter-spacing: 0; }
.menu-tabs button[aria-pressed="true"] { background: #234d3d; color: #fff0cf; }
.menu-content { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 0 2px 12px; }
.menu-content h3 { font: 19px Georgia,serif; margin: 22px 0 12px; }
.menu-actions { display: grid; gap: 8px; }
.menu-actions .wide { margin: 0; min-height: 44px; }
#menu-players>div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
#menu-players span { text-align: right; font-size: 11px; }
#menu-sound .sound-control { justify-content: flex-start; gap: 16px; }
#menu-sound input { width: 180px; max-width: calc(100% - 64px); }
.menu-content aside { display: block; }
#menu-sound:empty:before { content: 'Control de sonido en la cabecera de la mesa.'; font-size: 12px; color: #64745f; }
.menu-content .reference { padding: 14px; }
.menu-content .history { padding-top: 12px; }
.menu-content .result-losses { font-size: 9px; }
.menu-content .results-table { font-size: 10px; }
.menu-content .results-table .mini-hand { gap: 1px; }
.menu-content .results-table .mini-die { width: 18px; height: 21px; }
.view-message { position: fixed; z-index: 1000; top: max(54px,env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(340px,calc(100% - 24px)); padding: 12px 16px; border-radius: 9px; background: #eee6cd; border: 1px solid #b8a36e; color: #294634; box-shadow: 0 4px 20px #09251f33; font-size: 12px; line-height: 1.5; }
html.compact-ui { height: 100%; overflow: hidden; background: #143c31; }
body.compact-game { position: fixed; inset: 0; height: var(--app-height,100dvh); min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: #f1eee2; }
.compact-game header { flex: 0 0 48px; min-height: 48px; width: 100%; max-width: none; padding: 2px 8px; gap: 4px; }
.compact-game header .brand { font-size: 11px; letter-spacing: 1px; gap: 5px; }
.compact-game .brand-small { display: none; }
.compact-game .brand-icon { font-size: 24px; }
.compact-game header nav { margin-left: auto; display: flex; gap: 3px; font-size: 0; }
.compact-game header nav>.online-dot { display: none; }
.compact-game header #help, .compact-game header #new-game, .compact-game .view-tool { flex: 0 0 40px; width: 40px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; font-size: 0; letter-spacing: 0; }
.compact-game .view-tool { font-size: 24px; }
.compact-game header #help:before { content: '?'; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #48614c; border-radius: 50%; font-size: 16px; }
.compact-game header #help span { display: none; }
.compact-game header #new-game:before { content: '⚙'; font-size: 23px; }
.compact-game main { flex: 1; min-height: 0; max-width: 1100px; width: 100%; padding: 0 6px 6px; display: flex; flex-direction: column; }
.compact-game .intro, .compact-game footer, .compact-game .under-table { display: none; }
.compact-game .play-layout { display: block; height: 100%; min-height: 0; }
.compact-game .table-column { position: relative; height: 100%; display: grid; grid-template-rows: 32px minmax(0,1fr) 78px; gap: 4px; }
.compact-game .table-topline { grid-row: 1; align-items: center; padding: 0 3px; font-size: 14px; letter-spacing: 0; min-width: 0; }
.compact-game .table-topline>span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-game .table-topline>span:last-child { font-size: 11px; letter-spacing: 0; }
.compact-game #table-status { display: flex; flex-direction: column; align-items: flex-end; line-height: 13px; }
.compact-game #table-status small { font-size: 11px; font-weight: 600; }
.compact-game #table { grid-row: 2; height: 100%; min-height: 0; width: 100%; border-width: 5px; border-radius: 17px; --seats-space: 94px; --reference-space: 80px; --action-space: 68px; --hold-height: 64px; --options-height: 40px; --interaction-gap: 32px; }
.compact-game .table-stitch { inset: 7px; }
.compact-game .felt-mark { opacity: .22; top: 50%; }
.compact-game #mobile-seats { position: absolute; z-index: 3; top: 8px; left: 8px; right: 8px; display: grid; grid-template-columns: repeat(var(--players,3),minmax(0,1fr)); gap: 5px; }
.compact-game #opponents { display: contents; }
.compact-game #mobile-seats .opponent, .compact-game #mobile-seats .player-seat { position: relative; inset: auto; transform: none; max-width: none; width: auto; min-width: 0; min-height: 94px; margin: 0; padding: 5px 3px; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 16px 54px 12px; gap: 1px; border: 1px solid #b7c8a639; border-radius: 9px; background: #10382ebd; box-shadow: none; }
.compact-game #mobile-seats .player-seat { order: -1; }
.compact-game #mobile-seats .active { border-color: #dfc386; background: #395b3d; }
.compact-game #mobile-seats .capilla { border-color: #dba55b; background: #59472e; }
.compact-game #mobile-seats .avatar { display: none; }
.compact-game #mobile-seats .player-seat>div:nth-child(2) { display: contents; }
.compact-game #mobile-seats strong:not(.penalty-label) { grid-row: 1; font-size: 11px; line-height: 16px; color: #fff1cf; text-align: center; max-width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-game #mobile-seats small, .compact-game #human-status { grid-row: 3; font-size: 8px; line-height: 12px; margin: 0; padding-right: 20px; letter-spacing: 0; color: #d0ddbe; text-align: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-game #mobile-seats .sticks { grid-row: 2; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 30px 24px; width: 100%; min-width: 0; margin: 0; gap: 0; }
.compact-game #mobile-seats .penalty-visual { grid-column: 1/-1; width: 100%; max-width: 130px; height: 32px; justify-self: center; }
.compact-game #mobile-seats .chapel-icon { width: 42px; height: 37px; }
.compact-game #mobile-seats .penalty-wood { max-width: 130px; height: 34px; }
.compact-game #mobile-seats .no-stick { height: 25px; width: min(90px,100%); padding: 2px; font-size: 7px; }
.compact-game #mobile-seats .penalty-label { grid-row: 2; grid-column: 1; font-size: 10px; line-height: 12px; min-height: 0; max-height: 24px; align-self: center; color: #f3dfb5; white-space: normal; letter-spacing: 0; }
.compact-game #mobile-seats .sticks:has(.stage-5) .penalty-label { font-size: 10px; }
.compact-game #mobile-seats .sticks:after { content: attr(data-losses) '/6'; position: absolute; right: 3px; bottom: 5px; color: #d0d9b8; font-size: 8px; line-height: 12px; }
.compact-game #mobile-seats .loss-meter, .compact-game #mobile-seats .loss-count { display: none !important; }
.compact-game #mobile-seats .stage-5 + .penalty-label { font-weight: 800; color: #ffe1a2; }
.compact-game .pot, .compact-game .table-caption { display: none; }
.compact-game #target-board { position: absolute; top: calc(var(--seats-space) + 14px); left: 50%; right: auto; transform: translateX(-50%); margin: 0; width: calc(100% - 16px); max-width: 480px; padding: 8px; min-height: 80px; gap: 5px 8px; }
.compact-game #target-board .eyebrow { font-size: 9px; margin-bottom: 3px; letter-spacing: 1px; }
.compact-game .target-copy h2 { font-size: 20px; line-height: 1.12; }
.compact-game .target-owner { font-size: 12px; margin-top: 5px; line-height: 1.45; }
.compact-game .target-owner>span { display: flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; }
.compact-game .target-player { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-game .target-owner b { display: inline-block; flex-shrink: 0; font-size: 12px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: #dccb9e; color: #3b482e; white-space: nowrap; }
.compact-game .target-dice .mini-hand { gap: 2px; }
.compact-game .target-dice .mini-die { width: 21px; height: 24px; }
.compact-game .target-comparison { font-size: 11px; max-width: 115px; text-align: right; }
.compact-game #opening-board { position: absolute; z-index: 4; top: calc(var(--seats-space) + 14px); left: 8px; right: 8px; margin: 0; padding: 6px; }
.compact-game #opening-board>.eyebrow { font-size: 9px; letter-spacing: .5px; margin-bottom: 4px; }
.compact-game .opening-players { gap: 4px; }
.compact-game .opening-players>div { flex-direction: column; gap: 2px; padding: 3px; }
.compact-game .opening-players strong { font-size: 11px; }
.compact-game .opening-seat small, .compact-game .pending-face { font-size: 9px; }
.compact-game .opening-progress { font-size: 10px; margin: 3px 0 0; line-height: 1.2; }
.compact-game .opening-tie-note { padding: 3px 5px; margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.compact-game .opening-tie-note>strong { font-size: 9px; }
.compact-game .opening-tie-note p { display: none; }
.compact-game .tied-faces { gap: 4px; margin: 0; font-size: 9px; }
.compact-game .tied-faces .mini-die { width: 15px; height: 17px; }
body.compact-game #table #scene { top: calc(var(--seats-space) + var(--reference-space) + 24px); height: auto; bottom: calc(var(--action-space) + var(--options-height) + var(--hold-height) + var(--interaction-gap)); left: 0; right: 0; }
.compact-game .die-controls.aligned { left: 0; right: 0; bottom: calc(var(--action-space) + var(--options-height) + var(--interaction-gap) - 8px); height: var(--hold-height); }
.compact-game .die-controls.aligned .die-toggle { min-height: var(--hold-height); width: clamp(44px,12.8%,68px); padding: 4px 1px; }
.compact-game .die-number { font-size: 9px; line-height: 10px; margin-bottom: 2px; }
.compact-game .die-value { font-size: 10px; line-height: 11px; }
.compact-game .hold-track { margin: 3px auto 2px; }
.compact-game .hold-label { font-size: 9px; line-height: 10px; }
.compact-game .hold-options { bottom: calc(var(--action-space) + 16px); left: 8px; right: 8px; height: var(--options-height); justify-content: center; gap: 10px; font-size: 12px; }
.compact-game .auto-hold-toggle { min-height: 38px; padding: 6px 10px; font-size: 12px; }
body.compact-game #table .cup-controls { position: absolute; top: auto; bottom: 8px; left: 50%; right: auto; transform: translateX(-50%); width: min(440px,calc(100% - 16px)); display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 44px; align-items: end; }
.compact-game .cup-trigger { width: 100%; min-height: 68px; padding: 6px; flex-direction: row; justify-content: center; align-items: center; gap: 5px; border-radius: 10px; }
.compact-game #roll .cup { width: 32px; height: 43px; margin: 2px 6px 2px 0; flex-shrink: 0; }
.compact-game #roll .cup-mouth { width: 34px; height: 12px; top: -5px; }
.compact-game #roll .cup-mark { margin-top: 22px; font-size: 10px; }
.compact-game #roll .cup-seam { left: 8px; border-width: 1px; }
.compact-game .cup-action { font-size: 14px; line-height: 1.2; }
.compact-game .cup-hint { display: none; }
.compact-game .cup-bank { min-height: 68px; width: 100%; padding: 6px; font-size: 16px; border-radius: 10px; }
body.compact-game #table .cup-controls:has(#bank[hidden]) { grid-template-columns: 1fr; max-width: 220px; }
.compact-game #opening-continue { top: auto; bottom: 8px; left: 8px; right: 8px; transform: none; width: auto; margin: 0; padding: 8px; }
.compact-game #opening-continue>strong { display: none; }
.compact-game #opening-continue>p { margin: 0 0 5px; font-size: 12px; line-height: 1.3; }
.compact-game #start-first-hand { min-height: 48px; padding: 8px; font-size: 14px; }
.compact-game #table[data-phase="opening-result"] .cup-controls { visibility: hidden; }
body.compact-game #table[data-phase^="opening"] #scene { bottom: calc(var(--action-space) + 28px); }
.compact-game #table[data-phase^="opening"] .die-controls { bottom: calc(var(--action-space) + 9px); left: 10px; right: 10px; height: 16px; }
.compact-game .opening-instruction { font-size: 12px; }
.compact-game .action-panel { grid-row: 3; margin: 0; padding: 6px 10px; display: flex; flex-direction: row; align-items: center; gap: 5px; min-height: 0; border-radius: 10px; }
.compact-game .hand-info { min-width: 0; flex: 1; }
.compact-game #hand-label { display: none; }
.compact-game .hand-info strong { font-size: 21px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-game #hand-hint { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12px; line-height: 15px; margin-top: 2px; }
.compact-game .actions { width: auto; flex-shrink: 0; }
.compact-game .roll-dots { gap: 4px; font-size: 10px; }
.compact-game .roll-dots>span { margin-left: 3px; font-size: 12px; font-weight: 700; }
.compact-game #result { position: absolute; z-index: 10; top: calc(24px + var(--seats-space,88px) + 27px); left: 14px; right: 14px; bottom: 140px; overflow: hidden; margin: 0; padding: 16px; border-color: #cbb97f; background: #f0ead8fa; border-radius: 13px; display: flex; flex-direction: column; }
.compact-game #result .results-table { display: none; }
.compact-game #result h2 { font-size: 23px; margin-bottom: 8px; }
.compact-game #result h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex-shrink: 0; }
.compact-game #result[data-phase="finished"]>p, .compact-game #result .match-summary .eyebrow { display: none; }
.compact-game #result .match-summary { min-height: 0; overflow: hidden; }
.compact-game #result>.eyebrow { font-size: 8px; }
.compact-game #result>p:not(.eyebrow) { font-size: 11px; line-height: 1.4; margin: 2px 0 8px; }
.compact-game #result #next { min-height: 44px; width: 100%; margin-top: auto; flex-shrink: 0; }
.compact-game #result .match-summary { margin: 4px 0 10px; padding: 8px; }
.compact-game #result .match-summary p { font-size: 10px; margin: 5px 0; }
.compact-game dialog:not(.table-menu) { max-height: calc(var(--app-height,100dvh) - 20px); overscroll-behavior: contain; }
@media(max-width:390px) {
  /* Long full/repoker names keep two readable lines without inflating the band. */
  .compact-game .target-copy h2 { font-size: 18px; }
}
@media(max-height:650px) {
  .compact-game header { flex-basis: 44px; min-height: 44px; }
  .compact-game .table-column { grid-template-rows: 26px minmax(0,1fr) 56px; gap: 3px; }
  .compact-game #table { --hold-height: 54px; --options-height: 32px; --interaction-gap: 18px; }
  .compact-game .action-panel { padding: 3px 8px; }
  .compact-game #hand-hint { font-size: 10px; line-height: 12px; }
  .compact-game .hand-info { gap: 2px; }
  .compact-game .hand-info strong { font-size: 18px; }
  .compact-game .cup-trigger, .compact-game .cup-bank { min-height: 60px; }
  .compact-game #mobile-seats .opponent, .compact-game #mobile-seats .player-seat { min-height: 82px; grid-template-rows: 14px 48px 10px; padding: 3px 2px; }
  .compact-game #mobile-seats .sticks { grid-template-rows: 24px 24px; }
  .compact-game #mobile-seats .penalty-visual { height: 22px; }
  .compact-game #mobile-seats .penalty-wood { height: 24px; }
  .compact-game #mobile-seats .chapel-icon { height: 26px; width: 30px; }
  .compact-game #mobile-seats .no-stick { height: 20px; }
  .compact-game #mobile-seats .penalty-label, .compact-game #mobile-seats .sticks:has(.stage-5) .penalty-label { font-size: 9px; line-height: 12px; max-height: 24px; }
  .compact-game #target-board { min-height: 70px; padding: 6px; }
  .compact-game .target-copy h2 { font-size: 18px; }
  .compact-game .target-owner { font-size: 11px; margin-top: 3px; }
  .compact-game .target-owner b { font-size: 11px; }
  .compact-game .hold-options { bottom: calc(var(--action-space) + 10px); font-size: 11px; }
  .compact-game .auto-hold-toggle { min-height: 32px; padding: 4px 9px; font-size: 11px; }
  .compact-game .die-controls.aligned .die-toggle { padding: 2px 1px; }
  .compact-game .die-number { font-size: 8px; line-height: 9px; margin-bottom: 1px; }
  .compact-game .die-value { font-size: 9px; line-height: 10px; }
  .compact-game .hold-label { font-size: 9px; line-height: 10px; }
  .compact-game .hold-track { margin: 2px auto 1px; }
  .compact-game #result { bottom: 116px; padding: 10px; }
}
@media(max-height:500px) and (min-width:550px) {
  .compact-game #table-status { flex-direction: row; align-items: center; gap: 8px; }
  .compact-game .table-column { grid-template-rows: 20px minmax(0,1fr); }
  .compact-game .action-panel { display: none; }
  .compact-game #mobile-seats { width: 120px; right: auto; bottom: 8px; grid-template-columns: 1fr; grid-template-rows: repeat(var(--players,3),minmax(0,1fr)); gap: 3px; }
  .compact-game #mobile-seats .opponent, .compact-game #mobile-seats .player-seat { min-height: 0; grid-template-columns: 1fr; grid-template-rows: 10px minmax(0,1fr); padding: 2px 3px; }
  .compact-game #mobile-seats .sticks { grid-row: 2; grid-template-columns: 42px minmax(0,1fr) 16px; grid-template-rows: minmax(0,1fr); }
  .compact-game #mobile-seats .penalty-visual { grid-column: 1; grid-row: 1; height: 23px; }
  .compact-game #mobile-seats .penalty-wood { height: 24px; }
  .compact-game #mobile-seats .penalty-label { grid-column: 2; grid-row: 1; }
  .compact-game #mobile-seats .sticks:after { position: static; grid-column: 3; grid-row: 1; align-self: center; }
  .compact-game #mobile-seats .opponent>small, .compact-game #human-status { display: none; }
  .compact-game #mobile-seats .chapel-icon { height: 28px; width: 32px; }
  .compact-game #target-board, .compact-game #opening-board { top: 8px; left: 136px; right: 8px; width: auto; max-width: none; transform: none; }
  body.compact-game #table #scene { left: 130px; top: calc(var(--reference-space) + 15px); bottom: 118px; height: auto; }
  .compact-game #table[data-phase^="opening"] #scene { bottom: 82px; }
  .compact-game .die-controls.aligned { left: 130px; bottom: 68px; height: 46px; }
  /* Very short landscapes cannot spread the projected dice enough for five
     touch targets. Keep their numbered switches in a clear, separated row. */
  .compact-game .die-controls.aligned { display: flex; align-items: center; justify-content: center; gap: 6px; }
  .compact-game .die-controls.aligned .die-toggle { position: static; transform: none; flex: 0 0 44px; width: 44px; }
  .compact-game .die-number { font-size: 8px; line-height: 9px; margin-bottom: 1px; }
  .compact-game .die-value, .compact-game .hold-label { font-size: 8px; line-height: 9px; }
  .compact-game .die-controls.aligned .die-toggle { min-height: 46px; padding: 2px 1px; }
  .compact-game .hold-track { margin: 2px auto; }
  .compact-game .cup-trigger, .compact-game .cup-bank { min-height: 56px; }
  .compact-game #target-board { min-height: 52px; padding: 5px 7px; }
  .compact-game .target-copy h2 { font-size: 17px; }
  .compact-game #target-board .eyebrow { font-size: 8px; margin-bottom: 1px; }
  .compact-game .target-owner { margin-top: 1px; font-size: 10px; }
  .compact-game .target-owner b { font-size: 10px; padding: 0 3px; }
  .compact-game .target-comparison { font-size: 10px; }
  body.compact-game #table .cup-controls { left: 136px; right: 8px; bottom: 8px; width: auto; max-width: none; transform: none; }
  body.compact-game #table .cup-controls:has(#bank[hidden]) { max-width: none; }
  .compact-game .hold-options { position: fixed; z-index: 7; left: calc(50% - 60px); right: auto; width: 120px; top: max(4px,env(safe-area-inset-top)); bottom: auto; height: 34px; }
  .compact-game .hold-options>span { display: none; }
  .compact-game #opening-continue { left: 136px; }
  .compact-game #table[data-phase^="opening"] .die-controls { left: 136px; bottom: 66px; }
  .compact-game #result { left: 142px; top: 33px; bottom: 116px; }
  .compact-game #result>p:not(.eyebrow), .compact-game #result .eyebrow { display: none; }
  .compact-game #result h2 { font-size: 18px; }
  .compact-game #result .match-summary { display: none; }
}
