:root {
  --bg: #0b0f14;
  --card: #12181f;
  --card-2: #171f28;
  --line: #243140;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9cf0;
  --accent-2: #2a7cc7;
  --ok: #3ecf8e;
  --err: #e85d5d;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

.center-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card, .form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.login-card { width: min(420px, 100%); }
.eyebrow { color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; margin: 0 0 8px; }
h1, h2 { margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--err); }
.ok { color: var(--ok); }

label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 12px; }
input, select, button, textarea {
  font: inherit;
  color: var(--text);
}
input, select {
  width: 100%;
  margin-top: 6px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #041018; font-weight: 600; width: 100%; }
button.primary:hover { background: #5aaff5; }
button.ghost, .ghost-link {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
}
#app-view {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0e141b;
}
#game-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
#game-nav button {
  text-align: left;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
}
#game-nav button.active { background: var(--card); border: 1px solid var(--line); }
#game-nav button:disabled { color: var(--muted); opacity: 0.55; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
main { padding: 22px 28px 48px; }
.main-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.head-actions { display: flex; gap: 8px; }
.head-actions .primary { width: auto; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}
.tabs button.active { border-color: var(--accent); color: var(--accent); }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #1a2430;
}
.row label { margin: 0; color: var(--text); }
.row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.row input[type="number"], .row input[type="color"], .row select { width: 140px; margin: 0; }
.cat-row {
  display: grid;
  grid-template-columns: 22px 1fr 110px 52px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #1a2430;
}
.note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.field-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  margin: 10px 0 14px;
  overflow: hidden;
}
.field-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.field-group > summary::-webkit-details-marker { display: none; }
.field-group > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 500;
  font-size: 16px;
}
.field-group[open] > summary::after { content: "–"; }
.field-group[open] > summary {
  border-bottom: 1px solid var(--line);
  color: var(--accent);
}
.field-group-body { padding: 4px 14px 10px; }
.field-group .row:last-child,
.field-group .cat-row:last-child { border-bottom: 0; }
.admin-layout { padding: 24px; max-width: 1100px; margin: 0 auto; }
.create-row {
  display: grid;
  grid-template-columns: 100px 1fr 200px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.create-row label { margin: 0; }
.create-row button { width: auto; height: 42px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { padding: 6px 8px; background: var(--card-2); color: var(--text); }

@media (max-width: 800px) {
  #app-view { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .create-row { grid-template-columns: 1fr; }
  .main-head { flex-direction: column; }
}
