:root {
  --bg: #0f1117;
  --bg-soft: #161922;
  --panel: #1c202b;
  --panel-2: #252a36;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f7fb;
  --muted: #9aa4b2;
  --muted-2: #687386;
  --red: #e31837;
  --green: #35c079;
  --blue: #50a6ff;
  --amber: #f3b64b;
  --danger: #ff5261;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.36);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(227, 24, 55, 0.24), transparent 24rem),
    linear-gradient(180deg, #131721 0%, #0f1117 42%, #10131a 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span:last-child {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav a {
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topnav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

main {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
}

.eyebrow,
.sidebar-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 28px 0 24px;
}

.stats-strip.compact {
  margin-top: 24px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(28, 32, 43, 0.76);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.library-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(22, 25, 34, 0.84);
}

.stage-filter,
.health-filter {
  display: grid;
  gap: 8px;
}

.filter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-button.active,
.filter-button:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.library-toolbar,
.section-heading,
.admin-head,
.editor-head,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.library-toolbar {
  margin-bottom: 18px;
}

h1,
h2,
h3 {
  margin: 0;
}

.library-toolbar h2,
.section-heading h2 {
  font-size: 24px;
}

#resultCount,
.section-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tool-controls {
  display: flex;
  gap: 10px;
  width: min(560px, 100%);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11151d;
  color: var(--text);
  outline: 0;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(80, 166, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(80, 166, 255, 0.12);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.game-card:hover {
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-4px);
}

.card-art {
  min-height: 158px;
  padding: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, #11151d), #11151d 70%),
    var(--panel-2);
  background-position: center;
  background-size: cover;
}

.card-art.has-image {
  min-height: 190px;
}

.card-art span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 18px;
  font-weight: 900;
}

.card-art.has-image span {
  background: rgba(15, 17, 23, 0.58);
  backdrop-filter: blur(10px);
}

.card-body {
  padding: 17px;
}

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

.game-card h3 {
  font-size: 18px;
  line-height: 1.3;
}

.game-card p {
  min-height: 58px;
  margin: 11px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.stage-operational,
.health-good {
  background: rgba(53, 192, 121, 0.14);
  color: var(--green);
}

.stage-beta {
  background: rgba(80, 166, 255, 0.16);
  color: var(--blue);
}

.stage-development,
.health-watch {
  background: rgba(243, 182, 75, 0.16);
  color: var(--amber);
}

.stage-maintenance {
  background: rgba(154, 164, 178, 0.16);
  color: var(--muted);
}

.health-issue {
  background: rgba(255, 82, 97, 0.15);
  color: var(--danger);
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.primary-button,
.ghost-button,
.danger-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
}

.primary-button,
.link-button.primary {
  background: var(--red);
  color: #fff;
}

.ghost-button,
.link-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.danger-button {
  background: rgba(255, 82, 97, 0.14);
  color: var(--danger);
}

.section-heading {
  margin: 34px 0 12px;
}

.ops-list {
  display: grid;
  gap: 8px;
  margin-bottom: 42px;
}

.ops-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 120px 120px 150px minmax(180px, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 15px;
  background: rgba(28, 32, 43, 0.78);
}

.ops-row strong,
.ops-row span {
  display: block;
}

.ops-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1480px, calc(100% - 48px));
  margin: 20px auto 0;
  padding: 28px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  padding: 34px 0;
}

.admin-list,
.editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(22, 25, 34, 0.84);
  box-shadow: var(--shadow);
}

.admin-list {
  padding: 24px;
}

.admin-head {
  margin-bottom: 20px;
}

.admin-head h1 {
  font-size: 38px;
}

.admin-tools {
  display: grid;
  gap: 10px;
}

.admin-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--panel);
}

.admin-tool p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.editor {
  position: sticky;
  top: 92px;
  align-self: start;
  padding: 22px;
}

form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.save-note {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .hero,
  .library-shell,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .editor {
    position: static;
  }

  .featured-grid {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  main,
  .footer {
    width: min(100% - 28px, 1480px);
  }

  .stats-strip,
  .featured-grid,
  .ops-row,
  .tool-controls,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .library-toolbar,
  .admin-head,
  .editor-head {
    align-items: stretch;
    flex-direction: column;
  }
}
