/* /water-sort/ — the Pocket Games "Water Sort" (glass studio) on the site.
   The stage carries the app's own palette (liquids, glass, gold collars on a
   deep violet studio); the page frame, rank rows and the more-games row come
   from games.css / components.css. Shared by all locales. */

.ws-play { display: grid; gap: var(--space-3); text-align: center; }
.ws-h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--text);
}
.ws-h1-sub { max-inline-size: 60ch; margin: 0 auto !important; color: var(--text-muted); text-wrap: pretty; }
:lang(zh) .ws-h1, :lang(ja) .ws-h1 { font-family: var(--font-body); font-weight: 700; font-size: var(--step-3); line-height: 1.15; }
:lang(ar) .ws-h1, :lang(ru) .ws-h1, :lang(hi) .ws-h1 { line-height: 1.15; }
:lang(ar) .ws-h1 { line-height: 1.4; letter-spacing: 0; }

/* ── stage: the app's studio ─────────────────────────────────────────── */
.ws-card { inline-size: 100%; max-inline-size: 760px; margin-inline: auto; border-radius: 22px; overflow: hidden; box-shadow: 0 18px 50px #0b061f66; }
.ws-stage {
  --ws-c0:#ff2d6f;--ws-c1:#ff7a12;--ws-c2:#ffc300;--ws-c3:#37cf45;--ws-c4:#00c9b8;--ws-c5:#2b7fff;--ws-c6:#8a4dff;--ws-c7:#ff4fd8;--ws-c8:#a8e615;--ws-c9:#a318cf;--ws-c10:#ff4f33;--ws-c11:#25d3ff;
  --game-bg:#251845;--game-surface:#302250;--game-panel:#423363;--game-ink:#fff7ef;--game-muted:#d5c7e7;--game-accent:#edbd6c;--game-border:#7d699d;
  --ws-glass-fill:#bcc5ee12;--ws-glass-stroke:#b9bfe9;--ws-glass-stroke-hot:#fff3bf;--ws-cap:#bcc5ea66;--ws-cap-edge:#d9e1ff;--ws-cap-inner:#271d47;--ws-shadow:#0c0821;--ws-select-glow:#bc9ef1;--ws-glass-edge:#827cac;--ws-hero-disc:#4e376b;--ws-hero-ring:#ae94c0;--ws-hidden:#8f88a1;--ws-done:#a7e7b7;--ws-lock:#ddba72;--ws-lock-edge:#fff0bb;
  position: relative;
  display: grid;
  block-size: var(--ws-h, clamp(560px, 80vh, 760px));
  overflow: hidden;
  color: var(--game-ink);
  background: radial-gradient(ellipse at 50% 2%, #624284 0, transparent 57%), radial-gradient(ellipse at 8% 70%, #45347466, transparent 60%), #251845;
  font-family: var(--font-body, system-ui, sans-serif);
  text-align: center;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ws-stage > noscript { display: grid; place-items: center; padding: 2rem; }
.ws-stage button { font-family: inherit; cursor: pointer; }
.ws-stage :is(h2, h3) { font-family: inherit; letter-spacing: normal; text-transform: none; }
.ws-start, .ws-game { justify-self: center; inline-size: 100%; max-inline-size: 680px; }
.ws-stage [hidden] { display: none !important; }

/* ── start menu (level picker) ── */
.ws-start { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 18px 22px 20px; overflow: auto; min-block-size: 0; scrollbar-color: #9e86b5 #352550; }
.ws-hero { block-size: 168px; inline-size: 100%; max-inline-size: 320px; flex-shrink: 0; overflow: visible; }
.ws-menu-copy { display: grid; gap: 5px; }
.ws-menu-copy h3 { font-size: 24px; margin: 0; color: var(--game-ink); font-weight: 800; }
.ws-menu-copy p { font-size: 12px; margin: 0; color: var(--game-muted); }
.ws-menu-copy > span { font-size: 11px; color: var(--game-muted); }
.ws-lesson { font-size: 12px; line-height: 1.5; max-inline-size: 360px; margin: 0; color: var(--game-muted); }
.ws-primary {
  inline-size: 100%; max-inline-size: 390px; min-block-size: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 21px; border: 1px solid #ffe0a3; border-radius: 16px;
  color: #38234d; background: linear-gradient(#f4d393, #dca959);
  box-shadow: 0 6px 15px #10092066, inset 0 1px 0 #fff0c4;
  font-size: 18px; font-weight: 900; text-align: start;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.ws-primary:active { box-shadow: 0 3px 9px #10092066; transform: translateY(2px); }
.ws-primary:focus-visible, .ws-secondary:focus-visible, .ws-levels button:focus-visible, .ws-icon:focus-visible, .ws-tools button:focus-visible, .ws-pace button:focus-visible, .ws-pages button:focus-visible { outline: 2px solid #fff3bf; outline-offset: 2px; }
.ws-levels { display: grid; grid-template-columns: repeat(6, 1fr); inline-size: 100%; max-inline-size: 390px; gap: 7px; margin-top: 2px; flex-shrink: 0; }
.ws-levels button { display: grid; align-content: center; min-block-size: 46px; gap: 2px; border: 1px solid #66537f; border-radius: 12px; background: #45365f; color: #e1cfe9; }
.ws-levels button b { font-size: 15px; color: inherit; }
.ws-levels button[aria-pressed='true'] { background: #fff0d0; color: #543262; border-color: #edcc89; }
.ws-levels small { block-size: 8px; font-size: 8px; line-height: 8px; color: #ffda84; }
.ws-levels button[aria-pressed='true'] small { color: #b5832d; }
.ws-levels button:disabled { opacity: 0.4; cursor: default; }
.ws-pages { display: flex; inline-size: 100%; max-inline-size: 390px; align-items: center; justify-content: space-between; color: var(--game-muted); font-size: 11px; flex-shrink: 0; }
.ws-pages button { border: 0; background: none; font-size: 21px; min-inline-size: 44px; min-block-size: 44px; color: var(--game-accent); }
.ws-pages button:disabled { opacity: 0.3; cursor: default; }
.ws-pace { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--game-muted); }
.ws-pace span { margin-inline-end: 4px; }
.ws-pace button { min-block-size: 32px; padding: 4px 12px; border: 1px solid #66537f; border-radius: 999px; background: #3a2b56; color: var(--game-muted); font-size: 11px; font-weight: 800; }
.ws-pace button[aria-pressed='true'] { background: #54436c; color: var(--game-ink); border-color: var(--game-accent); }
.ws-menu-note { margin: 0; font-size: 11px; line-height: 1.7; color: var(--game-muted); }

/* ── game ── */
.ws-game { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 8px; min-block-size: 0; block-size: 100%; padding: 12px 16px 14px; }
.ws-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px; }
.ws-status-level { display: grid; gap: 2px; text-align: start; }
.ws-status span { color: var(--game-muted); font-size: 9px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; }
.ws-status h2 { margin: 1px 0; font-size: 26px; line-height: 1.1; color: var(--game-ink); font-family: inherit; font-weight: 800; text-transform: none; }
.ws-status-tools { display: flex; gap: 6px; margin-inline-start: auto; }
.ws-icon { display: grid; place-items: center; inline-size: 40px; block-size: 40px; border: 1px solid #7a6592; border-radius: 12px; background: #54436c99; color: var(--game-ink); font-size: 15px; }
.ws-icon:hover { background: #54436c; }
.ws-moves { display: grid; gap: 2px; min-inline-size: 64px; text-align: center; }
.ws-moves b { font-size: 28px; line-height: 1.1; color: var(--game-ink); font-variant-numeric: tabular-nums; }
.ws-moves.low b { color: #ffabbd; }
.ws-board { position: relative; isolation: isolate; flex: 1; min-block-size: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 65%, #79619219, transparent 72%); }
.ws-board::before { content: ''; position: absolute; left: 3%; right: 3%; bottom: 4%; block-size: 14%; border-radius: 50%; background: #130d2c55; filter: blur(15px); z-index: -1; pointer-events: none; }
.ws-svg { inline-size: 100%; block-size: 100%; min-block-size: 0; overflow: visible; touch-action: manipulation; }
.ws-tube { cursor: pointer; outline: none; }
.ws-tube:focus-visible { filter: drop-shadow(0 2px 3px #ffdfa2); }
.ws-tube[data-locked='true'], .ws-tube[data-frozen='true'] { cursor: not-allowed; }
.ws-message { min-block-size: 36px; max-inline-size: 420px; align-self: center; margin: 0; font-size: 12px; line-height: 1.4; color: var(--game-muted); }
.ws-tools { display: flex; justify-content: space-around; align-items: center; gap: 20px; inline-size: 100%; max-inline-size: 430px; align-self: center; }
.ws-tools button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-inline-size: 66px; min-block-size: 62px; border: 1px solid #7a6592; border-radius: 16px; background: #54436c; color: var(--game-ink); box-shadow: 0 5px 12px #1209274d, inset 0 1px #78638c; font-size: 10px; font-weight: 800; }
.ws-tools button > span { font-size: 28px; line-height: 1.1; }
.ws-tools button > small { position: absolute; right: 6px; top: 5px; display: grid; place-items: center; inline-size: 15px; block-size: 15px; border-radius: 50%; background: #f5d7a0; color: #49305c; font-size: 9px; }
.ws-tools button:disabled { opacity: 0.4; cursor: default; }
.ws-sorted { display: grid; gap: 3px; text-align: center; }
.ws-sorted b { font-size: 20px; color: var(--game-accent); font-variant-numeric: tabular-nums; }
.ws-sorted > span, .ws-sorted > small { font-size: 9px; color: var(--game-muted); }
.ws-sorted > small { margin-top: 4px; }
.ws-move-rule { margin: 0; font-size: 10px; line-height: 1.7; color: var(--game-muted); }

/* ── praise, sparks, overlay ── */
.ws-praise { position: absolute; inset: 18% 0 auto; display: grid; justify-items: center; gap: 2px; pointer-events: none; opacity: 0; z-index: 2; }
.ws-praise strong { color: #ffdd97; font-size: 25px; font-weight: 900; text-shadow: 0 3px 12px #100b2a; }
.ws-praise small { color: #fff3db; font-size: 12px; text-shadow: 0 2px 8px #100b2a; }
.ws-praise.is-on { animation: ws-praise 1.5s ease both; }
@keyframes ws-praise { 0% { opacity: 0; transform: translateY(12px) scale(.86); } 14% { opacity: 1; transform: translateY(0) scale(1.04); } 24% { transform: scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.ws-spark { animation: ws-spark 0.8s cubic-bezier(.2,.7,.3,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes ws-spark { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.ws-flask-body.is-nudge { animation: ws-nudge 0.32s ease; }
@keyframes ws-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.ws-board.is-shake { animation: ws-shake 0.45s ease; }
@keyframes ws-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.ws-bubble { animation: ws-rise linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ws-rise { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: .6; } 85% { opacity: .4; } 100% { transform: translateY(var(--rise, -60px)); opacity: 0; } }
.ws-sparkle { animation: ws-twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ws-twinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.05); } }
.ws-stream-shine { animation: ws-flow .5s linear infinite; }
@keyframes ws-flow { to { stroke-dashoffset: -15; } }
.ws-overlay { grid-area: 1 / 1; z-index: 3; display: grid; place-items: center; padding: 20px; background: #160d2fb8; backdrop-filter: blur(3px); }
.ws-sheet { display: grid; justify-items: center; gap: 12px; inline-size: min(100%, 360px); padding: 24px 20px; border: 1px solid #7a6592; border-radius: 20px; background: #302250; box-shadow: 0 18px 40px #0b061f99; animation: ws-in .3s ease both; }
@keyframes ws-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.ws-sheet h2 { margin: 0; font-size: 24px; line-height: 1.2; color: var(--game-ink); font-weight: 900; font-family: inherit; text-transform: none; }
.ws-sheet-score { margin: 0; color: var(--game-muted); font-size: 14px; }
.ws-sheet-score b { color: var(--game-accent); font-size: 20px; }
.ws-sheet-score em { display: block; margin-top: 4px; color: #a7e7b7; font-style: normal; font-weight: 800; }
.ws-sheet-sub { margin: 0; color: var(--game-muted); font-size: 12px; line-height: 1.5; }
.ws-sheet-actions { display: grid; gap: 8px; inline-size: 100%; }
.ws-sheet-actions .ws-primary { max-inline-size: none; }
.ws-secondary { min-block-size: 44px; border: 1px solid #7a6592; border-radius: 14px; background: #54436c; color: var(--game-ink); font-weight: 800; }
.ws-stars { margin: 0; display: flex; gap: 6px; font-size: 34px; line-height: 1; }
.ws-stars span { color: #54436c; }
.ws-stars span.on { color: #ffd56b; text-shadow: 0 2px 10px #f4b84a88; animation: ws-star .45s cubic-bezier(.3,1.6,.5,1) both; }
.ws-stars span.on:nth-child(2) { animation-delay: .12s; }
.ws-stars span.on:nth-child(3) { animation-delay: .24s; }
@keyframes ws-star { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }

@media (max-height: 720px), (max-width: 480px) {
  .ws-start { gap: 10px; padding-top: 12px; }
  .ws-hero { block-size: 130px; }
  .ws-lesson { font-size: 11px; }
  .ws-game { padding: 8px 10px 10px; gap: 5px; }
  .ws-message { min-block-size: 30px; font-size: 11px; }
  .ws-tools { gap: 10px; }
  .ws-tools button { min-block-size: 52px; min-inline-size: 60px; }
  .ws-status h2 { font-size: 22px; }
  .ws-icon { inline-size: 36px; block-size: 36px; }
}
@media (max-width: 380px) { .ws-move-rule { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .ws-bubble, .ws-sparkle, .ws-stream-shine, .ws-spark, .ws-praise.is-on, .ws-flask-body.is-nudge, .ws-board.is-shake, .ws-sheet, .ws-stars span.on { animation: none; }
  .ws-praise.is-on { opacity: 1; }
  .ws-spark { display: none; }
}

/* ── play layer: the stage fills the slot ── */
.play-slot .ws-play { gap: 0; }
.play-slot .ws-card { max-inline-size: 1000px; border-radius: 18px; }
.play-slot .ws-icon[data-ws='menu'] { display: none; }

/* ── leaderboard link ── */
.ws-lb-cta { display: flex; justify-content: center; }

/* Flask captions: capacity pips + keyboard keycap; touch screens have no keys to show. */
@media (pointer: coarse) { .ws-key { display: none; } }
