:root {
  --bg: #14110e;
  --ink: #241910;
  --paper: #f6f0e6;
  --paper-2: #efe6d6;
  --line: rgba(36, 25, 16, 0.12);
  --gold: #c8882a;
  --gold-2: #e2b15a;
  --blue: #243656;
  --muted: #7a6c5d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 40% at 10% -10%, #3a2a18 0%, transparent 50%),
    var(--bg);
  color: var(--paper);
}

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

button, .file-btn {
  border: 1px solid rgba(246, 240, 230, 0.16);
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

button.on, button.primary {
  background: var(--gold);
  color: #24160a;
  border-color: transparent;
  font-weight: 600;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 8px;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 {
  margin: 0;
  font-family: "Gowun Batang", serif;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}
.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 42%, #f2d48a 0 18%, transparent 19%),
    linear-gradient(#243656, #1a2233);
  box-shadow: inset 0 0 0 2px rgba(226, 177, 90, 0.4);
}
.eyebrow {
  margin: 0;
  color: var(--gold-2);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}
nav, .file { display: flex; flex-wrap: wrap; gap: 8px; }
.file-btn input { display: none; }

#view { padding: 8px 22px 32px; }

.play { display: flex; justify-content: center; }
.stage { width: min(480px, 100%); }
.frame { position: relative; }
.stage canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #14120f;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.hud {
  margin-top: 8px;
  color: #d9cbb8;
  font-size: 0.92rem;
}
.shade {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.28);
  border-radius: 12px;
}
.card {
  position: absolute;
  left: 12px;
  right: 12px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.title-card { top: 18%; }
.title-card h2 {
  margin: 4px 0 6px;
  font-family: "Gowun Batang", serif;
  font-size: 2rem;
}
.message { bottom: 12px; min-height: 92px; }
.sheet { top: 12px; max-height: calc(100% - 24px); overflow: auto; }
.who { margin: 0 0 4px; font-weight: 600; color: #8a4e22; }
.line { margin: 0; line-height: 1.55; }
.more { margin: 8px 0 0; text-align: right; color: var(--gold); font-weight: 600; }
.blurb, .hint { color: var(--muted); line-height: 1.5; }
.card .hint, .sheet .hint, .title-card .hint { color: #7d6b5a; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card button, .sheet button, .data button {
  border-color: rgba(36, 25, 16, 0.16);
  color: var(--ink);
  background: #fffdf8;
}
.card button.primary, .sheet button.primary, .card button.on, .sheet button.on {
  background: var(--gold);
  color: #24160a;
}
.pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.pad button {
  min-height: 46px;
  border-radius: 12px;
  background: #2a241e;
}
.choices, .menu-list { display: grid; gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.choices button, .menu-list button, .tabs button { width: 100%; text-align: left; border-radius: 10px; }
.menu-list span, .choices span { color: #7d6b5a; }
.fight { display: flex; justify-content: space-between; gap: 12px; }
.bar { height: 8px; background: #e4d8c6; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: #c0453a; }
.tabs { display: flex; gap: 6px; }

.editor {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.palette, .inspector, .data {
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px;
}
.palette .tools, .palette .layers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.palette button { color: var(--ink); background: #fffdf8; border-color: rgba(36, 25, 16, 0.14); border-radius: 999px; padding: 6px 10px; }
.palette button.on { background: var(--blue); color: #f6f0e6; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 70vh; overflow: auto; }
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  color: var(--ink);
  background: #fffdf8;
}
.swatch canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.swatch span { font-size: 0.75rem; }
.board { min-width: 0; }
.board canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #d7ecb8;
  border-radius: 12px;
}
.inspector { max-height: 78vh; overflow: auto; }
.inspector h3 { margin: 12px 0 6px; font-size: 1rem; }
label { display: block; margin: 8px 0; font-size: 0.85rem; color: #6d5d4e; }
input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(36, 25, 16, 0.16);
  background: #fffdf8;
  color: var(--ink);
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmd { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.wrap button { border-radius: 8px; padding: 6px 8px; font-size: 0.8rem; }
.data { max-width: 880px; }
.data h2 { margin: 0 0 8px; font-family: "Gowun Batang", serif; }
.data section + section { margin-top: 18px; }
.table { display: grid; gap: 10px; }

@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; }
  .swatches { grid-template-columns: repeat(4, 1fr); max-height: none; }
  .inspector { max-height: none; }
}

@media (pointer: coarse) {
  .pad { display: grid; }
}
