:root {
  --forge-ink: #111315;
  --forge-muted: #6c737a;
  --forge-faint: #929aa3;
  --forge-paper: #f7f5ef;
  --forge-panel: #fffdfa;
  --forge-rail: #ebe6db;
  --forge-line: rgba(17, 19, 21, 0.11);
  --forge-accent: #1f7a68;
  --forge-accent-strong: #155d50;
  --forge-warn: #a75522;
  --forge-good: #25734c;
  --shadow-soft: 0 0 0 1px rgba(17, 19, 21, 0.06), 0 10px 32px rgba(40, 35, 25, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--forge-ink);
  background: var(--forge-paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.stack > *, .dashboard > * {
  min-width: 0;
}

.game-row a, .diagnostic, .guide-grid, #dev-home {
  overflow-wrap: anywhere;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  vertical-align: middle;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 122, 104, 0.08), transparent 360px),
    var(--forge-paper);
}

a {
  color: inherit;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--forge-line);
  backdrop-filter: blur(18px);
  background: rgba(247, 245, 239, 0.86);
}

.topbar .shell {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  letter-spacing: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--forge-ink);
  color: var(--forge-panel);
  font-size: 14px;
}

.nav {
  display: flex;
  gap: 8px;
}

.button,
button {
  min-height: 40px;
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--forge-panel);
  color: var(--forge-ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
button.primary {
  border-color: transparent;
  background: var(--forge-accent);
  color: white;
}

.button:hover,
button:hover {
  border-color: rgba(17, 19, 21, 0.24);
}

.button.primary:hover,
button.primary:hover {
  background: var(--forge-accent-strong);
}

.hero {
  padding: 52px 0 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 36px;
  align-items: end;
}

.compact-hero {
  padding-bottom: 20px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--forge-accent-strong);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.lead {
  max-width: 700px;
  color: #42484d;
  font-size: 18px;
  line-height: 1.55;
  text-wrap: pretty;
}

.stats-strip {
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 6px;
  color: var(--forge-muted);
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 14px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--forge-muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 44px;
}

.game-card,
.panel {
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: var(--forge-panel);
  box-shadow: var(--shadow-soft);
}

.game-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-art {
  height: 96px;
  background:
    linear-gradient(135deg, rgba(31, 122, 104, 0.85), rgba(17, 19, 21, 0.92)),
    repeating-linear-gradient(90deg, transparent, transparent 10px, rgba(255,255,255,.14) 10px, rgba(255,255,255,.14) 11px);
}

.game-body {
  padding: 16px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.game-body p {
  color: var(--forge-muted);
  line-height: 1.45;
  flex: 1;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--forge-muted);
  font-size: 12px;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(31, 122, 104, 0.12);
  color: var(--forge-accent-strong);
  font-weight: 700;
}

.dashboard {
  padding: 28px 0 48px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--forge-muted);
  font-size: 12px;
  font-weight: 680;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: #f1eee7;
  color: var(--forge-ink);
  padding: 10px 11px;
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus,
.button:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  outline-offset: 2px;
}

.hint {
  color: var(--forge-muted);
  font-size: 13px;
  line-height: 1.45;
}

.quota {
  height: 10px;
  border-radius: 999px;
  background: #e0dbce;
  overflow: hidden;
}

.quota span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--forge-accent);
}

.game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--forge-line);
  padding: 14px 0;
}

.editable-game {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.game-edit-form,
.reupload-form {
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: #f9f6ef;
  padding: 14px;
}

.reupload-form {
  background: rgba(31, 122, 104, 0.07);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.plan-option,
.plan-card {
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: #f5f1e8;
  padding: 14px;
}

.plan-option {
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.plan-option.active {
  border-color: rgba(31, 122, 104, 0.44);
  background: rgba(31, 122, 104, 0.1);
}

.framework-guide {
  border: 1px solid var(--forge-line);
  border-radius: 8px;
  background: #f5f1e8;
  padding: 14px;
}

.guide-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.guide-head h3 {
  margin: 8px 0 0;
}

.guide-head code {
  border: 1px solid var(--forge-line);
  border-radius: 6px;
  background: rgba(255, 253, 250, 0.7);
  padding: 5px 7px;
  color: var(--forge-accent-strong);
  font-size: 12px;
}

.guide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 14px;
}

.guide-grid strong {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--forge-ink);
}

.guide-grid ol,
.guide-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--forge-muted);
  font-size: 13px;
  line-height: 1.45;
}

.guide-grid p {
  margin-bottom: 10px;
  color: var(--forge-muted);
  font-size: 13px;
  line-height: 1.45;
}

.diagnostic {
  margin: 6px 0 0;
  border-left: 3px solid var(--forge-warn);
  padding-left: 8px;
  color: var(--forge-warn);
  font-size: 12px;
}

.game-row:first-child {
  border-top: 0;
}

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

.empty {
  border: 1px dashed rgba(17, 19, 21, 0.2);
  border-radius: 8px;
  padding: 28px;
  color: var(--forge-muted);
  text-align: center;
}

.notice {
  display: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(31, 122, 104, 0.12);
  color: var(--forge-accent-strong);
  font-size: 13px;
}

.notice.show {
  display: block;
}

@media (max-width: 860px) {
  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}
