/* Compact portrait gameplay; desktop/tablet rules remain in styles.css. */
@media(max-width:480px) {
  .site-header { padding:6px 8px; gap:6px; min-height:42px; }
  .brand { font-size:14px; gap:5px; letter-spacing:-.4px; }
  .brand-mark { width:25px; height:25px; }
  .header-controls { flex-direction:row; gap:4px; }
  .quiet-button { min-height:30px; padding:4px 6px; font-size:9px; }
  main.game-page { padding:0 5px; }
  .game-table { padding:10px 12px 12px; border-radius:24px; }
  .game-table::before { border-width:4px; border-bottom-width:6px; }
  .game-table::after { inset:7px; border-radius:18px; }
  .game-heading { margin:0 0 4px; }
  .game-heading h1 { font-size:30px; gap:10px; margin:0; }
  .title-fish { width:38px; height:30px; }
  .title-waves { width:34px; height:28px; }
  .opponent-heading { gap:5px; margin:0 0 3px; }
  .opponent-heading h2 { font-size:11px; padding:3px 8px; margin:0; }
  .opponent-heading p { font-size:10px; }
  .computer-avatar,.player-avatar { width:28px; height:28px; margin:0; }
  .computer-avatar svg,.player-avatar svg { width:23px; height:23px; }
  .opponent-cards { min-height:66px; gap:5px; }
  .mini-back { width:46px; height:64px; flex-basis:46px; border-width:2px; border-radius:5px; }
  .speech-bubble { position:relative; top:auto; left:auto; transform:none; width:fit-content; max-width:100%; margin:7px auto 3px; padding:6px 10px; font-size:14px; }
  .opponent:has(.speech-bubble:not([hidden])),.opponent:has(.denial-bubble:not([hidden])) { margin-bottom:0; }
  .denial-bubble strong { font-size:20px; margin-bottom:2px; }
  .denial-bubble span { font-size:12px; line-height:1.3; }
  .pool-area { width:min(100%,270px); margin:5px auto; padding-bottom:0!important; }
  .pool { height:130px; }
  .pool-card { width:49px; height:70px; border-width:2px; top:clamp(44px,var(--y),calc(100% - 44px)); left:clamp(44px,var(--x),calc(100% - 44px)); }
  .pool:empty { display:none; }
  .pool-label,.pool-hint { display:none!important; }
  .pool-area:has(.pool-card:not(:disabled)) .pool-hint { display:block!important; margin:3px auto 0; padding:4px 8px; font-size:11px; }
  .start-panel.ready-panel { width:100%; margin:5px auto; }
  .start-panel.ready-panel h2 { font-size:14px; margin:0 0 4px; }
  .start-panel.ready-panel #start-button { min-height:64px; width:240px; font-size:30px; border-radius:18px; }
  .start-panel.ready-panel p { font-size:11px; margin-top:4px; }
  .hand-area { margin-top:4px; }
  .hand-heading { gap:5px; margin-bottom:2px; }
  .hand-heading h2 { min-width:0; margin:0; padding:3px 8px; font-size:11px; }
  .hand-heading h2 span { display:inline; margin-left:4px; font-size:9px; }
  .hand { --card-width:100%; --card-height:84px; --stack-step:14px; display:flex; flex-wrap:wrap; justify-content:center; align-items:flex-end; gap:22px 7px; min-height:0; overflow:visible; padding:18px 6px 8px; }
  .rank-group { width:calc((100% - 35px)/6); flex:0 0 calc((100% - 35px)/6); min-width:0; transform:none!important; }
  .hand:has(.rank-group:nth-child(13)) { --card-height:66px; --stack-step:10px; row-gap:20px; }
  .rank-stack { width:100%; }
  .rank-stack .playing-card { left:calc(var(--stack-index)*2px); border-radius:6px; }
  .card-corner { font-size:17px; left:4px; top:4px; }
  .card-corner small { font-size:13px; margin-top:1px; }
  .card-corner.bottom { right:4px; bottom:4px; }
  .card-suit { font-size:29px; }
  .stack-count { top:-17px; right:0; font-size:9px; padding:2px 4px; }
  .playing-card:not(:disabled):hover { transform:translateY(-5px); }
  .answer-slot { margin-bottom:4px; }
  #no-button { min-width:120px; min-height:36px; padding:4px 16px; font-size:20px; }
  .answer-slot:has(#no-button[hidden]) { display:none; }
  .side-scores { gap:8px; margin-top:6px; }
  .score-seat { display:grid; grid-template-columns:38px minmax(0,1fr); column-gap:4px; align-items:start; }
  .set-score { grid-row:1 / 3; font-size:36px; line-height:1.2; }
  .standing-label { min-height:0; font-size:9px; line-height:1.2; margin:0 0 3px; }
  .score-details { grid-column:2; padding:4px; border-radius:7px; }
  .capture-count { gap:3px; }
  .capture-count span { font-size:9px; }
  .capture-count strong { font-size:16px; }
  .score-books { margin-top:3px; padding-top:3px; }
  .score-books .books-label { font-size:9px; margin-bottom:2px; }
  .book-list { gap:2px; }
  .book { padding:1px 3px; font-size:9px; }
  .no-books { font-size:9px; }
  .table-actions { margin-top:8px; gap:8px; }
  .table-actions .restart-button { min-height:36px; font-size:11px; padding:6px 12px; }
  .quick-rules,.quick-rules.in-depth { top:50px; max-height:calc(100dvh - 66px); }
  /* Reserve the first viewport for gameplay, with advertising in the next row. */
  .game-page__column { display:grid; grid-template-rows:minmax(calc(100svh - 42px),auto) auto; gap:40px; }
  .game-table { align-self:start; }
  .reserved-slot--horizontal { margin-top:0; }
}
@media(max-width:480px) and (max-height:740px) {
  .pool { height:84px; }
  .pool-card { width:44px; height:64px; }
  .hand { --card-height:68px; --stack-step:12px; row-gap:20px; }
  .opponent-cards { min-height:58px; }
  .mini-back { height:56px; width:40px; flex-basis:40px; }
}

/* Keep every gameplay state in the same portrait board and interaction zone. */
@media(max-width:480px) and (orientation:portrait) {
  body { overflow-anchor:none; }
  .site-header { height:calc(43px + env(safe-area-inset-top,0px)); padding-top:calc(6px + env(safe-area-inset-top,0px)); box-sizing:border-box; }
  .game-page__column { grid-template-rows:auto auto; }
  .game-table {
    --pool-top:152px;
    --pool-height:112px;
    --interaction-top:calc(var(--pool-top) + var(--pool-height) + 8px);
    --interaction-height:80px;
    --hand-top:calc(var(--interaction-top) + var(--interaction-height) + 8px);
    height:calc(100svh - 43px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    min-height:0; max-height:none; overflow:hidden;
  }
  .game-heading { position:absolute; top:10px; left:12px; right:12px; width:auto; margin:0; }
  .board-layout,.play-lane { position:absolute; inset:0; display:block; }
  .opponent { position:static; margin:0; }
  .opponent-heading { position:absolute; top:49px; left:12px; right:12px; width:auto; height:28px; margin:0; }
  .opponent-cards { position:absolute; top:80px; left:12px; right:12px; height:66px; min-height:0; }
  .pool-area { position:absolute; top:var(--pool-top); left:50%; transform:translateX(-50%); height:var(--pool-height); margin:0; }
  .pool { height:100%; }
  .pool:empty { display:block; border:0; }
  .pool-area:has(.pool-card:not(:disabled)) .pool-hint { display:none!important; }
  .speech-bubble { position:absolute; top:var(--interaction-top); left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100% - 32px); margin:0; z-index:85; }
  .start-panel:not(.ready-panel) { position:absolute; top:var(--interaction-top); left:16px; right:16px; width:auto; height:var(--interaction-height); overflow:hidden; clip-path:none; text-align:center; pointer-events:none; }
  .start-panel:not(.ready-panel) h2 { margin:0 0 4px; font-size:14px; }
  .start-panel:not(.ready-panel) p { margin:0; font-size:11px; }
  .start-panel:not(.ready-panel) .turn-tag,.start-panel:not(.ready-panel) .last-event { display:none; }
  .game-table:has(.speech-bubble:not([hidden])) .start-panel:not(.ready-panel) { visibility:hidden; }
  .start-panel.ready-panel { position:absolute; top:var(--hand-top); left:16px; right:16px; bottom:auto; width:auto; margin:0; transform:none; }
  .hand-area { position:static; margin:0; }
  .hand-heading { position:absolute; top:var(--hand-top); left:12px; right:12px; width:auto; height:28px; margin:0; }
  .hand { position:absolute; top:calc(var(--hand-top) + 30px); left:12px; right:12px; bottom:158px; width:auto; height:auto; align-content:flex-start; row-gap:16px; padding-bottom:4px; overflow-y:auto; overflow-x:hidden; scrollbar-width:thin; overscroll-behavior:contain; }
  .answer-slot,.answer-slot:has(#no-button[hidden]) { display:block; position:absolute; top:calc(var(--interaction-top) + 39px); left:12px; right:12px; width:auto; height:38px; margin:0; z-index:90; }
  .side-scores { position:absolute; left:12px; right:12px; bottom:64px; height:88px; margin:0; align-items:stretch; }
  .score-seat { min-width:0; }
  .score-details { max-height:75px; overflow:auto; }
  .table-actions { position:absolute; left:12px; right:12px; bottom:12px; width:auto; height:46px; margin:0; }
  .quick-rules,.quick-rules.in-depth { top:calc(50px + env(safe-area-inset-top,0px)); }
}
@media(max-width:480px) and (orientation:portrait) and (max-height:740px) {
  .game-table { --pool-top:140px; --pool-height:84px; }
  .opponent-cards { height:56px; }
  .hand { --card-height:62px; --stack-step:10px; }
}

@media(max-width:480px) {
  .opponent-heading { z-index:15; }
  .computer-avatar { flex:0 0 28px; position:relative; z-index:16; }
  .compact-computer-flight { border-width:2px; border-radius:5px; }
}
@media(max-width:480px) and (orientation:portrait) {
  .opponent-heading { top:46px; }
  .opponent-cards { top:84px; }
}
