:root {
  --ink: #5b3550;
  --pink: #ff6fa5; --pink-d: #d03d79;
  --teal: #43d6c0; --teal-d: #1f9e8b;
  --sun: #ffd35c; --sun-d: #d99410;
  --font: 'Fredoka', 'Noto Sans Georgian', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #ffd9ec; font-family: var(--font); color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; }
#stage { position: fixed; inset: 0; }
canvas#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 10px); text-align: center; pointer-events: none; }
#score { font-weight: 700; font-size: clamp(56px, 14vmin, 104px); line-height: 1; color: #fff;
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 rgba(91,53,80,.35); transition: transform .12s; }
#score.pop { transform: scale(1.25); }
#comboLbl { height: 30px; margin-top: 4px; font-weight: 700; font-size: 22px; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; letter-spacing: .5px; }
#bestBox { position: absolute; right: 14px; top: 6px; font-weight: 700; font-size: 15px; opacity: .8; }
#bestBox b { font-size: 18px; }

#topBtns { position: absolute; left: 12px; top: calc(env(safe-area-inset-top) + 10px); display: flex; gap: 10px; z-index: 5; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: #fff; box-shadow: 0 4px 0 rgba(91,53,80,.28), 0 6px 14px rgba(91,53,80,.15); transition: transform .08s, box-shadow .08s; text-decoration: none; padding: 0; }
.round:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(91,53,80,.28); }
.round svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.round svg.fill { fill: currentColor; stroke: none; }

/* ---- banner / toast ---- */
#banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; font-weight: 700; font-size: clamp(44px, 12vmin, 92px);
  color: #fff; -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 rgba(91,53,80,.3); opacity: 0; }
#banner.show { animation: banner 1.4s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes banner { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 18% { opacity: 1; transform: scale(1.12) rotate(3deg); } 30% { transform: scale(1) rotate(-1deg); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) translateY(-30px); } }
#toast { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); background: #fff; color: var(--ink); font-weight: 700; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(91,53,80,.25); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 30; max-width: 86vw; text-align: center; }
#toast.show { opacity: 1; }

/* ---- screens ---- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.screen.dim { background: rgba(120, 60, 110, .38); backdrop-filter: blur(3px); }
#over.dim { background: linear-gradient(rgba(120,60,110,0) 20%, rgba(120,60,110,.45)); backdrop-filter: none; justify-content: flex-end; padding-bottom: calc(env(safe-area-inset-bottom) + 3vh); }
#over.side { justify-content: center; align-items: flex-end; padding: 16px 6vw; background: linear-gradient(90deg, rgba(120,60,110,0) 35%, rgba(120,60,110,.42)); }
#over .card { padding: 16px 20px 18px; }
#over .bigScore { font-size: 64px; }
#over .card h2 { font-size: 24px; margin-bottom: 4px; }
#menu { justify-content: space-between; padding-top: calc(env(safe-area-inset-top) + 8vh); padding-bottom: calc(env(safe-area-inset-bottom) + 6vh); pointer-events: none; }
#menu > * { pointer-events: auto; }
.logo { margin: 0; text-align: center; font-weight: 700; line-height: .95; font-size: clamp(46px, 13vmin, 96px); }
.logo .w { display: block; }
.logo .ch { display: inline-block; color: var(--c); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 rgba(91,53,80,.35);
  animation: bob 1.8s ease-in-out infinite; animation-delay: var(--d); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
.menuStats { display: flex; gap: 22px; justify-content: center; font-weight: 700; font-size: 18px; margin-top: 6px; opacity: .85; }
.menuStats b { font-size: 22px; }
.ver { font-size: 12px; opacity: .5; margin-top: 10px; }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; width: min(78vw, 320px); align-items: stretch; }

.card { background: #fff; border-radius: 28px; padding: 24px 22px 22px; width: min(88vw, 380px); text-align: center;
  box-shadow: 0 10px 0 rgba(91,53,80,.22), 0 20px 40px rgba(91,53,80,.25); animation: cardIn .35s cubic-bezier(.2,.9,.3,1.3) both; max-height: 92vh; overflow: auto; }
@keyframes cardIn { from { transform: scale(.8) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.card { touch-action: pan-y; }
.card h2 { margin: 0 0 12px; font-size: 30px; }
/* short screens (phone held sideways) */
@media (max-height: 480px) {
  #menu { flex-direction: row; justify-content: space-around; padding: 10px 24px; }
  #menu { justify-content: space-between; padding: 10px 6vw; }
  .logo { font-size: 17vh; text-align: left; }
  .logo .ch { -webkit-text-stroke-width: 6px; }
  .menu-buttons { gap: 8px; width: min(40vw, 300px); }
  .btn { font-size: 18px; padding: 8px 18px; }
  .btn.big { font-size: 22px; padding: 10px 18px; }
  .menuStats { margin-top: 0; font-size: 15px; }
  .card { padding: 12px 16px; max-height: 96vh; }
  .card h2 { font-size: 22px; margin-bottom: 4px; }
  .card p { font-size: 14px; margin: 4px 0; }
  .bigScore, #over .bigScore { font-size: 44px; }
  .statsRow { margin: 4px 0 8px; }
  #over .menu-buttons { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  #over .menu-buttons .btn { flex: 1 1 40%; }
}
.card p { margin: 8px 0; font-size: 17px; line-height: 1.35; font-weight: 500; }
.card .about { font-size: 13px; opacity: .65; margin-top: 14px; }
.card .about a { color: var(--pink-d); }
.lbl { font-weight: 700; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; opacity: .6; margin-top: 8px; }
.bigScore { font-weight: 700; font-size: 84px; line-height: 1; color: var(--pink-d); margin: 2px 0; }
.newbest { display: inline-block; font-weight: 700; font-size: 18px; color: #fff; background: linear-gradient(#ffb02e, #ff7a1a); border-radius: 999px; padding: 4px 16px; margin: 4px 0 6px; animation: wob .9s ease-in-out infinite; }
@keyframes wob { 0%,100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.1); } }
.statsRow { display: flex; justify-content: center; gap: 16px; font-weight: 700; font-size: 15px; opacity: .85; margin: 8px 0 16px; flex-wrap: wrap; }
.statsRow b { font-size: 18px; }
.card .menu-buttons { width: 100%; }

.btn { font-family: var(--font); font-weight: 700; font-size: 22px; padding: 14px 26px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; text-align: center;
  transition: transform .08s, box-shadow .08s, filter .15s; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn.big { font-size: 28px; padding: 16px 26px; }
.btn.pink { background: linear-gradient(#ff9cc2, var(--pink)); box-shadow: 0 7px 0 var(--pink-d), 0 12px 18px rgba(208,61,121,.3); }
.btn.sun { background: linear-gradient(#ffe590, var(--sun)); color: var(--ink); text-shadow: none; box-shadow: 0 7px 0 var(--sun-d), 0 12px 18px rgba(217,148,16,.3); animation: pulse 1.4s ease-in-out infinite; }
.btn.sun .play { display: inline-block; font-size: .8em; }
.btn.ghost { background: #fff; color: var(--ink); text-shadow: none; box-shadow: 0 7px 0 rgba(91,53,80,.25), 0 12px 18px rgba(91,53,80,.15); }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.25); animation: none; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

input[type=range] { width: 100%; margin: 8px 0 12px; accent-color: var(--pink); height: 28px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 18px; }
.langs button { font-family: var(--font); font-weight: 700; font-size: 16px; padding: 8px 14px; border-radius: 999px; border: 3px solid #f3d3e2; background: #fff; color: var(--ink); cursor: pointer; }
.langs button.on { background: var(--pink); border-color: var(--pink-d); color: #fff; }
