:root {
  --navy: #1b2a4a;
  --sun: #ffd23f;
  --sun-dark: #c98a0c;
  --sky: #3fa7ff;
  --coral: #ff5a5f;
  --mint: #7dff8a;
  --white: #ffffff;
  --ol2: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy), 0 -2px 0 var(--navy), 0 2px 0 var(--navy), -2px 0 0 var(--navy), 2px 0 0 var(--navy);
  --ol3: -3px -3px 0 var(--navy), 3px -3px 0 var(--navy), -3px 3px 0 var(--navy), 3px 3px 0 var(--navy), 0 -3px 0 var(--navy), 0 3px 0 var(--navy), -3px 0 0 var(--navy), 3px 0 0 var(--navy);
  --paper: #eef4ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; overflow: hidden; background: var(--navy); }

body {
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--white);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

canvas#game { position: fixed; inset: 0; display: block; }

.hidden { display: none !important; }

button { font-family: inherit; touch-action: manipulation; cursor: pointer; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; inset: 0 0 auto 0; z-index: 5; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 0;
}
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; }
#score {
  font-size: 40px; font-weight: 800; line-height: 1;
  text-shadow: var(--ol2), 0 4px 0 var(--navy);
}
.score-label { font-size: 12px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 0 var(--navy); }

.icon-btn {
  pointer-events: auto; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--navy); background: var(--white); color: var(--navy);
  font-size: 17px; font-weight: 800; box-shadow: 0 4px 0 var(--navy);
  display: grid; place-items: center;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }

.hud-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
  display: flex; align-items: center; gap: 4px; height: 30px; padding: 2px 10px 0;
  border-radius: 999px; background: rgba(27, 42, 74, .8); border: 2px solid rgba(255, 255, 255, .25);
  font-weight: 800; font-size: 15px; white-space: nowrap;
}
.pill img { width: 22px; height: 22px; margin-top: -2px; }
#hud-chances { color: var(--sun); }
.horse-pill { color: #aee4ff; border-color: rgba(174, 228, 255, .6); animation: pulse .7s infinite alternate; }

#bar-wrap { margin: 10px auto 0; width: min(70%, 320px); text-align: center; }
#bar-label { font-weight: 800; font-size: 17px; text-shadow: 0 2px 0 var(--navy); }
.bar { height: 14px; border-radius: 999px; background: rgba(27, 42, 74, .75); border: 2px solid var(--navy); overflow: hidden; }
#bar-fill { height: 100%; width: 100%; background: var(--sun); transform-origin: left center; }
#bar-wrap.boss #bar-fill { background: var(--coral); }

/* ---------- Natpisi ---------- */
#banner {
  position: fixed; left: 50%; top: 25%; z-index: 6; width: 92vw; max-width: 520px;
  text-align: center; pointer-events: none; opacity: 0;
  font-size: clamp(28px, 8.5vw, 46px); font-weight: 800; line-height: 1.05;
  color: var(--sun); text-shadow: var(--ol2), 0 5px 0 var(--navy);
  transform: translate(-50%, -50%);
}
#banner.show { animation: pop 2s ease forwards; }
#banner.boss { color: var(--coral); }
#banner.good { color: var(--mint); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

#countdown {
  position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none;
  font-size: 130px; font-weight: 800; color: var(--white);
  text-shadow: var(--ol3), 0 8px 0 var(--navy);
}
#countdown span { animation: cd .7s ease-out forwards; }
#countdown span.go { font-size: 76px; color: var(--sun); }
@keyframes cd {
  0% { transform: scale(1.8); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.92); opacity: .25; }
}

/* ---------- Ekrani ---------- */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
  text-align: center; background: rgba(15, 25, 50, .6); overflow-y: auto; touch-action: pan-y;
}

/* ---------- Glavni meni ---------- */
#screen-menu {
  justify-content: flex-start; gap: 8px;
  background: linear-gradient(180deg, rgba(63, 167, 255, .2), rgba(27, 42, 74, .5) 40%, rgba(27, 42, 74, .93));
}
.title {
  display: flex; flex-direction: column; align-items: center;
  font-size: clamp(40px, 12vw, 68px); line-height: 1.05; font-weight: 800; color: var(--sun);
  text-shadow: var(--ol3), 0 7px 0 var(--navy); transform: rotate(-3deg);
  padding-top: 6px;
}
.title span:last-child { font-size: 1.3em; color: var(--coral); margin-top: -4px; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; color: inherit; }
.hero-img {
  width: min(84vw, 340px); height: min(17vh, 170px); object-fit: contain; display: block;
  filter: drop-shadow(0 6px 0 rgba(27, 42, 74, .55));
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px); } }
.hero-name { font-size: 30px; font-weight: 800; line-height: 1; text-shadow: var(--ol2), 0 4px 0 var(--navy); }
.hero-item {
  display: flex; align-items: center; gap: 6px; padding: 3px 14px 1px; border-radius: 999px;
  background: rgba(27, 42, 74, .85); border: 2px solid rgba(255, 255, 255, .25); font-weight: 700; font-size: 15px;
}
.hero-item img { width: 24px; height: 24px; margin-top: -2px; }

/* elementi menija se ravnomerno raspoređuju; na malom ekranu meni se skroluje umesto da se odseče */
#screen-menu > :not(.icon-btn):not(.menu-topbar) { margin-top: auto; margin-bottom: auto; flex: none; }

#screen-menu { padding-top: calc(env(safe-area-inset-top) + 62px); }
/* naslov kao logo slika */
.title.has-logo { transform: none; padding-top: 0; }
.title-logo { display: block; width: min(90vw, 440px); height: auto; filter: drop-shadow(0 5px 0 rgba(27, 42, 74, .55)); }
#screen-menu .title-logo { width: min(80vw, 330px); }
#screen-menu .title { font-size: clamp(36px, 10.5vw, 60px); }

/* gore levo: pun ekran + coinsi */
.menu-topbar { position: absolute; top: calc(env(safe-area-inset-top) + 12px); left: 12px; display: flex; align-items: center; gap: 8px; z-index: 2; }
.coins-pill {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 2px 14px 0 6px; border-radius: 999px;
  background: rgba(27, 42, 74, .85); border: 3px solid var(--sun); font-size: 20px; font-weight: 800;
  box-shadow: 0 4px 0 var(--navy);
}
.coin-ic { width: 26px; height: 26px; display: block; flex: none; margin-top: -2px; }
.coins-pill.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* dugme za čest */
.chest-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 12px 4px; }
.chest-ic { width: 36px; height: 36px; margin: -6px 0 -4px; flex: none; object-fit: contain; }
.chest-label { font-size: 19px; white-space: nowrap; }
.chest-price { display: flex; align-items: center; gap: 3px; padding: 1px 10px 0 4px; border-radius: 999px; background: var(--navy); color: var(--sun); font-size: 17px; }
.chest-price .coin-ic { width: 20px; height: 20px; }
.chest-btn.ready { background: var(--sun); animation: glowPulse 1.2s infinite alternate; }
@keyframes glowPulse { to { box-shadow: 0 6px 0 var(--navy), 0 0 22px rgba(255, 210, 63, .9); } }
.chest-btn.poor { opacity: .75; }
.chest-btn.done { opacity: .6; }
.chest-btn.shake { animation: shake .4s; }

/* zaključani ćacimoni u kolekciji: tamna silueta, poluprovidno, katanac gore */
.char-tile.locked { background: #3a4766; color: rgba(255, 255, 255, .85); border-color: #10192e; }
.char-tile.locked .ct-img { filter: brightness(0); opacity: .55; }
.char-tile.locked::before {
  content: '🔒'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); border: 3px solid #8b97b3;
  display: grid; place-items: center; font-size: 15px;
}
.char-tile.locked.shake { animation: shake .4s; }
.collection-info { text-align: center; font-size: 15px; font-weight: 700; margin-bottom: 14px; opacity: .9; }

/* ---------- Otvaranje česta / otkrivanje ćacimona ---------- */
#screen-reveal {
  justify-content: center; gap: 10px; overflow: hidden; overflow: clip;
  background: radial-gradient(circle at 50% 45%, #4a7ee0, #1b2a4a 72%);
}
#screen-reveal > :not(.rays):not(.reveal-flash) { position: relative; z-index: 1; }
.rays {
  position: absolute; inset: -60%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 63, .22) 0deg 9deg, rgba(255, 210, 63, 0) 9deg 18deg);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reveal-title {
  min-height: 1.15em; font-size: clamp(30px, 9vw, 48px); font-weight: 800; line-height: 1.1; color: var(--sun);
  text-shadow: var(--ol3), 0 6px 0 var(--navy);
}
.reveal-title.name { font-size: clamp(40px, 13vw, 68px); color: var(--white); animation: namePop .6s ease forwards; }
@keyframes namePop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.reveal-stage { position: relative; width: min(88vw, 440px); height: min(48vh, 440px); display: grid; place-items: center; }
.reveal-opener, .reveal-img { position: absolute; max-width: 100%; max-height: 100%; object-fit: contain; }
.reveal-opener { width: 62%; height: auto; }
.reveal-opener.shake { animation: chestShake 1s ease-in-out; }
@keyframes chestShake {
  10%, 30%, 50%, 70%, 90% { transform: rotate(-8deg) scale(1.04); }
  20%, 40%, 60%, 80% { transform: rotate(8deg) scale(1.04); }
}
.reveal-opener.gone { animation: openerGone .45s ease-in forwards; }
@keyframes openerGone { to { transform: scale(1.7); opacity: 0; } }
.reveal-img {
  width: 100%; height: 100%; opacity: 0; transform: scale(.2);
  filter: brightness(0) drop-shadow(0 0 14px rgba(255, 255, 255, .95));
  transition: filter .7s ease, transform .55s cubic-bezier(.3, 1.5, .5, 1), opacity .3s;
}
.reveal-img.in { opacity: 1; transform: scale(1); }
.reveal-img.shown { filter: drop-shadow(0 10px 0 rgba(27, 42, 74, .6)); }
.reveal-sub { min-height: 1.3em; font-size: 18px; font-weight: 700; text-shadow: 0 2px 0 var(--navy); }
.reveal-ok { visibility: hidden; opacity: 0; transition: opacity .3s; }
.reveal-ok.on { visibility: visible; opacity: 1; }
.reveal-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
.reveal-flash.go { animation: flashGo .7s ease-out; }
@keyframes flashGo { 0% { opacity: .95; } 100% { opacity: 0; } }

/* skrivena šifra */
#best-row { cursor: default; -webkit-user-select: none; user-select: none; }
.code-display {
  width: 100%; min-height: 58px; padding: 6px 10px 2px; border-radius: 14px; border: 3px solid var(--navy);
  background: var(--paper); font-size: 38px; font-weight: 800; letter-spacing: 8px; line-height: 1.2;
}
.code-display.ok { background: #d8ffdc; border-color: #1fae4b; }
.code-display.bad { background: #ffe0e1; border-color: var(--coral); animation: shake .4s; }
.code-msg { min-height: 1.3em; font-size: 16px; font-weight: 800; }
.code-msg.bad { color: var(--coral); }
.code-msg.ok { color: #1fae4b; }

/* kraj partije: zarađeni coinsi */
.over-coins { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 18px; font-weight: 800; }
.over-coins .coin-ic { width: 24px; height: 24px; }
.over-coins b { color: #c98a0c; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: min(100%, 320px); }
.menu-buttons .big-btn { width: 100%; min-width: 0; }
.menu-buttons .big-btn.secondary { font-size: 20px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .big-btn.secondary { flex: 1; padding-left: 6px; padding-right: 6px; font-size: 16px; white-space: nowrap; }
.menu-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(100%, 340px); }

/* ---------- Nalog (prijava preko Google-a) ---------- */
.account { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.account-hint { font-size: 13px; font-weight: 600; line-height: 1.25; opacity: .9; text-shadow: 0 1px 0 var(--navy); }
.account-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px;
  background: rgba(27, 42, 74, .8); border: 2px solid rgba(255, 255, 255, .3); max-width: 100%;
}
.account-user .avatar { width: 32px; height: 32px; }
.account-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.link-btn {
  flex: none; border: none; background: rgba(255, 255, 255, .15); color: var(--white); border-radius: 999px;
  padding: 4px 10px 2px; font-size: 13px; font-weight: 800;
}
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 18px 6px; border-radius: 999px; border: 3px solid var(--navy); background: var(--white);
  color: var(--navy); font-size: 17px; font-weight: 800; box-shadow: 0 4px 0 var(--navy);
}
.google-btn svg { flex: none; margin-top: -2px; }
.google-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.google-btn:disabled { opacity: .6; }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--sky);
  border: 2px solid var(--navy); display: grid; place-items: center; color: var(--white); font-weight: 800; font-size: 18px;
}

/* ---------- Rang lista ---------- */
.board-tabs {
  display: flex; gap: 4px; width: calc(100% - 32px); max-width: 528px; padding: 4px; margin-bottom: 4px;
  background: rgba(0, 0, 0, .25); border-radius: 999px; border: 2px solid rgba(255, 255, 255, .2);
}
.board-tabs .tab {
  flex: 1; border: none; border-radius: 999px; padding: 7px 4px 5px; background: none;
  color: var(--white); font-size: 14px; font-weight: 800; white-space: nowrap;
}
.board-tabs .tab.active { background: var(--sun); color: var(--navy); box-shadow: 0 3px 0 var(--navy); }
.board-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.board-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; text-align: left;
  background: var(--white); color: var(--navy); border: 3px solid var(--navy); border-radius: 16px; box-shadow: 0 3px 0 var(--navy);
}
.board-row.me { background: #fff7d1; outline: 3px solid var(--sun); }
.board-row.gap-row { justify-content: center; background: none; border: none; box-shadow: none; color: var(--white); padding: 0; font-size: 22px; line-height: .6; }
.rank { flex: none; width: 34px; text-align: center; font-size: 20px; font-weight: 800; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.who b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; opacity: .8; white-space: nowrap; overflow: hidden; }
.who span img { width: 20px; height: 20px; object-fit: contain; }
.pts { flex: none; font-size: 20px; font-weight: 800; }
.board-msg { white-space: pre-line; text-align: center; font-size: 17px; font-weight: 700; line-height: 1.35; padding: 24px 8px; text-shadow: 0 2px 0 var(--navy); }
.board-foot { flex-direction: column; align-items: center; gap: 6px; }
.board-foot .account-hint { max-width: 320px; }

/* ---------- Kraj igre: rang lista ---------- */
.over-online { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; font-size: 15px; font-weight: 700; line-height: 1.25; }
.over-online .link-btn { background: var(--paper); color: var(--navy); border: 2px solid var(--navy); padding: 4px 12px 2px; font-size: 14px; }

/* ---------- Stranice (izbor igrača, uputstvo) ---------- */
.screen.page {
  justify-content: flex-start; gap: 0; padding: 0; overflow: hidden;
  background: linear-gradient(180deg, #2a4d8f, var(--navy) 70%);
}
.page-head {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px;
}
.page-head h2 {
  flex: 1; text-align: left; font-size: 30px; line-height: 1.1; font-weight: 800; color: var(--sun);
  text-shadow: var(--ol2), 0 4px 0 var(--navy);
}
.page-body {
  flex: 1; width: 100%; max-width: 560px; overflow-y: auto; touch-action: pan-y;
  -webkit-overflow-scrolling: touch; padding: 8px 16px 16px;
}
.page-foot {
  width: 100%; display: flex; justify-content: center;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 14px);
}
.page-foot .big-btn { width: min(100%, 340px); min-width: 0; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.char-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--white); color: var(--navy); border: 3px solid var(--navy); border-radius: 18px;
  padding: 6px 4px 8px; box-shadow: 0 4px 0 var(--navy);
}
.char-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.char-tile.selected { background: #fff7d1; outline: 4px solid var(--sun); }
.char-tile.selected::after {
  content: '✓'; position: absolute; top: -10px; right: -8px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--mint); border: 3px solid var(--navy); display: grid; place-items: center;
  font-size: 16px; font-weight: 800; color: var(--navy);
}
.ct-img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.ct-name { font-size: 17px; font-weight: 800; line-height: 1.1; }
.ct-item { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; line-height: 1.15; }
.ct-item img { width: 18px; height: 18px; flex: none; }
.char-tile.soon {
  justify-content: center; min-height: 150px; background: rgba(255, 255, 255, .06); color: var(--white);
  border: 3px dashed rgba(255, 255, 255, .45); box-shadow: none;
}
.soon-plus { font-size: 40px; font-weight: 800; line-height: 1; opacity: .8; }

.help-list { display: flex; flex-direction: column; gap: 12px; }
.help-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  background: var(--white); color: var(--navy); border: 3px solid var(--navy); border-radius: 18px;
  padding: 10px 12px; box-shadow: 0 4px 0 var(--navy);
}
.help-icon { flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 38px; }
.help-icon img { max-width: 100%; max-height: 100%; object-fit: contain; min-width: 0; }
.help-icon.two img { max-width: 50%; }
.help-card h3 { font-size: 20px; line-height: 1.1; margin-bottom: 2px; }
.help-card p, .help-card li { font-size: 15px; font-weight: 600; line-height: 1.3; }
.help-card ul { padding-left: 18px; }
.help-card b { color: #2a6fd6; }

.big-btn {
  min-width: 230px; padding: 10px 34px 6px; border: 4px solid var(--navy); border-radius: 999px;
  background: var(--sun); color: var(--navy); font-size: 26px; font-weight: 800;
  box-shadow: 0 6px 0 var(--navy);
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
.big-btn.secondary { background: var(--white); font-size: 19px; }
.panel .big-btn { width: 100%; min-width: 0; }

.best { font-weight: 800; font-size: 19px; text-shadow: 0 2px 0 var(--navy); }
.sound-btn { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 12px; }
.install-btn {
  padding: 6px 16px 4px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .5);
  background: rgba(27, 42, 74, .75); color: var(--white); font-size: 16px; font-weight: 800;
}
.install-btn:active { transform: translateY(2px); }
.install-steps { text-align: left; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.install-steps b { color: #2a6fd6; }

/* ---------- Uvodni ekran (prvi ulazak) ---------- */
#screen-intro {
  justify-content: space-evenly;
  background: radial-gradient(circle at 50% 48%, rgba(255, 255, 255, .28), rgba(27, 42, 74, .65) 45%, rgba(27, 42, 74, .95) 80%);
}
.intro-ball {
  position: relative; isolation: isolate; width: min(62vw, 300px); aspect-ratio: 1;
  background: none; border: none; padding: 0;
  animation: ballDrop .9s cubic-bezier(.3, 1.35, .5, 1) both, ballWobble 2.4s ease-in-out 1s infinite;
}
.intro-ball img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 10px 0 rgba(27, 42, 74, .6)); }
.intro-ball::before {
  content: ''; position: absolute; inset: -16%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 150, .8), rgba(255, 236, 150, 0) 65%);
  animation: glow 1.6s ease-in-out infinite;
}
.intro-ball.open { animation: ballOpen .45s ease-in forwards; }
@keyframes ballDrop { from { transform: translateY(-110vh) rotate(-540deg); } to { transform: none; } }
@keyframes ballWobble {
  0%, 55%, 100% { transform: rotate(0); }
  64% { transform: rotate(-14deg); } 73% { transform: rotate(12deg); }
  82% { transform: rotate(-7deg); } 91% { transform: rotate(3deg); }
}
@keyframes glow { 50% { transform: scale(1.12); opacity: .6; } }
@keyframes ballOpen { to { transform: scale(2.6) rotate(360deg); opacity: 0; } }
.intro-bottom { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(100%, 320px); }
.intro-bottom .big-btn { width: 100%; min-width: 0; }
.intro-text { font-size: 30px; font-weight: 800; line-height: 1.1; text-shadow: var(--ol2), 0 4px 0 var(--navy); animation: pulse .8s infinite alternate; }

.big-btn:disabled { opacity: .55; filter: grayscale(.7); transform: none; box-shadow: 0 6px 0 var(--navy); }

.panel {
  width: 100%; max-width: 380px; background: var(--white); color: var(--navy);
  border: 4px solid var(--navy); border-radius: 26px; padding: 18px 16px;
  box-shadow: 0 8px 0 var(--navy); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.panel h2 { font-size: 32px; line-height: 1; }
.small { font-size: 16px; font-weight: 600; line-height: 1.25; }

.task { font-size: 46px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.answer { display: inline-block; min-width: 84px; padding: 0 10px; border-bottom: 5px solid var(--navy); color: var(--sky); }
.answer.right { color: #1fae4b; }
.answer.wrong { color: var(--coral); }
.correct { font-size: 20px; font-weight: 800; color: #1fae4b; }
.correct.fail { display: flex; flex-direction: column; align-items: center; gap: 2px; animation: shake .4s; }
.fail-big { font-size: 27px; line-height: 1.1; color: var(--coral); }
.fail-small { font-size: 15px; color: var(--navy); font-weight: 700; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.test-line { font-size: 18px; }
.test-line b { color: var(--coral); }

/* ---------- powered by ---------- */
.powered { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .5px; opacity: .9; text-shadow: 0 1px 0 var(--navy); }
.powered-name { font-size: 18px; font-weight: 800; letter-spacing: 1px; color: var(--white); }
.powered-logo { height: 40px; width: auto; max-width: 70vw; display: block; filter: drop-shadow(0 2px 0 rgba(27, 42, 74, .7)); }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.key {
  height: 58px; border-radius: 16px; border: 3px solid var(--navy); background: var(--paper);
  color: var(--navy); font-size: 28px; font-weight: 800; box-shadow: 0 4px 0 var(--navy);
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.key.ok { background: var(--mint); }
.key.del { background: #ffd0d1; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.stats div { background: var(--paper); border-radius: 14px; padding: 6px 4px 4px; display: flex; flex-direction: column; }
.stats span { font-size: 13px; font-weight: 700; }
.stats b { font-size: 26px; line-height: 1.1; }
.new-record { font-size: 22px; font-weight: 800; color: var(--sun-dark); animation: pulse .7s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
