/* hexaQUIZ · viewport-fitted game layout. The game itself never scrolls;
   on unusually short displays the setup/help sheet may scroll internally. */
:root{--gamegap:5px}
html,body{width:100%;height:100%;max-height:100%;overflow:hidden;overscroll-behavior:none}
body{min-height:0;background:#0a1220}
.app{box-sizing:border-box;width:100%;max-width:1180px;margin:0 auto;height:100dvh;min-height:0;padding:calc(5px + env(safe-area-inset-top)) 8px calc(5px + env(safe-area-inset-bottom));display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto auto;gap:var(--gamegap);overflow:hidden}
.header{grid-column:1;grid-row:1;min-height:39px;margin:0;align-items:center}
.brand h1{font-size:clamp(18px,4.8vw,26px)}
.brand small{font-size:11px;margin-top:2px}
.topbtns{gap:5px}
.iconbtn{height:40px;width:40px;border-radius:10px;font-size:20px;min-width:0}
.langbtn{font-size:13px}
.backHome{display:grid;place-items:center;width:40px;height:40px;border:1.5px solid #778ba1;border-radius:10px;background:#1c3146;color:#f2fbff;text-decoration:none;font-size:21px;font-weight:900}
.current{grid-column:1;grid-row:2;margin:0;padding:5px 9px;min-height:58px;border-radius:13px;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'now count' 'paths paths';gap:2px 5px;align-items:center}
.current .now{grid-area:now;min-width:0;gap:7px;flex:none}
.current .path-count{grid-area:count;justify-self:end;margin:0;font-size:13px;padding:4px 6px}
.current .paths{grid-area:paths;justify-content:center;flex:none;flex-basis:auto;gap:6px}
.current .path{display:inline-flex;align-items:center;justify-content:center;gap:5px;width:58px;min-height:25px;max-height:27px;padding:0 5px;border-radius:8px;font-size:15px}
.current .path small{font-size:14px;margin:0}
.player-circle{width:30px;height:30px;font-size:16px;flex-shrink:0}
.now strong{font-size:clamp(14px,3.8vw,18px);max-width:180px}
.now small{font-size:11px}
.board-panel{grid-column:1;grid-row:3;margin:0;border-radius:14px;display:flex;flex-direction:column;min-height:0;height:100%;overflow:hidden}
.board-heading{flex:0 0 auto;padding:5px 10px 0;min-height:31px}
.board-heading strong{font-size:14px}
.board-help{min-height:28px;border-radius:8px;padding:2px 9px;font-size:12px}
.board{box-sizing:border-box;display:block;min-height:0;flex:1 1 0;width:100%;height:100%;max-height:100%;margin:0 auto;object-fit:contain;touch-action:manipulation}
.scorebar{grid-column:1;grid-row:4;margin:0;gap:5px;min-height:48px}
.scorechip{align-items:center;gap:4px;padding:5px 5px;border-radius:11px;min-width:0;flex-wrap:nowrap;align-content:start}
.scorechip .chipnumber{height:26px;width:26px;flex:0 0 26px;font-size:14px}
.chiptext strong{font-size:12px!important;line-height:1.1}
.chiptext small{font-size:11px!important}
.playerpaths{display:none}
.bottom{grid-column:1;grid-row:5;margin:0;min-height:39px;gap:7px;align-items:center}
.hint{font-size:12px;line-height:1.22;max-height:2.5em;overflow:hidden}
.darkbtn{min-height:38px;font-size:13px;padding:7px 11px;border-radius:10px}
.legend,.finefooter{display:none}
/* leave enough space for navigation controls on extremely narrow devices */
@media(max-width:350px){.app{padding-left:4px;padding-right:4px;gap:3px}.header .brand h1{font-size:17px}.brand small{font-size:10px}.backHome,.iconbtn{height:35px;width:35px}.topbtns{gap:3px}.current{padding:4px 6px}.scorechip{padding:3px}.board-heading{min-height:28px}.scorechip .chipnumber{width:23px;height:23px;flex-basis:23px}.chiptext strong{font-size:11px!important}.chiptext small{font-size:10px!important}}
@media(max-height:690px){.app{--gamegap:3px}.brand small{display:none}.header{min-height:34px}.backHome,.iconbtn{width:37px;height:37px}.current{min-height:49px}.current .paths{gap:4px}.current .path{height:23px;min-height:23px}.scorebar{min-height:41px}.scorechip{padding:3px 5px}.bottom{min-height:35px}.darkbtn{min-height:34px;padding:5px 10px}.board-heading{min-height:26px;padding-top:3px}.board-help{min-height:25px}}
@media (min-width:750px){
 .app{max-width:1180px;padding:14px 18px;display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);grid-template-rows:52px auto auto auto minmax(0,1fr);column-gap:16px;row-gap:10px}
 .header{grid-column:1/3;grid-row:1;margin:0}.brand h1{font-size:27px}.brand small{display:block;font-size:12px}
 .board-panel{grid-column:1;grid-row:2/6;margin:0;min-height:0;height:100%}.board-heading{padding:9px 14px 0;min-height:38px}.board-heading strong{font-size:17px}.board-help{min-height:34px;font-size:14px}
 .board{flex:1 1 0;height:100%;max-height:100%;min-height:0}
 .current{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:13px;gap:10px;min-height:96px}
 .current .now{flex:1;min-width:0}.current .paths{flex-basis:100%;justify-content:center}.current .path{width:69px;min-height:35px;max-height:none}.current .path-count{margin:0;font-size:16px}.now strong{font-size:20px}.now small{font-size:13px}.player-circle{width:43px;height:43px;font-size:21px}
 .scorebar{grid-column:2;grid-row:3;flex-wrap:wrap;min-height:0;gap:7px}.scorechip{flex:1;min-width:0;flex-wrap:wrap;padding:9px;min-height:90px;gap:6px}.scorechip .chipnumber{width:30px;height:30px;flex-basis:30px}.chiptext strong{font-size:14px!important}.chiptext small{font-size:12px!important}.playerpaths{flex-basis:100%;display:flex;gap:3px;margin:1px 0 0}.playerpaths span{padding:3px;min-width:24px;font-size:11px}
 .bottom{grid-column:2;grid-row:4;align-self:start;margin:0}.hint{font-size:14px;max-height:none}.darkbtn{font-size:14px;min-height:42px}
 .legend{grid-column:2;grid-row:5;display:flex;align-self:start;font-size:12px;gap:7px;justify-content:flex-start;padding:8px 10px;line-height:1.5}.leg{font-size:12px}
 .finefooter{display:none}
}
@media (min-width:750px) and (max-height:580px){.app{padding:6px 10px;grid-template-rows:40px auto auto auto minmax(0,1fr);row-gap:6px}.header{min-height:37px}.current{padding:8px;min-height:70px}.current .path{min-height:28px}.scorechip{min-height:65px;padding:5px}.playerpaths{display:none}.legend{display:none}}
/* Covering the page does not require page scrolling. For compact phones
   only the modal content is allowed to scroll if a long question cannot fit. */
.overlay{overflow:hidden;align-items:center;padding:max(5px,env(safe-area-inset-top)) 6px max(5px,env(safe-area-inset-bottom));overscroll-behavior:contain}
.sheet{width:min(100%,680px);max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 14px);overflow:auto;scrollbar-width:thin;overscroll-behavior:contain;padding:13px 14px 14px;border-radius:16px}
.sheet h2{font-size:clamp(20px,4vw,26px);margin:0 45px 6px 0}
.sheet p{font-size:14px;margin:5px 0 9px}
.cat-pick{min-height:54px;margin:6px 0;padding:6px 10px;font-size:16px;border-radius:12px}
.cat-pick .letterbox{height:37px;width:37px;font-size:21px}
.cat-pick small{font-size:12px}
.question-tag{font-size:14px}
.question-tag .letterbox{height:36px!important;width:36px!important;font-size:21px}
.question-title{font-size:clamp(20px,3.6vw,24px);line-height:1.2;margin:9px 0 12px}
.answer{font-size:clamp(16px,3.8vw,19px);min-height:48px;padding:6px 9px;border-radius:10px;margin:6px 0;gap:7px;line-height:1.25}
.answer .key{width:30px;height:30px;font-size:15px;border-radius:8px}
.response{padding:9px 11px;margin-top:8px;font-size:14px;line-height:1.35}.response strong{font-size:15px}
.primary{min-height:45px;font-size:17px;padding:9px;margin-top:9px;border-radius:11px}
.close{width:36px;height:36px;font-size:22px}
.timer{font-size:15px;padding:4px 5px}
.bot-result{padding:8px;margin-top:8px}
.card-section{padding:9px;margin:7px 0}
.setup-player{padding:8px;margin:7px 0;border-radius:12px}.setup-head{margin-bottom:5px}.setup-head strong{font-size:15px}.labelrow{font-size:14px;margin:5px 0 3px}.role-select,.name-input,.difficulty-select,.pack-select{font-size:15px;min-height:41px;padding:5px 9px}.name-input{margin-top:5px}.toggle-row{font-size:14px;padding:7px 0}.sheet .muted{font-size:12px}
@media(max-height:670px){.sheet{padding:9px 10px;max-height:calc(100dvh - 10px)}.question-title{font-size:clamp(18px,3.2vw,21px);margin:7px 0 8px}.answer{font-size:16px;min-height:42px;margin:4px 0;padding:5px 7px}.answer .key{height:28px;width:28px}.question-tag .letterbox{height:31px!important;width:31px!important}.primary{min-height:43px;font-size:16px;margin-top:7px}.response{padding:7px;margin-top:6px}.sheet p{font-size:13px}}
@media(max-width:370px) and (max-height:610px){.question-title{font-size:17px}.answer{font-size:15px;line-height:1.2;min-height:39px}.answer .key{height:25px;width:25px}.sheet .question-tag{font-size:12px}.response{font-size:12px}.response strong{font-size:13px}}
@media(prefers-reduced-motion:reduce){.board *, .sheet *{animation:none!important;transition:none!important}}
/* One-screen first-run setup; optional advanced controls expand on demand. */
.sheet[data-modal="setup"]{max-width:570px;padding:12px 13px}
.sheet[data-modal="setup"] .setup-intro{font-size:13px;line-height:1.25;color:#475974;margin:3px 0 6px}
.sheet[data-modal="setup"] .setup-language{display:flex;align-items:center;gap:14px;padding:7px 10px;margin:5px 0 8px}
.sheet[data-modal="setup"] .setup-language .labelrow{margin:0;min-width:46px;font-size:14px}
.sheet[data-modal="setup"] .setup-language select{flex:1;min-width:0;min-height:39px}
.sheet[data-modal="setup"] .setup-player{display:grid;grid-template-columns:95px minmax(0,1fr);gap:3px 9px;align-items:center;padding:6px 9px;margin:5px 0;border-radius:10px}
.sheet[data-modal="setup"] .setup-head{grid-column:1;grid-row:1;margin:0;align-items:center;gap:3px}
.sheet[data-modal="setup"] .setup-head strong{font-size:14px}
.sheet[data-modal="setup"] .badge-player{width:22px;height:22px;font-size:12px}
.sheet[data-modal="setup"] .role-select{grid-column:2;grid-row:1;min-height:38px;font-size:14px;padding:4px 8px}
.sheet[data-modal="setup"] .name-input{grid-column:1/-1;grid-row:2;min-height:37px;font-size:14px;margin:2px 0 0}
.sheet[data-modal="setup"] .setup-player>.muted{display:none}
.sheet[data-modal="setup"] .advanced-settings{margin:8px 0 0}
.sheet[data-modal="setup"] .advanced-settings summary{font-size:13px;font-weight:850;color:#234c76;cursor:pointer;border:1px solid #c9d6e5;border-radius:10px;padding:8px 11px;background:#eef3f9}
.sheet[data-modal="setup"] .advanced-settings .card-section{margin:5px 0 0;padding:8px}
.sheet[data-modal="setup"] .primary[data-action="start"]{position:sticky;bottom:0;z-index:1;box-shadow:0 -4px 14px #f7f9fccc,0 4px 0 #07603d}
.sheet[data-modal="setup"] #setupError:empty{display:none}
.sheet[data-modal="setup"] .secondary{min-height:38px;font-size:13px;margin-top:7px}
@media(max-height:620px){.sheet[data-modal="setup"]{padding:8px 9px}.sheet[data-modal="setup"] h2{font-size:19px}.sheet[data-modal="setup"] .setup-intro{font-size:12px;margin-bottom:5px}.sheet[data-modal="setup"] .setup-player{padding:4px 7px;margin:3px 0}.sheet[data-modal="setup"] .setup-language{margin:4px 0;padding:4px 7px}.sheet[data-modal="setup"] .advanced-settings{margin:5px 0}.sheet[data-modal="setup"] .primary{min-height:42px;margin-top:6px}}
@media(max-height:440px) and (min-width:650px){
 .sheet[data-modal="quiz"],.sheet[data-modal="bot"]{width:min(96%,840px);max-width:840px;padding:6px 12px}
 .sheet[data-modal="quiz"] .question-title{font-size:17px;margin:3px 0 5px;line-height:1.16}
 .sheet[data-modal="quiz"] .answers{display:grid;grid-template-columns:1fr 1fr;gap:5px 7px}
 .sheet[data-modal="quiz"] .answer{font-size:14px;min-height:50px;line-height:1.2;margin:0;padding:5px}
 .sheet[data-modal="quiz"] .question-tag{font-size:12px}
 .sheet[data-modal="quiz"] .response{font-size:12px;margin-top:5px;padding:5px}
 .sheet[data-modal="quiz"] .response strong{font-size:12px}
 .sheet[data-modal="quiz"] .primary{min-height:34px;font-size:14px;margin-top:5px}
}
