:root {
  --bg: #141821;
  --bg-2: #1c2230;
  --ink: #f4efe4;
  --muted: #b7b0a3;
  --line: rgba(244, 239, 228, 0.12);
  --gold: #d7b56d;
  --gold-2: #f0d9a0;
  --danger: #e07a5f;
  --ok: #7dcea0;
  --pad: 16px;
  --radius: 16px;
  --tap: 48px;
  font-family: "PingFang HK", "Noto Sans TC", "Hiragino Sans CNS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(215, 181, 109, 0.14), transparent 50%),
    radial-gradient(800px 400px at 110% 0%, rgba(80, 110, 180, 0.18), transparent 45%),
    var(--bg);
  color: var(--ink);
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

.top {
  padding: 20px var(--pad) 8px;
  max-width: 920px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #1a1408;
  background: linear-gradient(160deg, var(--gold-2), var(--gold) 55%, #9a7436);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  text-decoration: none;
}
.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.top-nav a {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
}
.top-nav a[aria-current="page"] {
  border-color: rgba(215, 181, 109, 0.55);
  color: var(--gold-2);
}
.kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
h1 {
  margin: 2px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}
.sub, .hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.sub { margin: 10px 0 0; max-width: 40rem; }

.banner {
  max-width: 920px;
  margin: 12px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(224, 122, 95, 0.45);
  background: rgba(224, 122, 95, 0.12);
  color: #ffd4c8;
  border-radius: 12px;
  width: calc(100% - 2 * var(--pad));
  font-size: 0.92rem;
}
.banner a { color: var(--gold-2); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px var(--pad) 40px;
  display: grid;
  gap: 16px;
}

.stage, .sheet {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.preview {
  position: relative;
  min-height: 220px;
  border-radius: 12px;
  overflow: hidden;
  background: #0e121a;
  border: 1px dashed rgba(215, 181, 109, 0.28);
  display: grid;
  place-items: center;
}
.preview img {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  background: #0e121a;
}
.placeholder {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}
.placeholder strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #262d3d;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.btn.primary {
  background: #2b3346;
  border-color: rgba(215, 181, 109, 0.35);
}
.btn.go {
  margin-top: 10px;
  background: linear-gradient(180deg, #e8c888, var(--gold));
  color: #1a1408;
  border: 0;
}
.btn.go:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
h2 { margin: 0; font-size: 1.05rem; }
.pill {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(125, 206, 160, 0.15);
  color: var(--ok);
  white-space: nowrap;
}

form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 0;
}
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #10151f;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 8px 16px 24px;
}

@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
  h1 { font-size: 1.18rem; }
}

@media (min-width: 800px) {
  .wrap {
    grid-template-columns: minmax(280px, 0.95fr) 1.05fr;
    align-items: start;
  }
  .catalog-wrap {
    grid-template-columns: 1fr;
  }
}

.catalog-wrap {
  max-width: 1080px;
}
.catalog-filters form {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
.catalog-search {
  margin-top: 0;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.stat-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #10151f;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stat-chip strong {
  font-size: 0.88rem;
}
.stat-chip span {
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.stat-chip.is-on {
  border-color: rgba(215, 181, 109, 0.55);
  background: #1a2230;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.card-tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-width: 0;
}
.card-art {
  aspect-ratio: 63 / 88;
  background: #0e121a;
  display: grid;
  place-items: center;
}
.card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-ph {
  color: var(--muted);
  font-size: 0.82rem;
}
.card-body {
  padding: 10px 10px 12px;
}
.card-game {
  margin: 0;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.card-body h3 {
  margin: 4px 0 0;
  font-size: 0.92rem;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.card-id, .card-langs {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.pager .btn {
  width: auto;
  min-width: 96px;
}

@media (min-width: 640px) {
  .catalog-filters form {
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }
  .catalog-q {
    grid-column: 1 / -1;
  }
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .catalog-filters form {
    grid-template-columns: 160px 140px 1fr auto;
  }
  .catalog-q { grid-column: auto; }
}
