/* Mobile table layouts. Loaded last so every game shares readable touch surfaces. */
@media (max-width: 900px) {
  .play-title,.play-title>div,.play-status,.game-board,.board-section,.cards-row,
  .actions-area,.actions-row,.playing-card,.action-card,.score,.privacy,.lobby,
  .tile-body,.name-grid>div,#modal-content,.input-action{min-width:0}
  .play-title h1,.play-status h2,.board-section h3,.playing-card strong,
  .playing-card p,.action-card strong,.action-card p,.score small,.score strong,
  .privacy h2,.victory h2,.roster li,.resume,.room-code,.rules-list,.edition,
  .dialog-sub,.form-note,.seat,.button,.site-footer{overflow-wrap:anywhere}
  button,input,select,.button,.text-button,.filter,.seat,.mode-tabs button{min-height:44px}
  .text-button,.nav-button,.filter,.seat,.button{white-space:normal;line-height:1.35}
  input,select,.input-action input{font-size:16px}
  .play-tools .button{min-height:44px;line-height:1.35}
  .modal-close{width:44px;height:44px;min-height:44px;top:8px;right:8px;line-height:1}
  dialog{max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overscroll-behavior:contain;scroll-padding-top:60px;scroll-padding-bottom:24px}
  .room-code{font-size:clamp(1.4rem,6vw,2.4rem);letter-spacing:.09em}
}
@media (max-width: 760px) {
  html{scroll-padding-top:16px}
  .site-header{padding:0 max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left));gap:12px}
  .brand{min-height:44px;flex-shrink:0}
  .site-header nav{min-width:0;gap:0}
  .site-header nav .button{min-height:44px;padding:9px 12px;font-size:.8rem;gap:7px}
  .hero{margin:0 20px;min-width:0}
  .hero h1{font-size:clamp(2.8rem,11.8vw,3.6rem)}
  .hero-art{width:100%;margin:0;overflow:clip;transform:scale(.88);height:350px}
  .hero-actions{flex-wrap:wrap;gap:10px}
  .hero-actions .button{min-height:48px;padding:12px 15px}
  .hero-notes{flex-wrap:wrap;row-gap:9px}
  .collection{margin:0 16px;padding-top:30px}
  .section-heading{min-width:0}
  .section-heading h2{font-size:clamp(1.65rem,6vw,2rem)}
  .filters{gap:8px;margin:16px 0 22px}
  .filter{padding:10px 14px;font-size:.84rem}
  .game-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
  .tile-art{height:auto;aspect-ratio:3/2}
  .tile-art .cover-art{object-fit:contain;object-position:center;transform:none}
  .game-tile:hover .tile-art .cover-art{transform:none}
  .tile-stamp{font-size:.56rem;padding:4px 7px;top:7px;right:7px;max-width:calc(100% - 14px)}
  .tile-body{padding:15px}
  .tile-body h3{overflow-wrap:anywhere;font-size:1.13rem}
  .tile-body>p{font-size:.86rem;line-height:1.5;margin-bottom:14px}
  .tile-meta{flex-wrap:wrap;column-gap:12px;row-gap:6px;font-size:.75rem}
  .tile-actions{gap:5px}
  .tile-actions .button,.tile-actions .text-button{min-height:44px;font-size:.84rem}
  .tile-actions .button{width:100%;padding:10px 12px}
  .tile-actions .text-button{white-space:normal;line-height:1.4}
  .resume{flex-wrap:wrap;padding:16px;gap:13px}
  .resume>div{min-width:0;flex:1 1 190px}
  .resume .button{min-height:44px;white-space:normal}
  .site-footer{padding-bottom:calc(24px + env(safe-area-inset-bottom));overflow-wrap:anywhere}
  .play-shell{padding:20px max(14px,env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  .play-top{gap:16px;margin-bottom:18px;align-items:stretch}
  .play-title{align-items:center;gap:12px}
  .play-title h1{font-size:1.55rem;line-height:1.15}
  .play-title .form-note{font-size:.78rem;line-height:1.5}
  .play-emblem{width:58px;height:58px;border-radius:15px}
  .play-tools{display:flex;flex-wrap:wrap;gap:8px}
  .play-tools .button{flex:1 1 130px;padding:10px 12px;font-size:.8rem}
  .play-status{padding:15px 16px;gap:8px;margin-bottom:16px}
  .play-status h2{font-size:1rem;line-height:1.5}
  .save-mark{white-space:normal;line-height:1.4}
  .score-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:15px 0 18px}
  .score{padding:10px 12px;min-width:0}
  .score small{font-size:.77rem;line-height:1.4}
  .score strong{font-size:.88rem;line-height:1.4;display:block}
  .seat-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-bottom:16px;margin-bottom:18px}
  .seat-row>span{grid-column:1/-1;font-size:.82rem}
  .seat{min-height:44px;padding:10px 11px;text-align:left;line-height:1.4;font-size:.82rem}
  .seat .seat-count{font-size:.68rem;margin-left:4px}
  .seat-row>.button{grid-column:1/-1;justify-self:start;min-height:44px}
  .board-section{padding:13px;margin-bottom:18px;border-radius:14px}
  .board-section h3{font-size:.85rem;line-height:1.5;align-items:baseline;margin-bottom:12px}
  .cards-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:stretch}
  .playing-card{width:100%;min-width:0;min-height:0;padding:9px;gap:8px}
  .playing-card strong{font-size:.94rem;line-height:1.3}
  .playing-card p,.action-card p{font-size:.875rem;line-height:1.5}
  .card-type{font-size:.6rem;letter-spacing:.07em;overflow-wrap:anywhere}
  .card-face{min-height:90px}
  .card-face>svg:not(.shape){height:96px;min-height:0}
  .core-art{min-height:0}
  .actions-area{padding:14px;border-radius:13px;margin:18px 0}
  .actions-area h3{font-size:1rem;line-height:1.4;margin-bottom:13px}
  .actions-row{gap:10px;align-items:stretch}
  .actions-row>.button{flex:1 1 120px;min-height:48px;padding:12px 14px;gap:8px;font-size:.9rem;text-align:center}
  .action-card{width:calc((100% - 10px)/2);min-width:0;padding:10px;gap:9px}
  .action-card strong{font-size:.9rem;line-height:1.4}
  .action-card .card-face{min-height:86px}
  .action-card .card-face>svg:not(.shape){height:90px;min-height:0}
  .input-action{max-width:none;flex:1 1 100%}
  .input-action label{line-height:1.5}
  .input-action .button{min-height:48px}
  .game-mitsukaruta .cards-row{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
  .game-mitsukaruta .playing-card{padding:6px;gap:7px;box-shadow:1px 3px 0 #ba903e25}
  .game-mitsukaruta .card-face{min-height:0}
  .game-mitsukaruta .card-face>svg{height:auto;aspect-ratio:180/124}
  .game-mitsukaruta .playing-card strong{font-size:.95rem;text-align:center}
  .game-mitsukaruta .playing-card p{font-size:.75rem;line-height:1.4;text-align:center}
  .game-split .board-section:first-child .cards-row{grid-template-columns:minmax(0,1fr)}
  .game-split .board-section:first-child .playing-card{max-width:420px;justify-self:center}
  .game-split .board-section:first-child .card-face{min-height:128px}
  .game-split .board-section:first-child .shape{height:124px}
  .game-split .card-face{padding:9px;min-height:94px}
  .game-split .shape{padding:4px;height:94px;max-width:100%}
  .game-split .action-card .shape{height:90px}
  .game-split .playing-card strong{text-align:center}
  .game-split .playing-card{gap:7px}
  .game-pakumogu .card-face,.game-poiyone .card-face{min-height:82px}
  .game-pakumogu .card-face>svg,.game-poiyone .card-face>svg{height:88px}
  .game-pakumogu .playing-card:only-child{grid-column:1/-1;max-width:360px;justify-self:center}
  .game-pakumogu .playing-card:only-child .card-face>svg{height:140px}
  .game-henken .cards-row{grid-template-columns:minmax(0,1fr)}
  .game-henken .playing-card{width:100%;max-width:none;padding:15px;gap:12px}
  .game-henken .playing-card strong{font-size:1.16rem;line-height:1.4}
  .game-henken .playing-card .card-face{min-height:120px}
  .game-henken .card-face>svg{height:120px}
  .game-taboo .playing-card strong{font-size:.96rem;line-height:1.4}
  .game-taboo .playing-card p{font-size:.9rem;color:var(--ink)}
  .game-rhyme .playing-card{gap:9px}
  .game-rhyme .playing-card strong{font-size:1.05rem}
  .game-rhyme .card-face>svg{height:86px}
  .game-jelly .card-face{min-height:88px}
  .game-jelly .card-face>svg{height:92px}
  .privacy{padding:28px 18px;min-height:300px;width:100%;margin:18px auto}
  .privacy h2{font-size:1.5rem;line-height:1.3}
  .privacy p{font-size:.9rem;line-height:1.6;margin:14px auto 20px}
  .privacy .button{max-width:100%;min-height:48px;padding:13px 17px;gap:10px}
  .privacy-capsule{width:86px;height:86px;margin-bottom:12px}
  .victory{padding:23px 17px}
  .victory h2{font-size:1.55rem;line-height:1.35}
  .victory p{font-size:.93rem}
  .victory .button{min-height:48px;margin-top:16px;max-width:100%}
  .lobby{width:100%;max-width:none;margin:10px auto;padding:22px 18px}
  .lobby h2{font-size:1.7rem;line-height:1.3;overflow-wrap:anywhere}
  .lobby .button{max-width:100%;min-height:48px}
  .roster li{gap:12px;align-items:baseline;line-height:1.5}
  .roster li>span{min-width:0}
  .roster small{flex-shrink:0;font-size:.75rem}
  .log{font-size:.84rem;line-height:1.6}
  .log summary{min-height:44px;padding:10px 0}
  .log ol{padding-left:22px;overflow-wrap:anywhere}
  .disconnect{padding:14px;overflow-wrap:anywhere;line-height:1.6}
  .disconnect .button{min-height:44px;max-width:100%;margin-top:8px}
  dialog{width:calc(100% - 24px);padding:24px 20px;border-radius:17px;margin:auto}
  .dialog-art{width:calc(100% + 40px);height:auto;aspect-ratio:3/2;margin:-24px -20px 21px}
  .dialog-art .cover-art{object-fit:contain;object-position:center}
  #modal-content h2{font-size:1.7rem;line-height:1.25;overflow-wrap:anywhere;padding-right:3px}
  .dialog-sub{font-size:.94rem;line-height:1.6;margin:12px 0 20px}
  .rules-list{font-size:.95rem;line-height:1.7;padding-left:20px}
  .rules-list li{padding-left:2px;margin-bottom:16px}
  .rules-source{flex-wrap:wrap;gap:10px 18px}
  .rules-source a{min-height:44px;display:inline-flex;align-items:center;line-height:1.5}
  .edition{font-size:.82rem;line-height:1.6;padding:12px}
  .name-grid{gap:13px 10px;grid-template-columns:repeat(2,minmax(0,1fr))}
  label{font-size:.86rem;line-height:1.45}
  .mode-tabs{gap:8px}
  .mode-tabs button{min-width:0;min-height:46px;font-size:.92rem;padding:11px 9px}
  #setup-form>.button,#join-form>.button{min-height:50px;margin-top:8px}
  input,select{min-width:0;min-height:48px;padding:12px;max-width:100%}
  input[type=file]{font-size:.85rem;white-space:normal;overflow-wrap:anywhere}
  #toast{max-width:calc(100% - 24px);width:max-content;bottom:calc(16px + env(safe-area-inset-bottom));padding:13px 16px;overflow-wrap:anywhere;line-height:1.5}
}
@media (max-width: 430px) {
  .game-bahamut .cards-row{grid-template-columns:minmax(0,1fr)}
  .game-bahamut .playing-card{display:grid;grid-template-columns:96px minmax(0,1fr);grid-template-rows:auto auto 1fr;column-gap:11px;row-gap:5px;padding:10px;align-items:start}
  .game-bahamut .playing-card .card-face{grid-column:1;grid-row:1 / span 3;align-self:center;min-height:82px}
  .game-bahamut .playing-card .card-type{grid-column:2;justify-self:start;font-size:.59rem}
  .game-bahamut .playing-card strong{grid-column:2;font-size:.94rem}
  .game-bahamut .playing-card p{grid-column:2;font-size:.875rem;line-height:1.5}
  .game-bahamut .playing-card .card-face>svg{height:88px}
  .game-bahamut .action-card{width:100%;display:grid;grid-template-columns:96px minmax(0,1fr);column-gap:11px;row-gap:7px}
  .game-bahamut .action-card .card-face{grid-column:1;grid-row:1 / span 2;align-self:center;min-height:82px}
  .game-bahamut .action-card strong,.game-bahamut .action-card p{grid-column:2}
  .game-bahamut .action-card .card-face>svg{height:88px}
  .game-mitsukaruta .cards-row{grid-template-columns:repeat(3,minmax(0,1fr))}
  .game-taboo .cards-row{grid-template-columns:minmax(0,1fr)}
  .game-taboo .playing-card{display:grid;grid-template-columns:80px minmax(0,1fr);column-gap:12px;row-gap:7px;padding:12px}
  .game-taboo .playing-card .card-face{grid-column:1;grid-row:1 / span 2;min-height:75px;align-self:center}
  .game-taboo .playing-card .card-face>svg{height:75px}
  .game-taboo .playing-card strong,.game-taboo .playing-card p{grid-column:2}
}
@media (max-width: 399px) {
  .game-grid{grid-template-columns:minmax(0,1fr);gap:21px}
  .tile-art{aspect-ratio:3/2;height:auto}
  .tile-body{padding:19px}
  .tile-body h3{font-size:1.35rem}
  .tile-body>p{font-size:.94rem}
  .tile-meta{font-size:.8rem;margin-bottom:16px}
  .tile-stamp{font-size:.65rem;right:11px;top:11px;padding:5px 9px}
  .tile-actions{flex-wrap:nowrap;gap:12px}
  .tile-actions .button{flex:1 1 0;width:auto;flex-basis:0;font-size:.9rem}
  .tile-actions .text-button{width:auto;flex:0 0 auto;font-size:.84rem}
  .hero{margin-left:18px;margin-right:18px}
  .hero-art{transform:scale(.82);height:330px;margin:0}
  .hero-notes{font-size:.75rem;gap:11px}
  .collection{margin-left:14px;margin-right:14px}
  .play-shell{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
  .board-section{padding:10px}
  .actions-area{padding:12px}
  .playing-card{padding:8px}
  .playing-card p,.action-card p{font-size:.875rem}
  .action-card{padding:9px}
  .game-bahamut .playing-card,.game-bahamut .action-card{grid-template-columns:82px minmax(0,1fr);column-gap:9px;padding:9px}
  .game-bahamut .playing-card .card-face>svg,.game-bahamut .action-card .card-face>svg{height:82px}
  .name-grid{grid-template-columns:minmax(0,1fr);gap:14px}
  .play-title h1{font-size:1.4rem}
  .play-emblem{width:52px;height:52px}
}
@media (max-width: 360px) {
  .site-header{padding-left:12px;padding-right:12px;gap:8px}
  .brand{font-size:1.4rem;gap:6px}
  .brand img{width:29px;height:29px}
  .site-header nav .button{font-size:.78rem;padding:10px;gap:0}
  .site-header nav .button span{display:none}
  .hero h1{font-size:2.8rem}
  .hero-copy>p{font-size:.97rem}
  .hero-actions .button{width:100%}
  .hero-art{transform:scale(.78);height:310px}
  .game-taboo .playing-card{grid-template-columns:70px minmax(0,1fr);column-gap:9px}
}
@media (max-height: 500px) and (max-width: 950px) and (orientation: landscape) {
  dialog{max-height:calc(100dvh - 16px);width:min(650px,calc(100% - 24px));padding-top:20px;padding-bottom:20px}
  .dialog-art{height:125px;max-height:125px;aspect-ratio:auto;margin-top:-20px}
  .dialog-art .cover-art{object-fit:contain}
  .privacy{min-height:0;padding-top:20px;padding-bottom:20px}
  .privacy-capsule{width:65px;height:65px;margin-bottom:7px}
  .privacy-capsule img{width:60px;height:60px}
  .privacy p{margin:9px auto 15px}
}
@media (hover:none) and (pointer:coarse) {
  .playing-card:hover,.action-card:hover,.game-tile:hover{transform:none}
  .game-split .action-card:hover .shape{transform:none}
}
/* Tablet headers need a second row once the mobile move shortcut is present. */
@media (max-width:900px) {
  .play-top{flex-wrap:wrap;flex-direction:column;align-items:flex-start}
  .play-title{min-width:0;max-width:100%;width:100%;flex:none}
  .play-title>div{min-width:0}
  .play-title h1,.play-title .form-note{overflow-wrap:anywhere}
  .play-tools{width:100%;flex:none;gap:8px}
  .play-tools .button,.button.small{min-height:44px}
  .round-result{min-width:0}
  .round-result h2,.round-result p{overflow-wrap:anywhere;line-height:1.45}
  .result-actions .button{min-height:48px;max-width:100%;white-space:normal;overflow-wrap:anywhere}
}

@media (min-width:761px) and (max-width:900px) {
  .hero{grid-template-columns:minmax(0,1fr);padding-top:40px;gap:0}
  .hero h1{font-size:clamp(3.6rem,8vw,4.5rem)}
  .hero-copy>p{max-width:560px}
  .hero-art{width:min(100%,460px);height:410px;margin:0 auto;overflow:clip;transform:scale(.92)}
  .game-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
