@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');

/* ============================================================
   Fun Comet — Shared Design System
   ============================================================ */

:root {
  /* Brand palette (from peacock-feather logo) */
  --brand-purple: #5b2a86;
  --brand-purple-2: #7b3fb0;
  --brand-teal: #159fb5;
  --brand-blue: #2b4ba0;
  --brand-gold: #d9a521;
  --brand-green: #3fa66a;

  --grad-brand: linear-gradient(135deg, #5b2a86 0%, #2b4ba0 45%, #159fb5 100%);
  --grad-warm: linear-gradient(135deg, #7b3fb0 0%, #d9a521 100%);

  /* Light theme */
  --bg: #f6f4fb;
  --bg-soft: #ffffff;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0ecfa;
  --text: #241533;
  --text-soft: #5c5470;
  --text-mut: #857e97;
  --border: #e6e0f2;
  --shadow: 0 10px 30px rgba(91, 42, 134, 0.10);
  --shadow-sm: 0 4px 14px rgba(91, 42, 134, 0.08);
  --ring: rgba(123, 63, 176, 0.35);
  --header-bg: rgba(255, 255, 255, 0.82);
}

[data-theme="dark"] {
  --bg: #120b1f;
  --bg-soft: #1a1030;
  --bg-elev: #211640;
  --surface: #1d1338;
  --surface-2: #271a49;
  --text: #f2eefc;
  --text-soft: #c6bce0;
  --text-mut: #9186b0;
  --border: #34265c;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.4);
  --ring: rgba(123, 63, 176, 0.6);
  --header-bg: rgba(18, 11, 31, 0.82);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Nunito", "Noto Sans Arabic", "Noto Sans JP", "Noto Sans Devanagari", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .35s ease, color .35s ease;
  min-height: 100vh;
}

/* Decorative aurora background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(50% 40% at 15% 10%, rgba(123, 63, 176, 0.18), transparent 70%),
    radial-gradient(45% 45% at 85% 15%, rgba(21, 159, 181, 0.16), transparent 70%),
    radial-gradient(50% 50% at 80% 90%, rgba(217, 165, 33, 0.12), transparent 70%);
  pointer-events: none;
}

h1, h2, h3, h4, .brand-name, .game-title, .hero-title {
  font-family: "Poppins", "Noto Sans Arabic", "Noto Sans JP", "Noto Sans Devanagari", system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

a { color: var(--brand-purple-2); text-decoration: none; }
[data-theme="dark"] a { color: #b98ce6; }

img { max-width: 100%; display: block; }

.container {
  width: min(1180px, 95vw);
  margin-inline: auto;
}

/* ---------------- Header / Nav ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}
.brand img { width: 42px; height: 42px; border-radius: 50%; box-shadow: var(--shadow-sm); }
.brand-name {
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1;
  background: linear-gradient(120deg, #2fa84f 0%, #e0b400 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: .5px;
}
.nav-spacer { flex: 1; }

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-links a {
  color: var(--text-soft);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: .95rem;
  transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }

/* Icon buttons */
.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 42px; height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 1.1rem;
  transition: transform .15s, background .2s, border-color .2s;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--brand-purple-2); }

/* Theme toggle (stylish pill) */
.theme-toggle {
  position: relative;
  width: 66px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(120deg, #bfe3ff, #ffe9a8);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  flex: none;
}
[data-theme="dark"] .theme-toggle {
  background: linear-gradient(120deg, #1c1740, #3a2a63);
}
.theme-toggle .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  display: grid; place-items: center;
  font-size: 15px;
  transition: transform .35s cubic-bezier(.68,-0.4,.27,1.4), background .35s;
}
[data-theme="dark"] .theme-toggle .knob {
  transform: translateX(32px);
  background: #2b1d52;
}
html[dir="rtl"] .theme-toggle .knob { left: auto; right: 3px; }
html[dir="rtl"][data-theme="dark"] .theme-toggle .knob { transform: translateX(-32px); }
.theme-toggle .sun { display: block; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

/* Language menu */
.lang-wrap { position: relative; flex: none; }
.lang-btn {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  height: 42px; padding: 0 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: .9rem;
  transition: border-color .2s, transform .15s;
}
.lang-btn:hover { border-color: var(--brand-purple-2); transform: translateY(-2px); }
.lang-btn .chev { font-size: .7rem; opacity: .7; }
.lang-menu {
  position: absolute;
  top: 52px; right: 0;
  min-width: 180px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 200;
}
html[dir="rtl"] .lang-menu { right: auto; left: 0; }
.lang-menu.open { display: block; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.lang-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: var(--text);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: .95rem; font-weight: 600; text-align: start;
}
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button.active { background: var(--grad-brand); color: #fff; }
.lang-menu .flag { font-size: 1.15rem; }

/* Mobile menu toggle */
.menu-toggle { display: none; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 34px 0 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-logo {
  width: 120px; height: 120px; border-radius: 50%;
  margin: 0 auto 22px;
  box-shadow: var(--shadow);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-10px); } }
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  margin: 0 0 14px;
}
.hero-title .accent {
  background: var(--grad-warm);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-soft);
  max-width: 640px; margin: 0 auto 26px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 14px;
  font-weight: 700; font-size: 1rem; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s;
  font-family: inherit;
}
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--brand-purple-2); }

/* Stat strip */
.stats {
  display: flex; gap: 28px; justify-content: center; flex-wrap: wrap;
  margin-top: 34px;
}
.stat { text-align: center; }
.stat b { font-size: 1.7rem; display: block; color: var(--brand-purple-2); font-family: "Poppins", sans-serif; }
[data-theme="dark"] .stat b { color: #c79bef; }
.stat span { color: var(--text-mut); font-size: .9rem; }

/* ---------------- Category sections ---------------- */
.section { padding: 40px 0; }
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.section-head .emoji { font-size: 1.6rem; }
.section-head h2 { font-size: 1.5rem; margin: 0; }
.section-head .count {
  margin-inline-start: auto;
  font-size: .8rem; color: var(--text-mut);
  background: var(--surface-2); padding: 4px 12px; border-radius: 999px; font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

/* Game card */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 18px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 150px;
  color: var(--text);
}
.card::after {
  content: ""; position: absolute; inset: 0;
  background: var(--grad-brand); opacity: 0;
  transition: opacity .2s; z-index: 0;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.card:hover::after { opacity: .07; }
.card > * { position: relative; z-index: 1; }
.card .ico {
  font-size: 2.2rem; width: 58px; height: 58px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-2);
}
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; font-size: .85rem; color: var(--text-mut); }
.badge {
  position: absolute; top: 12px; inset-inline-end: 12px;
  font-size: .68rem; font-weight: 800; letter-spacing: .5px;
  padding: 4px 9px; border-radius: 999px; text-transform: uppercase;
  z-index: 2;
}
.badge.live { background: rgba(63,166,106,.16); color: var(--brand-green); }
.badge.soon { background: rgba(217,165,33,.18); color: #b9860c; }
[data-theme="dark"] .badge.soon { color: var(--brand-gold); }
.card.soon { opacity: .82; }

/* Category grids: 2 rows of 5 on desktop, paginated with Load More */
.cat-grid { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1000px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px)  { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
.cat-more { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.load-more {
  background: linear-gradient(120deg, #3fa66a, #d9a521);
  color: #fff; border: none; border-radius: 999px;
  padding: 11px 24px; font-weight: 800; font-size: .9rem; cursor: pointer;
  font-family: inherit; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .2s;
}
.load-more:hover:not(.disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.load-more.disabled, .load-more[disabled] { opacity: .45; cursor: default; box-shadow: none; }
.cat-count {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 18px; font-weight: 800; font-size: .9rem;
  color: var(--text-soft); background: var(--surface);
}
.cat-count.disabled { opacity: .5; }

/* Filter chips */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.chip {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); padding: 8px 16px; border-radius: 999px;
  cursor: pointer; font-weight: 700; font-size: .88rem; font-family: inherit;
  transition: all .18s;
}
.chip:hover { border-color: var(--brand-purple-2); }
.chip.active { background: var(--grad-brand); color: #fff; border-color: transparent; }

/* ---------------- Footer ---------------- */
.site-footer {
  margin-top: 50px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 40px 0 30px;
}
.footer-grid {
  display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between;
}
.footer-brand { max-width: 320px; }
.footer-brand p { color: var(--text-mut); font-size: .9rem; }
.footer-col h4 { margin: 0 0 12px; font-size: 1rem; }
.footer-col a { display: block; color: var(--text-soft); padding: 4px 0; font-size: .9rem; font-weight: 600; }
.footer-col a:hover { color: var(--brand-purple-2); }
.footer-bottom {
  text-align: center; margin-top: 30px; padding-top: 20px;
  border-top: 1px solid var(--border); color: var(--text-mut); font-size: .85rem;
}

/* ---------------- Game page shell ---------------- */
.game-shell { padding: 34px 0 60px; }
.crumbs { font-size: .9rem; color: var(--text-mut); margin-bottom: 14px; }
.crumbs a { color: var(--text-soft); font-weight: 700; }
.game-header { text-align: center; margin-bottom: 24px; }
.game-header .game-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 8px; }
.game-header .game-desc { color: var(--text-soft); max-width: 560px; margin: 0 auto; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 26px;
  max-width: 720px;
  margin: 0 auto;
}
.panel.wide { max-width: 920px; }
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.stat-row {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 18px;
}
.pill {
  background: var(--surface-2); border-radius: 12px; padding: 10px 18px; text-align: center; min-width: 88px;
}
.pill b { display: block; font-size: 1.4rem; font-family: "Poppins", sans-serif; color: var(--brand-purple-2); }
[data-theme="dark"] .pill b { color: #c79bef; }
.pill span { font-size: .78rem; color: var(--text-mut); text-transform: uppercase; letter-spacing: .5px; }

.select, input.field {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 11px 14px; border-radius: 12px; font-size: 1rem; font-family: inherit;
}
.select:focus, input.field:focus { outline: 2px solid var(--ring); border-color: var(--brand-purple-2); }

.msg { text-align: center; font-weight: 700; min-height: 26px; margin-top: 14px; }
.msg.win { color: var(--brand-green); }
.msg.lose { color: #e05252; }

/* Utility */
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 18px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 820px) {
  .nav-links {
    position: absolute; top: 68px; inset-inline-end: 4vw;
    flex-direction: column; align-items: stretch;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 14px; padding: 8px; box-shadow: var(--shadow);
    min-width: 200px; display: none;
  }
  .nav-links.open { display: flex; }
  .menu-toggle { display: grid; }
  .brand-name { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lang-btn .lang-label { display: none; }
}

/* ============================================================
   ADDITIONS — comet, lang pill, tool extras, ads, footer, scroll-top
   ============================================================ */

/* --- Glowing disappearing comet (hero, top-right) --- */
.comet {
  position: absolute;
  top: 24px; right: 12%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #ffe9a8 55%, #d9a521);
  box-shadow: 0 0 14px 5px rgba(217,165,33,.85), 0 0 34px 10px rgba(21,159,181,.55), 0 0 60px 18px rgba(123,63,176,.35);
  animation: cometFly 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.comet::after {
  content: "";
  position: absolute;
  top: 50%; right: 8px;
  width: 130px; height: 4px;
  transform: translateY(-50%) rotate(26deg);
  transform-origin: right center;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(21,159,181,.65) 55%, #ffe9a8);
  border-radius: 4px;
  filter: blur(1.2px);
}
@keyframes cometFly {
  0%   { transform: translate(90px, 80px) scale(.5); opacity: 0; }
  12%  { opacity: 1; }
  55%  { transform: translate(-60px, -70px) scale(1); opacity: 1; }
  72%  { opacity: 0; }
  100% { transform: translate(-60px, -70px) scale(1); opacity: 0; }
}
html[dir="rtl"] .comet { right: auto; left: 12%; }
html[dir="rtl"] .comet::after { right: auto; left: 8px; transform: translateY(-50%) rotate(-26deg) scaleX(-1); transform-origin: left center; }
@media (prefers-reduced-motion: reduce) { .comet { animation-duration: 12s; } }

/* --- Select-your-language pill --- */
.select-lang-pill {
  background: linear-gradient(120deg, #3fa66a, #d9a521);
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  padding: 9px 15px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  flex: none;
}
@media (max-width: 720px) { .select-lang-pill { display: none; } }

/* --- Back button (green rounded) --- */
.game-play .crumbs { margin-bottom: 12px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(120deg, #3fa66a, #2f9d8a);
  color: #fff !important;
  font-weight: 800; font-size: .85rem;
  padding: 8px 16px; border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .2s;
}
.back-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* --- Compact tool page: About + How-to sit right under the tool --- */
.game-shell { padding: 14px 0 50px; }
.game-shell > .container { width: min(1520px, 98vw); }   /* minimal side padding */
.game-top {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px; align-items: start; max-width: 1460px; margin: 0 auto;
}
.game-play { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.game-rail { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 940px) { .game-top { grid-template-columns: 1fr; } }

/* --- Ad units (AdSense) --- */
.game-rail .adsbygoogle { display: inline-block; margin: 0 auto; }
.game-below .adsbygoogle { display: inline-block; margin: 20px auto 0; }
.ad-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 12px, var(--surface) 12px, var(--surface) 24px);
  border: 2px dashed var(--border); border-radius: 14px; color: var(--text-mut);
}
.ad-slot .ad-tag { font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: .72rem; }
.ad-slot .ad-dim { font-size: .85rem; font-weight: 700; opacity: .7; }
.ad-300 { width: 300px; max-width: 100%; height: 600px; margin: 0 auto; }
.ad-728 { width: 728px; max-width: 100%; height: 90px; margin: 20px auto 0; }

/* About + How to use side by side, directly below the tool */
.tool-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .tool-info { grid-template-columns: 1fr; } }

/* Compact header + panel so the tool sits high on the page */
/* Offset the header so the centered title lines up over the tool box (left column) */
.game-shell .game-header {
  margin-bottom: 10px;
  max-width: 1460px; margin-inline: auto;
  padding-inline-end: 320px; box-sizing: border-box;
}
@media (max-width: 940px) { .game-shell .game-header { padding-inline-end: 0; } }
.game-shell .game-header .game-title { font-size: clamp(1.35rem, 3vw, 1.8rem); margin: 0 0 3px; }
.game-shell .game-header .game-desc { font-size: .86rem; }
/* Uniform tool box: every game panel is the same width & minimum height,
   so About + How to use always sit just below it in view */
.game-play .panel {
  width: 560px; max-width: 100%;
  height: 492px;                 /* identical box on every tool page */
  margin: 0 auto; padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.panel-fit { width: 100%; }      /* content wrapper that auto-scales to fit the box */
/* On phones we let the box grow and the page scroll instead of shrinking games */
@media (max-width: 700px) {
  .game-play .panel { height: auto; min-height: 380px; overflow: visible; }
}
.game-play .tool-info { width: 100%; }

/* Keep individual game boards compact so they fit the uniform panel */
.game-shell .sudoku { width: min(360px, 84vw); }
.game-shell .board2048 { width: min(338px, 84vw); }
.game-shell #cv { width: min(340px, 84vw); height: auto; aspect-ratio: 1; }
.game-shell .mem { width: min(300px, 82vw); }
.game-shell .ms .c { width: 22px; height: 22px; font-size: .7rem; }
.game-shell .c4 { width: min(330px, 84vw); }
.game-shell .slide { width: min(300px, 80vw); }
.game-shell .lo { width: min(300px, 80vw); }
.game-shell .simon { width: min(280px, 78vw); }
.game-shell .wgrid { width: min(210px, 62vw); gap: 6px; }
.game-shell .wcell { font-size: 1.15rem; }
.game-shell .wkeys { max-width: 340px; margin-top: 10px; }
.game-shell .wkeys button { padding: 7px 6px; min-width: 24px; font-size: .78rem; }
.game-shell #wheel { width: min(300px, 80vw); height: auto; aspect-ratio: 1; }

/* --- Info cards (About / How to use) — compact --- */
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.info-card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--brand-purple-2); }
[data-theme="dark"] .info-card h3 { color: #c79bef; }
.info-card p { margin: 0 0 6px; color: var(--text-soft); font-size: .84rem; line-height: 1.55; }
.info-card p.lead { font-weight: 700; color: var(--text); }
.info-card ol { margin: 0; padding-inline-start: 18px; color: var(--text-soft); font-size: .84rem; }
.info-card ol li { margin-bottom: 4px; }

/* --- Share this tool (top of rail, one line) --- */
.share-card {
  padding: 12px 14px; margin: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-sm); text-align: center;
}
.share-card h4 { margin: 0 0 10px; font-size: .76rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-mut); }
.share-icons { display: flex; gap: 10px; justify-content: center; flex-wrap: nowrap; }
.share {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff;
  transition: transform .15s, box-shadow .2s;
}
.share:hover { transform: translateY(-4px) scale(1.05); box-shadow: var(--shadow); }
.share.fb   { background: #4a5cf0; }
.share.x    { background: #000; }
.share.in   { background: #2b62c4; }
.share.wa   { background: #25d366; }
.share.mail { background: #6b7280; }

/* --- Below the fold: trending --- */
.game-below { max-width: 1460px; margin: 1px auto 0; }

/* --- Trending Now (5 in one row, big cards, centered icons, no badge) --- */
.trending { margin-top: 4px; }
.trending .grid { grid-template-columns: repeat(5, 1fr); gap: 18px; }
.trend-card {
  min-height: 158px; padding: 24px 18px;
  align-items: center; justify-content: center; text-align: center; gap: 14px;
}
.trend-card .ico { margin: 0 auto; width: 60px; height: 60px; font-size: 2.3rem; }
.trend-card h3 { font-size: 1.06rem; }
@media (max-width: 620px) {
  .trend-card { min-height: 120px; padding: 16px 8px; gap: 10px; }
  .trend-card .ico { width: 46px; height: 46px; font-size: 1.6rem; }
  .trend-card h3 { font-size: .8rem; }
}

/* --- Slim gradient footer --- */
.site-footer {
  margin-top: 44px;
  border: none;
  background: linear-gradient(90deg, #2b4ba0 0%, #7b3fb0 50%, #e0559c 100%);
  padding: 16px 0;
}
.footer-slim {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px 22px; flex-wrap: wrap;
}
.footer-brand { gap: 6px; }
.footer-brand img { width: 34px; height: 34px; border-radius: 50%; }
.footer-brand .brand-name {
  background: linear-gradient(120deg, #6ee78f 0%, #ffe14d 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  font-size: 1.65rem;
}
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: #fff; font-weight: 700; font-size: .9rem; opacity: .92; }
.footer-links a:hover { opacity: 1; text-decoration: underline; }
.footer-copy { color: rgba(255,255,255,.85); font-size: .85rem; font-weight: 600; }
@media (max-width: 620px) { .footer-slim { justify-content: center; text-align: center; } .footer-links { justify-content: center; gap: 16px; } }

/* --- Scroll to top --- */
.scroll-top {
  position: fixed; bottom: 24px; inset-inline-end: 24px;
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, #3fa66a, #2f9d8a);
  color: #fff; border: none; font-size: 1.5rem; font-weight: 800;
  cursor: pointer; box-shadow: var(--shadow);
  display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .25s, transform .25s, visibility .25s;
  z-index: 300;
}
.scroll-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { transform: translateY(-3px) scale(1.06); }

/* ============================================================
   New puzzle tools — Mahjong, Mastermind, Flow (+ shared bits)
   ============================================================ */

/* Toast */
.fc-toast {
  position: fixed; bottom: 84px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brand-purple); color: #fff;
  padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s; z-index: 400;
}
.fc-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* small controls row */
.toolbar .btn, .toolbar .select { font-size: .85rem; padding: 8px 12px; }
.mini-toggle { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .82rem; color: var(--text-soft); cursor: pointer; }
.mini-toggle input { accent-color: var(--brand-purple-2); width: 16px; height: 16px; }

/* Mini panel: progress / achievements / leaderboard */
.mini-panel { margin-top: 14px; width: 100%; border-top: 1px solid var(--border); padding-top: 12px; }
/* When relocated below the info boxes it becomes a standalone card */
.game-below .mini-panel {
  max-width: 760px; margin: 0 auto 22px; border-top: none; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-sm);
}
.mini-tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.mini-tabs button { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); border-radius: 999px; padding: 5px 13px; font-weight: 700; font-size: .76rem; cursor: pointer; font-family: inherit; }
.mini-tabs button.active { background: var(--grad-brand); color: #fff; border-color: transparent; }
.mini-body { font-size: .85rem; min-height: 40px; }
.mini-pane { display: none; }
.mini-pane.active { display: block; animation: pop .18s ease; }
.stat-line { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.stat-line b { color: var(--brand-purple-2); font-family: "Poppins", sans-serif; }
[data-theme="dark"] .stat-line b { color: #c79bef; }
.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px; }
.achv { text-align: center; opacity: .3; filter: grayscale(1); transition: .2s; }
.achv.got { opacity: 1; filter: none; }
.achv .ic { font-size: 1.7rem; line-height: 1.1; }
.achv .nm { font-size: .6rem; color: var(--text-mut); line-height: 1.15; margin-top: 2px; }
.lb-row { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.lb-row span:first-child { color: var(--text-mut); }
.share-result { margin-top: 12px; }
.btn-share { background: linear-gradient(120deg, #3fa66a, #159fb5); color: #fff; }

/* ---- Mastermind ---- */
.mm-board { display: flex; flex-direction: column; gap: 7px; align-items: center; width: 100%; }
.mm-row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.mm-row.active .mm-peg { box-shadow: 0 0 0 2px var(--ring); }
.mm-pegs { display: flex; gap: 7px; }
.mm-peg { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface-2); cursor: pointer; transition: transform .1s; }
.mm-row.active .mm-peg:hover { transform: scale(1.08); }
.mm-peg.sel { outline: 3px solid var(--brand-purple-2); outline-offset: 2px; }
.mm-fbwrap { width: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.mm-fb { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.mm-fb.black { background: #241533; }
[data-theme="dark"] .mm-fb.black { background: #f2eefc; }
.mm-fb.white { background: #fff; border: 1px solid var(--text-mut); }
.mm-palette { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.mm-palette .mm-peg { width: 36px; height: 36px; }
.mm-num { font-size: .6rem; text-align: center; color: var(--text-mut); }

/* ---- Flow Connect ---- */
.flow-grid { display: grid; gap: 3px; background: var(--border); border: 4px solid var(--brand-purple-2); border-radius: 14px; margin: 0 auto; touch-action: none; width: max-content; padding: 3px; }
.flow-cell { background: var(--surface); position: relative; box-sizing: border-box; }
.flow-dot { position: absolute; inset: 14%; border-radius: 50%; z-index: 2; }
.flow-seg { position: absolute; background: currentColor; z-index: 1; }
.flow-core { position: absolute; inset: 30%; border-radius: 4px; background: currentColor; z-index: 1; }
.flow-cell.done-dot .flow-dot { box-shadow: 0 0 0 3px rgba(255,255,255,.5) inset; }

/* ---- Mahjong ---- */
.mahjong-wrap { width: 100%; overflow: auto; }
.mahjong-board { position: relative; margin: 0 auto; }
.mj-tile {
  position: absolute; border-radius: 6px;
  background: linear-gradient(160deg, #fffdf3, #ece5cf);
  border: 1px solid #bcae86;
  box-shadow: 2px 3px 0 #bcae86, 3px 4px 5px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; overflow: hidden;
}
[data-theme="dark"] .mj-tile { background: linear-gradient(160deg, #efe9d6, #cfc7a9); }
.mj-tile .mj-face { font-size: 20px; line-height: 1; }
.mj-tile.blocked { filter: brightness(.86) saturate(.75); cursor: default; }
.mj-tile.free:hover { transform: translateY(-1px); }
.mj-tile.sel { outline: 3px solid var(--brand-purple-2); outline-offset: -1px; box-shadow: 2px 3px 0 #bcae86, 0 0 12px var(--brand-purple-2); }
.mj-tile.hintpair { animation: mjpulse .7s ease-in-out 3; }
@keyframes mjpulse { 50% { box-shadow: 0 0 0 3px var(--brand-gold), 2px 3px 0 #bcae86; } }

/* ============================================================
   Blog
   ============================================================ */
.blog-hero { text-align: center; padding: 8px 0 6px; }
.blog-hero h1 {
  font-family: "Poppins", sans-serif; font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 6px 0;
}
.blog-hero p { color: var(--text-mut); font-weight: 600; max-width: 640px; margin: 0 auto; }

.blog-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 8px;
}
@media (max-width: 1080px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .blog-grid { grid-template-columns: 1fr; } }

.post-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 18px; text-decoration: none; color: var(--text);
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s; overflow: hidden;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.post-card .thumb {
  height: 96px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; background: var(--grad-brand); color: #fff;
}
.post-card .tag {
  align-self: flex-start; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--brand-purple-2);
}
.post-card h3 { margin: 0; font-size: 1.02rem; line-height: 1.35; }
.post-card p { margin: 0; font-size: .85rem; color: var(--text-mut); line-height: 1.5; flex: 1; }
.post-card .meta { font-size: .74rem; color: var(--text-soft); font-weight: 700; }
.post-card .rm { font-weight: 800; color: var(--brand-green); font-size: .82rem; }

.blog-more { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 26px; }

/* --- Article --- */
.article { max-width: 760px; margin: 0 auto; padding: 6px 0 20px; }
.article .post-tag {
  display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--brand-purple-2);
}
.article h1 {
  font-family: "Poppins", sans-serif; font-weight: 800; line-height: 1.2;
  font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 12px 0 8px;
}
.article .byline { color: var(--text-soft); font-weight: 700; font-size: .88rem; margin-bottom: 18px; }
.article .lead { font-size: 1.12rem; line-height: 1.7; color: var(--text); font-weight: 600; }
.article p { line-height: 1.8; margin: 14px 0; color: var(--text); }
.article h2 {
  font-family: "Poppins", sans-serif; font-weight: 800; font-size: 1.5rem;
  margin: 34px 0 10px; padding-top: 6px;
}
.article h3 { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 1.15rem; margin: 22px 0 6px; }
.article ul, .article ol { margin: 12px 0 12px 4px; padding-left: 22px; line-height: 1.8; }
.article li { margin: 6px 0; }
.article a { color: var(--brand-green); font-weight: 700; }
.article blockquote {
  margin: 20px 0; padding: 14px 18px; border-left: 4px solid var(--brand-purple-2);
  background: var(--surface-2); border-radius: 0 12px 12px 0; font-style: italic; color: var(--text);
}
.article .takeaways {
  background: var(--surface-2); border-radius: 16px; padding: 18px 20px; margin: 26px 0;
}
.article .takeaways h2 { margin: 0 0 8px; font-size: 1.2rem; }
.article .takeaways ul { margin: 0; }
.article .faq { margin: 26px 0; }
.article .faq details {
  border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; margin: 10px 0; background: var(--surface);
}
.article .faq summary {
  font-weight: 800; cursor: pointer; padding: 10px 0; list-style: none; font-size: 1rem;
}
.article .faq summary::-webkit-details-marker { display: none; }
.article .faq summary::after { content: "+"; float: right; color: var(--brand-purple-2); font-weight: 800; }
.article .faq details[open] summary::after { content: "–"; }
.article .faq details p { margin: 0 0 12px; }
.article .cta {
  text-align: center; background: var(--grad-brand); color: #fff; border-radius: 18px; padding: 26px 22px; margin: 30px 0 10px;
}
.article .cta h2 { margin: 0 0 8px; color: #fff; }
.article .cta p { color: rgba(255,255,255,.92); margin: 0 0 16px; }
.article .cta .btn { background: #fff; color: var(--brand-purple); font-weight: 800; }
.article .inline-tool {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  padding: 2px 10px; border-radius: 999px; font-weight: 700; text-decoration: none; color: var(--brand-purple-2);
}

/* --- Article author bio --- */
.author-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px 18px; margin: 30px 0 6px;
}
.author-card img {
  width: 66px; height: 66px; border-radius: 50%; flex: 0 0 66px;
  border: 3px solid var(--surface); box-shadow: var(--shadow-sm); background: var(--surface);
}
.author-card .who { min-width: 0; }
.author-card .who .nm { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 1.02rem; }
.author-card .who .ro { color: var(--brand-purple-2); font-weight: 700; font-size: .84rem; }
.author-card .who .bio { color: var(--text-mut); font-size: .84rem; line-height: 1.5; margin-top: 4px; }
.byline .author-inline { font-weight: 800; color: var(--text); }
