/* Survey chart look: ink blue sea, bone and sand rock, coral accents. */
.tp{--ink:#0b2230;--panel:#0f2b3a;--line:#1d4557;--aqua:#6ee7f2;--gold:#ffd36b;--coral:#ff7a59;--bone:#f7f1df;
  font-family:system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;color:#e8f1f2;padding-bottom:env(safe-area-inset-bottom);
  padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
.game-title h1{color:#e8f1f2}.game-title a{color:#6ee7f2}
.tp-hud{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:6px}
.tp-stat{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:5px 7px;min-width:0}
.tp-k{display:block;font-size:.66rem;letter-spacing:.06em;text-transform:uppercase;color:#8fb3bf}
.tp-stat b{font-size:.98rem;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--bone)}
.tp-goal{display:flex;align-items:center;gap:8px;margin-bottom:6px;font-size:.78rem;color:#8fb3bf}
.tp-goalbar{flex:1;height:10px;background:var(--panel);border:1px solid var(--line);border-radius:5px;overflow:hidden}
.tp-goalbar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#2db6c8,var(--gold));transition:width .25s}
.tp-hint{background:#173a4c;border-left:4px solid var(--gold);padding:7px 10px;margin-bottom:6px;font-size:.88rem;border-radius:0 6px 6px 0}
.tp-stage{position:relative;width:100%;margin:0 auto}
#tp-board,#tp-strip{display:block;margin:0 auto;border:2px solid var(--line);border-radius:6px;background:var(--ink)}
#tp-board{touch-action:none;cursor:crosshair;-webkit-touch-callout:none}
#tp-strip{margin-top:6px;border-width:1px}
.tp-toast{position:absolute;left:50%;top:10px;transform:translate(-50%,-8px);background:rgba(11,34,48,.94);border:1px solid var(--gold);color:var(--bone);padding:6px 12px;border-radius:16px;font-size:.84rem;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s;white-space:nowrap;max-width:94%;overflow:hidden;text-overflow:ellipsis}
.tp-toast.show{opacity:1;transform:translate(-50%,0)}
.tp-ov{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(7,22,31,.78);border-radius:6px;padding:12px}
.tp-ov[hidden]{display:none}
.tp-card{width:100%;max-width:320px;background:var(--panel);border:2px solid var(--aqua);border-radius:8px;padding:16px;text-align:center;animation:tpin .25s ease-out}
.tp-card h2{font-size:1.35rem;color:var(--bone);margin-bottom:6px}
.tp-sub{font-size:.9rem;line-height:1.4;color:#c4dce2;margin-bottom:12px}
.tp-pearl{font-weight:700;color:var(--gold);margin-bottom:6px}
.tp-small{font-size:.76rem;color:#8fb3bf;margin-top:8px}
#tp-result.win .tp-card{border-color:var(--gold)}
.tp-btn{display:block;width:100%;min-height:46px;margin-top:8px;padding:10px 12px;border-radius:8px;border:2px solid var(--line);background:#143648;color:var(--bone);font:inherit;font-weight:700;font-size:.95rem;cursor:pointer;touch-action:manipulation}
.tp-btn:focus-visible,.tp-tool:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.tp-btn.main{background:var(--coral);border-color:#ffb199;color:#2b0f08}
.tp-btn.alt{background:#143648;border-color:var(--aqua)}
.tp-btn:disabled{opacity:.45;cursor:default}
.tp-btn.storm.ready{background:var(--gold);color:#2b1d00;border-color:#fff1c2;animation:tppulse 1.2s infinite}
.tp-tray{display:flex;gap:6px;overflow-x:auto;margin-top:8px;padding-bottom:4px;touch-action:pan-x;scrollbar-width:thin}
.tp-tool{flex:0 0 auto;width:76px;min-height:64px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;background:var(--panel);border:2px solid var(--line);border-radius:8px;color:var(--bone);font:inherit;cursor:pointer;padding:4px 2px;touch-action:manipulation}
.tp-tool.sel{border-color:var(--gold);background:#1b4054}
.tp-tool.lock{opacity:.5;cursor:default;border-style:dashed}
.tp-tool .tn{font-size:.7rem;font-weight:700;line-height:1.1;text-align:center}
.tp-tool .tc{font-size:.68rem;color:#8fb3bf}
.tp-bar{display:grid;grid-template-columns:2fr 1fr 1fr 1fr;gap:6px;margin-top:6px}
.tp-bar .tp-btn{margin-top:0;font-size:.78rem;padding:8px 4px}
.tp-bar .tp-btn.storm{font-size:.82rem}
.tp-help{margin:12px 0 0 1.1rem;font-size:.8rem;line-height:1.5;color:#9fbfca}
@keyframes tpin{from{transform:scale(.94);opacity:0}to{transform:none;opacity:1}}
@keyframes tppulse{50%{box-shadow:0 0 0 5px rgba(255,211,107,.35)}}
@keyframes tpstorm{0%,100%{filter:none}15%{filter:brightness(2.2)}30%{filter:brightness(.6)}50%{filter:brightness(1.7)}}
.tp.storm .tp-stage{animation:tpstorm .8s}
@media (max-width:380px){.tp-hud{grid-template-columns:repeat(2,1fr)}.tp-tool{width:70px}}
@media (prefers-reduced-motion:reduce){.tp *,.tp-card{animation:none!important;transition:none!important}}
#tp-retry[hidden]{display:none}
.tp-stars{font-size:1.9rem;letter-spacing:.2em;color:var(--gold);margin-bottom:4px;text-shadow:0 0 12px rgba(255,211,107,.5)}
.tp-live{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:.78rem;color:#8fb3bf;font-variant-numeric:tabular-nums}
.tp-live .warn{color:var(--coral)}
.tp-hint{animation:tphint 1.6s ease-in-out infinite}
@keyframes tphint{50%{border-left-color:var(--coral)}}

/* ---- Full screen (shell immersive on iPhone, native on Android): fill the stage, no scrolling ---- */
html.pip-immersive .tp-help,html.pip-native .tp-help,.game-wrap:fullscreen .tp-help{display:none}
html.pip-immersive .game-wrap.pip-stage,html.pip-native .game-wrap.pip-stage{display:flex;flex-direction:column;overflow:hidden!important;padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right));padding-bottom:max(6px,env(safe-area-inset-bottom))}
html.pip-native .game-wrap.pip-stage{padding-top:max(8px,env(safe-area-inset-top))}
html.pip-immersive .game-wrap.pip-stage>.tp,html.pip-native .game-wrap.pip-stage>.tp{flex:1 1 0;min-height:0;display:flex;flex-direction:column;padding:0}
html.pip-immersive .tp-stage,html.pip-native .tp-stage{flex:1 1 0;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden;contain:size}
html.pip-immersive #tp-board,html.pip-native #tp-board{margin:0}
html.pip-immersive .tp-hud,html.pip-native .tp-hud{margin-bottom:4px}
html.pip-immersive .tp-tray,html.pip-native .tp-tray{margin-top:6px}
html.pip-immersive .tp-ov,html.pip-native .tp-ov{overflow:auto}
/* full screen compact chrome: no title, no live line, tray as a wrapping grid so no tile is cut off */
html.pip-immersive .game-title,html.pip-native .game-title,html.pip-immersive .tp-live,html.pip-native .tp-live{display:none}
html.pip-immersive .tp-hud,html.pip-native .tp-hud{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
html.pip-immersive .tp-stat,html.pip-native .tp-stat{padding:3px 5px}
html.pip-immersive .tp-goal,html.pip-native .tp-goal{margin-bottom:4px}
html.pip-immersive #tp-strip,html.pip-native #tp-strip{margin-top:4px;flex:0 0 auto}
html.pip-immersive .tp-tray,html.pip-native .tp-tray{display:grid;grid-template-columns:repeat(auto-fill,minmax(50px,1fr));gap:4px;overflow-x:hidden;overflow-y:auto;max-height:124px;touch-action:pan-y;padding-bottom:0;flex:0 0 auto}
html.pip-immersive .tp-tool,html.pip-native .tp-tool{width:auto;min-width:0;min-height:52px}
html.pip-immersive .tp-bar,html.pip-native .tp-bar{flex:0 0 auto}
html.pip-immersive .tp-bar .tp-btn,html.pip-native .tp-bar .tp-btn{min-height:44px}
html.pip-immersive .tp-hint,html.pip-native .tp-hint{flex:0 0 auto;margin-bottom:4px;padding:4px 8px;font-size:.8rem}
html.pip-immersive .tp-hint[hidden],html.pip-native .tp-hint[hidden]{display:none}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .game-wrap.pip-stage>.tp,html.pip-native .game-wrap.pip-stage>.tp{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,430px);grid-template-rows:repeat(7,auto) minmax(0,1fr);column-gap:10px;align-content:start;overflow:hidden}
  html.pip-immersive .tp>*,html.pip-native .tp>*{grid-column:2}
  html.pip-immersive .tp>.tp-stage,html.pip-native .tp>.tp-stage{grid-column:1;grid-row:1/-1;min-height:0;height:100%}
  html.pip-immersive .tp-tool,html.pip-native .tp-tool{min-height:50px}
  html.pip-immersive .tp-bar,html.pip-native .tp-bar{grid-template-columns:1fr 1fr;margin-top:4px}
  html.pip-immersive .tp-btn,html.pip-native .tp-btn{min-height:44px;margin-top:6px}
  html.pip-immersive .tp-sub,html.pip-native .tp-sub{margin-bottom:6px;font-size:.82rem}
  html.pip-immersive .tp-card,html.pip-native .tp-card{padding:10px}
}
