:root {
  color-scheme: light;
  font-family: -apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  color: #202723;
  background: #f4f3eb;
  --muted: #5c6961;
  --border: #d6ded3;
  --paper: #fffef9;
  --ink: #163a32;
  --accent: #316655;
}
* { box-sizing: border-box; }
body { margin: 0; }
button,input,select,textarea { font: inherit; }
button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid #cdd7cb;
  border-radius: 7px;
  background: #fffef9;
  color: #22342c;
  font-size: 13px;
  font-weight: 690;
  cursor: pointer;
}
button:not(:disabled):hover { border-color: #6d9584; background: #eaf2e8; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid #287d63;
  outline-offset: 2px;
}
button.primary { color: #fffef8; border-color: #214b3d; background: #214b3d; }
button.primary:not(:disabled):hover { color: white; background: #2e6250; border-color: #2e6250; }
button.delete { color: #9f4037; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.shell { width: min(100% - 48px, 1450px); margin: 0 auto; }
.site-header { border-bottom: 1px solid #dcded3; background: #f9f7ef; }
.site-inner { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.site-inner .brand-mark { width: 19px; background: #397d67; }
.site-inner .brand-period { color: #397d67; }
.site-divider { width: 1px; height: 15px; background: #c6cfc3; }
.app-name { color: var(--muted); font-size: 14px; }
.save-state { margin-left: auto; color: var(--muted); font-size: 12px; }
main { padding: 23px 0 28px; }
.intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 13px; margin-bottom: 18px; }
.intro h1 { margin: 0; font-size: clamp(1.7rem,3.4vw,2.7rem); letter-spacing: -.065em; line-height: 1.14; }
.intro p { margin: 7px 0 0; color: var(--muted); font-size: 15px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.project-actions button { min-height: 36px; padding-inline: 11px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(296px, 326px);
  overflow: hidden;
  border: 1px solid #c7d3c8;
  border-radius: 13px;
  background: var(--paper);
}
.map-panel, .inspector { min-width: 0; }
.map-panel { display: grid; grid-template-rows: auto 1fr auto; }
.map-toolbar {
  min-height: 57px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.project-title { min-width: 0; display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 13px; }
.project-title span { white-space: nowrap; }
.project-title input { width: clamp(110px, 16vw, 202px); min-width: 0; font-weight: 780; }
.map-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: center; gap: 5px; }
.map-actions output { display: block; min-width: 37px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.zoom-button { min-width: 31px; padding-inline: 5px; font-size: 16px; }
.story-map {
  position: relative;
  min-height: 430px;
  height: min(60vh, 670px);
  overflow: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at 44% 12%, #24443a77, transparent 66%), #152b26;
  scrollbar-color: #6e978a #152b26;
}
.story-map:focus-visible { outline-offset: -3px; outline-color: #9de2bf; }
.map-size { position: relative; min-width: 100%; min-height: 100%; overflow: hidden; }
.map-world {
  position: absolute;
  inset: 0 auto auto 0;
  background-image: radial-gradient(circle,#79a99b58 1px, transparent 1px);
  background-size: 22px 22px;
  transform-origin: left top;
}
.connections, .scene-nodes { position: absolute; inset: 0; width: 100%; height: 100%; }
.connections { pointer-events: none; }
.node {
  position: absolute;
  display: grid;
  grid-template-rows: auto auto 1fr;
  width: 150px;
  height: 96px;
  gap: 3px;
  padding: 9px;
  text-align: left;
  touch-action: none;
  cursor: grab;
  border: 1px solid #6ca38e;
  border-top-width: 3px;
  border-radius: 8px;
  background: #29483f;
  color: #f8fff6;
  box-shadow: 0 3px 7px #071c156b;
}
.node.is-start { border-top-color: #d6ee9b; }
.node.is-ending { border-color: #a17d5e; border-top-color: #edb67d; background: #423d30; }
.node.is-selected { outline: 2px solid #a2e5be; outline-offset: 2px; background: #315b4b; }
.node.is-ending.is-selected { background: #5a4935; }
.node:not(:disabled):hover { background: #376250; border-color: #9dd4af; }
.node.is-dragging { cursor: grabbing; z-index: 1; }
.node:focus-visible { outline: 3px solid #e1f7b0; }
.node-meta { color: #c2e3d3; font-size: 10px; font-weight: 710; }
.node.is-ending .node-meta { color: #f3d0a8; }
.node strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; letter-spacing: -.03em; }
.node-body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: #dfebe1;
  font-size: 11px;
  font-weight: 470;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.map-footer {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 13px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}
.map-footer p { margin: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.map-legend i { width: 7px; height: 7px; border-radius: 2px; background: #458571; }
.map-legend span:nth-child(2) i { background: transparent; border: 1px dashed #9b6534; }
.map-legend span:nth-child(3) i { background: #be8b5a; }
.inspector { border-left: 1px solid var(--border); max-height: min(78vh, 768px); overflow: auto; }
.inspector-header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.inspector-header { min-height: 57px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.inspector-header h2, .section-heading h3 { margin: 0; font-size: 15px; font-weight: 760; }
.entry-badge { padding: 4px 7px; border-radius: 99px; background: #ddedd7; color: #255c42; font-size: 11px; font-weight: 730; }
.inspector-section { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.inspector-section > label { display: block; margin: 0 0 5px; font-size: 13px; font-weight: 700; }
.inspector-section > input { margin-bottom: 9px; }
input,textarea,select {
  min-height: 34px;
  height: auto;
  padding: 5px 7px;
  border: 1px solid #cbd6ca;
  border-radius: 6px;
  background: #fffefa;
  color: #26332c;
  font-size: 13px;
}
.inspector :is(input:not([type=checkbox]),textarea,select) { width: 100%; min-width: 0; }
textarea { resize: vertical; }
.scene-actions { display: flex; justify-content: space-between; gap: 6px; margin-top: 7px; }
.section-heading > div { display: flex; align-items: center; gap: 5px; }
.section-heading span, .flags-section summary span { color: var(--muted); font-size: 12px; }
.choice-card { margin-top: 9px; padding: 7px; border: 1px solid #dce4d8; border-radius: 8px; background: #f7f8f0; }
.choice-card > .choice-heading { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-bottom: 6px; }
.choice-heading strong { font-size: 13px; }
.choice-heading button { min-height: 26px; padding: 1px 6px; }
.choice-card label { display: block; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 640; }
.choice-card label + label { margin-top: 5px; }
.choice-card label :is(input,select) { display: block; margin-top: 3px; }
.choice-card details summary, .flags-section summary { cursor: pointer; color: #275744; font-size: 13px; font-weight: 700; }
.choice-card details { margin-top: 7px; }
.choice-card details[open] summary { margin-bottom: 6px; }
.flags-section summary { list-style-position: inside; }
.flag-content { margin-top: 8px; }
.flag-form, .flag-row { display: flex; align-items: center; gap: 7px; }
.flag-form button, .flag-row button { flex-shrink: 0; }
.flag-row { justify-content: space-between; margin-top: 7px; }
.flag-row label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.flag-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flag-row input { min-height: 18px; accent-color: #285743; }
.flag-row button { min-height: 28px; }
.empty { margin: 9px 0 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.workspace-footer {
  grid-column: 1 / -1;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  color: #41594b;
  background: #f0f4ec;
  font-size: 12px;
}
.notice { position: fixed; bottom: 16px; right: 16px; max-width: calc(100% - 32px); margin: 0; z-index: 3; padding: 10px 13px; border: 1px solid #32594b; border-radius: 8px; background: #294a3d; color: white; font-size: 14px; box-shadow: 0 8px 20px #10251d30; }
#player { width: min(780px, calc(100% - 26px)); max-height: 88vh; padding: 0; border: 1px solid #6b8e7b; border-radius: 14px; background: #f4f2e8; color: #202e27; box-shadow: 0 18px 70px #112a21aa; }
#player::backdrop { background: #102a22ae; }
.player-bar { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; background: #21473a; color: #eef8e9; font-size: 14px; font-weight: 720; }
.player-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(145px, 29%); min-height: 320px; }
.play-text { padding: clamp(17px, 4vw, 30px); }
.play-project { margin: 0 0 9px; color: #476d5b; font-size: 13px; font-weight: 700; }
.play-text h2 { margin: 0 0 13px; font-size: clamp(1.6rem, 4vw, 2.45rem); letter-spacing: -.06em; }
#play-scene-body { margin: 0 0 20px; color: #374b42; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
#play-options { display: grid; gap: 6px; }
#play-options button { min-height: 42px; text-align: left; }
#play-options .ending-label { color: #705335; font-size: 14px; font-weight: 760; }
.play-details { padding: 17px 11px; background: #e6eddf; }
.play-details h3 { font-size: 13px; margin: 0 0 7px; }
.play-details ul, .play-details ol { padding-inline-start: 18px; margin: 0 0 14px; color: #406055; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.play-details ol { max-height: 170px; overflow: auto; }
@media (max-width: 780px) {
  .shell { width: calc(100% - 24px); }
  main { padding-top: 17px; }
  .workspace { grid-template-columns: minmax(0,1fr); }
  .map-toolbar { flex-wrap: wrap; }
  .inspector { max-height: none; border-left: 0; border-top: 1px solid var(--border); }
  .story-map { min-height: 365px; height: 48dvh; }
}
@media (max-width: 480px) {
  .intro p { font-size: 14px; }
  .site-inner { gap: 8px; }
  .app-name { font-size: 12px; }
  .save-state { font-size: 10px; }
  .map-actions { flex-shrink: 1; }
  .project-title input { width: 145px; }
  .player-content { grid-template-columns: minmax(0,1fr); }
  .play-details { border-top: 1px solid #c6d9c8; }
}
