/* Tap Coin — Samarqand ko'ki, firuza va oltin */
:root {
  --lapis-950: #04142a;
  --lapis-900: #061a33;
  --lapis-800: #0a2748;
  --lapis-700: #103a68;
  --lapis-600: #1a4f87;
  --line: rgba(190, 215, 245, .12);
  --turq: #2ad1c6;
  --turq-d: #13a29a;
  --gold: #f6b93b;
  --gold-l: #ffe29a;
  --gold-d: #b9780a;
  --cream: #f7eddb;
  --muted: #8fa9c8;
  --coral: #f0705b;
  --ok: #5fd99a;
  --r-lg: 22px;
  --r-md: 14px;
  --nav-h: 68px;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23f6b93b' stroke-opacity='.055' stroke-width='1'%3E%3Crect x='14' y='14' width='36' height='36'/%3E%3Crect x='14' y='14' width='36' height='36' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--lapis-900);
  color: var(--cream);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

#app {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(42, 209, 198, .16), transparent 60%),
    var(--star),
    linear-gradient(180deg, var(--lapis-800) 0%, var(--lapis-900) 55%, var(--lapis-950) 100%);
  transition: background-color .4s;
}
#app.turbo {
  background:
    radial-gradient(120% 60% at 50% 20%, rgba(246, 185, 59, .26), transparent 62%),
    var(--star),
    linear-gradient(180deg, #3a2a12 0%, var(--lapis-900) 55%, var(--lapis-950) 100%);
}

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 26px; height: 26px; }

/* ---------- Yuklanish / blok ekranlari ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--lapis-900); text-align: center; padding: 32px;
}
.splash[hidden] { display: none; }
.splash .spin { width: 64px; height: 64px; animation: spin 2.4s linear infinite; }
.splash h1 { margin: 0; font-size: 20px; }
.splash p { margin: 0; color: var(--muted); max-width: 280px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ekranlar ---------- */
.screen { display: none; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); }
.screen.active { display: block; }
.screen::-webkit-scrollbar { display: none; }

.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 2px 8px; }
.sec h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.sec span { color: var(--muted); font-size: 13px; }

/* ---------- Bosh ekran ---------- */
#screen-home { display: none; padding-bottom: 0; overflow: hidden; }
#screen-home.active { display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 0 0; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.avatar { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 800; color: var(--lapis-900); background: linear-gradient(135deg, var(--gold-l), var(--gold)); }
.who-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font-size: 12px; color: var(--muted); }
.chest { position: relative; width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line);
  background: rgba(255,255,255,.05); display: grid; place-items: center; cursor: pointer; color: var(--gold); }
.chest.ready::after { content: ""; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--coral); box-shadow: 0 0 0 3px var(--lapis-800); animation: pulse 1.6s ease-in-out infinite; }
.chest:not(.ready) { color: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.25); } }

.balance { text-align: center; margin-top: 14px; }
.balance-row { display: inline-flex; align-items: center; gap: 10px; }
.balance-row svg { width: 38px; height: 38px; }
.balance-val { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--cream); }

.league { margin: 14px auto 0; max-width: 300px; }
.league-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.league-head b { color: var(--cream); font-weight: 700; }
.track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.09); overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--turq-d), var(--turq)); transition: width .35s ease; }
.fill.gold { background: linear-gradient(90deg, var(--gold-d), var(--gold-l)); }

.chips { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 700;
  background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.chip .ico { color: var(--turq); }
.chip.turbo { display: none; color: var(--lapis-900); background: linear-gradient(90deg, var(--gold), var(--gold-l)); border: 0; }
.chip.turbo .ico { color: var(--lapis-900); }
#app.turbo .chip.turbo { display: inline-flex; animation: pulse 1s ease-in-out infinite; }

.coin-area { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.halo { position: absolute; width: min(78vw, 330px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(42,209,198,.30) 0%, rgba(42,209,198,.08) 45%, transparent 68%);
  animation: breathe 3.6s ease-in-out infinite; pointer-events: none; }
#app.turbo .halo { background: radial-gradient(circle, rgba(246,185,59,.45) 0%, rgba(246,185,59,.12) 45%, transparent 68%); }
@keyframes breathe { 50% { transform: scale(1.07); opacity: .8; } }
.coin { width: min(60vw, 250px, 34vh); aspect-ratio: 1; cursor: pointer; touch-action: none; position: relative;
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3); filter: drop-shadow(0 18px 26px rgba(0,0,0,.45)); will-change: transform; }
.coin.down { transition: transform .05s linear; }
.coin svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--gold-l); opacity: 0; pointer-events: none; }
.ring.go { animation: ring .5s ease-out; }
@keyframes ring { from { opacity: .7; transform: scale(.96); } to { opacity: 0; transform: scale(1.22); } }

.float { position: fixed; z-index: 90; pointer-events: none; font-weight: 800; font-size: 28px; color: var(--gold-l);
  text-shadow: 0 2px 0 var(--gold-d), 0 4px 14px rgba(0,0,0,.45); animation: floatUp .85s ease-out forwards; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, -30%) scale(.9); } to { opacity: 0; transform: translate(-50%, -120px) scale(1.15); } }

.energy { margin-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
.energy-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.5px; margin-bottom: 7px; }
.energy-head .l { display: inline-flex; align-items: center; gap: 6px; }
.energy-head .ico { color: var(--gold); }
.energy .track { height: 12px; }
.energy .fill { background: linear-gradient(90deg, var(--gold-d), var(--gold), var(--gold-l)); transition: width .12s linear; }
.energy.low .fill { background: linear-gradient(90deg, #b3402e, var(--coral)); }
.energy.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Umumiy: panel va qatorlar ---------- */
.panel { background: rgba(9, 36, 68, .82); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.row-ico { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: rgba(42,209,198,.12); color: var(--turq); font-size: 18px; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.gold { color: var(--gold); }
.coin-mini { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 14px; }

.btn { border: 0; border-radius: 12px; padding: 10px 15px; font-weight: 800; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .1s, opacity .15s; }
.btn:active { transform: scale(.96); }
.btn:focus-visible, .chest:focus-visible, .nav-item:focus-visible, .input:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; }
.btn-gold { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: #3b2704; box-shadow: 0 3px 0 var(--gold-d); }
.btn-turq { background: var(--turq); color: #022b29; box-shadow: 0 3px 0 var(--turq-d); }
.btn-ghost { background: rgba(255,255,255,.09); color: var(--cream); }
.btn-danger { background: rgba(240,112,91,.16); color: var(--coral); }
.btn-done { background: rgba(95,217,154,.14); color: var(--ok); cursor: default; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }

/* ---------- Aksiya banneri ---------- */
.banner { position: relative; border-radius: var(--r-lg); padding: 18px; overflow: hidden; margin-top: 6px;
  background: linear-gradient(135deg, var(--lapis-600), var(--lapis-700) 60%, #0f6a73); border: 1px solid rgba(42,209,198,.35); }
.banner::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; background: var(--star); background-size: 40px;
  opacity: 1; transform: rotate(18deg); pointer-events: none; filter: brightness(3); }
.banner h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.banner p { margin: 0 0 14px; color: #cfe3f7; font-size: 13.5px; max-width: 85%; }

/* ---------- Kunlik sovg'a ---------- */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 14px 12px 4px; }
.day { border-radius: 12px; border: 1px solid var(--line); padding: 8px 0 7px; text-align: center; background: rgba(255,255,255,.04);
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.day b { font-size: 12px; color: var(--cream); }
.day.done { background: rgba(95,217,154,.13); border-color: rgba(95,217,154,.4); color: var(--ok); }
.day.done b { color: var(--ok); }
.day.now { border-color: var(--gold); background: rgba(246,185,59,.14); color: var(--gold); box-shadow: 0 0 0 2px rgba(246,185,59,.18); }
.day.now b { color: var(--gold-l); }
.day .ico { width: 15px; height: 15px; }
.streak-foot { padding: 12px; }

/* ---------- Topshiriq ---------- */
.q-track { height: 6px; margin-top: 7px; }

/* ---------- Maydonlar ---------- */
.input { width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--cream); border-radius: 12px; padding: 11px 13px;
  font: inherit; font-size: 14px; user-select: text; -webkit-user-select: text; }
.input::placeholder { color: #6684a6; }
.input:focus { border-color: var(--turq); outline: none; }
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 5px 2px; }
.promo-form { display: flex; gap: 8px; padding: 12px 14px 14px; }
.promo-form .input { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
select.input { appearance: none; }

/* ---------- Boost ---------- */
.pips { display: inline-flex; gap: 3px; margin-left: 2px; }
.pip { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.18); }
.pip.on { background: var(--turq); }
.left-dots { display: inline-flex; gap: 4px; }
.left-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.left-dots i.off { background: rgba(255,255,255,.16); }

/* ---------- Reyting ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 8px; align-items: end; margin: 10px 0 16px; }
.pod { border-radius: 18px 18px 8px 8px; padding: 12px 6px 10px; text-align: center; border: 1px solid var(--line); background: rgba(255,255,255,.05); min-width: 0; }
.pod.p1 { padding-top: 22px; background: linear-gradient(180deg, rgba(246,185,59,.22), rgba(246,185,59,.04)); border-color: rgba(246,185,59,.5); }
.pod .medal { width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-weight: 800; color: #2a1c02;
  background: linear-gradient(135deg, #e7eef7, #9fb3c9); }
.pod.p1 .medal { background: linear-gradient(135deg, var(--gold-l), var(--gold)); width: 40px; height: 40px; }
.pod.p3 .medal { background: linear-gradient(135deg, #f0c3a0, #c4814f); }
.pod-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod-score { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 2px; }
.rank { width: 34px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.row.me { background: rgba(42,209,198,.12); }
.score { font-weight: 800; color: var(--gold); font-size: 14px; }

/* ---------- Pastki navigatsiya ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: rgba(4, 20, 42, .94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); }
.nav-item { flex: 1; min-width: 0; max-width: 90px; background: none; border: 0; cursor: pointer; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 10.5px; font-weight: 700; position: relative; white-space: nowrap; }
.nav-item .ico { width: 23px; height: 23px; transition: transform .2s; }
.nav-item.active { color: var(--gold); }
.nav-item.active .ico { transform: translateY(-2px); }
.nav-item.active::before { content: ""; position: absolute; top: -9px; width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--gold); }
.nav-item[hidden] { display: none; }

/* ---------- Toast, modal ---------- */
.toast { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; z-index: 150; max-width: 90%;
  transform: translate(-50%, -140%); opacity: 0; pointer-events: none; transition: transform .3s cubic-bezier(.2,.9,.3,1.2), opacity .2s; padding: 11px 16px; border-radius: 14px;
  background: var(--lapis-700); border: 1px solid rgba(42,209,198,.4); font-weight: 700; font-size: 13.5px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-color: rgba(240,112,91,.6); background: #3a1c22; }

.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; background: rgba(2, 10, 22, .72); animation: fade .2s; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(100%, 340px); text-align: center; padding: 26px 22px 22px; border-radius: 26px; border: 1px solid rgba(246,185,59,.4);
  background: linear-gradient(180deg, var(--lapis-700), var(--lapis-800)); animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.sheet h3 { margin: 12px 0 2px; font-size: 18px; }
.sheet .big { font-size: 44px; font-weight: 800; color: var(--gold-l); letter-spacing: -.02em; margin: 4px 0 18px; }
.sheet .gift { width: 84px; height: 84px; margin: 0 auto; color: var(--gold); }
.sheet .gift .ico { width: 84px; height: 84px; stroke-width: 1.5; }
.sheet .gift.shake { animation: wobble .5s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-9deg) scale(1.05); } 75% { transform: rotate(9deg) scale(1.05); } }
#confetti { position: fixed; inset: 0; z-index: 130; pointer-events: none; }

/* ---------- Do'stlar ---------- */
.stat-line { display: flex; gap: 8px; margin: 12px 0 0; }
.stat { flex: 1; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 12.5px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ---------- Admin ---------- */
.admin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.form { padding: 14px; }
.form + .row, .form .btn { margin-top: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--turq); }

/* ---------- Bozor ---------- */
.seg { display: flex; gap: 4px; padding: 4px; margin: 4px 0 12px; border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid var(--line); }
.seg-btn { flex: 1; border: 0; border-radius: 10px; padding: 9px 4px; cursor: pointer; background: none; color: var(--muted); font: inherit; font-weight: 800; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg-btn.active { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: #3b2704; }
.seg-btn .dot { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
  background: var(--coral); color: #fff; font-size: 11px; }
.note { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; color: #cfe3f7; background: rgba(42,209,198,.09); border: 1px solid rgba(42,209,198,.22); }
.note.warn, .row-sub.warn { color: var(--gold); }
.note.warn { background: rgba(246,185,59,.1); border-color: rgba(246,185,59,.3); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; vertical-align: 1px;
  background: rgba(255,255,255,.1); color: var(--muted); white-space: nowrap; }
.tag.ok { background: rgba(95,217,154,.15); color: var(--ok); }
.tag.warn { background: rgba(246,185,59,.15); color: var(--gold); }
.tag.bad { background: rgba(240,112,91,.18); color: var(--coral); }
.cards { display: grid; gap: 10px; }
.mcard { padding: 14px; display: grid; gap: 8px; }
.mhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.paybox { padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px dashed rgba(246,185,59,.45); display: grid; gap: 6px; }
.pay-val { font-weight: 800; font-size: 15px; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.preview { min-height: 18px; margin: -2px 0 10px 2px; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; }
.col-btns { display: flex; flex-direction: column; gap: 6px; }
.sheet-lines { text-align: left; margin: 10px 0 4px; }
.sheet-lines p { margin: 7px 0; font-size: 14px; color: #cfe3f7; }
.sheet .btn-row { margin-top: 16px; }

@media (max-height: 640px) {
  .balance-val { font-size: 38px; }
  .league { margin-top: 8px; }
  .chips { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
