/* Glugg — game styles */
@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url(../fonts/baloo-2-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url(../fonts/baloo-2-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(../fonts/baloo-2-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(../fonts/baloo-2-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(../fonts/baloo-2-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(../fonts/baloo-2-latin-ext-800-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #16324F;
  --ink-2: #4A6178;
  --ink-3: #8193A5;
  --cordial: #E8385E;
  --cordial-dk: #B91F46;
  --lemon: #FFC93C;
  --lemon-dk: #E5AA14;
  --glass: #F3FAF9;
  --paper: #F6FBFA;
  --mint: #DDF0EC;
  --good: #17805F;
  --good-bg: #DDF3EA;
  --bad-bg: #FDE3E8;
  --line: rgba(22, 50, 79, .14);
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 26px;
  --bar: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; }
a { color: var(--cordial-dk); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--cordial); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30; height: var(--bar);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(246, 251, 250, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar .brand img { height: 34px; width: auto; }
.bar nav.inline { display: none; gap: 4px; margin-left: 12px; }
.bar nav.inline a {
  font-weight: 700; text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 999px;
}
.bar nav.inline a[aria-current="page"] { color: var(--ink); background: var(--mint); }
.bar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-family: var(--display); font-weight: 700; font-size: 17px;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.chip svg { width: 18px; height: 18px; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.langs button {
  border: 0; background: none; padding: 5px 10px; font-weight: 700; font-size: 14px; color: var(--ink-3); cursor: pointer;
}
.langs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink);
}
.iconbtn svg { width: 22px; height: 22px; }
.menu {
  position: fixed; z-index: 40; top: calc(var(--bar) + 8px); right: 12px; width: min(300px, calc(100vw - 24px));
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px;
  box-shadow: 0 18px 40px -18px rgba(22, 50, 79, .45);
}
.menu a, .menu button.link {
  display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px; text-decoration: none;
  color: var(--ink); font-weight: 700; background: none; border: 0; cursor: pointer;
}
.menu a:hover, .menu button.link:hover { background: var(--mint); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 8px; }
.menu .small { font-weight: 400; color: var(--ink-2); font-size: 14px; padding: 8px 14px; }

@media (min-width: 900px) {
  .bar { padding: 0 28px; }
  .bar nav.inline { display: flex; }
  .bar .menu-btn { display: none; }
}

/* ---------- page frame ---------- */
main.view { padding: 24px 16px 64px; max-width: 1040px; margin: 0 auto; }
.lead { color: var(--ink-2); font-size: 18px; max-width: 60ch; }
.foot {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 18px 16px 28px; color: var(--ink-3); font-size: 14px;
}
.foot a { color: var(--ink-2); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px;
  border-radius: 14px; border: 2px solid var(--ink); background: var(--lemon); color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 19px; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: 0 4px 0 rgba(22, 50, 79, .5); }
.btn.ghost { background: #fff; }
.btn.small { min-height: 40px; font-size: 16px; padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); }
.btn.danger { background: var(--cordial); color: #fff; }
.btn.wide { width: 100%; }

.form { display: grid; gap: 16px; max-width: 440px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 2px solid rgba(22, 50, 79, .25); background: #fff;
}
.field input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(255, 201, 60, .6); }
.field small { color: var(--ink-2); }
.err, .form-err { color: var(--cordial-dk); font-weight: 700; font-size: 15px; }
.err:empty, .form-err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.note {
  padding: 14px 16px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line);
}
.note.ok { background: var(--good-bg); border-color: transparent; }
.note.warn { background: #FFF4D6; border-color: transparent; }
.note.bad { background: var(--bad-bg); border-color: transparent; }
.links { display: grid; gap: 8px; margin-top: 8px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.stack > * + * { margin-top: 18px; }
.page-title { font-size: clamp(30px, 6vw, 44px); }

/* ---------- home ---------- */
.hero { display: grid; gap: 10px; margin: 8px 0 26px; }
.hero h1 { font-size: clamp(36px, 8vw, 64px); max-width: 14ch; }
.status { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: baseline; margin-bottom: 18px; }
.status .stat { display: grid; }
.status .stat b { font-family: var(--display); font-size: 30px; line-height: 1; }
.status .stat span { color: var(--ink-2); font-size: 14px; }
.guest-note { max-width: 62ch; color: var(--ink-2); }
.guest-note a { font-weight: 700; }

/* the level shelf: one tank per level, filled by progress */
.shelf {
  display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr); align-items: end; gap: clamp(8px, 2.4vw, 26px);
  padding: 22px clamp(8px, 3vw, 28px) 0; margin-top: 8px;
  border-bottom: 5px solid var(--ink); position: relative;
}
.lvl {
  display: grid; justify-items: center; gap: 8px; border: 0; background: none; padding: 0 0 12px; cursor: pointer; color: var(--ink);
}
.lvl .tank {
  width: min(100%, 104px); height: var(--h); position: relative; border: 5px solid var(--ink); border-top: 0;
  border-radius: 0 0 18px 18px; background: var(--glass); overflow: hidden;
}
.lvl .tank::before, .lvl .tank::after { /* rim lips */
  content: ""; position: absolute; top: 0; width: 9px; height: 5px; background: var(--ink); border-radius: 0 0 3px 3px;
}
.lvl .tank::before { left: -2px; } .lvl .tank::after { right: -2px; }
.lvl .liquid {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill); background: var(--cordial);
  transition: height .6s cubic-bezier(.3, .8, .3, 1);
}
.lvl .num {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 6vw, 40px);
  color: var(--ink); paint-order: stroke; -webkit-text-stroke: 6px var(--glass);
}
.lvl .cap { font-size: 13px; color: var(--ink-2); font-weight: 700; text-align: center; line-height: 1.2; }
.lvl.locked .tank { background: #E9EEF1; border-color: #9AAAB8; }
.lvl.locked .num { color: #9AAAB8; -webkit-text-stroke: 0; }
.lvl .valve { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; }
.lvl[aria-pressed="true"] .tank { box-shadow: 0 0 0 4px var(--lemon); }
.lvl[aria-pressed="true"] .cap { color: var(--ink); }

.detail {
  margin-top: 22px; display: grid; gap: 14px; padding: 22px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line);
}
.detail h2 { font-size: 34px; }
.detail .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); }
.detail .meta b { color: var(--ink); }
.detail .progress { height: 12px; border-radius: 999px; background: var(--mint); overflow: hidden; }
.detail .progress i { display: block; height: 100%; background: var(--cordial); border-radius: 999px; }
@media (min-width: 700px) {
  .detail { grid-template-columns: 1fr auto; align-items: center; }
  .detail .go { grid-column: 2; grid-row: 1 / span 3; }
}
.footnote { color: var(--ink-2); font-size: 14px; margin-top: 18px; }

/* ---------- game ---------- */
body.playing { overflow: hidden; }
body.playing .foot { display: none; }
.game {
  position: fixed; inset: var(--bar) 0 0 0; background: var(--mint) center / cover no-repeat;
  display: grid; grid-template-rows: 1fr auto; gap: 10px; padding: 10px;
}
.stage {
  position: relative; min-height: 0; display: grid; grid-template-rows: auto 1fr; border-radius: var(--r-lg);
  background: rgba(250, 253, 252, .8); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, .8); box-shadow: 0 20px 50px -30px rgba(22, 50, 79, .6);
}
.stage-top { display: flex; align-items: center; gap: 8px; padding: 8px 8px 0; }
.stage-top h2 { font-size: 20px; flex: 1; text-align: center; }
.board { position: relative; min-height: 0; }
.board svg { position: absolute; left: 8px; top: 2px; width: calc(100% - 16px); height: calc(100% - 10px); overflow: visible; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board .loading { min-height: 100%; }
.tray {
  border-radius: var(--r-lg); background: rgba(255, 255, 255, .94); border: 1px solid var(--line); padding: 12px;
  display: grid; gap: 10px; box-shadow: 0 20px 50px -30px rgba(22, 50, 79, .6);
}
.tray .hint { color: var(--ink-2); font-size: 15px; text-align: center; }
.slots { display: flex; justify-content: center; gap: 6px; flex-wrap: nowrap; }
.slot {
  flex: 1 1 0; max-width: 46px; height: 46px; border: 3px solid var(--ink); border-top-width: 0; border-radius: 0 0 12px 12px;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; background: var(--glass);
  position: relative;
}
.slot:empty { border-color: rgba(22, 50, 79, .3); background: transparent; }
.slot.next { border-color: var(--ink); border-style: dashed; }
.slot.right { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.slot.wrong { background: var(--bad-bg); border-color: var(--cordial-dk); color: var(--cordial-dk); }
.tray-actions { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
.legend { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 14px; color: var(--ink-2); }
.legend svg { width: 18px; height: 18px; flex: none; }

@media (min-width: 900px) {
  .game { grid-template-columns: 1fr 320px; grid-template-rows: 1fr; padding: 18px; gap: 18px; }
  .tray { align-self: center; padding: 20px; gap: 16px; }
  .slots { flex-wrap: wrap; }
  .slot { flex: 0 0 46px; }
  .tray-actions { grid-template-columns: 1fr 1fr; }
  .tray-actions .pour { grid-column: 1 / -1; }
}

/* tanks in the puzzle svg */
.t-hit { cursor: pointer; }
.t-hit:focus { outline: none; }
.t-hit:focus-visible .t-ring { stroke: var(--cordial); stroke-width: 8; opacity: 1; }
.t-ring { fill: none; stroke: var(--lemon); stroke-width: 14; opacity: 0; transition: opacity .15s; }
.t-hit.picked .t-ring { opacity: 1; }
.t-label { font-family: var(--display); font-weight: 800; fill: var(--ink); paint-order: stroke; stroke: var(--glass); stroke-width: 10px; stroke-linejoin: round; pointer-events: none; }
.t-badge circle { fill: var(--ink); }
.t-badge text { fill: #fff; font-family: var(--display); font-weight: 800; }
.t-full { animation: pop .45s ease-out; transform-box: fill-box; transform-origin: center bottom; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.05, .96); } 70% { transform: scale(.98, 1.03); } 100% { transform: scale(1); } }
.flow { stroke-dasharray: 14 12; animation: flow .5s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -26; } }
.stream { animation: stream .25s linear infinite; }
@keyframes stream { 50% { opacity: .82; } }

/* result: replaces the tray content once the pour finishes */
.result { display: grid; gap: 10px; animation: rise .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.result h3 { font-size: 24px; }
.result .pts { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; }
.result .pts.zero { font-size: 21px; color: var(--ink-2); }
.result .rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.result .rows span { font-size: 14px; color: var(--ink-2); }
.result .rows .slots { justify-content: flex-start; flex-wrap: wrap; gap: 4px; }
.result .rows .slot { flex: 0 0 30px; max-width: 30px; height: 30px; font-size: 16px; border-width: 2px; border-top-width: 0; border-radius: 0 0 8px 8px; }
.result .unlock { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--good); }
.result .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.result .acts .btn { flex: 1 1 auto; font-size: 17px; white-space: nowrap; padding: 8px 14px; }
.result small { color: var(--ink-2); line-height: 1.35; }
.tray.done { border: 2px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
@media (max-width: 899px) {
  .result { gap: 8px; }
  .result h3 { font-size: 21px; }
  .result .pts { font-size: 30px; }
  .result .acts .btn { min-height: 44px; }
}

/* ---------- leaderboard ---------- */
.board-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.board-table th { text-align: left; font-size: 14px; color: var(--ink-2); padding: 12px 14px; border-bottom: 2px solid var(--ink); }
.board-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.board-table td.r { font-family: var(--display); font-weight: 800; font-size: 20px; width: 64px; }
.board-table td.s { font-family: var(--display); font-weight: 700; font-size: 19px; text-align: right; }
.board-table th.s { text-align: right; }
.board-table td.l { width: 60px; text-align: center; color: var(--ink-2); }
.board-table tr.me td { background: #FFF4D6; }
.board-table tr:nth-child(1) td.r { color: var(--cordial-dk); }
.board-table .gap td { text-align: center; color: var(--ink-3); padding: 4px; }

/* ---------- how to play ---------- */
.rules { display: grid; gap: 12px; max-width: 64ch; padding-left: 1.3em; }
.rules li::marker { font-family: var(--display); font-weight: 800; }
.howto-grid { display: grid; gap: 28px; }
@media (min-width: 900px) { .howto-grid { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.pts-table { border-collapse: collapse; width: 100%; background: #fff; border-radius: var(--r-md); overflow: hidden; }
.pts-table th, .pts-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.pts-table th:first-child, .pts-table td:first-child { text-align: left; }
.pts-table th { font-size: 14px; color: var(--ink-2); }
.pts-table td { font-family: var(--display); font-weight: 700; font-size: 18px; }
.demo { background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line); padding: 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}

.loading { display: grid; place-items: center; min-height: 40vh; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .lvl .liquid, .result, .t-full { transition: none; animation: none; }
  .flow, .stream { animation: none; }
}
