@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@500;600;700;800&display=swap');
:root{color-scheme:dark;font-family:Inter,system-ui,sans-serif;--ink:#f8fafc;--muted:#a5b4cc}
*{box-sizing:border-box}body{margin:0;min-height:100vh;color:var(--ink);font-family:Inter,system-ui,sans-serif;background:radial-gradient(circle at 8% 0%,#3730a3 0,transparent 35%),radial-gradient(circle at 95% 88%,#9d174d 0,transparent 34%),linear-gradient(145deg,#090d1c,#111b35 58%,#21123e);overflow-x:hidden;user-select:none;-webkit-tap-highlight-color:transparent}
button,input,select{font:inherit}button{cursor:pointer;touch-action:manipulation;transition:transform .18s,filter .18s}button:active{transform:scale(.96)}button:disabled{opacity:.5;cursor:not-allowed}
.font-display,.brand,.setup h2,.target,.stat strong,.timertext{font-family:Fredoka,Inter,sans-serif}
.app{max-width:1180px;margin:auto;padding:16px}.top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.brand-wrap{display:flex;align-items:center;gap:12px}.brand-icon{width:46px;height:46px;border-radius:17px;background:linear-gradient(135deg,#f59e0b,#ec4899,#6366f1);display:grid;place-items:center;font:700 19px Fredoka;box-shadow:0 8px 25px #ec489944}
.brand{font-size:clamp(25px,5vw,36px);font-weight:700;line-height:1;background:linear-gradient(90deg,#fcd34d,#f9a8d4,#a5b4fc);background-clip:text;color:transparent}.tag{font-size:10px;font-weight:800;letter-spacing:1.2px;background:#ffffff12;border:1px solid #ffffff25;border-radius:30px;padding:9px 13px;color:#e0e7ff}
.panel,.hud,.board-shell{background:#0f172acc;border:1px solid #64748b55;backdrop-filter:blur(18px);border-radius:24px;box-shadow:0 20px 55px #02061770}
.setup{max-width:620px;margin:4vh auto;padding:22px}.setup h2{font-size:25px;margin:0 0 17px}.howto{background:#312e814f;border:1px solid #818cf855;border-radius:17px;padding:14px;margin-bottom:20px;color:#dbeafe;font-size:12px;line-height:1.7}.howto strong{color:#f9a8d4}
.fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.field label{display:block;color:#94a3b8;font-size:10px;font-weight:900;letter-spacing:1.2px;margin-bottom:7px}.field input,.field select,.names input{width:100%;background:#0b1224;color:white;border:1px solid #475569;border-radius:13px;padding:12px;outline:none}.field input:focus,.field select:focus,.names input:focus{border-color:#ec4899;box-shadow:0 0 0 3px #ec489922}.names{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:7px}
.primary{border:0;border-radius:16px;background:linear-gradient(100deg,#f59e0b,#ec4899,#6366f1);color:white;font-weight:900;box-shadow:0 9px 25px #ec489933;padding:15px}.primary:hover{filter:brightness(1.12)}.secondary{background:#1e293b;color:#e2e8f0;border:1px solid #475569;border-radius:13px;padding:11px 14px;font-weight:800}.create{width:100%;margin-top:20px;font:700 19px Fredoka;letter-spacing:.3px}
.game{margin:0 auto}.game-layout{display:grid;grid-template-columns:minmax(260px,.72fr) minmax(0,1.6fr);gap:14px;align-items:stretch}.leftcol{min-width:0}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}.stat{background:#0f172acc;border:1px solid #64748b55;border-radius:16px;padding:11px 7px;text-align:center}.stat small{display:block;color:#94a3b8;font-size:9px;font-weight:900;letter-spacing:1px;text-transform:uppercase}.stat strong{display:block;font-size:23px;color:#6ee7b7;margin-top:3px}
.roundbox{padding:18px 12px;text-align:center;border-radius:22px;background:linear-gradient(120deg,#db2777,#7c3aed 55%,#0891b2);box-shadow:0 12px 28px #02061770;margin-bottom:12px}.eyebrow{font-size:10px;font-weight:900;letter-spacing:1.3px}.target{font-size:clamp(48px,8vw,76px);font-weight:700;line-height:1.05;text-shadow:0 4px 0 #312e81}.target.target-hidden{letter-spacing:5px;color:#fde68a;text-shadow:0 0 18px #facc15aa}.roles{font-size:12px;font-weight:800;margin-top:5px}
.timer-panel{padding:15px;background:#0f172acc;border:1px solid #64748b55;border-radius:20px}.timertext{text-align:center;font-size:31px;font-weight:700;font-variant-numeric:tabular-nums;color:#67e8f9}.timerline{height:10px;background:#334155;border-radius:20px;overflow:hidden;margin:10px 0}.timerfill{height:100%;width:100%;background:linear-gradient(90deg,#34d399,#facc15,#fb7185);border-radius:20px;transition:width .3s linear}.instruction{text-align:center;color:#cbd5e1;font-size:11px;font-weight:700;line-height:1.5;margin:10px 0}.start{width:100%;padding:14px;border:0;border-radius:15px;background:linear-gradient(100deg,#34d399,#a3e635);color:#052e2b;font-weight:1000;font-size:15px;box-shadow:0 5px 0 #047857}.message{min-height:42px;text-align:center;padding:11px 5px;font-size:12px;font-weight:800;color:#fde68a}
.scores{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.score{padding:11px;border-radius:14px;background:#ffffff0d;border:1px solid #ffffff22;display:flex;justify-content:space-between;gap:7px;font-weight:800;font-size:12px}.score.active{border:2px solid #facc15;background:#facc1517}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:11px}.actions button{flex:1;min-width:90px;font-size:11px}.board-shell{padding:12px;display:flex;align-items:center;justify-content:center;min-height:100%}.board{width:100%;display:grid;grid-template-columns:repeat(var(--cols,5),minmax(0,1fr));gap:9px;padding:3px}
.tile{position:relative;min-width:0;aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:clamp(17px,3.5vw,29px);font-weight:1000;color:white;text-shadow:0 2px 4px #0008;border:2px solid #ffffff75;box-shadow:inset 0 2px 9px #ffffff55,0 5px 0 #02061799;border-radius:var(--shape);padding:0;background:var(--tile);overflow:hidden;animation:tileShufflePop .32s cubic-bezier(.22,1,.36,1) both}.tile:before{content:"";position:absolute;width:80%;height:25%;background:#ffffff3d;transform:rotate(-35deg);top:9%;left:-15%;border-radius:50%}.tile:after{content:"";position:absolute;width:11px;height:11px;border-radius:50%;background:#ffffff66;right:12%;bottom:12%}.tile.found{background:linear-gradient(135deg,#064e3b,#065f46)!important;border:3px solid #34d399;box-shadow:0 0 16px #10b98166,inset 0 0 0 3px #34d39944,0 4px 0 #022c22;color:#a7f3d0}.tile.found:before,.tile.found:after{display:none}.check{display:none;position:absolute;right:5px;top:2px;font-size:12px}.tile.found .check{display:block}.hidden{display:none!important}.winner{text-align:center;padding:25px;max-width:600px;margin:20px auto}.trophy{font-size:58px}.foot{text-align:center;font-size:10px;color:#94a3b8;margin:12px 0}
.rotate{position:fixed;inset:0;z-index:20;background:#080d1cf5;display:none;align-items:center;justify-content:center;text-align:center;padding:24px}.rotate .card{max-width:340px}.rotate .symbol{font-size:65px;animation:turn 2s infinite ease-in-out}@keyframes turn{50%{transform:rotate(90deg)}}body.portrait-playing .rotate{display:flex}
@keyframes tileShufflePop{0%{transform:scale(.75) rotate(-6deg);opacity:.65}65%{transform:scale(1.06) rotate(2deg)}100%{transform:scale(1) rotate(0);opacity:1}}
@media(max-width:760px){.app{padding:12px}.game-layout{grid-template-columns:1fr}.leftcol{display:grid;grid-template-columns:1fr}.board-shell{min-height:0}.board{gap:6px}.tile{font-size:clamp(16px,5vw,26px)}}
@media(orientation:landscape) and (max-height:600px){.app{max-width:1300px;padding:8px 14px}.top{margin-bottom:7px}.game-layout{grid-template-columns:minmax(250px,.65fr) minmax(0,1.7fr);gap:10px}.leftcol{display:block}.stats{margin:0 0 7px}.stat{padding:7px}.roundbox{padding:9px;margin-bottom:7px}.target{font-size:43px}.timer-panel{padding:8px}.timertext{font-size:23px}.instruction{margin:5px}.message{min-height:30px;padding:5px}.scores{margin-top:5px}.actions{margin-top:6px}.board{grid-template-columns:repeat(10,minmax(0,1fr));gap:6px}.tile{font-size:clamp(13px,3vh,22px)}}
@media(max-width:440px) and (orientation:portrait){.fields{grid-template-columns:1fr}.names{grid-template-columns:1fr}.board{gap:5px}.setup{padding:17px}}


/* True edge-to-edge game view on phones held sideways */
@media (orientation:landscape) and (max-height:700px){
  html,body{width:100%;height:100%;height:100dvh;min-height:0;overflow:hidden;overscroll-behavior:none}
  body.game-active .app{position:fixed;inset:0;width:100%;height:100%;height:100dvh;max-width:none;margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overflow:hidden}
  body.game-active .top{display:none}
  body.game-active .game{height:100%;width:100%;margin:0;overflow:hidden}
  body.game-active .game-layout{height:100%;height:100dvh;grid-template-columns:minmax(235px,34%) minmax(0,66%);gap:7px;align-items:stretch;overflow:hidden}
  body.game-active .leftcol{height:100%;min-height:0;display:flex;flex-direction:column;gap:4px;overflow:hidden}
  body.game-active .stats{flex:0 0 auto;gap:4px;margin:0}
  body.game-active .stat{padding:3px 2px;border-radius:9px}
  body.game-active .stat small{font-size:7px;letter-spacing:.5px}
  body.game-active .stat strong{font-size:16px;margin:0}
  body.game-active .roundbox{flex:0 0 auto;padding:5px 7px;margin:0;border-radius:12px}
  body.game-active .eyebrow{font-size:8px}
  body.game-active .target{font-size:clamp(27px,6vh,42px)}
  body.game-active .roles{font-size:9px;margin-top:0}
  body.game-active .target-picker{margin-top:5px!important;padding:5px!important;border-radius:9px!important}
  body.game-active .target-picker>label{font-size:8px!important;margin-bottom:3px!important}
  body.game-active #targetMode{padding:5px!important;font-size:10px!important}
  body.game-active #manualTargetBox{margin-top:4px!important}
  body.game-active #manualTargetBox input,body.game-active #applyTarget{padding:5px!important;font-size:10px!important}
  body.game-active #targetHint{display:none}
  body.game-active .timer-panel{flex:0 0 auto;padding:5px 8px;border-radius:11px}
  body.game-active .timertext{font-size:20px;line-height:1}
  body.game-active .timerline{height:5px;margin:4px 0}
  body.game-active .instruction{font-size:8px;line-height:1.15;margin:3px 0}
  body.game-active .start{padding:7px;border-radius:9px;font-size:11px;box-shadow:0 2px 0 #047857}
  body.game-active .message{flex:0 0 auto;min-height:0;padding:3px 2px;font-size:9px;line-height:1.1}
  body.game-active .scores{flex:0 0 auto;gap:4px}
  body.game-active .score{padding:4px 5px;border-radius:8px;font-size:9px}
  body.game-active .actions{flex:0 0 auto;gap:4px;margin:0}
  body.game-active .actions button{min-width:0;padding:6px 4px;font-size:8px;border-radius:8px}
  body.game-active .rightcol{height:100%;min-height:0;display:block;overflow:hidden}
  body.game-active .board-shell{height:100%;min-height:0;padding:4px;border-radius:12px;overflow:hidden}
  body.game-active .board{height:100%;width:100%;padding:0;gap:3px;grid-template-rows:repeat(var(--rows,5),minmax(0,1fr));align-content:stretch;justify-content:stretch}
  body.game-active .tile{height:100%;min-height:0;aspect-ratio:auto;border-width:1px;border-radius:9px;font-size:clamp(9px,2.5vh,18px);box-shadow:inset 0 1px 3px #ffffff44,0 1px 0 #02061799}
  body.game-active .tile:after{width:5px;height:5px}
  body.game-active .check{font-size:8px;right:2px;top:0}
  body.game-active .foot{display:none}
}
@media (orientation:landscape) and (max-height:700px) and (max-width:600px){
  body.game-active .game-layout{grid-template-columns:minmax(190px,38%) minmax(0,62%)}
  body.game-active .actions button{font-size:7px}
}
