:root {
  --bg: #f6f7f9;
  --ink: #1d2430;
  --muted: #647184;
  --line: #d9dee8;
  --panel: #ffffff;
  --brand: #126b5f;
  --brand-dark: #0d5148;
  --danger: #a73737;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.site-header {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(260px, 520px) auto;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 7;
}
.brand {
  align-items: center;
  color: var(--brand-dark);
  display: inline-flex;
  font-weight: 800;
  min-height: 64px;
  text-decoration: none;
}
nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-main-nav { justify-content: flex-end; }
.site-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0;
}
.site-search input {
  min-width: 0;
}
.site-search button {
  padding-inline: 16px;
}
.game-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 64px;
  z-index: 6;
}
.game-nav-scroll {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0 auto;
  max-width: 1180px;
  overflow-x: auto;
  padding: 10px 28px;
}
.game-nav a,
.game-nav-dropdown > button {
  background: transparent;
  border-radius: 6px;
  color: #334155;
  font: inherit;
  font-weight: 500;
  padding: 7px 10px;
  white-space: nowrap;
}
.game-nav a:hover,
.game-nav-dropdown:hover > button,
.game-nav-dropdown:focus-within > button {
  background: #e7ecef;
  color: var(--ink);
}
.game-nav-dropdown {
  position: relative;
}
.game-nav-menu {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .14);
  display: none;
  min-width: 190px;
  padding: 8px;
  position: fixed;
  z-index: 50;
}
.game-nav-menu::before {
  content: "";
  height: 8px;
  left: 0;
  position: absolute;
  right: 0;
  top: -8px;
}
.game-nav-dropdown:hover .game-nav-menu,
.game-nav-dropdown:focus-within .game-nav-menu,
.game-nav-menu.is-open {
  display: grid;
}
.game-nav-menu a {
  border-radius: 6px;
}
.inline-form { display: inline; }
button, .button {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
button:hover, .button:hover { background: var(--brand-dark); }
.button.ghost { background: #e7ecef; color: var(--ink); }
button.danger, .button.danger { background: var(--danger); }
button.small, .button.small { padding: 7px 10px; font-size: 13px; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px; }
.hero {
  min-height: 320px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.hero h1 { font-size: clamp(34px, 6vw, 68px); line-height: 1.02; max-width: 900px; margin: 0 0 18px; }
.hero p { max-width: 680px; color: var(--muted); font-size: 18px; }
.home-hero .actions {
  margin-top: 22px;
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 24px 0 16px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.game-card h3 { margin: 12px 12px 4px; font-size: 16px; }
.game-card p { margin: 0 12px 14px; color: var(--muted); font-size: 13px; }
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 24px;
}
.empty-state h2,
.empty-state h3 {
  margin: 0;
}
.empty-state p {
  color: var(--muted);
  margin: 0;
}
.empty-state .button {
  justify-self: start;
  margin-top: 4px;
}
.empty-state.compact {
  padding: 16px;
}
.empty-state.inline {
  background: #f7f9fb;
  margin-top: 12px;
}
.cover {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #1c6f64, #b53e47);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.large { border-radius: 8px; overflow: hidden; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.panel, .auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.auth-panel { max-width: 460px; margin: 50px auto; }
.auth-panel.wide { max-width: 720px; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; }
.field-label {
  font-weight: 700;
}
.form-field {
  display: grid;
  gap: 6px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.checkline, .checkbox-grid label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkline input, .checkbox-grid input { width: auto; }
.translation-fieldset { display: grid; gap: 18px; }
.translation-block { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.translation-block h3 { margin: 0; font-size: 1rem; }
.detail-layout { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 28px; align-items: start; }
.game-watch-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}
.game-watch-layout > * {
  min-width: 0;
}
.game-watch-main {
  min-width: 0;
}
.game-watch-main .player-frame {
  margin-top: 0;
}
.game-watch-info {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 16px;
}
.game-watch-info h1 {
  margin: 6px 0 10px;
}
.game-watch-info p {
  color: #334155;
}
.game-watch-sidebar {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 144px;
}
.sidebar-panel {
  padding: 14px;
}
.section-title.compact {
  align-items: center;
  margin: 0 0 10px;
}
.section-title.compact h2 {
  font-size: 18px;
  margin: 0;
}
.sidebar-game-list {
  display: grid;
  gap: 12px;
}
.sidebar-game-card a {
  align-items: center;
  color: inherit;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px minmax(0, 1fr);
}
.sidebar-game-card .cover {
  aspect-ratio: 4 / 3;
  min-height: auto;
}
.sidebar-game-card h3 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 4px;
}
.sidebar-game-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--brand-dark);
  font-weight: 700;
}
.rating-panel, .comments-panel { margin-top: 16px; }
.game-content { margin-top: 16px; }
.panel > h2:first-child {
  margin-top: 0;
}
.game-content h2,
.game-content h3,
.game-content h4 {
  margin: 22px 0 10px;
}
.game-content p,
.game-content ul {
  color: #334155;
}
.game-content img {
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 14px 0;
  max-height: 520px;
  object-fit: contain;
}
.star-rating-form { display: grid; gap: 8px; }
.star-rating {
  --rating: 0;
  display: inline-flex;
  width: max-content;
  gap: 3px;
  position: relative;
}
.star-button {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #cfd6e2;
  font-size: 34px;
  line-height: 1;
}
.star-button:hover { background: transparent; }
.star-button::before {
  content: "★";
  position: absolute;
  inset: 0;
  width: var(--fill, 0%);
  overflow: hidden;
  color: #f5b301;
}
.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.comment-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.comment-item span {
  color: var(--muted);
  font-size: 13px;
}
.screenshot-section { margin-top: 22px; }
.related-section { margin-top: 24px; }
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.screenshot-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #111827;
}
.screenshot-grid figure { margin: 0; }
.screenshot-grid figcaption { margin-top: 8px; }
.screenshot-admin-list {
  margin-top: 26px;
}
.screenshot-admin-grid figcaption {
  display: grid;
  gap: 8px;
}
.screenshot-admin-grid input[type="number"] {
  max-width: 110px;
}
.eyebrow { text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-size: 12px; font-weight: 800; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.ai-content-panel {
  align-items: center;
  background: #eef6f4;
  border: 1px solid #cfe4df;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 12px;
}
.ai-content-panel .form-note {
  margin: 0;
}
.ai-model-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) auto;
}
.modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, .55);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 40;
}
.modal-backdrop[hidden] {
  display: none;
}
.report-modal {
  max-width: 560px;
  width: min(100%, 560px);
}
.modal-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h2 {
  margin: 0;
}
.player-page {
  min-width: 0;
  width: 100%;
}
.player-page:fullscreen,
.player-page.is-fullscreen {
  background: #000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}
.player-frame {
  aspect-ratio: 16 / 9;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  background: #10151d;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  display: block;
  color: #fff;
  margin: 18px 0 0;
}
.player-frame:fullscreen {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
  margin: 0;
  background: #000;
}
.player-page:fullscreen .player-frame,
.player-page.is-fullscreen .player-frame {
  aspect-ratio: auto;
  border-radius: 0;
  flex: 1 1 auto;
  height: auto;
  margin: 0;
  min-height: 0;
  width: 100%;
}
.player-frame.is-loading::before {
  content: "";
  position: absolute;
}
#nostalgist-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #000;
  z-index: 1;
}
.emulatorjs-host {
  background: #000;
  border-radius: inherit;
  height: 100%;
  inset: 0;
  overflow: hidden;
  position: absolute;
  width: 100%;
  z-index: 2;
}
.emulatorjs-host[hidden] {
  display: none;
}
.emulatorjs-frame {
  border: 0;
  border-radius: inherit;
  display: block;
  height: 100%;
  overflow: hidden;
  width: 100%;
}
.player-engine-emulatorjs .player-frame {
  border-radius: 8px;
  margin-bottom: 18px;
}
.player-engine-emulatorjs:fullscreen .player-frame,
.player-engine-emulatorjs.is-fullscreen .player-frame {
  border-radius: 0;
  margin-bottom: 0;
}
.player-engine-emulatorjs #nostalgist-canvas {
  display: none;
}
.player-frame:not(.is-running) #nostalgist-canvas {
  opacity: 0;
}
.player-frame.is-running {
  background-image: none !important;
}
.player-frame.is-running .player-cover {
  display: none;
}
.player-frame:fullscreen #nostalgist-canvas,
.player-frame.is-fullscreen #nostalgist-canvas,
.player-page:fullscreen #nostalgist-canvas,
.player-page.is-fullscreen #nostalgist-canvas {
  width: 100vw !important;
  height: 100% !important;
}
.player-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  filter: brightness(.58);
  transform: scale(1.01);
}
.player-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(10, 15, 22, .18), rgba(10, 15, 22, .48));
  pointer-events: none;
  z-index: 1;
}
.player-frame.is-running::after {
  display: none;
}
.play-overlay {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 86px;
  height: 86px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(18, 107, 95, .94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  z-index: 4;
}
.play-overlay span {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-left: 5px;
}
.play-overlay.is-hidden { display: none; }
.player-message {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  min-height: 24px;
  color: #fff;
  text-align: center;
  pointer-events: none;
  z-index: 6;
}
.player-message.error { color: #ffb4b4; }
.emulatorjs-turbo-tool {
  background: rgba(5, 7, 11, .84);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 10px 11px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 7;
}
.emulatorjs-turbo-tool:hover,
.emulatorjs-turbo-tool:focus-visible {
  background: rgba(18, 107, 95, .96);
}
.player-controlbar {
  align-items: center;
  background: #05070b;
  border-radius: 0 0 8px 8px;
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  min-height: 54px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 10px 12px;
  position: relative;
  scrollbar-width: thin;
}
.player-page:fullscreen .player-controlbar,
.player-page.is-fullscreen .player-controlbar {
  border-radius: 0;
  flex: 0 0 auto;
  margin: 0;
}
.player-tool-button {
  align-items: center;
  background: transparent;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 34px;
  padding: 0 8px;
}
.player-tool-button:hover,
.player-tool-button:focus-visible {
  background: rgba(255, 255, 255, .12);
}
.player-tool-button:disabled {
  cursor: not-allowed;
  opacity: .35;
}
.player-tool-spacer {
  flex: 1;
}
.player-slot-menu-wrap {
  position: relative;
}
.player-slot-menu {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  bottom: calc(100% + 8px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .38);
  color: #fff;
  display: grid;
  gap: 8px;
  left: 0;
  min-width: 260px;
  padding: 10px;
  position: absolute;
  z-index: 20;
}
.player-slot-menu[hidden] {
  display: none;
}
.player-slot-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}
.player-slot-note {
  color: #cbd5e1;
  font-size: 13px;
  margin: 0 0 4px;
}
.player-volume-wrap {
  align-items: center;
  display: flex;
  gap: 8px;
  position: relative;
}
.player-volume-slider {
  accent-color: #f7b731;
  opacity: 1;
  width: 104px;
}
.player-modal {
  background: rgba(17, 24, 39, .96);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
  color: #fff;
  left: 50%;
  max-width: min(520px, calc(100% - 36px));
  padding: 18px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 22;
  width: 520px;
}
.player-modal[hidden] {
  display: none;
}
.player-modal-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.player-modal-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}
.player-keymap-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.player-modal-close {
  background: transparent;
  border-radius: 6px;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
}
.player-keymap-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0;
}
.player-keymap-grid label {
  align-items: center;
  color: #dbe4ee;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}
.player-key-bind {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  min-width: 92px;
  padding: 7px 10px;
}
.player-ab-mode {
  border: 0;
  margin: 12px 0 0;
  padding: 0;
}
.player-ab-mode legend {
  color: #fff;
  font-weight: 800;
  margin-bottom: 10px;
}
.player-ab-mode-options {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}
.player-ab-mode-options label {
  color: #dbe4ee;
  cursor: pointer;
  min-width: 0;
  position: relative;
}
.player-ab-mode-options label + label {
  border-left: 1px solid rgba(255, 255, 255, .16);
}
.player-ab-mode-options input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}
.player-ab-mode-options span {
  display: block;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 8px;
  text-align: center;
}
.player-ab-mode-options input:checked + span {
  background: rgba(18, 107, 95, .96);
  color: #fff;
}
.player-ab-mode-options input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: -2px;
}
.player-modal-actions {
  margin-top: 10px;
}
.save-state-panel { margin: 0 0 18px; }
.save-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.save-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}
.save-slot span {
  color: var(--muted);
  font-size: 13px;
}
.loading { color: #fff; padding: 24px; }
.loading.error { color: #ffb4b4; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list span, .chip-list a, .badge { background: #e8eef2; border-radius: 999px; padding: 5px 10px; font-size: 13px; }
.badge.success { background: #dff3e9; color: #15533b; }
.badge.warning { background: #fff3cd; color: #7a4f00; }
.chip-list a:hover { background: #d9e3e9; }
.filter-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}
.filter-actions {
  display: flex;
  gap: 8px;
}
.admin-filter-bar {
  grid-template-columns: 1.2fr .85fr .85fr .9fr .85fr auto;
}
.comments-filter-bar {
  grid-template-columns: minmax(260px, 1fr) 220px auto;
}
.reports-filter-bar {
  grid-template-columns: minmax(260px, 1fr) 220px auto;
}
.users-filter-bar {
  grid-template-columns: minmax(240px, 1fr) 160px 160px 180px auto;
}
.logs-filter-bar {
  grid-template-columns: minmax(260px, 1fr) 180px 220px auto;
}
.taxonomy-filter-bar {
  grid-template-columns: minmax(220px, 1fr) 180px auto;
}
.console-filter-bar {
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
}
.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}
.pagination span {
  align-self: center;
  color: var(--muted);
  font-weight: 700;
}
.account-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.account-nav a {
  background: #e8eef2;
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 700;
}
.account-nav a:hover {
  background: #d9e3e9;
}
.save-state-game {
  display: flex;
  align-items: center;
  gap: 12px;
}
.save-state-cover {
  width: 72px;
  aspect-ratio: 4 / 3;
  flex: 0 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #1c6f64, #b53e47);
}
.save-state-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.taxonomy-header {
  margin: 14px 0 18px;
}
.taxonomy-header h1 {
  margin: 0 0 8px;
  font-size: 36px;
}
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.success { background: #dff3e9; color: #15533b; }
.alert.error { background: #ffe2e2; color: var(--danger); }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #eef2f5; }
.status-form { display: grid; grid-template-columns: 130px minmax(180px, 1fr) auto; gap: 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row-actions form { display: inline; }
.form-note { color: var(--muted); margin: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stats-grid h2 { font-size: 40px; margin: 0; }
.stats-grid > div { background: #f7f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.stats-grid > div strong { display: block; font-size: 28px; margin-bottom: 4px; }
.stats-grid > div span { color: var(--muted); font-weight: 700; }
.ai-job-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.ai-job-progress { height: 12px; background: #e8eef2; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.ai-job-progress span { display: block; height: 100%; background: var(--primary); transition: width .2s ease; }
.ai-job-errors { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.ai-job-errors ul { margin: 8px 0 0; padding-left: 18px; }
.dashboard-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.stat-card {
  display: grid;
  gap: 6px;
  color: inherit;
}
.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.stat-card h2 {
  font-size: 34px;
  line-height: 1;
}
.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.stat-card.attention {
  border-color: #f2c46d;
  background: #fff8e8;
}
.quick-actions {
  margin-bottom: 18px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.dashboard-card .section-title {
  margin-top: 0;
}
.compact-list {
  display: grid;
  gap: 8px;
}
.compact-list a,
.compact-list > div {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.compact-list a:first-child,
.compact-list > div:first-child {
  border-top: 0;
  padding-top: 0;
}
.compact-list span {
  color: var(--muted);
  font-size: 13px;
}
.compact-list a:hover strong {
  color: var(--brand-dark);
}
.search-form { display: flex; gap: 8px; min-width: min(100%, 420px); }
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}
.admin-sidebar {
  background: #1d2327;
  color: #c3c4c7;
  height: 100vh;
  overflow-y: auto;
  padding: 10px 0;
  position: sticky;
  top: 0;
}
.admin-sidebar-head {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 0 10px 10px 14px;
}
.admin-brand {
  align-items: center;
  color: #fff;
  display: flex;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  min-height: 32px;
  min-width: 0;
  padding: 0;
}
.admin-sidebar-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  height: 32px;
}
.admin-icon-form {
  align-items: center;
  display: flex;
  height: 30px;
  margin: 0;
}
.admin-icon-button {
  align-items: center;
  background: #2c3338;
  border: 0;
  border-radius: 4px;
  color: #c3c4c7;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}
.admin-icon-button:hover {
  background: #2271b1;
  color: #fff;
}
.admin-icon-button svg {
  display: block;
  fill: currentColor;
  height: 16px;
  width: 16px;
}
.admin-nav {
  display: grid;
  gap: 0;
}
.admin-nav-group {
  display: grid;
  gap: 0;
  padding: 2px 0 5px;
}
.admin-nav-group > span {
  color: #9aa0a6;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.2;
  padding: 7px 12px 4px;
  text-transform: uppercase;
}
.admin-nav a {
  display: block;
  margin: 0;
  padding: 6px 10px 6px 20px;
  border-left: 3px solid transparent;
  color: #f0f0f1;
  font-size: 14.5px;
  line-height: 1.35;
  min-height: 31px;
}
.admin-nav a:hover {
  background: #2c3338;
  border-left-color: #72aee6;
  color: #72aee6;
}
.admin-main {
  min-width: 0;
  padding: 24px;
}
.admin-main > .section-title:first-child,
.admin-main > .panel:first-child,
.admin-main > .auth-panel:first-child {
  margin-top: 0;
}
.admin-form-panel {
  max-width: none;
  width: 100%;
}
.EasyMDEContainer {
  font-weight: 400;
}
.EasyMDEContainer .CodeMirror {
  border-color: var(--line);
  border-radius: 0 0 6px 6px;
}
.editor-toolbar {
  border-color: var(--line);
  border-radius: 6px 6px 0 0;
}
.editor-toolbar button,
.editor-toolbar a {
  background: transparent;
  border: 0;
  color: #263241 !important;
  display: inline-block;
  font-weight: 400;
  height: 30px;
  line-height: 30px;
  padding: 0;
  text-align: center;
  width: 30px;
}
.editor-toolbar button:hover,
.editor-toolbar a:hover,
.editor-toolbar button.active,
.editor-toolbar a.active {
  background: #e7ecef;
  border-color: transparent;
  color: #111827 !important;
}
.editor-toolbar i.separator {
  border-left: 1px solid var(--line);
  border-right: 0;
  color: transparent;
  margin: 0 6px;
}
.editor-upload-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2px 0 4px;
}
.editor-upload-button {
  cursor: pointer;
  font-weight: 700;
  margin: 0;
  padding: 7px 10px;
}
.editor-image-input {
  display: none;
}
.ai-status-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}
.ai-status-box.is-ok {
  background: #f2fbf6;
  border-color: #b7e4c7;
}
.ai-status-box.is-bad {
  background: #fff7f7;
  border-color: #f3b6b6;
}
.ai-status-box span,
.ai-status-box p {
  color: var(--muted);
  margin: 0;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.settings-tabs,
.settings-actions {
  grid-column: 1 / -1;
}
.settings-tabs {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}
.settings-tabs button {
  background: #e7ecef;
  color: var(--ink);
}
.settings-tabs button.is-active {
  background: var(--brand);
  color: #fff;
}
.status-form.compact {
  grid-template-columns: minmax(130px, 1fr) auto;
}
.system-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.post-install-panel {
  margin-bottom: 18px;
}
.post-install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.post-install-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.post-install-item h3 {
  font-size: 16px;
  margin: 10px 0 6px;
}
.post-install-item p {
  color: var(--muted);
  margin: 0;
}
.post-install-item a {
  display: inline-block;
  font-weight: 800;
  margin-top: 10px;
}
.post-install-item.is-ok {
  background: #f2fbf6;
}
.post-install-item.is-bad {
  background: #fff7f7;
}
.release-status {
  margin-bottom: 18px;
}
.release-status.is-ready {
  border-color: #bfe7ce;
}
.release-status.is-not-ready {
  border-color: #f2c4c4;
}
.release-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.release-status-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.release-status-grid h3 {
  font-size: 16px;
  margin: 10px 0 6px;
}
.release-status-grid strong {
  display: block;
  margin-bottom: 6px;
}
.release-status-grid p {
  color: var(--muted);
  margin: 0;
}
.release-status-grid article.is-ok {
  background: #f2fbf6;
  border-color: #bfe7ce;
}
.release-status-grid article.is-bad {
  background: #fff7f7;
  border-color: #f2c4c4;
}
.system-quick-tests {
  margin-bottom: 18px;
}
.quick-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.quick-test-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.quick-test-item h3 {
  font-size: 16px;
  margin: 10px 0 6px;
}
.quick-test-item strong {
  display: block;
  margin-bottom: 6px;
}
.quick-test-item p {
  color: var(--muted);
  margin: 0;
}
.quick-test-item.is-ok {
  border-color: #bfe7ce;
  background: #f2fbf6;
}
.quick-test-item.is-bad {
  border-color: #f2c4c4;
  background: #fff7f7;
}
.error-page {
  margin: 60px auto;
  max-width: 720px;
}
.error-page h1 {
  margin-top: 4px;
}
.error-search {
  margin: 22px 0 0;
  max-width: 520px;
}
.system-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.system-check h2 {
  margin: 0;
  font-size: 17px;
}
.system-check.is-ok .badge {
  background: #dff3e9;
  color: #15533b;
}
.system-check.is-bad .badge {
  background: #ffe2e2;
  color: #9b2525;
}
.system-help {
  margin-top: 18px;
}
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.realtime-import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.import-drop-zone {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  transition: border-color .15s ease, background .15s ease;
}
.import-drop-zone input {
  margin-top: 8px;
}
.import-drop-zone span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 400;
  margin-top: 8px;
}
.import-drop-zone.is-dragover {
  background: #eef8f5;
  border-color: var(--primary);
}
.bulk-match-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.bulk-match-summary div {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.bulk-match-summary strong {
  display: block;
  font-size: 22px;
}
.bulk-match-summary span {
  color: var(--muted);
  font-size: 13px;
}
.bulk-progress {
  margin: 16px 0;
}
.bulk-progress-bar {
  background: #e8eef3;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.bulk-progress-bar span {
  background: var(--primary);
  display: block;
  height: 100%;
  transition: width .2s ease;
  width: 0;
}
.bulk-progress-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
}
.bulk-progress-meta span {
  color: var(--muted);
}
.bulk-log {
  background: #0f1720;
  border-radius: 8px;
  color: #e8eef3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  margin-top: 14px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
}
.bulk-log:empty {
  display: none;
}
.bulk-log-line {
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 6px 0;
}
.bulk-log-line.is-created,
.bulk-log-line.is-updated {
  color: #9ae6b4;
}
.bulk-log-line.is-skipped {
  color: #fbd38d;
}
.bulk-log-line.is-error {
  color: #feb2b2;
}
.legacy-import-panel summary {
  cursor: pointer;
  font-weight: 700;
}
.legacy-import-panel[open] summary {
  margin-bottom: 12px;
}

@media (max-width: 1080px) {
  .game-watch-layout {
    grid-template-columns: 1fr;
  }
  .game-watch-sidebar {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
    position: static;
  }
  .site-main-nav { justify-content: flex-start; }
  .game-nav {
    position: static;
  }
  .game-nav-scroll {
    padding: 10px 18px;
  }
  .section-title { align-items: flex-start; flex-direction: column; }
  .page { padding: 18px; }
  .two-columns, .detail-layout, .game-watch-layout, .stats-grid, .dashboard-stats, .dashboard-grid { grid-template-columns: 1fr; }
  .game-watch-sidebar { position: static; }
  .status-form { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-actions { flex-direction: column; }
  .ai-model-row { grid-template-columns: 1fr; }
  .save-slots { grid-template-columns: 1fr; }
  .player-frame { height: auto; min-height: 0; }
  .player-controlbar {
    gap: 6px;
    min-height: 50px;
    padding: 8px;
  }
  .player-tool-button {
    height: 32px;
    min-width: 32px;
    padding-inline: 7px;
  }
  .player-slot-menu {
    left: 0;
    max-width: calc(100vw - 44px);
    min-width: 230px;
  }
  .player-volume-slider {
    width: 86px;
  }
  .player-modal {
    max-height: calc(100% - 28px);
    overflow: auto;
    padding: 14px;
    width: calc(100% - 28px);
  }
  .player-keymap-grid {
    grid-template-columns: 1fr;
  }
  .game-watch-info,
  .panel {
    padding: 16px;
  }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-main { padding: 18px; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Import realtime: compact two-row layout */
.import-config-row,
.import-file-row {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.import-config-row {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px);
  align-items: start;
}
.import-file-row {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}
.import-config-row label,
.import-file-row label {
  min-width: 0;
}
.import-file-row .import-drop-zone {
  min-height: 118px;
}
.import-drop-zone input[type="file"] {
  max-width: 100%;
}
.compact-checkbox-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
@media (max-width: 1180px) {
  .import-file-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}
@media (max-width: 720px) {
  .import-config-row,
  .import-file-row {
    grid-template-columns: 1fr;
  }
}


.site-brand-mark {
  --logo-icon-size: 22px;
  --logo-image-height: 28px;
  --logo-text-size: 16px;
  --logo-gap: 7px;
  align-items: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: var(--logo-gap);
  line-height: 1;
  min-width: 0;
  vertical-align: middle;
}
.site-brand-icon,
.site-brand-image {
  flex: 0 0 auto;
}
.site-brand-icon {
  align-items: center;
  color: var(--brand);
  display: inline-flex;
  height: var(--logo-icon-size);
  justify-content: center;
  line-height: 0;
  overflow: hidden;
  width: var(--logo-icon-size);
}
.site-brand-icon svg {
  display: block;
  height: 100% !important;
  max-height: 100% !important;
  max-width: 100% !important;
  width: 100% !important;
}
.site-brand-icon svg [fill="currentColor"],
.site-brand-icon svg [stroke="currentColor"] {
  color: currentColor;
}
.site-brand-image {
  display: block;
  height: var(--logo-image-height);
  max-width: 220px;
  object-fit: contain;
  width: auto;
}
.site-brand-text {
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  font-size: var(--logo-text-size);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.logo-settings-box {
  display: grid;
  gap: 12px;
}
.logo-size-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}
.logo-size-grid small {
  color: var(--muted);
  font-weight: 500;
}
@media (max-width: 900px) {
  .logo-size-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}
@media (max-width: 560px) {
  .logo-size-grid {
    grid-template-columns: 1fr;
  }
}
.logo-current-preview {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
}
.logo-current-preview > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.logo-current-preview img {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 46px;
  max-width: 180px;
  object-fit: contain;
  padding: 6px;
}

.site-footer {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  margin-top: 48px;
}
.site-footer-inner {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1280px;
  padding: 24px 28px;
}
.site-footer-brand {
  max-width: 460px;
}
.site-footer-brand p {
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 0;
}
.site-footer-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: flex-end;
  min-height: 32px;
  max-width: 560px;
}
.site-footer-links a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.site-footer-links a:hover {
  color: var(--brand);
}
@media (max-width: 760px) {
  .site-footer-inner {
    display: grid;
    gap: 18px;
  }
  .site-footer-links {
    justify-content: flex-start;
  }
}
