/* ── LIGHT THEME VARIABLES ──────────────────────────────────── */
:root {
  --primary:      #2a6fbd;
  --primary-dk:   #1d5296;
  --err-color:    #d03030;
  --page-bg:      #fdfdfd;
  --card-bg:      #ffffff;
  --header-bg:    #fdfdfd;
  --text:         #1e2e48;
  --muted:        #5878a0;
  --box-bd:       #1e3a6e;
  --border-light: #eaf2fc;
  --ad-bg:        #ddeaf8;
  --ad-border:    #94b4d8;
  --ad-color:     #7898c0;
  --best-bg:      #f4f8ff;
  --best-border:  #dde8f8;
  --label-col:    #90a8c8;
  --bt-row-col:   #4a6a9a;
  --info-text:    #4a6080;
  --sub-heading:  #3a5a90;
  --btn-border:   #cddaee;
  --btn-text:     #3558a0;
  --btn-hover-bg: #f0f6ff;
}

/* ── DARK THEME VARIABLES ───────────────────────────────────── */
[data-theme="dark"] {
  --primary:      #5aa0ff;
  --primary-dk:   #4a8ff0;
  --err-color:    #ff5555;
  --page-bg:      #0f1e30;
  --card-bg:      #162840;
  --header-bg:    #010512;
  --text:         #c8dcf0;
  --muted:        #7090b0;
  --box-bd:       #4a7ec0;
  --border-light: #1e3a5a;
  --ad-bg:        #0d1f35;
  --ad-border:    #2a4a78;
  --ad-color:     #4a7ab0;
  --best-bg:      #0d1f35;
  --best-border:  #1e3a5a;
  --label-col:    #5a7a9a;
  --bt-row-col:   #7090c0;
  --info-text:    #8ab0ce;
  --sub-heading:  #7aacde;
  --btn-border:   #2a4a78;
  --btn-text:     #7ab0e0;
  --btn-hover-bg: #0d1f35;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

/* ── AD SLOTS ───────────────────────────────────────────────── */
.ad-slot {
  background: var(--ad-bg);
  border: 1.5px dashed var(--ad-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ad-color);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; margin: 0 auto; }
.ad-halfbanner  { width: 468px; height: 60px;  max-width: 100%; }
.ad-rectangle   { width: 300px; height: 250px; max-width: 100%; }
.ad-halfpage    { width: 300px; height: 600px; max-width: 100%; }

/* ── HEADER ─────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  box-shadow: 0 2px 14px rgba(42,111,189,.15);
  transition: background .25s;
}

.hdr-nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Logo: image + game name stacked */
.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}

.logo-img {
  height: 82px;
  width: auto;
  display: block;
}

/* CSS-driven logo swap — no JS needed */
.logo-light { display: block; }
.logo-dark  { display: none;  }
[data-theme="dark"] .logo-light { display: none;  }
[data-theme="dark"] .logo-dark  { display: block; }

.logo-game-name {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "Nunito", sans-serif;
}

/* Theme toggle button */
.theme-toggle {
  position:absolute;
  top:10px;
  right:10px;
  width: 34px;
  height: 34px;
  border: 2px solid var(--btn-border);
  border-radius: 50%;
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: border-color .15s, background .25s;
}
.theme-toggle:hover { border-color: var(--primary); }

/* Banner inside header — full 90px height */
.hdr-nav .ad-leaderboard { flex: 1; max-width: 728px; height: 90px; margin: 0; }

/* ── DIFFICULTY BUTTONS ─────────────────────────────────────── */
.diff-group { display: flex; gap: 8px; }

.diff-btn {
  padding: 6px 18px;
  border: 2px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .18s;
}
.diff-btn:hover,
.diff-btn.active { background: var(--primary); color: white; }

/* ── PAGE WRAPPER ───────────────────────────────────────────── */
.page-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 16px 0;
}

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb-sep {
  color: var(--muted);
  margin: 0 2px;
}

.breadcrumb-current {
  color: var(--muted);
  font-weight: 600;
}

/* ── CONTENT ROW ────────────────────────────────────────────── */
.content-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 10px;
  align-items: start;
}

/* ── GAME COLUMN ────────────────────────────────────────────── */
.game-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── GAME CARD ──────────────────────────────────────────────── */
.game-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px 4px;
  box-shadow: 0 3px 20px rgba(42,111,189,.13);
  transition: background .25s;
}

/* ── GAME HEADER ────────────────────────────────────────────── */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.game-header .diff-group { flex-shrink: 0; }
.timer {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--given-col);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* ── PAUSE BUTTON ───────────────────────────────────────────── */
.pause-btn {
  width: 34px;
  height: 34px;
  border: 2px solid var(--btn-border);
  border-radius: 50%;
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: .15s;
}
.pause-btn:hover     { border-color: var(--primary); color: var(--primary); }
.pause-btn.is-paused { background: var(--primary); color: white; border-color: var(--primary); }

/* ── ACTION BUTTONS ─────────────────────────────────────────── */
.act-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border: 2px solid var(--btn-border);
  border-radius: 10px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--btn-text);
  transition: .18s;
  white-space: nowrap;
}
.act-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--btn-hover-bg); }
.act-btn.on    { background: var(--primary); color: white; border-color: var(--primary); }
.act-icon { font-size: 14px; }

/* ── BEST TIMES BOX ─────────────────────────────────────────── */
.best-box {
  background: var(--best-bg);
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--best-border);
  min-width: 140px;
  transition: background .25s;
}
.best-box h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--label-col);
  margin-bottom: 7px;
}
.bt-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  color: var(--bt-row-col);
  border-bottom: 1px solid var(--border-light);
}
.bt-row:last-child { border-bottom: none; }
.bt-val { font-weight: 600; color: var(--primary); }

/* ── BELOW-GAME AD ──────────────────────────────────────────── */
.ad-below-game { display: flex; justify-content: center; }

/* ── RIGHT SIDEBAR ──────────────────────────────────────────── */
.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

/* ── INFO SECTIONS ──────────────────────────────────────────── */
.info-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.info-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(42,111,189,.08);
  transition: background .25s;
}
.info-card h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}
.info-card p {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--info-text);
  margin-bottom: 10px;
}
.info-card p:last-child { margin-bottom: 0; }
.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}
.info-card ul:last-child { margin-bottom: 0; }
.info-card li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--info-text);
  padding-left: 16px;
  position: relative;
}
.info-card li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 10px;
  top: 3px;
}
.info-card .sub-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--sub-heading);
  margin: 10px 0 6px;
}
.info-card .sub-heading:first-child { margin-top: 0; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
  max-width: 1160px;
  margin: 24px auto 0;
  padding: 0 16px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.footer-games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 14px;
  padding: 14px 0;
  margin-bottom: 10px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.footer-games-title {
  font-weight: 700;
  color: var(--muted);
  margin-right: 4px;
}

.footer-games a { color: var(--primary); text-decoration: none; }
.footer-games a:hover { text-decoration: underline; }

/* ── WIN / LOSE OVERLAY ──────────────────────────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,15,45,.7);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 999;
}
#overlay.show { display: flex; }

.win-card {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 44px 56px;
  text-align: center;
  box-shadow: 0 32px 90px rgba(0,0,60,.35);
  animation: pop .42s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}
.win-trophy   { font-size: 64px; line-height: 1.1; }
.win-title    { font-size: 2em; font-weight: 800; color: var(--primary); margin: 8px 0 4px; }
.win-sub      { font-size: 15px; color: var(--muted); }
.win-time     { font-size: 3em; font-weight: 700; color: var(--text); letter-spacing: 3px; margin: 14px 0 6px; }
.win-new-best { font-size: 15px; font-weight: 700; color: #e09010; min-height: 24px; }

.play-again {
  margin-top: 18px;
  padding: 12px 36px;
  border: none;
  border-radius: 30px;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s;
}
.play-again:hover { background: var(--primary-dk); transform: translateY(-1px); }

.challenge-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 28px;
  border: 2px solid var(--primary);
  border-radius: 30px;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s;
}
.challenge-btn:hover { background: var(--primary); color: white; }

.share-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 10px;
  background: var(--best-bg);
  border: 1px solid var(--best-border);
  border-radius: 14px;
}
.share-panel.show { display: flex; }

.share-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.share-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.share-link:hover     { opacity: .82; }
.share-twitter        { background: #000; }
.share-facebook       { background: #1877f2; }
.share-whatsapp       { background: #25d366; }
.share-telegram       { background: #2ca5e0; }

.share-copy-btn {
  padding: 6px 18px;
  border: 1.5px solid var(--btn-border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.share-copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1050px) {
  .content-row { grid-template-columns: 1fr; }
  .right-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    position: static;
  }
}

@media (max-width: 940px) {
  .right-sidebar { display: none; }
}

@media (max-width: 860px) {
  .info-sections { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 580px) {
  .game-header { justify-content: center; gap: 8px; }
  .game-header .diff-group { order: 1; width: 100%; justify-content: center; }
  .info-sections { grid-template-columns: 1fr; }
  .game-card { padding: 12px; }
  .win-card  { padding: 32px 24px; }
  .win-time  { font-size: 2.3em; }
  .hdr-nav .ad-leaderboard { display: none; }
  .ad-halfpage { display: none; }
}
