:root {
  color-scheme: light;
  --ink: #15251f;
  --muted: #64746d;
  --paper: #f5f3ec;
  --card: rgba(255, 255, 252, 0.88);
  --line: #d9ddd6;
  --green: #155f49;
  --green-2: #0d4535;
  --amber: #a45c12;
  --red: #a43838;
  --blue: #2a5d83;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(225, 188, 111, .25), transparent 32rem),
    radial-gradient(circle at 92% 10%, rgba(49, 127, 98, .17), transparent 35rem),
    var(--paper);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
.topbar {
  max-width: 1240px;
  margin: auto;
  padding: 48px 32px 24px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.045em; }
h2 { margin-bottom: 8px; }
.eyebrow { margin-bottom: 9px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.subtitle, .policy { color: var(--muted); }
main { max-width: 1240px; margin: auto; padding: 0 32px 72px; }
.card, .game-card, .catalog-card {
  border: 1px solid rgba(44, 71, 60, .14);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 50px rgba(28, 48, 39, .07);
  backdrop-filter: blur(14px);
}
.loading { max-width: 620px; padding: 28px; display: flex; align-items: center; gap: 18px; }
.loading h2, .loading p { margin-bottom: 4px; }
.loading p { color: var(--muted); }
.loading-dot { width: 18px; height: 18px; flex: 0 0 auto; border: 3px solid #b7cbc3; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { max-width: 780px; padding: 28px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 36px; }
label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 700; }
.login form { display: grid; align-content: start; }
.login form label:not(:first-child) { margin-top: 14px; }
.login-submit { margin-top: 18px; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
}
.workspace-nav { display: inline-flex; gap: 5px; margin-bottom: 28px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.55); }
.nav-button { color: var(--muted); background: transparent; }
.nav-button.active { color: white; background: var(--green); }
button { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 750; }
.primary { color: white; background: var(--green); white-space: nowrap; }
.primary:hover { background: var(--green-2); }
.ghost { border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.6); }
.danger { color: white; background: var(--red); }
.hidden { display: none !important; }
.error { margin: 10px 0 0; color: var(--red); font-size: .86rem; }
.notice { margin-bottom: 24px; border-left: 4px solid var(--green); border-radius: 10px; padding: 14px 16px; background: #e8f1ed; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.catalog-filters { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)) minmax(230px, 2fr) auto; align-items: end; gap: 10px; margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.58); }
.catalog-filters label { margin: 0; }
.catalog-filters label span { display: block; margin-bottom: 7px; color: var(--muted); }
.catalog-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 12px; }
.catalog-summary .version { margin: 0; }
.catalog-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.catalog-card { padding: 0; overflow: hidden; text-align: left; color: var(--ink); background: var(--card); }
.catalog-card:hover { transform: translateY(-2px); box-shadow: 0 20px 45px rgba(28, 48, 39, .12); }
.catalog-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #edf0ed; }
.catalog-card-body { padding: 13px; }
.catalog-card h3 { margin: 0 0 8px; font-size: 1rem; }
.catalog-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.catalog-meta span { padding: 4px 7px; border-radius: 999px; color: var(--muted); background: #eef0ec; font-size: .68rem; }
.catalog-more { display: block; margin: 20px auto 0; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.catalog-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 22px; padding: 24px; color: var(--ink); background: #fbfaf5; box-shadow: 0 24px 80px rgba(0,0,0,.24); }
.catalog-dialog::backdrop { background: rgba(15, 28, 23, .52); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.detail-layout { display: grid; grid-template-columns: 190px 1fr; gap: 22px; }
.detail-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; background: #e8ebe7; }
.detail-images { display: grid; gap: 8px; }
.detail-images a { overflow-wrap: anywhere; font-size: .72rem; }
.detail-section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 8px; font-size: .85rem; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 7px 12px; margin: 0; font-size: .82rem; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.attribute-json { max-height: 310px; overflow: auto; margin: 0; padding: 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; color: #33423c; background: #eef0ec; font: .74rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.game-card { padding: 22px; overflow: hidden; }
.game-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.game-name { font-size: 1.35rem; }
.status { border-radius: 999px; padding: 5px 9px; background: #edf0ed; color: var(--muted); font-size: .72rem; font-weight: 800; }
.status.ready { color: var(--green); background: #dff0e9; }
.status.warning { color: var(--amber); background: #fbecd8; }
.version { margin: 12px 0 17px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); font-size: .75rem; word-break: break-all; }
.section { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.section h4 { margin: 0 0 10px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.counts, .source-list, .diff-list { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { display: inline-flex; gap: 5px; align-items: center; border-radius: 999px; padding: 6px 9px; background: #eef0ec; font-size: .75rem; }
.source-row { margin-bottom: 11px; }
.source-row strong { display: block; margin-bottom: 4px; font-size: .82rem; }
.source-row small { color: var(--muted); }
.active-source { color: var(--green); }
.alternative { color: var(--blue); }
.actions { display: flex; gap: 8px; margin-top: 17px; }
.actions button { flex: 1; }
.candidate { border-radius: 14px; padding: 13px; background: #f2f4f0; }
.candidate-id { color: var(--muted); font-family: ui-monospace, monospace; font-size: .67rem; overflow-wrap: anywhere; }
.issues { margin: 10px 0 0; padding-left: 18px; color: var(--red); font-size: .82rem; }
.warning-box { margin-top: 12px; border: 1px solid #e8c99d; border-radius: 14px; padding: 13px; background: #fff7e9; }
.notice-text { max-height: 160px; overflow: auto; white-space: pre-wrap; color: #5f4c35; font-size: .76rem; line-height: 1.55; }
.candidates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cone { padding: 7px; border: 1px solid #eadfc9; border-radius: 10px; background: white; }
.cone img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; background: #eee; }
.cone span { display: block; min-height: 2.4em; margin: 5px 0; font-size: .7rem; line-height: 1.2; }
.cone button { width: 100%; padding: 7px; font-size: .7rem; color: white; background: var(--amber); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; border-radius: 14px; padding: 14px 17px; color: white; background: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.2); }
@media (max-width: 1100px) {
  .catalog-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catalog-query { grid-column: span 2; }
  .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .game-grid { grid-template-columns: 1fr 1fr; }
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .login, .game-grid { grid-template-columns: 1fr; }
  .workspace-nav { display: flex; }
  .workspace-nav button { flex: 1; }
  .catalog-filters { grid-template-columns: 1fr 1fr; }
  .catalog-query { grid-column: 1 / -1; }
  .catalog-filters button { grid-column: 1 / -1; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
}
