/* ===== O‘YINLAR PORTALI — UMUMIY DIZAYN (dark / neon) ===== */
:root {
  --bg: #0a0d1f;
  --bg2: #12163a;
  --card: #161b45;
  --card2: #1d2360;
  --text: #f2f4ff;
  --muted: #9aa3d6;
  --neon: #00e5ff;
  --pink: #ff2bd6;
  --lime: #7cff4f;
  --gold: #ffd54a;
  --radius: 18px;
  --tg-h: var(--tg-viewport-stable-height, 100vh);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior: none; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #2a1a6b 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #0b4a6b 0%, transparent 55%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Katalog ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
.hero {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0,229,255,.18), rgba(255,43,214,.18));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 0 30px rgba(0,229,255,.08) inset;
}
.hero .logo {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(135deg, var(--neon), var(--pink));
  box-shadow: 0 0 18px rgba(255,43,214,.55);
}
.hero h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.hero p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.hello { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); }
.hello b { display: block; color: var(--text); font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search {
  margin: 14px 0 4px; position: relative;
}
.search input {
  width: 100%; padding: 12px 14px 12px 40px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  color: var(--text); font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--neon); box-shadow: 0 0 0 3px rgba(0,229,255,.15); }
.search span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .6; }

.section-title { margin: 18px 2px 10px; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.card:active { transform: scale(.97); }
.card .cover { position: relative; aspect-ratio: 1 / 1; background: linear-gradient(135deg, #3b2bd6, #ff2bd6); overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cover .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 54px; }
.card .plays {
  position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 3px 8px; border-radius: 99px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
}
.card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { margin: 0; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .author { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .top1 {
  font-size: 12px; margin-top: 4px; padding: 6px 8px; border-radius: 10px;
  background: rgba(255,213,74,.1); border: 1px solid rgba(255,213,74,.25); color: var(--gold);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .top1.empty { color: var(--muted); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.btn-play {
  margin-top: 8px; display: block; text-align: center; padding: 10px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: linear-gradient(90deg, var(--neon), var(--pink)); color: #0a0d1f;
  box-shadow: 0 0 16px rgba(0,229,255,.35);
}
.empty-state { text-align: center; color: var(--muted); padding: 40px 10px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; opacity: .7; }

/* ---------- O‘yin sahifasi ---------- */
body.game-page { overflow: hidden; background: #05060f; position: fixed; inset: 0; height: 100%; touch-action: manipulation; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: rgba(10,13,31,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar .t { flex: 1; min-width: 0; }
.topbar .t b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .t small { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  border: 0; background: rgba(255,255,255,.08); color: var(--text); height: 36px; min-width: 36px; padding: 0 12px;
  border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn.gold { background: linear-gradient(90deg, #ffb300, var(--gold)); color: #241a00; }
.frame-wrap { position: fixed; top: calc(52px + env(safe-area-inset-top)); left: 0; right: 0; bottom: 0; background: #000; padding-bottom: env(safe-area-inset-bottom); }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }

/* Pastdan chiqadigan oyna (reyting) */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-bg.show { display: flex; animation: fade .2s ease; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88%; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1a1f55, #0f1236);
  border-radius: 24px 24px 0 0; border: 1px solid rgba(255,255,255,.1); border-bottom: 0;
  box-shadow: 0 -10px 40px rgba(0,229,255,.15);
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.25); margin: 10px auto 4px; }
.sheet .head { padding: 6px 18px 10px; text-align: center; }
.sheet .head h2 { margin: 4px 0 2px; font-size: 20px; }
.sheet .head p { margin: 0; color: var(--muted); font-size: 13px; }
.result {
  margin: 6px 16px 10px; padding: 14px; border-radius: 16px; text-align: center;
  background: linear-gradient(135deg, rgba(0,229,255,.15), rgba(255,43,214,.15));
  border: 1px solid rgba(255,255,255,.1); display: none;
}
.result.show { display: block; }
.result .big { font-size: 38px; font-weight: 800; background: linear-gradient(90deg, var(--neon), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.result .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.result .rec { display: none; margin-top: 6px; color: var(--lime); font-weight: 700; animation: pulse 1s ease infinite alternate; }
.result .rec.show { display: block; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

.lb { overflow-y: auto; padding: 0 12px 8px; flex: 1; -webkit-overflow-scrolling: touch; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.05);
}
.lb-row .rk { width: 34px; text-align: center; font-weight: 800; color: var(--muted); font-size: 15px; flex: none; }
.lb-row .rk.m { font-size: 24px; }
.lb-row .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #0a0d1f;
}
.lb-row .nm { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .nm small { display: block; color: var(--muted); font-size: 11px; }
.lb-row .sc { font-weight: 800; font-size: 16px; color: var(--neon); }
.lb-row.r1 { background: linear-gradient(90deg, rgba(255,213,74,.22), rgba(255,213,74,.04)); border-color: rgba(255,213,74,.35); }
.lb-row.r2 { background: linear-gradient(90deg, rgba(200,210,230,.2), rgba(200,210,230,.03)); border-color: rgba(200,210,230,.3); }
.lb-row.r3 { background: linear-gradient(90deg, rgba(205,127,50,.22), rgba(205,127,50,.03)); border-color: rgba(205,127,50,.35); }
.lb-row.me { outline: 2px solid var(--lime); outline-offset: -2px; }
.lb-empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.myrank { margin: 0 12px 8px; padding: 10px 14px; border-radius: 14px; background: rgba(124,255,79,.1); border: 1px dashed rgba(124,255,79,.4); font-size: 14px; display: none; }
.myrank.show { display: block; }
.sheet .actions { display: flex; gap: 8px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.06); }
.sheet .actions button {
  flex: 1; border: 0; border-radius: 14px; padding: 13px; font-weight: 700; font-size: 15px; cursor: pointer;
  background: rgba(255,255,255,.08); color: var(--text);
}
.sheet .actions button.primary { background: linear-gradient(90deg, var(--neon), var(--pink)); color: #0a0d1f; }

/* Mehmon ismi oynasi */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(5,6,15,.85); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; }
.modal { width: 100%; max-width: 380px; background: linear-gradient(180deg, #1d2360, #12163a); border-radius: 22px; padding: 22px; border: 1px solid rgba(255,255,255,.1); text-align: center; }
.modal h2 { margin: 0 0 6px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.modal input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.25); color: var(--text); font-size: 16px; outline: none; margin-bottom: 10px; text-align: center;
}
.modal input:focus { border-color: var(--neon); }
.modal button { width: 100%; border: 0; border-radius: 14px; padding: 13px; font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 6px; }
.modal .primary { background: linear-gradient(90deg, var(--neon), var(--pink)); color: #0a0d1f; }
.modal .ghost { background: rgba(255,255,255,.08); color: var(--text); }

.toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%) translateY(-20px); z-index: 70;
  background: rgba(20,24,70,.95); border: 1px solid rgba(255,255,255,.15); color: var(--text);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Telefon moslashuvi (barcha ekranlar) ---------- */
.topbar { height: calc(52px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
@supports (height: 100dvh) { body.game-page { height: 100dvh; } }
img { max-width: 100%; }
input, textarea, select { font-size: 16px; } /* iPhone’da avtomatik kattalashtirmaslik uchun */
@media (max-width: 360px) {               /* kichik telefonlar */
  .wrap { padding-left: 8px; padding-right: 8px; }
  .grid { gap: 8px; }
  .hero { padding: 10px 12px; gap: 8px; }
  .hero .logo { width: 42px; height: 42px; font-size: 22px; border-radius: 12px; }
  .hero h1 { font-size: 17px; }
  .hello { display: none; }
  .card h3 { font-size: 13.5px; }
  .card .body { padding: 8px 8px 10px; }
  .card .top1 { font-size: 11px; padding: 5px 6px; }
  .btn-play { padding: 8px; font-size: 13px; }
  .topbar .icon-btn.gold { padding: 0 9px; font-size: 13px; }
}
@media (min-width: 900px) {              /* planshet / kompyuter */
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wrap { max-width: 960px; }
}
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,229,255,.18); } }
