/* tuvvy-games.css — wspólne style gier Tuvvy Games (tokeny, layout pełnoekranowy, HUD, overlay, toast, konfetti). */
:root {
  --bg: #F3F6F4; --bg-2: #E6EDE9; --bg-3: #D7E1DB; --ink: #16211D; --muted: #61706A; --line: #C9D3CD;
  --accent: #0F7A5A; --accent-2: #0B5C44; --gold: #E1A63A; --game: #0F7A5A; --game-ink: #ffffff;
  --c1: #4C9AFF; --c2: #F2994A; --c3: #27AE60; --c4: #EB5757; --c5: #9B51E0; --c6: #F2C94C;
  --shadow: 0 2px 4px rgba(22,33,29,.08), 0 14px 36px rgba(22,33,29,.14);
  --panel: rgba(255,255,255,.72);
  --glass: rgba(255,255,255,.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1412; --bg-2: #161E1B; --bg-3: #1F2A26; --ink: #EAF0EC; --muted: #98A8A0; --line: #2A3531;
    --accent: #55C89B; --accent-2: #7FD9B4; --panel: rgba(22,30,27,.78); --glass: rgba(255,255,255,.06);
  }
}
:root[data-theme="dark"] {
  --bg: #0E1412; --bg-2: #161E1B; --bg-3: #1F2A26; --ink: #EAF0EC; --muted: #98A8A0; --line: #2A3531;
  --accent: #55C89B; --accent-2: #7FD9B4; --panel: rgba(22,30,27,.78); --glass: rgba(255,255,255,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", "Segoe UI", Roboto, system-ui, sans-serif;
  user-select: none; -webkit-user-select: none;
}
body.no-touch-scroll { touch-action: none; }

/* Scena zawsze na cały ekran — bez zgadywania 100dvh w WebView. */
.tg-stage {
  position: fixed; inset: 0; margin: 0 auto; max-width: 520px;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 10px) calc(env(safe-area-inset-bottom) + 8px) calc(env(safe-area-inset-left) + 10px);
  background:
    radial-gradient(120% 55% at 50% -10%, color-mix(in srgb, var(--game) 26%, transparent), transparent 70%),
    var(--bg);
}

/* ── HUD ── */
.tg-hud { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; }
.tg-title {
  display: flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: -.01em; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
}
.tg-title .emoji { font-size: 1.25rem; }
.tg-title small { color: var(--muted); font-weight: 600; font-size: .68rem; margin-left: 2px; letter-spacing: .04em; text-transform: uppercase; }
.tg-pill {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: 6px 12px;
  border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
}
.tg-pill .lbl { font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tg-pill .val { font-size: 1.35rem; font-weight: 900; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tg-pill.score { background: var(--game); border-color: transparent; color: var(--game-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--game) 40%, transparent); }
.tg-pill.score .lbl { color: color-mix(in srgb, var(--game-ink) 75%, transparent); }
.tg-pill.best .val { font-size: 1rem; }
.tg-pill.score .val.bump { animation: tg-bump .25s ease-out; }
@keyframes tg-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

.tg-toolbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 2px 8px; }
.tg-btn-ghost {
  appearance: none; background: var(--glass); border: 1px solid var(--line); color: var(--ink);
  padding: 7px 12px; border-radius: 999px; font-size: .76rem; font-weight: 700; cursor: pointer; font-family: inherit;
  backdrop-filter: blur(8px); transition: transform .08s ease, background .15s;
}
.tg-btn-ghost:active { transform: scale(.96); }
.tg-btn-ghost.active { background: var(--game); color: var(--game-ink); border-color: transparent; }

/* ── Obszar gry ── */
.tg-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.tg-game canvas {
  display: block; touch-action: none; border-radius: 18px; background: var(--bg-2); max-width: 100%;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.tg-hint { font-size: .74rem; color: var(--muted); text-align: center; padding: 0 12px; font-weight: 600; }
.tg-row { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.tg-status { font-size: .8rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ── Overlay ── */
.tg-overlay {
  position: fixed; inset: 0; background: rgba(10,15,13,.5); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; z-index: 10; padding: 20px;
}
.tg-overlay.show { display: flex; animation: tg-fade .2s ease-out; }
@keyframes tg-fade { from { opacity: 0; } to { opacity: 1; } }
.tg-panel {
  background: var(--panel); color: var(--ink); border-radius: 24px; padding: 26px 22px 20px;
  width: min(100%, 340px); text-align: center; box-shadow: var(--shadow); border: 1px solid var(--line);
  backdrop-filter: blur(16px); animation: tg-pop .32s cubic-bezier(.2,.9,.3,1.3); position: relative; overflow: hidden;
}
@keyframes tg-pop { from { transform: translateY(18px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.tg-panel .big-emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.2)); }
.tg-panel h2 { margin: 0 0 4px; font-size: 1.45rem; letter-spacing: -.02em; font-weight: 900; }
.tg-panel p { margin: 0 0 14px; color: var(--muted); font-size: .92rem; font-weight: 600; }
.tg-panel .tg-final { font-size: 3rem; font-weight: 900; line-height: 1; color: var(--game); letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.tg-panel .tg-best-line { font-size: .78rem; color: var(--muted); font-weight: 700; margin-bottom: 16px; }
.tg-panel .tg-btn {
  appearance: none; background: var(--game); color: var(--game-ink); border: none; padding: 14px 18px; border-radius: 14px;
  font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit; width: 100%;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--game) 40%, transparent); transition: transform .08s ease;
}
.tg-panel .tg-btn:active { transform: scale(.97); }
.tg-panel .tg-btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); margin-top: 8px; box-shadow: none; }
.tg-new-best {
  display: none; margin: 0 auto 10px; padding: 5px 12px; border-radius: 999px; width: max-content;
  background: linear-gradient(90deg, #F6C453, #E1A63A, #F6C453); background-size: 200% 100%; color: #3a2a05;
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 900; animation: tg-shimmer 1.6s linear infinite;
}
.tg-new-best.show { display: block; }
@keyframes tg-shimmer { to { background-position: 200% 0; } }

/* konfetti */
.tg-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 11; }
.tg-confetti i {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: .95;
  animation: tg-fall linear forwards;
}
@keyframes tg-fall { to { transform: translateY(110vh) rotate(720deg); opacity: .7; } }

/* toast */
.tg-toast {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%) scale(.9);
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-weight: 900; font-size: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .35s cubic-bezier(.2,.9,.3,1.4); z-index: 5;
  box-shadow: var(--shadow);
}
.tg-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
