:root {
  --bg: #0f1020;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --chip: rgba(255, 255, 255, 0.18);
  --topbar-h: 56px;
  --card-max: 600px;
  --font: "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(to bottom, rgba(15, 16, 32, 0.92), rgba(15, 16, 32, 0.55));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 20px; color: var(--fg); text-decoration: none; white-space: nowrap; }
.logo span { letter-spacing: 0.5px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; border-radius: 999px; padding: 7px 12px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--fg); }
.tab.active { background: var(--fg); color: #111; }
.tools { display: flex; align-items: center; gap: 8px; }
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { border: 0; background: var(--chip); border-radius: 999px; width: 36px; height: 36px; font-size: 16px; }
.icon-btn:active { transform: scale(0.92); }

/* ---------- feed ---------- */
.feed {
  height: 100dvh; width: 100%;
  overflow-y: scroll; overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  outline: none;
}
.feed::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  height: 100dvh; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px) 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--g, linear-gradient(160deg, #3b2f80, #1c1b3a));
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: -20%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 45%),
              radial-gradient(circle at 80% 85%, rgba(255,255,255,0.12), transparent 40%);
  pointer-events: none;
}
.card-inner {
  position: relative; width: 100%; max-width: var(--card-max);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { background: var(--chip); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.chip-cat.science { background: rgba(80, 220, 255, 0.28); }
.chip-cat.history { background: rgba(255, 200, 80, 0.3); }
.chip-cat.world { background: rgba(120, 255, 160, 0.28); }
.chip-cat.fun { background: rgba(255, 120, 200, 0.3); }

.reveal {
  border: 2px dashed rgba(255,255,255,0.6); background: rgba(0,0,0,0.2); color: var(--fg);
  border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 16px;
}
.reveal:active { transform: scale(0.96); }
.answer { margin: 0; font-size: clamp(19px, 2.8vh, 24px); font-weight: 800; background: rgba(255,255,255,0.18); border-radius: 14px; padding: 10px 18px; }

.emoji {
  font-size: clamp(72px, 20vh, 150px); line-height: 1;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.35));
  transform: scale(0.8); opacity: 0.6;
  transition: transform .45s cubic-bezier(.2,.9,.3,1.3), opacity .3s;
}
.card.active .emoji { transform: scale(1); opacity: 1; animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -8px; } }

.title { margin: 0; font-size: clamp(22px, 3.6vh, 30px); font-weight: 800; line-height: 1.25; text-wrap: balance; }
.text { margin: 0; font-size: clamp(17px, 2.5vh, 22px); line-height: 1.55; font-weight: 400; text-wrap: pretty; }
.extra { width: 100%; background: rgba(0,0,0,0.25); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: var(--muted); text-align: left; }
.extra p { margin: 4px 0; }
.extra .source:empty { display: none; }
.extra .source::before { content: "წყარო: "; opacity: .7; }

.actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 14px;
  background: var(--chip); font-weight: 600; font-size: 14px;
  transition: transform .1s, background .15s;
}
.act:active { transform: scale(0.94); }
.act .ic { font-size: 18px; line-height: 1; }
.act.like[aria-pressed="true"] { background: rgba(255, 90, 120, 0.4); }
.act.info[aria-expanded="true"] { background: rgba(255,255,255,0.35); }
.act.meh[aria-pressed="true"] { background: rgba(100,116,139,0.5); opacity: .8; }

.burst {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  font-size: 110px; opacity: 0; pointer-events: none;
}
.burst.go { animation: burst .8s ease-out; }
@keyframes burst {
  0% { opacity: 0; transform: scale(0.3); }
  25% { opacity: 1; transform: scale(1.15); }
  60% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3) translateY(-40px); }
}

/* ---------- special cards ---------- */
.card.special .emoji { font-size: 90px; }
.card.special .big-btn {
  border: 0; border-radius: 999px; padding: 14px 24px; font-size: 18px; font-weight: 800;
  background: var(--fg); color: #111; margin-top: 8px;
}
.card.special .text { color: var(--muted); }

/* ---------- hint ---------- */
.hint {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0;
  background: rgba(0,0,0,0.5); color: var(--fg); border-radius: 999px; padding: 8px 14px; font-size: 13px;
  display: flex; gap: 8px; align-items: center; pointer-events: none; z-index: 5;
  transition: opacity .4s;
}
.hint span { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%,100% { translate: 0 2px; } 50% { translate: 0 -3px; } }
.hint.hide { opacity: 0; }

/* ---------- loader ---------- */
.sentinel { height: 1px; }
.loading { position: fixed; bottom: calc(60px + env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; font-size: 13px; color: var(--muted); z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  .card.active .emoji { animation: none; }
  .hint span { animation: none; }
  .emoji { transition: none; }
}
@media (min-width: 700px) {
  .card { padding-left: 32px; padding-right: 32px; }
  .tab { font-size: 15px; }
}
@media (max-width: 420px) {
  .act .lbl { display: none; }
  .act { padding: 10px 13px; }
  .tab { padding: 7px 10px; font-size: 13px; }
  .tab:not(.active) span { display: none; }
  .logo span { display: none; }
  .counter { display: none; }
}

/* ---------- family accounts ---------- */
.fam-btn { width: auto; min-width: 36px; padding: 0 10px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.fam-btn.has-kid { background: rgba(255,255,255,0.9); color: #111; }
.fam-modal[hidden] { display: none; }
.fam-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.6); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.fam-box { width: 100%; max-width: 480px; max-height: 90dvh; overflow-y: auto; background: #1b1a2e; color: var(--fg); border-radius: 22px 22px 0 0; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .fam-modal { align-items: center; } .fam-box { border-radius: 22px; } }
.fam-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fam-head h2 { margin: 0; font-size: 20px; }
.fam-x { border: 0; background: var(--chip); color: var(--fg); border-radius: 999px; width: 34px; height: 34px; font-size: 16px; }
.fam-lead { margin: 0 0 12px; color: var(--muted); line-height: 1.5; font-size: 15px; }
.fam-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.fam-form { display: grid; gap: 12px; }
.fam-form label, .fam-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.fam-form input, .fam-form select { font: inherit; font-size: 17px; color: var(--fg); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); border-radius: 12px; padding: 12px 14px; }
.fam-form input:focus { outline: 2px solid rgba(255,255,255,0.5); }
.fam-primary { border: 0; border-radius: 999px; padding: 13px 18px; font-weight: 800; font-size: 16px; background: var(--fg); color: #111; }
.fam-primary:disabled { opacity: .6; }
.fam-secondary { border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 700; font-size: 14px; background: var(--chip); color: var(--fg); text-decoration: none; text-align: center; }
.fam-link { border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; padding: 6px; }
.fam-err { margin: 0; min-height: 1.2em; color: #fb7185; font-size: 14px; }
.fam-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fam-row > * { flex: 1; }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.fam-kid { position: relative; border: 2px solid transparent; background: rgba(255,255,255,0.08); color: var(--fg); border-radius: 18px; padding: 12px 8px; display: grid; gap: 6px; justify-items: center; font-weight: 700; font-size: 14px; }
.fam-kid.active { border-color: #fff; background: rgba(255,255,255,0.18); }
.fam-kid.add { border-style: dashed; border-color: rgba(255,255,255,0.3); color: var(--muted); }
.fam-avatar { font-size: 40px; line-height: 1; }
.fam-lock { position: absolute; top: 6px; right: 8px; font-size: 12px; }
.fam-avatars { display: flex; flex-wrap: wrap; gap: 6px; }
.fam-av { border: 2px solid transparent; background: rgba(255,255,255,0.08); border-radius: 12px; font-size: 26px; width: 46px; height: 46px; }
.fam-av.on { border-color: #fff; background: rgba(255,255,255,0.2); }
.fam-big { font-size: 64px; text-align: center; }
.fam-topics { margin: 0 0 12px; } .fam-topics h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.fam-topics .chip { margin: 0 6px 6px 0; display: inline-block; }

/* ---------- search ---------- */
.search { position: fixed; left: 0; right: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 20; padding: 8px 12px 10px; background: rgba(15,16,32,0.96); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,0.1); }
.search[hidden] { display: none; }
.search-bar { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.search-bar input { flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--fg); background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 999px; padding: 10px 16px; }
.search-bar input:focus { outline: 2px solid rgba(255,255,255,0.5); }
.search-go, .search-x { border: 0; background: var(--chip); color: var(--fg); border-radius: 999px; width: 42px; font-size: 16px; }
.search-go { background: var(--fg); color: #111; }
.search-topics { display: flex; gap: 6px; flex-wrap: wrap; max-width: 640px; margin: 8px auto 0; }
.search-topics:empty { display: none; }
.search-topics .chip { cursor: pointer; }
.search-status { max-width: 640px; margin: 6px auto 0; font-size: 13px; color: var(--muted); min-height: 1em; }
/* stardust banked for the game by reading */
#game-btn { position: relative; }
#game-btn .energy { position: absolute; top: -5px; right: -9px; background: #fbbf24; color: #111; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 8px rgba(251,191,36,0.5); pointer-events: none; }
#game-btn .energy[hidden] { display: none; }
#game-btn .energy.pop { animation: energy-pop .5s ease; }
@keyframes energy-pop { 40% { transform: scale(1.35); } }
