:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --ink: #1f2524;
  --muted: #66706d;
  --line: #d8d3c8;
  --paper: #fffdf8;
  --paper-strong: #ece7dc;
  --teal: #0f766e;
  --blue: #315d92;
  --red: #a43d32;
  --gold: #a46f1c;
  --shadow: 0 18px 50px rgba(41, 34, 22, 0.1);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(30, 42, 39, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(30, 42, 39, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, #f8f6f0 0%, #eef3f0 46%, #f6efe9 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font: inherit;
}

button, select, input {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

button, select {
  min-height: 38px;
}

button, a.primary, .card-actions a {
  border-radius: 7px;
}

button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--paper-strong);
}

.site-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 47%, var(--ink) 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, var(--ink) 47% 53%, transparent 53%),
    #e9bd54;
}

.navline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.navline a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  border-radius: 7px;
  color: var(--muted);
}

.hero, .game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy, .game-hero > div:first-child {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 32px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), transparent 42%),
    linear-gradient(24deg, rgba(164, 61, 50, 0.12), transparent 58%),
    var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  line-height: 1.75;
}

.hero-copy p:last-child, .game-hero p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-metrics, .fact-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hero-metrics div, .fact-panel div {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
}

.hero-metrics strong, .fact-panel strong {
  font-size: 31px;
  line-height: 1;
}

.hero-metrics span, .fact-panel span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px 180px;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
}

.toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar input, .toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 7px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.game-card, .brief-grid article, .detail-grid article, .version-card, .report-panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.game-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  margin-bottom: 0;
}

.score {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  background: rgba(15, 118, 110, 0.1);
  border-radius: 999px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.preview {
  min-height: 110px;
  margin-bottom: 0;
  color: var(--muted);
}

.tag-row, .version-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span, .version-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  border-radius: 999px;
  color: #4f5a57;
  font-size: 12px;
}

.version-strip span {
  background: rgba(49, 93, 146, 0.09);
  color: var(--blue);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions a, a.primary, .version-card button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 750;
}

a.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fffdf8;
}

.brief-grid, .detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brief-grid article, .detail-grid article {
  padding: 18px;
}

.brief-grid p, .detail-grid p {
  color: var(--muted);
}

.version-section {
  margin-bottom: 18px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin-bottom: 0;
}

.section-title > a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 7px;
  color: var(--blue);
  font-weight: 750;
}

.version-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.version-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.version-letter {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: #e9bd54;
  font-size: 25px;
  font-weight: 900;
}

.version-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.version-title span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(164, 111, 28, 0.28);
  background: rgba(164, 111, 28, 0.1);
  border-radius: 999px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 750;
}

.version-card p {
  min-height: 112px;
  color: var(--muted);
}

.report-panel {
  padding: 18px;
}

.report-body {
  max-height: 720px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fffefb;
}

.report-body h1 {
  font-size: 34px;
}

.report-body h2 {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.report-body p, .report-body pre {
  color: #3f4846;
  line-height: 1.8;
  white-space: pre-wrap;
}

.report-body pre {
  padding: 8px 10px;
  border-left: 3px solid var(--teal);
  background: rgba(15, 118, 110, 0.06);
  overflow: auto;
}

.bullet::before {
  content: "• ";
  color: var(--red);
  font-weight: 900;
}

.fade-note, .empty, .not-found p {
  color: var(--muted);
}

.not-found {
  padding: 80px 0;
}

@media (max-width: 980px) {
  .hero, .game-hero, .toolbar, .game-grid, .brief-grid, .detail-grid, .version-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy, .game-hero > div:first-child {
    min-height: 220px;
    padding: 24px;
  }

  .preview, .version-card p {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(100vw - 22px, 1440px);
    padding-top: 12px;
  }

  .masthead, .card-head, .section-title, .version-title {
    align-items: start;
    flex-direction: column;
  }

  .navline {
    width: 100%;
  }

  .navline a {
    flex: 1 1 auto;
    justify-content: center;
  }

  h1 {
    font-size: 42px;
  }

  .version-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .version-letter {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
}

.overview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 4px 0 4px;
}

.overview-head h1 {
  margin-bottom: 0;
  font-size: clamp(38px, 5.4vw, 82px);
  line-height: 0.9;
}

.overview-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
}

.overview-counts span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

main > .toolbar {
  margin-bottom: 10px;
  padding: 8px;
}

main > .toolbar input,
main > .toolbar select {
  min-height: 38px;
}

main > .game-grid {
  gap: 12px;
}

.game-grid > .game-card {
  --card-bg: #fffdf8;
  --card-ink: var(--ink);
  --card-accent: var(--teal);
  --card-soft: rgba(15, 118, 110, 0.1);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 7px 11px;
  min-height: 196px;
  padding: 10px;
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--card-accent), transparent 86%), transparent 50%),
    var(--card-bg);
  border-color: color-mix(in oklch, var(--card-accent), var(--line) 68%);
  box-shadow: none;
}

.game-grid > .game-card::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in oklch, var(--card-accent), transparent 42%);
  opacity: 0.32;
  transform: rotate(14deg);
  pointer-events: none;
}

.card-visual {
  grid-row: 1 / 5;
  position: relative;
  min-height: 156px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--card-accent), var(--ink) 18%);
  background: var(--card-soft);
}

.card-visual::before,
.card-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.card-visual span {
  position: relative;
  z-index: 1;
  color: var(--card-ink);
  font-size: 30px;
  font-weight: 950;
  line-height: 1;
}

.card-main {
  grid-column: 2;
  min-width: 0;
}

.game-card .tag-row,
.game-card .version-strip,
.game-card .card-actions {
  grid-column: 2;
}

.card-main h2 {
  margin-bottom: 0;
  color: var(--card-ink);
  font-size: clamp(19px, 1.8vw, 27px);
  line-height: 1.05;
}

.game-card .preview {
  min-height: 0;
  margin-top: 6px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card .tag-row span,
.game-card .version-strip span {
  min-height: 22px;
  padding: 0 6px;
  font-size: 11px;
}

.game-card .version-strip span {
  background: color-mix(in oklch, var(--card-accent), transparent 88%);
  color: color-mix(in oklch, var(--card-accent), var(--ink) 22%);
}

.game-card .card-actions a {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.game-card a.primary {
  border-color: var(--card-ink);
  background: var(--card-ink);
}

.theme-anime-brotato {
  --card-bg: #fff5ef;
  --card-ink: #2f1d24;
  --card-accent: #d44d57;
  --card-soft: #f8d9c7;
}

.theme-anime-brotato .card-visual {
  background:
    radial-gradient(circle at 62% 28%, #f3b24d 0 10px, transparent 11px),
    repeating-linear-gradient(135deg, rgba(212, 77, 87, 0.22) 0 9px, transparent 9px 18px),
    #f8d9c7;
}

.theme-anime-brotato .card-visual::before {
  inset: 18px 12px;
  border: 2px solid rgba(47, 29, 36, 0.76);
  border-radius: 50%;
}

.theme-anime-brotato .card-visual::after {
  inset: auto 10px 22px 10px;
  height: 19px;
  background: #2f1d24;
  clip-path: polygon(0 65%, 25% 20%, 48% 68%, 72% 8%, 100% 60%, 100% 100%, 0 100%);
}

.theme-territory-match-rogue {
  --card-bg: #f5fbef;
  --card-ink: #1d3328;
  --card-accent: #4b9d64;
  --card-soft: #dcefd4;
}

.theme-territory-match-rogue .card-visual {
  background:
    linear-gradient(90deg, rgba(29, 51, 40, 0.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 51, 40, 0.18) 1px, transparent 1px),
    #dcefd4;
  background-size: 29px 29px;
}

.theme-territory-match-rogue .card-visual::before {
  inset: 20px 12px auto;
  height: 23px;
  background: #4b9d64;
  box-shadow: 0 31px #4f8dc9, 0 62px #d2a23a;
}

.theme-territory-match-rogue .card-visual::after {
  inset: auto 11px 17px;
  height: 15px;
  background: #1d3328;
  opacity: 0.78;
}

.theme-contract-dice {
  --card-bg: #f8f1e3;
  --card-ink: #2d261d;
  --card-accent: #9d7042;
  --card-soft: #ead6b6;
}

.theme-contract-dice .card-visual {
  background:
    linear-gradient(90deg, rgba(45, 38, 29, 0.15) 1px, transparent 1px),
    #ead6b6;
  background-size: 12px 100%;
}

.theme-contract-dice .card-visual::before {
  inset: 20px 13px;
  border: 2px solid rgba(45, 38, 29, 0.75);
  transform: rotate(45deg);
}

.theme-contract-dice .card-visual::after {
  inset: auto 15px 18px auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #b53932;
}

@media (max-width: 980px) {
  .overview-head {
    align-items: start;
    flex-direction: column;
  }

  .overview-counts {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .game-grid > .game-card {
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 190px;
  }

  .card-visual {
    min-height: 150px;
  }

  .card-visual span {
    font-size: 28px;
  }
}
