/* ===================== Tokens ===================== */
:root {
  --bg: #FBFBFC;
  --surface: #FFFFFF;
  --surface-2: #F2F2F5;
  --text: #14141A;
  --text-2: #62626E;
  --muted: #9A9AA6;
  --link-muted: #55555F;
  --body: #3D3D47;
  --border: #ECECF0;
  --border-strong: #E4E4EA;
  --divider: #F0F0F3;
  --ad-border: #D8D8E0;
  --ad-stripe: #F5F5F8;
  --accent: #4F3EE0;
  --accent-ring: rgba(79, 62, 224, .12);
  --accent-soft: #F0EEFD;
  --deal: #11833F;
  --deal-soft: #E8F6EE;
  --danger: #C8323C;
  --shadow: 0 1px 2px rgba(20, 20, 26, .04), 0 8px 24px rgba(20, 20, 26, .05);
  --shadow-focus: 0 0 0 4px var(--accent-ring), 0 8px 24px rgba(20, 20, 26, .06);
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E12;
    --surface: #16161C;
    --surface-2: #202028;
    --text: #EDEDF2;
    --text-2: #A3A3AE;
    --muted: #74747F;
    --link-muted: #B4B4BE;
    --body: #C4C4CD;
    --border: #26262E;
    --border-strong: #30303A;
    --divider: #24242C;
    --ad-border: #3A3A45;
    --ad-stripe: #16161C;
    --accent: #8C7FFF;
    --accent-ring: rgba(140, 127, 255, .2);
    --accent-soft: #1F1C3A;
    --deal: #3CC673;
    --deal-soft: #13281C;
    --danger: #FF6B74;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-focus: 0 0 0 4px var(--accent-ring), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--text); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h2 { font-size: 32px; line-height: 1.15; letter-spacing: -.025em; margin-bottom: 40px; }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
::placeholder { color: var(--muted); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--text); color: var(--bg); font: 500 14px/1 var(--font);
  text-decoration: none; transition: background .2s, color .2s;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }

/* ===================== Header ===================== */
.header-row { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.logo:hover { color: var(--text); }
.logo svg { width: 26px; height: 26px; }
.nav { display: flex; gap: 28px; }
.nav a { color: var(--link-muted); font-size: 14px; }
.nav a:hover { color: var(--text); }

/* ===================== Hero / tool ===================== */
.hero { padding: 88px 0 0; }
.hero h1 {
  text-align: center; font-weight: 600; letter-spacing: -.035em; line-height: 1.04;
  font-size: clamp(36px, 6vw, 60px); max-width: 672px; margin: 0 auto; text-wrap: balance;
}
.sub { text-align: center; color: var(--text-2); max-width: 460px; margin: 20px auto 0; font-size: 17px; line-height: 1.5; text-wrap: pretty; }

.tool-card { max-width: 672px; margin: 40px auto 0; padding-bottom: 72px; }
.tool-card[data-state="results"], .tool-card[data-state="searching"], .tool-card[data-state="error"] { max-width: 860px; }

.search { position: relative; max-width: 672px; margin: 0 auto; }
.search-pill {
  display: flex; align-items: center; gap: 6px; height: 64px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow); padding: 0 8px 0 22px; transition: border-color .2s, box-shadow .2s;
}
.search-pill:focus-within { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.search-ico { color: var(--muted); flex: none; width: 18px; height: 18px; }
.search-pill input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font: 400 17px var(--font); padding: 0 8px;
}
.search-pill input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.clear-btn {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font: 400 20px/1 var(--font); cursor: pointer; transition: background .15s, color .15s;
}
.clear-btn:hover { background: var(--surface-2); color: var(--text); }
.clear-btn[hidden] { display: none; }
.search-btn {
  flex: none; height: 48px; padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--text); color: var(--bg); font: 500 15px var(--font); transition: background .2s, color .2s;
}
.search-btn:hover { background: var(--accent); color: #fff; }
.btn-ico { display: none; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20;
  list-style: none; margin: 0; padding: 6px; background: var(--surface); text-align: left;
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.suggest li {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 15px;
}
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-2); }
.suggest img { width: 64px; height: 24px; object-fit: cover; border-radius: 4px; background: var(--surface-2); flex: none; }
.suggest .s-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .s-price { color: var(--deal); font: 500 13px var(--mono); }

.popular { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; margin-top: 22px; font-size: 14px; }
.popular > span { color: var(--muted); }
.chips { display: contents; }
.chip { color: var(--link-muted); }
.chip:hover { color: var(--accent); }

.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 56px 0 0; font-size: 13px; color: var(--muted); }
.notice { text-align: center; background: var(--accent-soft); border-radius: 12px; padding: 12px; margin-top: 16px; font-size: 14px; }

/* ===================== Results & states ===================== */
.results { margin-top: 32px; }
.tool-card[data-state="idle"] .results { margin-top: 0; }
.status { color: var(--text-2); font-size: 14px; margin: 0 4px 12px; }
.status strong { color: var(--text); font-weight: 600; }
.skeleton, .state-msg, .game-list { display: none; }
.tool-card[data-state="searching"] .skeleton { display: block; }
.tool-card[data-state="empty"] .state-empty,
.tool-card[data-state="error"] .state-error { display: block; }
.tool-card[data-state="results"] .game-list { display: block; }

.sk-row {
  height: 70px; border-radius: 16px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--border);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.state-msg {
  max-width: 560px; margin: 44px auto 0; padding: 24px 26px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.state-msg h2 { font-size: 16px; line-height: 1.4; letter-spacing: 0; margin: 0; }
.state-msg p { color: var(--text-2); font-size: 14px; line-height: 1.55; margin: 6px 0 0; text-wrap: pretty; }
.state-msg .btn { margin-top: 16px; }
.state-msg .console-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }

.game-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.game {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  margin-bottom: 8px; overflow: hidden; animation: fadein .25s ease both;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.game-head {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px;
  background: none; border: 0; cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.game-head:hover { background: var(--bg); }
.game-thumb { width: 120px; height: 45px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.game-title { flex: 1; min-width: 0; font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.game-from { color: var(--muted); font-size: 13px; white-space: nowrap; }
.game-from b { color: var(--text); font: 500 15px var(--mono); }
.chev { flex: none; transition: transform .2s; color: var(--muted); }
.game[aria-expanded="true"] .chev { transform: rotate(90deg); }
.game-body { padding: 4px 16px 16px; border-top: 1px solid var(--divider); }
.game-body[hidden] { display: none; }

.highlights { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 14px 0 10px; font-size: 14px; }
.badge-best { background: var(--deal-soft); color: var(--deal); font-weight: 500; padding: 4px 10px; border-radius: 8px; }
.hist { color: var(--text-2); }
.hist b { color: var(--text); font-weight: 500; font-family: var(--mono); }

.deals { width: 100%; border-collapse: collapse; font-size: 15px; }
.deals th { text-align: left; color: var(--muted); font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 8px; }
.deals td { padding: 10px 8px; border-top: 1px solid var(--divider); vertical-align: middle; }
.deals tr.best td { background: color-mix(in srgb, var(--deal-soft) 60%, transparent); }
.store { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.store img, .store .ini { width: 20px; height: 20px; border-radius: 4px; flex: none; }
.store .ini { display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600; }
.price { font: 500 16px var(--mono); }
.was { color: var(--muted); text-decoration: line-through; font-family: var(--mono); font-size: 14px; }
.off { display: inline-block; background: var(--deal-soft); color: var(--deal); font: 500 12px var(--mono); padding: 3px 8px; border-radius: 6px; }
.off.zero { background: var(--surface-2); color: var(--muted); }
.deals .go { text-align: right; }
.deal-btn { padding: 9px 14px; font-size: 14px; white-space: nowrap; }

.console-row { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin-top: 14px; font-size: 14px; font-weight: 500; }
.console-row .lbl { color: var(--muted); font-weight: 400; margin-right: -8px; }

.loading-deals { color: var(--text-2); padding: 12px 0; margin: 0; font-size: 14px; }
.err-deals { color: var(--danger); padding: 12px 0; margin: 0; font-size: 14px; }

/* ===================== Ad slots (placeholders) ===================== */
.gf-zone {
  position: relative; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--ad-border); border-radius: 12px;
  background: repeating-linear-gradient(135deg, var(--ad-stripe) 0 8px, var(--bg) 8px 16px);
  margin: 0 auto; overflow: hidden;
}
.gf-zone-label { font: 400 11px var(--mono); letter-spacing: .08em; color: var(--muted); }
.gf-zone-wide { max-width: 728px; min-height: 90px; margin-bottom: 96px; }
.gf-zone-mid { width: 336px; max-width: 100%; min-height: 280px; margin-top: 96px; }
.gf-zone-box { width: 300px; max-width: 100%; min-height: 250px; margin: 14px auto; }
.gf-zone-small { width: 300px; max-width: 100%; min-height: 100px; margin: 0; }

/* ===================== Sections ===================== */
.section { padding: 0 0 112px; }
.section.alt { background: var(--surface); border-block: 1px solid var(--border); padding: 104px 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px; }
.steps li { border-top: 1px solid var(--text); padding-top: 20px; }
.steps .n { display: block; font: 400 12px var(--mono); color: var(--accent); }
.steps h3 { margin: 14px 0 8px; }
.steps p { color: var(--text-2); margin: 0; font-size: 15px; line-height: 1.6; }

.ideas {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.idea { background: var(--surface); padding: 28px 26px; }
.idea h3 { font-size: 16px; margin: 0 0 8px; }
.idea p { color: var(--text-2); margin: 0; font-size: 14px; line-height: 1.6; }

.prose { max-width: 680px; font-size: 16px; line-height: 1.75; color: var(--body); }
.section .prose { padding-top: 96px; }
.prose h2 { color: var(--text); margin-bottom: 24px; }
.prose h3 { color: var(--text); font-size: 19px; margin: 40px 0 10px; }
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.2em; }

.section.alt .faq { padding-bottom: 16px; }
.faq { max-width: 680px; }
.faq h2 { margin-bottom: 32px; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; cursor: pointer; list-style: none; font-size: 16px; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 20px; font-weight: 400; color: var(--muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: -6px 0 22px; max-width: 600px; color: var(--text-2); font-size: 15px; line-height: 1.65; }

/* ===================== Footer ===================== */
.site-footer { padding: 32px 0 90px; color: var(--muted); font-size: 13px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.footer-row p { margin: 0; }
.footer-row nav { display: flex; gap: 20px; }
.site-footer a { color: var(--link-muted); }
.site-footer a:hover { color: var(--text); }

/* ===================== Pop-up ===================== */
.gf-pop {
  width: min(360px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px 20px 18px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(20, 20, 26, .2);
}
.gf-pop::backdrop { background: rgba(14, 14, 18, .5); }
.gf-pop[open] { animation: pop .18s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.pop-title { font-weight: 600; margin: 0 28px 0 0; color: var(--deal); }
.x {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.x:hover { background: var(--surface-2); color: var(--text); }

/* ===================== Corner toast ===================== */
.gf-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; padding: 12px; padding-top: 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  animation: slidein .25s ease both;
}
.gf-toast[hidden] { display: none; }
.gf-toast .x { top: 4px; right: 4px; width: 26px; height: 26px; font-size: 17px; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===================== Responsive ===================== */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .header-row { padding-top: 16px; padding-bottom: 16px; }
  .nav { gap: 18px; }
  .hero { padding-top: 48px; }
  .sub { font-size: 16px; }
  .tool-card { margin-top: 28px; padding-bottom: 56px; }
  .search-pill { height: 56px; padding-left: 16px; border-radius: 16px; }
  .search-ico { display: none; }
  .search-pill input { padding-left: 2px; font-size: 16px; }
  .search-btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 12px; }
  .btn-txt { display: none; }
  .btn-ico { display: block; }
  .trust { margin-top: 40px; }
  .state-msg { margin-top: 32px; padding: 20px; }
  h2 { font-size: 26px; margin-bottom: 28px; }
  .section { padding-bottom: 80px; }
  .section.alt { padding: 72px 0; }
  .section .prose { padding-top: 72px; }
  .gf-zone-wide { max-width: 320px; min-height: 100px; margin-bottom: 72px; }
  .gf-zone-mid { width: 300px; min-height: 250px; margin-top: 72px; }

  .game-head { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .game-thumb { width: 92px; height: 35px; }
  .game-title { flex-basis: calc(100% - 130px); white-space: normal; font-size: 15px; }
  .game-from { margin-left: 102px; }
  .game-body { padding: 4px 12px 14px; }

  /* deal table → stacked rows */
  .deals thead { display: none; }
  .deals, .deals tbody, .deals tr, .deals td { display: block; }
  .deals tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "store off" "price go"; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--divider); }
  .deals td { border: 0; padding: 0; }
  .deals td.c-store { grid-area: store; }
  .deals td.c-off { grid-area: off; text-align: right; }
  .deals td.c-price { grid-area: price; }
  .deals td.c-price .was { margin-left: 8px; font-size: 13px; }
  .deals td.c-was { display: none; }
  .deals td.go { grid-area: go; }
  .deals tr.best { background: color-mix(in srgb, var(--deal-soft) 60%, transparent); border-radius: 8px; padding-inline: 8px; }
  .deals tr.best td { background: none; }

  .gf-toast { left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; display: flex; justify-content: center; }
  .gf-toast[hidden] { display: none; }
}
@media (min-width: 641px) { .c-price .was { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
