@charset "utf-8";
@import url("https://cdn.jsdelivr.net/npm/galmuri@latest/dist/galmuri.css");

:root {
  --bg: #ead7bd;
  --panel: #fff8ec;
  --ink: #3a2a22;
  --muted: #8a7567;
  --line: #8a5f45;
  --deep: #201715;
  --accent: #b78455;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

body {
  color: var(--ink);
  background: #ead7bd;
  font-family: "Galmuri11", "DungGeunMo", "NeoDunggeunmo Pro", "PFStardust", "Apple SD Gothic Neo", "Malgun Gothic", monospace;
}

.credit {
  position: fixed;
  left: 14px;
  top: 10px;
  z-index: 20;
  color: rgba(255, 248, 236, .92);
  background: rgba(32, 23, 21, .68);
  border: 2px solid rgba(255, 248, 236, .58);
  box-shadow: 3px 3px 0 rgba(0,0,0,.16);
  padding: 7px 12px;
  font-size: 14px;
  letter-spacing: .02em;
  backdrop-filter: blur(2px);
}

.maker {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(900px, 1fr) 370px;
  gap: 14px;
  padding: 18px 14px 14px;
}

.preview-panel,
.edit-panel {
  border: 2px solid var(--line);
  background: rgba(255, 248, 236, .74);
  box-shadow: 6px 6px 0 rgba(60, 38, 28, .10);
}

.preview-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  padding: 12px;
}

.canvas-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,.20), rgba(126,87,54,.10));
  border: 1px solid rgba(138, 95, 69, .42);
  overflow: hidden;
}

canvas {
  width: min(100%, calc((100svh - 118px) * 16 / 9));
  max-height: calc(100svh - 118px);
  aspect-ratio: 16 / 9;
  display: block;
  background: #dec5a5;
}

.player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding-top: 10px;
}

.player-bar button,
.timeline-tools button,
.row-actions button,
.add-dialogue-btn,
.guide-box button {
  min-height: 34px;
  padding: 0 12px;
  color: #fff8ec;
  background: var(--deep);
  border: 1px solid var(--line);
}

.player-bar button:hover,
.timeline-tools button:hover,
.row-actions button:hover,
.add-dialogue-btn:hover,
.guide-box button:hover { transform: translateY(-1px); }

.player-bar button:disabled { opacity: .55; cursor: wait; }
.player-bar label,
.json-load-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.player-bar input[type="range"] { width: 110px; }
.json-load-label {
  min-height: 34px;
  padding: 0 10px;
  color: #fff8ec !important;
  background: var(--deep);
  border: 1px solid var(--line);
  align-items: center;
  cursor: pointer;
}
.json-load-label input { display: none; }

.status-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.edit-panel {
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 14px;
}

.edit-panel h1 { margin: 0; font-size: 22px; font-weight: 700; }
.mini { margin: 6px 0 14px; color: var(--muted); font-size: 12px; }

details {
  margin-top: 10px;
  border: 1px solid rgba(138, 95, 69, .45);
  background: rgba(255, 255, 255, .28);
}

summary {
  padding: 9px 10px;
  color: #fff8ec;
  background: var(--deep);
  cursor: pointer;
  user-select: none;
}

.field-grid { display: grid; gap: 10px; padding: 12px; }
.field-grid label,
.scene-row label,
.dialogue-line label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(138, 95, 69, .55);
  background: rgba(255, 255, 255, .68);
  color: var(--ink);
  padding: 7px 8px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.compact input[type="range"] { padding: 0; }

.timeline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 12px 0;
}
.timeline-editor { display: grid; gap: 12px; padding: 12px; }

.scene-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px dashed rgba(138, 95, 69, .50);
  background: rgba(255, 248, 236, .55);
}

.scene-row .wide { grid-column: 1 / -1; }
.dialogue-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.dialogue-line {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(138, 95, 69, .25);
  background: rgba(255,255,255,.35);
}

.dialogue-line textarea {
  min-height: 58px;
  resize: vertical;
  line-height: 1.5;
}

.line-remove {
  align-self: end;
  min-height: 30px;
  padding: 0 9px;
  color: #fff8ec;
  background: #4b3028;
  border: 1px solid rgba(138,95,69,.7);
}

.scene-tools,
.row-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button,
.add-dialogue-btn,
.line-remove { font-size: 12px; }

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(29, 22, 18, .56);
}

.guide-modal.is-hidden { display: none; }

.guide-box {
  width: min(520px, calc(100vw - 40px));
  padding: 24px;
  border: 3px solid #fff7ee;
  outline: 2px solid var(--line);
  background: #1f1714;
  color: #fff8ec;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}

.guide-box h2 { margin: 0 0 14px; font-size: 24px; color: #ffe5ad; }
.guide-box p { margin: 8px 0; line-height: 1.65; }
.guide-box button { margin-top: 16px; min-width: 90px; }

@media (max-width: 1120px) {
  body { overflow: auto; }
  .maker { grid-template-columns: 1fr; }
  .edit-panel { max-height: none; }
  canvas { width: 100%; max-height: none; }
}
