/* ============================================================
   So'z — premium dizayn tizimi
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.28);
  --t: .18s cubic-bezier(.4,0,.2,1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg-soft: #0e1117;
  --surface: #12151d;
  --surface-2: #171b25;
  --surface-3: #1d2230;
  --border: rgba(255,255,255,.075);
  --border-strong: rgba(255,255,255,.14);
  --text: #eceef2;
  --text-2: #9aa2b0;
  --text-3: #6b7280;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-soft: rgba(129,140,248,.14);
  --accent-grad: linear-gradient(135deg,#6366f1,#8b5cf6);
  --success: #34d399;
  --success-soft: rgba(52,211,153,.14);
  --danger: #fb7185;
  --danger-soft: rgba(251,113,133,.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,.14);
  --glass: rgba(18,21,29,.72);
  --scroll: rgba(255,255,255,.14);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f9;
  --bg-soft: #eef0f5;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef0f6;
  --border: rgba(15,20,40,.09);
  --border-strong: rgba(15,20,40,.16);
  --text: #151a26;
  --text-2: #5c6472;
  --text-3: #98a0ae;
  --accent: #5558e8;
  --accent-2: #7c5cf0;
  --accent-soft: rgba(85,88,232,.1);
  --accent-grad: linear-gradient(135deg,#5558e8,#8b5cf6);
  --success: #0fae7a;
  --success-soft: rgba(15,174,122,.12);
  --danger: #e5486a;
  --danger-soft: rgba(229,72,106,.1);
  --warn: #d97706;
  --warn-soft: rgba(217,119,6,.12);
  --glass: rgba(255,255,255,.78);
  --scroll: rgba(15,20,40,.18);
}

html { font-family: var(--font); background: var(--bg); color: var(--text); }
body { min-height: 100dvh; overflow-x: hidden; }

/* ---------- Fon orbalari ---------- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
html[data-theme="dark"] .orb { opacity: .22; }
.orb-1 { width: 480px; height: 480px; top: -160px; left: -120px; background: #6366f1; }
.orb-2 { width: 420px; height: 420px; bottom: -140px; right: -100px; background: #8b5cf6; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Umumiy ---------- */
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-grad); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
  flex-shrink: 0;
}

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 15px;
  transition: var(--t); border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 18px rgba(99,102,241,.35); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,.42); }
.btn-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn-success { background: var(--success); color: #04120c; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: 14px; }

/* ---------- Maydonlar ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field textarea {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 15px;
  transition: var(--t); outline: none; width: 100%;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.field textarea { resize: vertical; min-height: 74px; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 40px 34px; box-shadow: var(--shadow-lg);
  animation: rise .45s cubic-bezier(.2,.7,.3,1);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-brand .logo-mark { margin: 0 auto 14px; width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
.login-brand h1 { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login-brand p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error {
  background: var(--danger-soft); color: var(--danger);
  padding: 10px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  animation: shake .3s;
}

/* ---------- LAYOUT ---------- */
#app { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  padding: 26px 18px 20px; border-right: 1px solid var(--border);
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--font-display); font-size: 19px; font-weight: 800; }
.brand-text span { font-size: 12px; color: var(--text-3); }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; color: var(--text-2); font-weight: 600; font-size: 14.5px;
  transition: var(--t); position: relative;
}
.nav-item svg, .bn-item svg { width: 21px; height: 21px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: -18px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px; background: var(--accent-grad);
}
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.user-chip:hover { background: var(--surface-2); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent-grad);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.user-chip div:last-child { display: flex; flex-direction: column; line-height: 1.3; overflow: hidden; }
.user-chip strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.user-chip span { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.user-chip span svg { width: 13px; height: 13px; fill: currentColor; }
.btn-logout { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--text-3); transition: var(--t); }
.btn-logout:hover { color: var(--danger); background: var(--danger-soft); }
.btn-logout svg { width: 18px; height: 18px; fill: currentColor; }

.main { padding: 28px 32px 60px; max-width: 1120px; width: 100%; margin: 0 auto; }
.view { animation: fade .3s ease; }

/* ---------- Bottom nav (mobil) ---------- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 12px; border-radius: 12px; color: var(--text-3); font-size: 11px; font-weight: 600; transition: var(--t); }
.bn-item svg { width: 22px; height: 22px; }
.bn-item.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- Sahifa sarlavhalari ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); font-size: 14px; margin-top: 3px; }

/* ---------- Dashboard ---------- */
.hello-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.hello h1 { font-family: var(--font-display); font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.hello .date { color: var(--text-2); font-size: 13.5px; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 999px; background: var(--warn-soft); color: var(--warn);
  font-weight: 700; font-size: 13.5px; border: 1px solid transparent;
}
.streak-chip.fire { animation: pulseGlow 2s ease-in-out infinite; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
  transition: var(--t); position: relative; overflow: hidden; cursor: pointer; text-align: left;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat-card:active { transform: scale(.98); }
.stat-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--accent-soft); opacity: 0; transition: opacity .2s;
}
.stat-card:hover::after { opacity: .22; }
.stat-card > * { position: relative; z-index: 1; }
.stat-arrow { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--text-3); opacity: 0; transform: translateX(-4px); transition: var(--t); }
.stat-arrow svg { width: 15px; height: 15px; fill: currentColor; }
.stat-card:hover .stat-arrow { opacity: 1; transform: none; color: var(--accent); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
}
.stat-ico svg { width: 21px; height: 21px; fill: currentColor; }
.stat-ico.indigo { background: var(--accent-soft); color: var(--accent); }
.stat-ico.green { background: var(--success-soft); color: var(--success); }
.stat-ico.red { background: var(--danger-soft); color: var(--danger); }
.stat-ico.amber { background: var(--warn-soft); color: var(--warn); }
.stat-num { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }

/* Bugungi vazifa — katta karta */
.task-hero {
  background: linear-gradient(150deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px; display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  margin-bottom: 20px; position: relative; overflow: hidden;
}
.task-hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: var(--accent-grad); opacity: .09; border-radius: 50%; filter: blur(30px);
}
.task-ring { position: relative; width: 118px; height: 118px; flex-shrink: 0; }
.task-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.task-ring .ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.task-ring .ring-fg { fill: none; stroke: url(#grad); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.7,.3,1); }
.task-ring .ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 26px; flex-direction: column;
}
.task-ring .ring-num small { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.task-body { flex: 1; min-width: 220px; }
.task-body h3 { font-family: var(--font-display); font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.task-body p { color: var(--text-2); font-size: 13.5px; max-width: 520px; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Haftalik faollik */
.week-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.week-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.week-chart { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.wcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.wbar { width: 100%; max-width: 20px; min-height: 4px; border-radius: 5px 5px 3px 3px; background: var(--accent-soft); position: relative; transition: height .6s cubic-bezier(.2,.7,.3,1); }
.wbar.has { background: var(--accent-grad); }
.wbar.today { outline: 2px solid var(--accent); outline-offset: 2px; }
.wday { font-size: 9.5px; color: var(--text-3); font-weight: 600; }

/* O'yin kartalari */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.game-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 12px; transition: var(--t);
  cursor: pointer; position: relative; overflow: hidden; text-align: left;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.game-card:active { transform: scale(.98); }
.game-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.game-ico svg { width: 24px; height: 24px; fill: currentColor; }
.game-card h4 { font-family: var(--font-display); font-size: 17px; font-weight: 800; }
.game-card p { font-size: 13px; color: var(--text-2); line-height: 1.55; flex: 1; }
.game-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; }

/* ---------- So'zlar sahifasi ---------- */
.words-toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px 11px 40px; font-size: 14.5px; outline: none; transition: var(--t);
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: var(--text-3); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2); transition: var(--t);
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.add-card { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.add-card form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.add-card .field:last-of-type { grid-column: 1 / -1; }
.add-card .add-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; }

.word-list { display: flex; flex-direction: column; gap: 10px; }
.word-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  transition: var(--t); animation: fade .3s ease;
}
.word-item:hover { border-color: var(--border-strong); }
.word-main { flex: 1; min-width: 0; }
.word-main .w-word { font-family: var(--font-display); font-weight: 800; font-size: 16.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.word-main .w-trans { color: var(--accent); font-weight: 600; font-size: 14.5px; margin-top: 2px; }
.word-main .w-comment { color: var(--text-3); font-size: 13px; margin-top: 5px; font-style: italic; }
.word-badges { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.badge.learned { background: var(--success-soft); color: var(--success); }
.badge.learning { background: var(--accent-soft); color: var(--accent); }
.badge.new { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge svg { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; }
.word-actions { display: flex; gap: 4px; opacity: 0; transition: var(--t); }
.word-item:hover .word-actions, .word-item:focus-within .word-actions { opacity: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text-3); transition: var(--t);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state svg { width: 64px; height: 64px; fill: var(--surface-3); margin-bottom: 14px; }
.empty-state h4 { color: var(--text-2); font-weight: 700; font-size: 16px; margin-bottom: 5px; }
.empty-state p { font-size: 13.5px; }

/* ---------- Sozlamalar ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.set-card h4 { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.set-card .set-desc { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.set-card form { display: flex; flex-direction: column; gap: 14px; }
.set-card .btn { align-self: flex-start; }

/* Tema tugmasi */
.theme-row { display: flex; gap: 10px; }
.theme-opt {
  flex: 1; border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; text-align: center;
  transition: var(--t); background: var(--surface-2); position: relative;
}
.theme-opt svg { width: 26px; height: 26px; fill: currentColor; margin-bottom: 8px; }
.theme-opt .t-label { font-size: 13px; font-weight: 700; }
.theme-opt .t-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.theme-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- O'yin ---------- */
.game-view { padding: 0; max-width: 860px; margin: 0 auto; }
.game-top { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.game-top h2 { font-family: var(--font-display); font-size: 20px; font-weight: 800; flex: 1; }
.game-progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.game-progress > div { height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width .4s cubic-bezier(.2,.7,.3,1); }

/* Pre-game (pool tanlash) */
.pool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; transition: var(--t); cursor: pointer; display: flex; align-items: center; gap: 14px; }
.pool-card:hover { border-color: var(--border-strong); }
.pool-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.pool-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; }
.pool-card.selected .pool-ico { background: var(--accent); color: #fff; }
.pool-ico svg { width: 20px; height: 20px; fill: currentColor; }
.pool-body { flex: 1; }
.pool-body strong { font-size: 15px; font-weight: 700; }
.pool-body p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.pool-count { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text-2); }

/* Quiz */
.quiz-word { text-align: center; margin: 26px 0 30px; }
.quiz-word .qw-label { font-size: 13px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.quiz-word .qw-text { font-family: var(--font-display); font-size: clamp(30px, 6vw, 44px); font-weight: 800; letter-spacing: -.02em; }
.quiz-word .qw-hint { color: var(--text-3); font-size: 13.5px; margin-top: 10px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-opt {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 18px 16px; font-size: 16.5px; font-weight: 600; transition: var(--t);
  animation: rise .3s ease backwards;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { background: var(--success-soft); border-color: var(--success); color: var(--success); animation: pop .4s cubic-bezier(.2,.7,.3,1); }
.quiz-opt.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); animation: shake .35s; }
.quiz-opt.dim { opacity: .35; }

/* Match */
.match-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.match-col { display: flex; flex-direction: column; gap: 9px; }
.match-col-head { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; text-align: center; }
.match-item {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-weight: 600; font-size: 15px; text-align: center;
  transition: var(--t); cursor: pointer; user-select: none;
}
.match-item:hover:not(.matched):not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.match-item.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.match-item.matched { border-color: var(--success); background: var(--success-soft); color: var(--success); opacity: .85; cursor: default; animation: pop .35s; }
.match-item.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake .35s; }

/* Type */
.type-word { text-align: center; margin: 30px 0; }
.type-input-row { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.type-input-row input {
  flex: 1; text-align: center; font-size: 19px; font-weight: 700; padding: 14px 16px;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 14px; outline: none; transition: var(--t);
}
.type-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.type-input-row input.ok { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.type-input-row input.bad { border-color: var(--danger); background: var(--danger-soft); animation: shake .35s; }

/* Flash */
.flash-stage { perspective: 1200px; margin: 30px auto; max-width: 440px; }
.flash-card { position: relative; width: 100%; height: 240px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.3,1); cursor: pointer; }
.flash-card.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  display: grid; place-items: center; text-align: center; padding: 24px;
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md);
}
.flash-face .f-label { position: absolute; top: 16px; font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.flash-face .f-text { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.01em; }
.flash-face.back { transform: rotateY(180deg); background: var(--accent-soft); border-color: var(--accent); }
.flash-face.back .f-text { color: var(--accent); }
.flash-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.flash-actions .btn { flex: 1; max-width: 200px; padding: 14px; font-size: 15.5px; }

/* Scramble */
.scr-word { text-align: center; margin: 26px 0; }
.scr-hint { color: var(--accent); font-weight: 600; font-size: 16px; margin-top: 10px; }
.scr-tiles { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin: 22px 0; min-height: 46px; }
.scr-tile {
  width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--border);
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  transition: var(--t); cursor: pointer; animation: rise .25s ease backwards;
}
.scr-tile:hover:not(.used):not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.scr-tile.used { opacity: .18; pointer-events: none; }
.scr-answer { display: flex; gap: 7px; justify-content: center; min-height: 52px; flex-wrap: wrap; padding: 8px 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px dashed var(--border-strong); }
.scr-answer .scr-tile { cursor: pointer; animation: none; }
.scr-answer .scr-tile:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.scr-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* Yakuniy natija */
.result-wrap { text-align: center; padding: 30px 0 10px; }
.result-emoji { margin-bottom: 10px; animation: pop .5s cubic-bezier(.2,.7,.3,1); display: grid; place-items: center; }
.result-emoji svg { width: 62px; height: 62px; fill: var(--accent); }
.result-wrap h2 { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.result-wrap p { color: var(--text-2); font-size: 14.5px; margin-bottom: 24px; }
.result-stats { display: flex; justify-content: center; gap: 14px; margin-bottom: 28px; flex-wrap: wrap; }
.result-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 22px; min-width: 110px; }
.result-stat strong { font-family: var(--font-display); font-size: 24px; font-weight: 800; display: block; }
.result-stat.good strong { color: var(--success); }
.result-stat.bad strong { color: var(--danger); }
.result-stat span { font-size: 12px; color: var(--text-3); font-weight: 600; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- To'liq yangilash tugmasi (aylana) ---------- */
.full-refresh-btn {
  position: fixed; top: 18px; right: 20px; z-index: 70;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--border-strong);
  color: var(--text-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md); transition: var(--t);
}
.full-refresh-btn svg { width: 20px; height: 20px; fill: currentColor; transition: transform .5s cubic-bezier(.2,.7,.3,1); }
.full-refresh-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.full-refresh-btn:hover svg { transform: rotate(180deg); }
.full-refresh-btn:active { transform: scale(.92); }
@media (max-width: 900px) {
  .full-refresh-btn { top: 14px; right: 14px; width: 40px; height: 40px; }
}
body.in-game .full-refresh-btn { display: none; }

/* ---------- Ilovani o'rnatish banneri ---------- */
.install-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 75;
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 10px 14px; max-width: min(92vw, 460px); width: max-content;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg); animation: rise .4s cubic-bezier(.2,.7,.3,1);
}
.install-ico { flex-shrink: 0; display: grid; place-items: center; }
.install-ico svg { width: 24px; height: 24px; fill: var(--accent); }
.install-text { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.install-text strong { font-size: 13.5px; font-weight: 700; }
.install-text span { font-size: 11.5px; color: var(--text-2); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; flex-shrink: 0; }
.install-close {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-3); transition: var(--t); flex-shrink: 0;
}
.install-close svg { width: 13px; height: 13px; fill: currentColor; }
.install-close:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 480px) {
  .install-banner { flex-wrap: wrap; justify-content: center; text-align: center; }
  .install-text { flex-basis: 100%; align-items: center; }
}

/* ---------- Toast / Modal / Confetti ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: rise .3s cubic-bezier(.2,.7,.3,1); max-width: 90vw;
  display: flex; align-items: center; gap: 9px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.leaving { animation: fadeDown .3s forwards; }

.confetti-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); animation: fade .2s; padding: 20px; }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 26px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: rise .3s cubic-bezier(.2,.7,.3,1);
}
.modal h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.modal p { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* So'zlar ro'yxati modal */
.modal-words { max-width: 520px; padding: 22px; max-height: min(78vh, 640px); display: flex; flex-direction: column; }
.words-modal-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding-right: 4px; }
.words-modal-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; transition: var(--t);
}
.words-modal-item:hover { border-color: var(--border-strong); }
.wm-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wm-main strong { font-weight: 700; font-size: 14.5px; }
.wm-main span { color: var(--accent); font-size: 13px; font-weight: 600; }
.wm-main i { color: var(--text-3); font-size: 12px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.words-modal-empty { text-align: center; padding: 26px 0; color: var(--text-3); font-size: 13.5px; }
.words-modal-more { text-align: center; color: var(--text-3); font-size: 12px; padding: 6px 0; }

/* ---------- Animatsiyalar ---------- */
.shake { animation: shake .35s; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeDown { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-10px); } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,.35); } 50% { box-shadow: 0 0 0 8px rgba(251,191,36,0); } }

/* ---------- Responsiv ---------- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
  .add-card form { grid-template-columns: 1fr; }
  .add-card .field:last-of-type, .add-card .add-actions { grid-column: 1; }
  .word-actions { opacity: 1; }
  .quiz-options { grid-template-columns: 1fr; }
  .task-hero { padding: 20px; gap: 18px; justify-content: center; text-align: center; }
  .task-body { min-width: 100%; }
  .task-actions { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
  .page-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stat-num { font-size: 25px; }
  .match-wrap { gap: 10px; }
  .match-item { font-size: 13.5px; padding: 11px 9px; }
  .hello h1 { font-size: 23px; }
}
