/* ── Fireflies ───────────────────────────────────────────────── */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(assets/fraunces-roman-latin.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: 'Fraunces'; font-style: italic; font-weight: 300 700; font-display: swap;
  src: url(assets/fraunces-italic-latin.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: 'Fraunces'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(assets/fraunces-roman-ext.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: 'Fraunces'; font-style: italic; font-weight: 300 700; font-display: swap;
  src: url(assets/fraunces-italic-ext.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; }

:root {
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --paper: #f3ecd2;
  --paper-dim: rgba(243, 236, 210, .66);
  --paper-faint: rgba(243, 236, 210, .38);
  --glow: #d8ff6a;
  --gold: #ffe9a0;
  --night: #06080f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night); color: var(--paper);
  font-family: var(--serif); font-weight: 300;
  overflow: hidden; position: fixed; inset: 0;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: none; }
body.pointer-visible #c { cursor: default; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button { pointer-events: auto; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── hud ── */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 0 calc(18px + env(safe-area-inset-left));
}
.hud-left { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; transition: opacity .8s; }
.meadow-name { font-style: italic; font-size: 17px; letter-spacing: .04em; color: var(--paper-dim); }
.meadow-sub { font-size: 12.5px; letter-spacing: .06em; color: var(--paper-faint); font-variant-numeric: tabular-nums; }
.hud-right { display: flex; gap: 2px; align-items: center; }
.ib {
  background: none; border: 0; cursor: pointer; color: var(--paper-faint);
  width: 40px; height: 40px; padding: 8px; border-radius: 50%; line-height: 0;
  transition: color .3s, background .3s; font-family: inherit;
}
.ib svg { width: 100%; height: 100%; }
.ib:hover, .ib:focus-visible { color: var(--paper); background: rgba(243, 236, 210, .06); outline: none; }
.ib.text { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; line-height: 1; font-style: italic; }
#btnSound .off { display: none; }
#btnSound.muted .wave { display: none; }
#btnSound.muted .off { display: block; }
body.playing .hud-left { opacity: 1; }
body:not(.playing) #btnRestart { display: none; }
#btnRestart:hover svg, #btnRestart:focus-visible svg { transform: rotate(-40deg); }
#btnRestart svg { transition: transform .4s ease; }

/* ── title ── */
.title {
  position: absolute; left: 0; right: 0; top: 18%;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 24px; transition: opacity .9s ease, transform .9s ease;
}
.title.gone { opacity: 0; transform: translateY(-12px); pointer-events: none; visibility: hidden; transition: opacity .9s ease, transform .9s ease, visibility 0s .9s; }
.title.gone button { pointer-events: none; }
.title h1 {
  margin: 0; font-style: italic; font-weight: 300;
  font-size: clamp(54px, 13vw, 104px); line-height: 1; letter-spacing: .02em;
  color: var(--paper);
  text-shadow: 0 0 40px rgba(216, 255, 106, .18), 0 0 90px rgba(216, 255, 106, .08);
  animation: rise 1.6s ease both;
}
.title .sub { margin: 14px 0 0; font-style: italic; font-size: clamp(15px, 2.4vw, 18px); color: var(--paper-dim); letter-spacing: .03em; animation: rise 1.6s .25s ease both; }
.title .cta {
  margin: 44px 0 0; font-size: 15px; letter-spacing: .14em; text-transform: lowercase; color: var(--gold);
  animation: breathe 2.6s ease-in-out infinite, rise 1.6s .6s ease both;
}
.title-links { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; animation: rise 1.6s .8s ease both; }
.title-links button {
  background: none; border: 0; cursor: pointer; font-family: inherit; font-style: italic; font-size: 14.5px;
  color: var(--paper-dim); letter-spacing: .04em; padding: 6px 2px; border-bottom: 1px solid transparent; transition: color .3s, border-color .3s;
}
.title-links button:hover, .title-links button:focus-visible { color: var(--paper); border-color: rgba(243, 236, 210, .3); outline: none; }
.worldline { margin: 34px 0 0; font-size: 12.5px; letter-spacing: .06em; color: var(--paper-faint); font-variant-numeric: tabular-nums; min-height: 1em; animation: rise 1.6s 1s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ── whisper (the tutorial that isn't) ── */
.whisper {
  position: absolute; left: 0; right: 0; bottom: calc(30px + env(safe-area-inset-bottom));
  text-align: center; padding: 0 28px;
  font-style: italic; font-size: clamp(15px, 2.6vw, 18px); letter-spacing: .03em; color: var(--paper-dim);
  opacity: 0; transition: opacity 1.1s ease; text-shadow: 0 2px 18px rgba(6, 8, 15, .9);
}
.whisper.on { opacity: 1; }

/* ── the moment ── */
.card {
  position: absolute; left: 0; right: 0; top: 34%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 24px;
  animation: cardin 1.4s ease both;
}
@keyframes cardin { from { opacity: 0; transform: translateY(-50%) scale(.98); } to { opacity: 1; transform: translateY(-50%) scale(1); } }
.card-big { margin: 0; font-style: italic; font-weight: 300; font-size: clamp(30px, 7vw, 54px); line-height: 1.1; color: var(--paper); text-shadow: 0 0 40px rgba(216, 255, 106, .25); }
.card-line { margin: 14px 0 0; font-style: italic; font-size: clamp(15px, 2.6vw, 18px); color: var(--paper-dim); }
.card-stat { margin: 22px 0 0; font-size: 13.5px; letter-spacing: .06em; color: var(--paper-dim); font-variant-numeric: tabular-nums; line-height: 1.7; }
.card-stat.dim { margin-top: 4px; color: var(--paper-faint); }
.card-actions { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; opacity: 0; visibility: hidden; animation: riseIn 1s 1.2s ease both; }
@keyframes riseIn { from { opacity: 0; visibility: hidden; transform: translateY(10px); } 1% { visibility: visible; } to { opacity: 1; visibility: visible; transform: none; } }
.pill {
  font-family: inherit; font-style: italic; font-size: 15px; letter-spacing: .1em;
  color: var(--gold); background: rgba(255, 233, 160, .06);
  border: 1px solid rgba(255, 233, 160, .45); border-radius: 999px; padding: 11px 26px; cursor: pointer;
  transition: background .3s, color .3s, border-color .3s, transform .2s;
}
.pill:hover, .pill:focus-visible { background: rgba(255, 233, 160, .16); color: #fff6d8; outline: none; }
.pill:active { transform: scale(.97); }
.pill.ghost { color: var(--paper-dim); border-color: rgba(243, 236, 210, .22); background: transparent; }
.pill.ghost:hover { color: var(--paper); border-color: rgba(243, 236, 210, .45); }

/* ── panels (menu, about) ── */
.panel {
  position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(6, 8, 15, .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadein .5s ease both;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.panel-inner { max-width: 40rem; margin: 0 auto; padding: calc(64px + env(safe-area-inset-top)) 24px calc(48px + env(safe-area-inset-bottom)); position: relative; }
.panel-inner.narrow { max-width: 26rem; }
.panel h1 { font-style: italic; font-weight: 300; font-size: clamp(34px, 7vw, 52px); margin: 0 0 18px; line-height: 1.05; }
.panel h2 { font-style: italic; font-weight: 400; font-size: 17px; margin: 30px 0 8px; color: var(--gold); letter-spacing: .02em; }
.panel p { margin: 0 0 13px; font-size: 16.5px; line-height: 1.6; color: var(--paper-dim); }
.panel p.lede { font-size: 19px; font-style: italic; color: var(--paper); line-height: 1.5; }
.panel p em { color: var(--paper); font-style: italic; }
.panel .sig { margin-top: 32px; font-style: italic; font-size: 22px; color: var(--paper); }
.panel .sigsub { font-size: 12.5px; letter-spacing: .05em; color: var(--paper-faint); margin-top: -6px; }
.ib.close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; }
body.pl .lang-en, body:not(.pl) .lang-pl { display: none; }
.menu-list { list-style: none; padding: 0; margin: 0 0 24px; }
.menu-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(243, 236, 210, .08); }
.menu-list button { background: none; border: 0; cursor: pointer; font-family: inherit; font-style: italic; font-size: 17px; color: var(--paper); text-align: left; padding: 0; }
.menu-list li.locked button { color: var(--paper-faint); cursor: default; }
.menu-list .best { font-size: 12.5px; letter-spacing: .06em; color: var(--paper-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu-list .num { font-size: 12px; color: var(--paper-faint); margin-right: 10px; font-variant-numeric: tabular-nums; }
.panel-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── toast ── */
.toast {
  position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%);
  font-size: 13.5px; letter-spacing: .05em; color: var(--paper-dim); background: rgba(6, 8, 15, .7);
  border: 1px solid rgba(243, 236, 210, .12); border-radius: 999px; padding: 8px 16px; animation: fadein .4s ease both;
  max-width: calc(100vw - 32px); text-align: center; line-height: 1.4;
}

@media (max-width: 480px) {
  .title { top: 14%; }
  .card { top: 30%; }
  .title .cta { margin-top: 34px; }
  .panel p { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .title h1, .title .sub, .title .cta, .title-links, .worldline, .card, .panel { animation: none; }
  .card-actions { animation-duration: .01s; }
}
