/* th.css - Tide Hopper panels. Paper-cut chart look: ink navy, cream paper, coral for danger. */
.th{--ink:#0c2433;--deep:#103a52;--foam:#e9f1e4;--paper:#eadbb6;--paper-d:#b79f6a;--coral:#ff6b4a;--gold:#f2c14e;color:var(--foam);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.th-stage{position:relative;width:100%;border-radius:14px;overflow:hidden;background:var(--ink);touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;box-shadow:0 6px 0 rgba(4,16,24,.55)}
#th-canvas{display:block;width:100%;touch-action:none;outline:none;border-radius:14px;margin:0;background:var(--ink)}
.th-icon{position:absolute;top:4px;right:4px;width:48px;height:48px;border:0;border-radius:12px;background:transparent;color:var(--foam);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;touch-action:manipulation}
.th-icon svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.th-icon .x{display:none}
.th-icon.off .wave{display:none}
.th-icon.off .x{display:block}
.th-icon:focus-visible,.th-btn:focus-visible,.th-bay:focus-visible,.th-skin:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.th-panel{position:absolute;left:0;right:0;top:0;bottom:96px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:16px;padding-top:max(16px,env(safe-area-inset-top));text-align:center;background:rgba(8,28,42,.78)}
.th-panel[hidden]{display:none}
.th-logo{font-size:2.3rem;line-height:1;font-weight:900;letter-spacing:.01em;color:var(--paper);text-shadow:0 4px 0 #6b5a34}
.th-h{font-size:1.5rem;font-weight:900;color:var(--paper);text-shadow:0 3px 0 #6b5a34}
.th-h.lose{color:#ff9d7f;text-shadow:0 3px 0 #7a2a18}
.th-lead{font-size:.95rem;max-width:26ch;line-height:1.35;color:var(--foam)}
.th-meta{font-size:.8rem;color:rgba(233,241,228,.7)}
.th-note{font-size:.85rem;max-width:30ch;line-height:1.35;color:var(--gold)}
.th-score{font-size:2.6rem;font-weight:900;line-height:1;color:var(--foam)}
.th-row{display:flex;gap:10px;width:100%;max-width:300px}
.th-row .th-btn{flex:1}
.th-btn{min-height:48px;min-width:48px;padding:0 18px;border:0;border-radius:12px;background:var(--paper);color:var(--ink);font:800 1rem/1 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;box-shadow:0 4px 0 var(--paper-d);cursor:pointer;touch-action:manipulation;transition:transform .08s,box-shadow .08s}
.th-btn:active{transform:translateY(3px);box-shadow:0 1px 0 var(--paper-d)}
.th-btn.primary{min-height:56px;width:100%;max-width:300px;background:var(--gold);box-shadow:0 5px 0 #a9802a;font-size:1.1rem}
.th-btn.primary:active{box-shadow:0 2px 0 #a9802a}
.th-skins{display:flex;gap:8px;justify-content:center}
.th-skin{width:44px;height:44px;border-radius:50%;border:3px solid rgba(233,241,228,.25);background:var(--c);color:var(--ink);font:800 .8rem system-ui,sans-serif;cursor:pointer;touch-action:manipulation;padding:0}
.th-skin.sel{border-color:var(--foam);box-shadow:0 0 0 3px var(--ink),0 0 0 5px var(--gold)}
.th-skin:disabled{background:#26485c;color:rgba(233,241,228,.6);cursor:default}
.th-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;width:100%;max-width:340px}
.th-bay{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:56px;padding:4px 0;border:0;border-radius:10px;background:var(--paper);color:var(--ink);box-shadow:0 3px 0 var(--paper-d);cursor:pointer;touch-action:manipulation;font-family:inherit}
.th-bay.locked{background:#1d4258;color:rgba(233,241,228,.4);box-shadow:none;cursor:default}
.th-num{font-weight:900;font-size:1.05rem}
.th-stars{display:inline-flex;gap:3px}
.th-star{display:block;width:11px;height:11px;background:rgba(12,36,51,.25);clip-path:polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%)}
.th-star.on{background:var(--coral)}
.th-panel>.th-stars{gap:8px}
.th-panel>.th-stars .th-star{width:34px;height:34px;background:rgba(233,241,228,.2)}
.th-panel>.th-stars .th-star.on{background:var(--gold)}
.th-fallback{padding:1rem;text-align:center}
.th-how{margin:1rem 0;font-size:.95rem;line-height:1.5}
.th-how h2{font-size:1.1rem;margin-bottom:.4rem}
.th-how p{margin:.4rem 0}
.th-streak{font-size:.85rem;font-weight:800;color:var(--gold);max-width:30ch;line-height:1.3}
.th-btn.daily{background:var(--foam);box-shadow:0 4px 0 #8fa58a}
.th-logo{position:relative;padding-bottom:10px}
.th-logo::after{content:"";position:absolute;left:12%;right:12%;bottom:0;height:6px;border-radius:3px;background:repeating-linear-gradient(90deg,#2a7f8e 0 14px,#3fb59a 14px 28px);background-size:56px 6px;animation:thwave 3s linear infinite}
@keyframes thwave{to{background-position:56px 0}}
.th-panel:not([hidden]){animation:thin .25s ease-out}
@keyframes thin{from{opacity:0;transform:translateY(8px)}}
@media (prefers-reduced-motion:reduce){.th-btn{transition:none}.th-logo::after,.th-panel:not([hidden]){animation:none}}
@media (max-height:640px){.th-logo{font-size:1.9rem}.th-panel{gap:7px;padding:10px}}

/* phones: playfield first, copy below */
@media (max-width:600px){
.game-wrap{display:flex;flex-direction:column}
.game-wrap>.th{order:1}.game-wrap>.game-title{order:2}.game-wrap>.facts{order:3}.game-wrap>.th-how{order:4}.game-wrap>.pip-actions{order:5}
}
/* full screen (native and immersive both add pip-immersive) */
html.pip-immersive .game-wrap{display:flex;flex-direction:column;padding:0!important;margin:0!important;max-width:none!important}
html.pip-immersive .game-wrap>.th{flex:1;min-height:0;display:flex;order:0}
html.pip-immersive .th-how,html.pip-immersive .th-fallback[hidden]{display:none}
html.pip-immersive .th-stage{flex:1;min-height:0;width:auto;border-radius:0;box-shadow:none;display:flex;align-items:center;justify-content:center}
html.pip-immersive #th-canvas{width:auto;max-width:100%;max-height:100%;border-radius:0;flex:none}
html.pip-immersive .th-panel{bottom:0;overflow-y:auto;justify-content:safe center;padding-bottom:max(16px,env(safe-area-inset-bottom))}
html.pip-immersive .th-icon{top:max(4px,env(safe-area-inset-top))}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive .th-panel{gap:6px;padding:8px 12px}
html.pip-immersive .th-logo{font-size:1.7rem}
html.pip-immersive .th-grid{grid-template-columns:repeat(10,1fr);max-width:640px;gap:6px}
html.pip-immersive .th-bay{min-height:44px}
html.pip-immersive .th-panel>.th-stars .th-star{width:26px;height:26px}
}
