/* ==========================================================================
   CDKeyCheap — Modern price-comparison template
   Self-contained design system. No external CDNs. Light + dark aware.
   ========================================================================== */

:root {
  /* Brand */
  --brand: #16d17b;          /* deal green */
  --brand-2: #0ea5e9;        /* accent cyan */
  --brand-glow: rgba(22, 209, 123, .35);

  /* Dark surface scale (default) */
  --bg: #0b0f17;
  --bg-2: #0f1522;
  --surface: #131a2a;
  --surface-2: #182135;
  --surface-3: #1e2942;
  --border: #26314b;
  --border-2: #33415f;

  --text: #eef2fb;
  --text-2: #aab4cc;
  --text-3: #6f7c99;

  --danger: #ff5470;
  --warn: #ffb020;
  --gold: #f5b544;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.65);
  --ring: 0 0 0 3px var(--brand-glow);

  --maxw: 1240px;
  --header-h: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #eef2f9;
  --border: #e3e8f2;
  --border-2: #d3dae8;
  --text: #0d1526;
  --text-2: #47536b;
  --text-3: #7a879f;
  --shadow: 0 10px 30px -14px rgba(20,30,60,.22);
  --shadow-lg: 0 24px 60px -20px rgba(20,30,60,.28);
}

/* Reset-ish */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  /* subtle ambient glow */
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(700px 380px at 12% -8%, rgba(22,209,123,.12), transparent 60%),
    radial-gradient(720px 420px at 100% 0%, rgba(14,165,233,.12), transparent 60%);
  pointer-events: none; z-index: 0;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 800; }
p { margin: 0 0 1em; color: var(--text-2); }
::selection { background: var(--brand); color: #04110a; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.muted { color: var(--text-3); }
.accent { color: var(--brand); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  --bh: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--bh); padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: .92rem; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-2); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #0fbf6d);
  color: #04110a; border-color: transparent;
  box-shadow: 0 8px 22px -8px var(--brand-glow);
}
.btn-primary:hover { box-shadow: 0 12px 30px -8px var(--brand-glow); }
.btn-ghost { background: transparent; }
.btn-sm { --bh: 36px; padding: 0 14px; font-size: .85rem; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge-deal { background: rgba(22,209,123,.14); color: var(--brand); border-color: rgba(22,209,123,.3); }
.badge-hot  { background: rgba(255,84,112,.14); color: var(--danger); border-color: rgba(255,84,112,.3); }
.badge-new  { background: rgba(14,165,233,.14); color: var(--brand-2); border-color: rgba(14,165,233,.3); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; letter-spacing: -.03em; flex-shrink: 0; }
.logo-mark { width: 34px; height: 34px; flex-shrink: 0; }
.logo b { color: var(--brand); }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav a {
  padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .92rem;
  transition: color .15s, background .15s;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface-2); }

.header-search { flex: 1; max-width: 420px; margin-left: auto; position: relative; }
.header-search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
}
.header-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.header-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }

.burger { display: none; }

/* Search suggestions dropdown */
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60; display: none;
}
.suggest.open { display: block; }
.suggest a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; }
.suggest a:hover { background: var(--surface-2); }
.suggest img { width: 42px; height: 30px; object-fit: cover; border-radius: 6px; }
.suggest .s-title { font-weight: 600; font-size: .9rem; }
.suggest .s-price { margin-left: auto; color: var(--brand); font-weight: 800; font-size: .9rem; }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 30px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); font-weight: 900; letter-spacing: -.035em; }
.hero h1 .grad { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; max-width: 46ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats { display: flex; gap: 30px; margin-top: 34px; }
.hero-stats .num { font-size: 1.7rem; font-weight: 900; color: var(--text); }
.hero-stats .lbl { font-size: .82rem; color: var(--text-3); }

.hero-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-lg); transform: rotate(.5deg);
}
.hero-card .hc-img { border-radius: 16px; overflow: hidden; aspect-ratio: 16/9; background: var(--surface-3); position: relative; }
.hero-card .hc-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-card .hc-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.hero-card .hc-title { font-weight: 800; font-size: 1.05rem; }
.hero-card .hc-price { text-align: right; }
.hero-card .hc-old { color: var(--text-3); text-decoration: line-through; font-size: .85rem; }
.hero-card .hc-new { color: var(--brand); font-weight: 900; font-size: 1.5rem; }

/* ---------- Section head ---------- */
.section { padding: 40px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin: 0; }
.section-head p { margin: 6px 0 0; font-size: .95rem; }
.section-head .link { color: var(--brand); font-weight: 700; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-weight: 700; font-size: .88rem; transition: all .15s;
}
.chip:hover, .chip.active { color: var(--text); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }

/* ---------- Game grid + cards ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-2); }
.card-media { position: relative; aspect-ratio: 3/4; background: var(--surface-3); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.card-disc {
  position: absolute; top: 10px; right: 10px; background: var(--danger); color: #fff;
  font-weight: 900; font-size: .82rem; padding: 4px 9px; border-radius: 8px; box-shadow: 0 6px 16px -6px rgba(255,84,112,.7);
}
.card-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-plat { display: flex; gap: 6px; align-items: center; font-size: .74rem; color: var(--text-3); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.card-title { font-weight: 700; font-size: .98rem; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.card-price .from { font-size: .72rem; color: var(--text-3); }
.card-price .old { font-size: .8rem; color: var(--text-3); text-decoration: line-through; }
.card-price .new { font-size: 1.25rem; font-weight: 900; color: var(--brand); letter-spacing: -.02em; }
.card-stores { font-size: .72rem; color: var(--text-3); }

/* ---------- Category tiles (home) ---------- */
.cat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
.cat-tile {
  position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/10;
  border: 1px solid var(--border); display: flex; align-items: flex-end; padding: 16px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface-3)); transition: transform .18s, border-color .2s;
}
.cat-tile:hover { transform: translateY(-3px); border-color: var(--brand); }
.cat-tile .emoji { position: absolute; top: 12px; right: 14px; font-size: 2rem; opacity: .9; }
.cat-tile .name { font-weight: 800; font-size: 1.05rem; z-index: 1; }
.cat-tile .cnt { position: absolute; bottom: 16px; right: 16px; font-size: .78rem; color: var(--text-3); }

/* ---------- Trust strip ---------- */
.trust { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.trust .t {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  display: flex; gap: 14px; align-items: center;
}
.trust .t .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); flex-shrink: 0; }
.trust .t h4 { margin: 0 0 2px; font-size: .98rem; }
.trust .t p { margin: 0; font-size: .82rem; }

/* ---------- Product / price comparison page ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: var(--text-3); padding: 18px 0 6px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }

.product { display: grid; grid-template-columns: 340px 1fr; gap: 34px; padding: 12px 0 20px; align-items: start; }
.product-cover { position: sticky; top: calc(var(--header-h) + 16px); }
.product-cover .cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-lg); aspect-ratio: 3/4; background: var(--surface-3); }
.product-cover .cover img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbs { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 10px; }
.product-thumbs img { aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }

.product h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.product-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.stars { color: var(--gold); font-size: 1rem; letter-spacing: 2px; }
.pill { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--text-2); font-weight: 600; }

.bestprice {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 8px 0 22px;
}
.bestprice .bp-l { font-size: .8rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.bestprice .bp-price { font-size: 2.4rem; font-weight: 900; color: var(--brand); letter-spacing: -.03em; line-height: 1; }
.bestprice .bp-old { color: var(--text-3); text-decoration: line-through; font-weight: 600; }
.bestprice .bp-save { color: var(--brand); font-weight: 800; font-size: .9rem; }
.bestprice .spacer { flex: 1; }

/* Offers table */
.offers { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.offers-head, .offer {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.1fr 130px; gap: 12px; align-items: center;
  padding: 14px 18px;
}
.offers-head { background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 800; border-bottom: 1px solid var(--border); }
.offer { border-bottom: 1px solid var(--border); transition: background .15s; }
.offer:last-child { border-bottom: 0; }
.offer:hover { background: var(--surface-2); }
.offer.best { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.offer-store { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.offer-store .slogo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; color: #04110a; font-size: .9rem; flex-shrink: 0; }
.offer-edition { font-size: .84rem; color: var(--text-2); }
.offer-region .pill { font-size: .74rem; }
.offer-price { font-size: 1.3rem; font-weight: 900; color: var(--text); }
.offer-price small { display: block; font-size: .72rem; color: var(--text-3); font-weight: 600; text-decoration: line-through; }
.offer.best .offer-price { color: var(--brand); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 34px 0 20px; }
.tab { padding: 12px 4px; margin-right: 20px; color: var(--text-3); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab.active, .tab:hover { color: var(--text); border-color: var(--brand); }
.prose { max-width: 70ch; }
.prose h3 { margin-top: 1.4em; }
.prose ul { color: var(--text-2); padding-left: 1.1em; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 14px; margin: 8px 0 20px; }
.spec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.spec .k { font-size: .74rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.spec .v { font-weight: 700; margin-top: 2px; }

/* ---------- Filters (category page) ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar .select {
  height: 42px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: .9rem;
}
.toolbar .select:focus { outline: none; border-color: var(--brand); }
.toolbar .count { margin-left: auto; color: var(--text-3); font-size: .9rem; }

/* ---------- Newsletter ---------- */
.cta-band {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, var(--surface)), color-mix(in srgb, var(--brand-2) 14%, var(--surface)));
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; text-align: center;
}
.cta-band h2 { font-size: clamp(1.5rem,3vw,2.2rem); }
.cta-form { display: flex; gap: 10px; max-width: 460px; margin: 18px auto 0; }
.cta-form input { flex: 1; height: 48px; padding: 0 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.cta-form input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 50px; background: var(--bg-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 50px 0 30px; }
.footer-grid h5 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 14px; }
.footer-grid a { display: block; color: var(--text-2); padding: 5px 0; font-size: .92rem; }
.footer-grid a:hover { color: var(--brand); }
.footer-about p { font-size: .92rem; max-width: 34ch; }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--text-3); font-size: .85rem; }
.socials { display: flex; gap: 10px; }
.socials a { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.socials a:hover { color: var(--brand); border-color: var(--brand); }

/* ---------- Mobile nav ---------- */
.mobile-nav {
  position: fixed; inset: 0 0 0 auto; width: min(320px, 84vw); background: var(--surface); z-index: 100;
  transform: translateX(100%); transition: transform .28s ease; border-left: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-lg);
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav a { padding: 12px 14px; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.mobile-nav a:hover { background: var(--surface-2); color: var(--text); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; opacity: 0; visibility: hidden; transition: .25s; }
.overlay.open { opacity: 1; visibility: visible; }

/* ---------- Utility / responsive ---------- */
.hide-sm { }
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-card { max-width: 460px; }
  .product { grid-template-columns: 260px 1fr; gap: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .trust { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav, .hide-sm { display: none; }
  .burger { display: grid; }
  .header-search { max-width: none; }
  .product { grid-template-columns: 1fr; }
  .product-cover { position: static; max-width: 300px; }
  .offers-head { display: none; }
  .offer { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .offer-region, .offer-edition { grid-column: 1; }
  .offer-price { grid-column: 2; grid-row: 1; text-align: right; }
  .offer .btn { grid-column: 2; }
  .hero-stats { gap: 20px; flex-wrap: wrap; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .trust { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .cta-form { flex-direction: column; }
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
