/* khelo.fun — Patakha Neon theme. Shared by the hub and every game page. */

:root {
  --bg: #0E0A1F;          /* page */
  --sky: #140F26;         /* ground / hero panels */
  --card: #211A3D;        /* surface */
  --card-hi: #2C2152;     /* card art band */
  --line: #2A2148;
  --line-2: #332A58;
  --line-3: #3D2F6B;
  --marigold: #FFB224;    /* primary */
  --marigold-hi: #FFC95C;
  --ink: #140F26;         /* text on marigold */
  --rani: #FF3D8A;        /* pop */
  --rani-bg: #2B1030;
  --flame: #FF7A1A;
  --text: #FFF6E8;
  --text-2: #CFC7E8;
  --text-3: #9A90BE;
  --paper: #FFF6E8;       /* WhatsApp bubble */
  --paper-ink: #1A1A1A;
  --paper-ink-2: #6B6355;
  --paper-ink-3: #7A6F5C;

  --glow-marigold: 0 0 28px rgba(255, 178, 36, 0.55);
  --glow-rani: 0 0 18px rgba(255, 61, 138, 0.3);
  --glow-card: 0 0 40px rgba(255, 61, 138, 0.2);
  --text-glow-marigold: 0 0 30px rgba(255, 178, 36, 0.55);
  --text-glow-rani: 0 0 26px rgba(255, 61, 138, 0.55);

  --font-display: 'Baloo 2', ui-rounded, system-ui, sans-serif;
  --font-body: 'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --gutter: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--marigold); }
a:hover { color: var(--marigold-hi); }

[hidden] { display: none !important; }

img, svg { display: block; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 3px;
  border-radius: 6px;
}

.k-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.k-display { font-family: var(--font-display); font-weight: 800; line-height: 1; }

/* ---------- Logo ---------- */
.k-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.k-logo span:first-child { color: var(--marigold); }
.k-logo span:last-child { color: var(--rani); }

/* ---------- Buttons ---------- */
.k-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 30px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  user-select: none;
}
.k-btn:active { transform: scale(0.97); }
.k-btn svg { flex-shrink: 0; }

.k-btn--primary {
  background: var(--marigold);
  color: var(--ink);
  box-shadow: var(--glow-marigold);
}
.k-btn--primary:hover { background: var(--marigold-hi); color: var(--ink); }

.k-btn--ghost {
  background: transparent;
  color: var(--rani);
  border: 2px solid var(--rani);
  box-shadow: var(--glow-rani);
  padding: 11px 26px;
  font-size: 18px;
}
.k-btn--ghost:hover { background: var(--rani-bg); color: var(--rani); }

.k-btn--quiet {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line-3);
  font-size: 16px;
  padding: 10px 20px;
}
.k-btn--quiet:hover { background: var(--card-hi); color: var(--text); }

.k-btn--block { display: flex; width: 100%; }
.k-btn[disabled], .k-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.k-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line-3);
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
}
.k-iconbtn:hover { background: var(--card-hi); color: var(--text); }

/* ---------- Chips, pills, labels ---------- */
.k-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line-3);
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap;
}
.k-chip--gold { color: var(--marigold); }
.k-chip--rani { color: var(--rani); background: var(--rani-bg); border-color: var(--rani); }

.k-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.k-badge--live { color: var(--ink); background: var(--marigold); }
.k-badge--soon { color: var(--rani); background: var(--rani-bg); border: 1px solid var(--rani); }

.k-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- Cards ---------- */
.k-card {
  background: var(--card);
  border: 1px solid var(--line-3);
  border-radius: var(--r-lg);
}

/* ---------- Game screen scaffold ---------- */
.k-screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  touch-action: manipulation;
}

.k-topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px var(--gutter);
  padding-top: max(12px, env(safe-area-inset-top));
  pointer-events: none;
}
.k-topbar > * { pointer-events: auto; }
.k-topbar .k-spacer { margin-left: auto; }

/* Game intro overlay — headline + one glowing button */
.k-intro {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 32px;
  text-align: center;
}
.k-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(38px, 11vw, 56px);
  line-height: 1.05;
  text-shadow: 0 2px 20px rgba(14, 10, 31, 0.9);
}
.k-intro h1 em { font-style: normal; color: var(--marigold); text-shadow: 0 0 26px rgba(255, 178, 36, 0.6); }
.k-intro p {
  margin: 0;
  max-width: 340px;
  font-size: 16px;
  color: var(--text-2);
  text-shadow: 0 2px 12px rgba(14, 10, 31, 0.9);
}
.k-intro .k-btn { margin-top: 10px; }

.k-footnote {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px var(--gutter);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}
.k-footnote strong { margin-left: auto; color: var(--rani); font-weight: 600; }

/* ---------- End card (same layout on every game) ---------- */
.k-end {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: var(--bg);
  animation: k-fade-in 0.25s ease-out;
}
.k-end__inner {
  position: relative;
  max-width: 440px;
  min-height: 100%;
  margin: 0 auto;
  padding: 16px 20px 24px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.k-end__top { display: flex; align-items: center; position: relative; z-index: 2; }
.k-end__top .k-chip { margin-left: auto; }
.k-end__hero {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.k-end__burst { position: absolute; top: -52px; left: 50%; width: 280px; height: 280px; margin-left: -140px; opacity: 0.9; pointer-events: none; }
.k-end__kicker { position: relative; font-size: 14px; letter-spacing: 2.5px; font-weight: 600; color: var(--rani); text-transform: uppercase; }
.k-end__score {
  position: relative;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(84px, 30vw, 130px);
  line-height: 0.95;
  color: var(--marigold);
  text-shadow: 0 0 46px rgba(255, 178, 36, 0.65);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.k-end__score--long { font-size: clamp(48px, 15vw, 72px); line-height: 1.05; }
.k-end__unit { position: relative; font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.2; }
.k-end__chips { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.k-end__extra { position: relative; z-index: 1; margin-top: 22px; }
.k-end__preview { position: relative; z-index: 1; margin-top: 26px; display: flex; flex-direction: column; gap: 8px; }
.k-end__actions { margin-top: auto; padding-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.k-end__more { display: flex; gap: 10px; }

/* WhatsApp-bubble share preview */
.k-wa {
  background: var(--paper);
  border-radius: 14px;
  padding: 11px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.k-wa__thumb {
  width: 96px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--sky);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 4px;
}
.k-wa__big { font-family: var(--font-display); font-weight: 800; font-size: 27px; line-height: 1; color: var(--rani); text-shadow: 0 0 12px rgba(255, 61, 138, 0.8); }
.k-wa__small { font-size: 9px; font-weight: 600; letter-spacing: 1px; color: var(--marigold); text-transform: uppercase; }
.k-wa__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.k-wa__title { font-size: 13.5px; font-weight: 600; color: var(--paper-ink); line-height: 1.3; }
.k-wa__sub { font-size: 12px; color: var(--paper-ink-2); line-height: 1.35; }
.k-wa__url { font-size: 11px; color: var(--paper-ink-3); }

/* "More games" tile */
.k-mini {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text);
}
.k-mini:hover { background: var(--card-hi); color: var(--text); }
.k-mini__art { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.k-mini__name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.k-mini__sub { font-size: 11.5px; color: var(--text-3); line-height: 1.2; }

/* ---------- Toast ---------- */
.k-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 100;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.k-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Site chrome (hub, trending, tools) ---------- */
.k-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .k-wrap { padding: 0 var(--gutter); } }

.k-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.k-nav__links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-left: 20px; font-size: 15px; font-weight: 600; }
.k-nav__links a { color: var(--text-2); text-decoration: none; padding: 10px 0; }
.k-nav__links a:hover, .k-nav__links a[aria-current="page"] { color: var(--text); }
.k-nav__streak { margin-left: auto; }
@media (max-width: 720px) {
  .k-nav__links { order: 3; width: 100%; margin-left: 0; gap: 4px 18px; }
}

.k-footer {
  margin-top: 56px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 14px;
  color: var(--text-3);
}
.k-footer a { color: var(--text-2); text-decoration: none; }
.k-footer a:hover { color: var(--text); }

.k-h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.15; }
@media (max-width: 600px) { .k-h2 { font-size: 22px; } }

/* Decorative glowing dot */
.k-spark { position: absolute; border-radius: 50%; pointer-events: none; }
.k-spark--gold { background: var(--marigold); box-shadow: 0 0 14px 4px rgba(255, 178, 36, 0.7); }
.k-spark--rani { background: var(--rani); box-shadow: 0 0 12px 4px rgba(255, 61, 138, 0.7); }
.k-spark--white { background: var(--text); box-shadow: 0 0 10px 3px rgba(255, 246, 232, 0.6); }

@keyframes k-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes k-pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
