/* Pool: the canvas fills the stage; HUD, power bar and menus are HTML over it */
.pl { display: flex; flex-direction: column; color: #dfe9ff; }
.pl-stage { position: relative; width: 100%; height: min(80vh, 700px); min-height: 380px; background: #04060f; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
@media (max-width: 600px) { .pl-stage { height: min(86vh, 730px); height: clamp(420px, calc(100svh - 138px), 760px); min-height: 420px; } }
.stage.is-immersive .stage-body > .pl { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .pl-stage { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; }
#pl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.pl-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* HUD */
.pl-hud { position: absolute; left: 0; right: 0; top: 0; height: 48px; display: flex; align-items: center; gap: 6px; padding: 4px 6px; z-index: 3; pointer-events: none; }
.pl-hud > * { pointer-events: auto; }
.pl-card { flex: 1 1 0; min-width: 0; height: 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 16px 20px; column-gap: 5px; align-items: center;
  padding: 2px 7px; border-radius: 12px; border: 1px solid #1c2b4a; background: rgba(11,19,40,0.82); transition: border-color .2s, box-shadow .2s, opacity .2s; }
.pl-card.is-turn { border-color: #55d6ff; box-shadow: 0 0 0 1px rgba(85,214,255,0.35), 0 0 16px rgba(85,214,255,0.28); }
.pl-card.is-off { opacity: 0.62; }
.pl-name { font-size: 12.5px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 10.5px; color: #8aa3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; font-variant-numeric: tabular-nums; }
.pl-icons { grid-column: 1 / 3; width: 100%; height: 18px; display: block; }
.pl-tool { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid #1c2b4a; background: rgba(11,19,40,0.82);
  color: #bfe0ff; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s, opacity .15s; }
.pl-tool svg { width: 19px; height: 19px; }
@media (hover: hover) { .pl-tool:hover:not(:disabled) { border-color: #55d6ff; color: #fff; } }
.pl-tool:focus-visible, .pl-btn:focus-visible, .pl-power:focus-visible, .pl-spinbtn:focus-visible, .pl-chip:focus-visible, .pl-lvl:focus-visible, .pl-look:focus-visible { outline: 2px solid #55d6ff; outline-offset: 2px; }
.pl-tool:disabled { opacity: 0.35; cursor: default; }
#pl-sound .pl-off { display: none; } #pl-sound[aria-pressed="true"] { color: #6f84a3; } #pl-sound[aria-pressed="true"] .pl-on { display: none; } #pl-sound[aria-pressed="true"] .pl-off { display: inline; }

/* side strip: spin, power, fine aim */
.pl-side { position: absolute; right: 0; top: 48px; bottom: 0; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 8px; z-index: 2; transition: opacity .2s; }
.pl-side.is-off { opacity: 0.38; pointer-events: none; }
.pl-spinbtn { width: 44px; height: 54px; flex: none; padding: 0; border: 0; background: none; color: #8aa3c4; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; touch-action: manipulation; border-radius: 10px; }
.pl-spinbtn canvas { width: 40px; height: 40px; display: block; }
.pl-spinbtn i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
.pl-power { flex: 1 1 auto; min-height: 120px; width: 44px; position: relative; cursor: grab; touch-action: none; border-radius: 22px; outline: none; }
.pl-power:active { cursor: grabbing; }
.pl-ptrack { position: absolute; left: 9px; right: 9px; top: 0; bottom: 0; border-radius: 13px; border: 1px solid #1c2b4a; background: linear-gradient(180deg, rgba(11,19,40,0.9), rgba(6,11,24,0.9)); overflow: visible; }
.pl-pfill { position: absolute; left: 3px; right: 3px; top: 3px; height: 0; border-radius: 10px; background: linear-gradient(180deg, #55d6ff, #ffd166 60%, #ff6b81); opacity: 0.9; }
.pl-pknob { position: absolute; left: -9px; right: -9px; top: 0; height: 44px; border-radius: 14px; border: 1px solid #55d6ff; background: #0f1d3d; box-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 12px rgba(85,214,255,0.25);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #dff6ff; font-variant-numeric: tabular-nums; }
.pl-nudge { display: flex; flex-direction: column; gap: 6px; flex: none; }
.pl-nudge .pl-tool { width: 44px; height: 40px; }

/* banners */
.pl-toast { position: absolute; left: calc(50% - 26px); top: 62px; transform: translateX(-50%); z-index: 4; width: max-content; max-width: min(calc(100% - 76px), 420px); padding: 9px 16px 10px; border-radius: 14px; text-align: center;
  background: rgba(8,14,30,0.94); border: 1px solid #1c2b4a; box-shadow: 0 8px 28px rgba(0,0,0,0.5); pointer-events: none; animation: pl-in .22s ease-out; }
.pl-toast[hidden] { display: none; }
.pl-toast b { display: block; font-size: 15px; font-weight: 800; color: #fff; }
.pl-toast span { display: block; font-size: 12.5px; color: #b9c9e4; margin-top: 2px; line-height: 1.35; }
.pl-toast.is-foul { border-color: #ff6b81; } .pl-toast.is-foul b { color: #ff9aa9; }
.pl-toast.is-good { border-color: #55d6ff; } .pl-toast.is-good b { color: #9fe8ff; }
.pl-toast.is-win { border-color: #ffd166; } .pl-toast.is-win b { color: #ffd166; }
@keyframes pl-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%); } }
.pl-tip { position: absolute; left: 8px; right: 60px; bottom: 6px; margin: 0 auto; width: fit-content; max-width: calc(100% - 68px); z-index: 2; text-align: center; font-size: 12.5px; line-height: 1.3; color: #dfe9ff; pointer-events: none;
  padding: 4px 10px; border-radius: 10px; background: rgba(4,6,15,0.94); }
.pl-tip:empty { display: none; }
.pl-tip[hidden] { display: none; }

/* spin picker */
.pl-spinpop { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(2,4,10,0.55); }
.pl-spinpop[hidden] { display: none; }
.pl-spinbox { width: min(92%, 250px); padding: 14px 16px 16px; border-radius: 18px; background: #0b1328; border: 1px solid #1c2b4a; box-shadow: 0 16px 50px rgba(0,0,0,0.6); text-align: center; }
.pl-spinbox b { font-size: 15px; color: #fff; }
.pl-spinbox canvas { display: block; width: 180px; height: 180px; margin: 8px auto 4px; touch-action: none; cursor: crosshair; }
.pl-spinbox p { margin: 0 0 10px; font-size: 12.5px; color: #8aa3c4; min-height: 17px; }

/* panels */
.pl-panel { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(2,4,10,0.62); overflow: hidden; }
.pl-panel[hidden] { display: none; }
.pl-stage.is-panel { touch-action: pan-y; }   /* a menu is up: a swipe may scroll the page */
@media (pointer: coarse) { .pl-stage.is-panel .pl-pin { overscroll-behavior: auto; } }
.pl-pin { width: min(100%, 460px); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 16px; border-radius: 20px; background: rgba(11,19,40,0.97); border: 1px solid #1c2b4a;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65), 0 0 0 1px rgba(85,214,255,0.06); text-align: center; touch-action: pan-y; animation: pl-pop .2s ease-out; }
.pl-pin.is-wide { width: min(100%, 620px); }
@keyframes pl-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.pl-pin h2 { margin: 0 0 4px; font-size: 26px; font-weight: 900; color: #fff; letter-spacing: -0.01em; }
.pl-pin h2 em { font-style: normal; color: #55d6ff; display: inline-block; white-space: nowrap; font-size: 0.74em; margin-left: 4px; }
.pl-pin h3 { margin: 14px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #8aa3c4; }
.pl-pin p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; color: #b9c9e4; }
.pl-pin p.pl-big { font-size: 15px; color: #dfe9ff; }
.pl-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pl-btn { min-height: 42px; padding: 0 16px; border-radius: 13px; border: 1px solid #1c2b4a; background: #101c3a; color: #dfe9ff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: border-color .15s, background .15s, transform .1s; }
@media (hover: hover) { .pl-btn:hover:not(:disabled) { border-color: #55d6ff; } }
.pl-btn:active:not(:disabled) { transform: translateY(1px); }
.pl-btn:disabled { opacity: 0.4; cursor: default; }
.pl-btn.pl-primary { background: linear-gradient(180deg, #6fe0ff, #37b9ea); border-color: #8be7ff; color: #04121a; font-weight: 900; box-shadow: 0 0 18px rgba(85,214,255,0.35); }
.pl-btn.pl-go { width: 100%; min-height: 54px; font-size: 18px; margin: 12px 0 8px; }
.pl-btn.pl-half { flex: 1 1 140px; }
.pl-btn small { font-size: 11.5px; font-weight: 700; color: #ffd166; white-space: nowrap; }
.pl-btn.pl-two { flex-direction: column; gap: 1px; min-height: 50px; line-height: 1.15; }
.pl-seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: #060b18; border: 1px solid #1c2b4a; margin-top: 8px; }
.pl-chip { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0 4px; border-radius: 10px; border: 0; background: none; color: #8aa3c4; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.pl-seg.is-opp { display: grid; grid-template-columns: repeat(4, 1fr); }
.pl-seg.is-opp .pl-chip:last-child { grid-column: 1 / -1; }
.pl-chip[aria-pressed="true"] { background: #17305e; color: #fff; box-shadow: inset 0 0 0 1px #55d6ff; }
.pl-links { display: flex; gap: 0 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.pl-link { min-height: 40px; padding: 0 4px; border: 0; background: none; color: #8fd3ff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; touch-action: manipulation; }
.pl-left { text-align: left; }
.pl-left ul { margin: 0 0 10px; padding-left: 18px; font-size: 13.5px; line-height: 1.5; color: #b9c9e4; }
.pl-left li { margin-bottom: 3px; }
.pl-kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; font-size: 13.5px; text-align: left; margin: 6px 0 12px; }
.pl-kv span { color: #8aa3c4; } .pl-kv b { color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.pl-stars { font-size: 34px; letter-spacing: 6px; color: #2a3a5c; margin: 2px 0 6px; line-height: 1; }
.pl-stars i { font-style: normal; } .pl-stars i.on { color: #ffd166; text-shadow: 0 0 14px rgba(255,209,102,0.6); }
.pl-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 2px; text-align: left; font-size: 13.5px; color: #dfe9ff; cursor: pointer; border-top: 1px solid #132040; }
.pl-opt input { width: 20px; height: 20px; accent-color: #55d6ff; flex: none; }
.pl-opt small { display: block; color: #8aa3c4; font-size: 12px; }

/* challenge grid */
.pl-chap { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 1px 8px; margin: 14px 0 7px; text-align: left; }
.pl-chap b { font-size: 14px; color: #fff; } .pl-chap em { font-style: normal; font-size: 12px; color: #ffd166; font-weight: 700; white-space: nowrap; } .pl-chap span { grid-column: 1 / -1; font-size: 12px; line-height: 1.35; color: #8aa3c4; }
.pl-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pl-lvl { aspect-ratio: 1; min-height: 44px; border-radius: 12px; border: 1px solid #1c2b4a; background: #101c3a; color: #fff; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; touch-action: manipulation; }
.pl-lvl small { font-size: 9px; letter-spacing: 1px; color: #2f4168; } .pl-lvl small i { font-style: normal; } .pl-lvl small i.on { color: #ffd166; }
.pl-lvl.is-next { border-color: #55d6ff; box-shadow: 0 0 12px rgba(85,214,255,0.3); }
.pl-lvl:disabled { opacity: 0.38; cursor: default; } .pl-lvl:disabled small { letter-spacing: 0; }
/* looks */
.pl-looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pl-look { min-height: 74px; border-radius: 12px; border: 1px solid #1c2b4a; background: #101c3a; color: #dfe9ff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px; touch-action: manipulation; }
.pl-look i { display: block; width: 100%; max-width: 84px; height: 26px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.14); }
.pl-look[aria-pressed="true"] { border-color: #55d6ff; box-shadow: inset 0 0 0 1px #55d6ff; }
.pl-look:disabled { opacity: 0.5; cursor: default; } .pl-look small { font-size: 10.5px; color: #8aa3c4; font-weight: 600; }

/* small stages: phone on its side */
.pl.is-short .pl-hud { height: 44px; padding: 2px 6px; } .pl.is-short .pl-card { height: 36px; grid-template-rows: 15px 17px; } .pl.is-short .pl-icons { height: 15px; }
.pl.is-short .pl-side { top: 44px; gap: 4px; padding: 2px 0 4px; }
.pl.is-short .pl-power { min-height: 70px; } .pl.is-short .pl-nudge { gap: 4px; }
.pl.is-short .pl-spinbtn { height: 42px; } .pl.is-short .pl-spinbtn i { display: none; }
.pl.is-short .pl-pin { padding: 12px 14px; } .pl.is-short .pl-pin h2 { font-size: 20px; } .pl.is-short .pl-btn.pl-go { min-height: 46px; margin: 8px 0 6px; }
.pl.is-short .pl-tag { display: none; }
@media (min-width: 601px) { .pl.is-short .pl-tip { left: auto; right: calc(50% + 56px); margin: 0; max-width: 222px; font-size: 11px; line-height: 1.2; bottom: 2px; padding: 2px 8px; } }
@media (max-width: 600px) { .pl.is-short .pl-tip { font-size: 11.5px; line-height: 1.2; bottom: 2px; padding: 2px 8px; } }
@media (prefers-reduced-motion: reduce) { .pl-toast, .pl-pin { animation: none; } }
