:root {
  --bg: #0f0f0f;
  --panel: #1a1a1c;
  --panel-2: #222226;
  --text: #f0f0f0;
  --muted: #9a9a9a;
  --line: rgba(255, 255, 255, 0.1);
  --green: #00b337;
  --green-d: #008c2a;
  --green-soft: rgba(0, 179, 55, 0.18);
  --green-line: rgba(0, 179, 55, 0.55);
  --warn: #e6b84d;
  --danger: #e05a5a;
  --radius: 10px;
  --control-h: 2rem;
  --block-gap: 1.25rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
}

img { max-width: 100%; height: auto; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: #1f1f1f;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar__brand img {
  display: block;
  width: 140px;
  height: auto;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar__nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.topbar__nav a[aria-current="page"],
.topbar__nav a:hover { color: var(--green); }

.topbar-go-ad-free {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border: 1px solid rgba(0, 179, 55, 0.5);
  border-radius: 999px;
  color: var(--green);
  font-size: 0.72rem;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-go-ad-free:hover {
  color: var(--green);
  background: var(--green-soft);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.hero { margin-bottom: 1.25rem; }

.hero__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.hero__sub {
  margin: 0;
  color: #d4d4d4;
  max-width: 46rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: var(--block-gap);
}

.panel h2,
.filter-section h2,
.filters-panel__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel h3,
.filter-section h3,
.target-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #c8c8c8;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.section-head h2 { margin: 0; }

.hint, .status, .freshness {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0.35rem 0;
}

.game-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.game-tile {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.35rem;
  height: 100%;
  padding: 0.7rem 0.7rem 0.7rem 0.55rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: inherit;
  border-radius: 8px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.game-tile__label {
  display: block;
  white-space: nowrap;
}

.game-tile:hover { border-color: var(--green-line); }

.game-tile.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(0, 179, 55, 0.28);
}

.game-tile.is-active::after {
  content: "";
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  width: 0.42rem;
  height: 0.7rem;
  border-right: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: rotate(40deg);
}

.game-tile:focus-visible,
.chip:focus-within,
.seg__opt:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.filters-panel > summary {
  list-style: none;
}

.filters-panel > summary::-webkit-details-marker { display: none; }

.filters-panel__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.filters-panel__title {
  margin: 0;
}

.filters-panel__chevron {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.2rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.filters-panel[open] > .filters-panel__summary .filters-panel__chevron {
  transform: rotate(45deg);
  margin-top: -0.1rem;
}

.filters-panel__body {
  display: flex;
  flex-direction: column;
  gap: var(--block-gap);
  margin-top: 0.95rem;
}

.filter-section > h2 { margin-bottom: 0.7rem; }

.set-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.set-search { display: block; margin: 0.15rem 0 0.65rem; }

.set-search input {
  width: 100%;
  max-width: 360px;
  height: var(--control-h);
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #111;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-list--sets {
  max-height: 16rem;
  overflow: auto;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.chip-list--sets:empty { display: none; }

.chip,
.seg__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0.28rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip input,
.seg__opt input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip:hover,
.seg__opt:hover { border-color: rgba(255, 255, 255, 0.22); }

.chip.is-on,
.chip:has(input:checked),
.seg__opt:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  color: #fff;
}

.chip.is-hidden { display: none; }

.filter-block { margin: 0.85rem 0 0; }
.filter-block:first-of-type { margin-top: 0; }

.filter-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.filter-block__head h3 { margin: 0; }

.period-bar {
  display: flex;
  padding: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.period-seg {
  flex: 1;
  flex-wrap: wrap;
}

.target-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.target-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem 0.85rem;
}

.target-card--period { padding-bottom: 0.75rem; }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.custom-num {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.custom-num input {
  width: 8.5rem;
  height: var(--control-h);
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #111;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: inherit;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: #666; }
.btn--ghost { background: transparent; }
.btn--primary {
  background: var(--green-d);
  border-color: var(--green);
}
.btn--primary:hover {
  background: #00a332;
  border-color: var(--green);
}
.btn--link {
  background: none;
  border: none;
  color: var(--green);
  padding: 0;
  text-decoration: underline;
}

.results-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.65rem;
  row-gap: 0.15rem;
  margin: 0.1rem 0 0.55rem;
}

.results-meta .status,
.results-meta .freshness {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.results-meta .freshness:not(:empty)::before {
  content: "·";
  margin-right: 0.65rem;
  color: #6a6a6a;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  margin: 0.65rem 0 0.85rem;
}

.action-bar__primary,
.action-bar__secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.action-bar__secondary .btn {
  background: transparent;
  color: #c8c8c8;
  font-weight: 500;
}

.toast {
  color: var(--green);
  font-size: 0.88rem;
}

.sticky-ref {
  display: none;
}

.results { display: flex; flex-direction: column; gap: 0.45rem; }

.result {
  display: grid;
  grid-template-columns: 1.2rem 52px minmax(0, 1fr) 5.75rem 5.35rem;
  gap: 0.7rem 0.75rem;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.result__check {
  accent-color: var(--green);
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  justify-self: center;
}

.result__img {
  width: 52px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
}

.result__body { min-width: 0; }
.result__name { font-weight: 700; }
.result__meta { color: var(--muted); font-size: 0.8rem; }

.result__nums { display: contents; }

.result__price,
.result__daily {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.result__price { font-weight: 700; }
.result__daily { color: #cfcfcf; font-size: 0.82rem; }

.empty {
  padding: 1.25rem 0.25rem;
  color: var(--muted);
}

.page-ad {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2.5rem;
}

.noscript { padding: 2rem; text-align: center; }

.print-root { display: none; }

@media (min-width: 800px) {
  .target-grid { grid-template-columns: 1fr 1fr; }
  .filters-panel > summary { pointer-events: none; }
  .filters-panel__chevron { display: none; }
}

@media (max-width: 799px) {
  .sticky-ref {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    position: sticky;
    top: 64px;
    z-index: 30;
    background: #141416;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.45rem;
    margin-bottom: 0.7rem;
  }

  .sticky-ref[hidden] { display: none !important; }

  .sticky-ref__chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .game-tile {
    font-size: 0.8rem;
    padding: 0.65rem 0.55rem;
  }
}

@media (max-width: 720px) {
  .game-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .result {
    grid-template-columns: 1.15rem 48px minmax(0, 1fr);
    grid-template-areas:
      "check thumb body"
      ".     .     nums";
  }
  .result__check { grid-area: check; }
  .result__img { grid-area: thumb; width: 48px; height: 66px; }
  .result__body { grid-area: body; }
  .result__nums {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-area: nums;
    gap: 0.5rem;
  }
  .topbar__nav a:nth-child(3) { display: none; }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .hero, .filters-panel, .panel:not(.results-panel), .action-bar,
  .result-actions, .sticky-ref, .toast, .status, .freshness, .results-meta, .page-ad { display: none !important; }

  .page { max-width: none; padding: 0; }
  .results-panel {
    background: #fff;
    border: 0;
    padding: 0;
  }

  html.print-mode-simple .results,
  html.print-mode-visual .results { display: none !important; }

  .print-root,
  .print-root[hidden] { display: block !important; color: #111; }

  .print-head { margin-bottom: 0.75rem; }
  .print-head h1 { font-size: 16pt; margin: 0 0 0.25rem; }
  .print-meta { font-size: 9pt; color: #333; margin: 0; }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
  }
  .print-table th, .print-table td {
    border-bottom: 1px solid #ccc;
    text-align: left;
    padding: 0.28rem 0.35rem;
  }
  .print-table th:nth-child(3),
  .print-table td:nth-child(3),
  .print-table th:nth-child(4),
  .print-table td:nth-child(4) { text-align: right; }

  .print-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }
  .print-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.5rem;
    break-inside: avoid;
    border: 1px solid #ccc;
    padding: 0.4rem;
  }
  .print-card img {
    width: 72px;
    height: 100px;
    object-fit: cover;
  }
  .print-card strong { display: block; }
}
