/* Zanim popłynie woda: wspólna zabawa z Akwawit Leszno */

@font-face { font-family: 'Fredoka'; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url(fonts/fredoka-latin-ext-wght-normal.woff2) format('woff2-variations'), url(fonts/fredoka-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Fredoka'; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url(fonts/fredoka-latin-wght-normal.woff2) format('woff2-variations'), url(fonts/fredoka-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/nunito-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/nunito-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/nunito-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/nunito-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 800; src: url(fonts/nunito-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 800; src: url(fonts/nunito-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --deep: #04304a;
  --sea: #075f82;
  --lagoon: #0b86ad;
  --foam: #e8f8fd;
  --ink: #0c2a3b;
  --muted: #4d6a7a;
  --line: #d3e6ee;
  --card: #ffffff;
  --cta: #0a78a8;
  --cta-hover: #08658e;
  --sun: #ffd23f;
  --plus: #13865a;
  --plus-bg: #e3f6ee;
  --minus: #c63c3c;
  --minus-bg: #fdecec;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --top: 60px;
  --ar: 1.7;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--lagoon); }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, var(--deep) 0, var(--sea) 70vh, var(--lagoon) 140vh, var(--lagoon) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: var(--cta); }
h1, h2, h3, p { margin: 0; }

/* ---------- moving light on the water ---------- */
.water { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.water::before, .water::after {
  content: ""; position: absolute; inset: -40%;
  background:
    radial-gradient(closest-side, rgba(160, 235, 255, .16), transparent 70%) 0 0 / 220px 160px,
    radial-gradient(closest-side, rgba(160, 235, 255, .10), transparent 70%) 110px 80px / 260px 190px;
  filter: blur(6px);
  animation: drift 26s linear infinite;
}
.water::after { animation-duration: 38s; animation-direction: reverse; opacity: .7; transform: rotate(12deg); }
@keyframes drift { from { translate: 0 0; } to { translate: 220px 160px; } }
.bubble {
  position: absolute; bottom: -20px; width: var(--s); height: var(--s); border-radius: 50%;
  border: 1.5px solid rgba(220, 248, 255, .45); background: rgba(220, 248, 255, .08);
  left: var(--x); animation: rise var(--d) linear infinite; animation-delay: var(--w);
}
@keyframes rise { from { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } to { transform: translateY(-110vh) translateX(20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .water::before, .water::after, .bubble { animation: none; } .bubble { display: none; } }

/* ---------- top bar ---------- */
.topbar {
  position: relative; z-index: 2; height: var(--top);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  color: #fff;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { opacity: .7; font-weight: 400; }
.sound { display: flex; gap: 6px; flex-shrink: 0; }
.sound button {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.sound button:hover { background: rgba(255,255,255,.18); }
.sound button[aria-pressed="false"] { opacity: .5; }
.sound button[aria-pressed="false"] .on, .sound button[aria-pressed="true"] .off { display: none; }
.sound svg { width: 20px; height: 20px; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

main { position: relative; z-index: 1; padding: 0 16px 32px; }

/* ---------- intro ---------- */
.intro { max-width: 980px; margin: 0 auto; padding-top: clamp(8px, 4vh, 40px); }
.hero { text-align: center; color: #fff; margin-bottom: clamp(20px, 4vh, 36px); }
.hero h1 {
  font-family: var(--display); font-weight: 700; line-height: .98;
  font-size: clamp(44px, 9vw, 96px); letter-spacing: -.01em;
  text-shadow: 0 4px 24px rgba(0, 30, 50, .35);
}
.hero h1 .w { display: block; color: #9fe8ff; }
.wave { display: block; width: min(320px, 70%); height: 18px; margin: 14px auto 16px; color: var(--sun); }
.with {
  display: inline-flex; align-items: center; gap: 8px; font-size: clamp(16px, 2.4vw, 20px);
  padding: 8px 18px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
}
.with strong { font-weight: 800; }

.panel {
  background: var(--card); border-radius: 26px; padding: clamp(20px, 3.5vw, 36px);
  box-shadow: 0 30px 60px -30px rgba(0, 20, 40, .6);
}
.panel h2 { font-family: var(--display); font-weight: 600; font-size: 24px; margin-bottom: 14px; color: var(--ink); }
.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); }
@media (max-width: 760px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; counter-increment: s; }
.steps li::before {
  content: counter(s); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--foam); color: var(--cta); font-family: var(--display); font-weight: 600; font-size: 18px;
}
.steps b { font-weight: 800; }

.score-table { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.score-table li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; align-items: center; }
.v {
  font-family: var(--display); font-weight: 600; font-size: 19px; text-align: center; border-radius: 10px; padding: 4px 0;
  font-variant-numeric: tabular-nums;
}
.v.plus { color: var(--plus); background: var(--plus-bg); }
.v.minus { color: var(--minus); background: var(--minus-bg); }
.tip { margin-top: 14px; font-size: 15px; color: var(--muted); }

.start { margin-top: clamp(22px, 3vw, 30px); padding-top: clamp(20px, 3vw, 26px); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 28px; align-items: center; }
@media (max-width: 760px) { .start { grid-template-columns: minmax(0, 1fr); } }
.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; cursor: pointer; font-size: 15px; }
.check input {
  appearance: none; -webkit-appearance: none; width: 26px; height: 26px; margin: 0; border-radius: 8px;
  border: 2px solid #9fbccb; background: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.check input::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
.check input:checked { background: var(--cta); border-color: var(--cta); }
.check input:checked::after { opacity: 1; }
.check span { padding-top: 2px; }
.check.small { font-size: 14px; color: var(--muted); }
.check.small span { color: var(--ink); }

.btn {
  font: inherit; font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: .01em;
  min-height: 56px; padding: 12px 34px; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cta); color: #fff; box-shadow: 0 10px 22px -12px rgba(10, 120, 168, .9); }
.btn.primary:hover { background: var(--cta-hover); }
.btn.primary[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--cta); border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--cta); }
.btn svg { width: 22px; height: 22px; }
.hint { font-size: 13px; color: var(--muted); text-align: right; }
@media (max-width: 760px) { .btn.big { width: 100%; } .hint { text-align: left; } }

/* ---------- play ---------- */
.play { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.stage {
  position: relative;
  width: min(100%, 1060px, calc((100vh - var(--top) - 36px) * var(--ar)));
  width: min(100%, 1060px, calc((100dvh - var(--top) - 36px) * var(--ar)));
  aspect-ratio: var(--ar);
  border-radius: 22px; overflow: hidden; background: #0b3550;
  box-shadow: 0 30px 60px -28px rgba(0, 15, 30, .8), 0 0 0 1px rgba(255,255,255,.08);
}
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; -webkit-tap-highlight-color: transparent; }

/* ---------- result ---------- */
.result { max-width: 600px; margin: 0 auto; padding-top: clamp(4px, 3vh, 28px); }
.score-head { text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.outcome { font-weight: 800; color: var(--muted); }
.outcome.ok { color: var(--plus); }
.outcome.bad { color: var(--minus); }
.total { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 13vw, 84px); line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--ink); }
.total-unit { color: var(--muted); font-size: 15px; }
.breakdown { margin: 0 0 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-size: 15px; }
.breakdown dt { color: var(--muted); }
.breakdown { column-gap: 0; }
.breakdown dd { padding-left: 16px; }
.breakdown dd { margin: 0; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.breakdown dd.p { color: var(--plus); }
.breakdown dd.m { color: var(--minus); }
.breakdown .sum { border-top: 1px solid var(--line); padding-top: 8px; color: var(--ink); font-weight: 800; }

.save { background: var(--foam); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.save h2 { font-size: 21px; margin: 0; }
.save p.lead { font-size: 15px; color: var(--muted); margin-top: -6px; }
.field label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid #b9d3df; background: #fff; color: var(--ink);
}
.field input:focus { border-color: var(--cta); outline: none; }
.field input[aria-invalid="true"] { border-color: var(--minus); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.rodo { font-size: 13px; color: var(--muted); }
.rodo summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.rodo p { margin-top: 8px; }
.err { color: var(--minus); font-weight: 700; font-size: 14px; }
.saved { display: flex; gap: 12px; align-items: flex-start; background: var(--plus-bg); color: #0d5a3d; border-radius: 18px; padding: 18px; font-weight: 700; }
.saved svg { flex-shrink: 0; width: 28px; height: 28px; }
.again { margin-top: 18px; display: flex; justify-content: center; }

/* wynik + tabela top 10 */
.result { max-width: 1040px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 18px 32px; align-items: start; }
.result-grid .again { grid-column: 1 / -1; margin-top: 4px; }
@media (max-width: 840px) { .result-grid { grid-template-columns: minmax(0, 1fr); } .result { max-width: 600px; } }
.top {
  background: linear-gradient(160deg, #06405f, #0a6d93); color: #fff; border-radius: 20px; padding: 20px 18px 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.top h2 { color: #fff; font-size: 22px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.top h2::before { content: ""; width: 26px; height: 26px; flex-shrink: 0; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffd23f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 21h8M12 17v4M7 4h10v5a5 5 0 0 1-10 0V4z'/%3E%3Cpath d='M17 5h3v2a3 3 0 0 1-3 3M7 5H4v2a3 3 0 0 0 3 3'/%3E%3C/svg%3E"); }
.top-note { background: var(--sun); color: #3d2e00; font-weight: 800; font-size: 14px; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
.toplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toplist li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.07); font-size: 15px;
}
.toplist .pos { font-family: var(--display); font-weight: 600; text-align: center; color: #9fe8ff; }
.toplist li:nth-child(1) .pos { color: var(--sun); }
.toplist li:nth-child(-n+3) { background: rgba(255,255,255,.13); }
.toplist .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .pts { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
.toplist li.me { background: var(--sun); color: #3d2e00; }
.toplist li.me .pos { color: #3d2e00; }
.top-msg { font-size: 14px; color: #cfeefa; margin-top: 6px; }
.top-msg:empty { display: none; }
