:root {
  color-scheme: dark;
  --bg: #15181c;
  --panel: #20262b;
  --panel-2: #272f34;
  --line: #394249;
  --text: #f2f5f1;
  --muted: #a9b3ad;
  --accent: #d7b46a;
  --accent-2: #6fc0b8;
  --danger: #e08172;
  font-family:
    Inter, Pretendard, "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 18px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 15px;
  color: var(--accent);
}

p {
  margin-top: 8px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
}

.actions button {
  padding: 0 14px;
  background: #2d393c;
}

.preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #1f2428 25%, transparent 25%),
    linear-gradient(-45deg, #1f2428 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1f2428 75%),
    linear-gradient(-45deg, transparent 75%, #1f2428 75%);
  background-color: #171a1d;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  background-size: 24px 24px;
  overflow: hidden;
}

canvas {
  width: min(72vh, 72vw, 680px);
  height: min(72vh, 72vw, 680px);
  image-rendering: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

canvas:active {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  display: grid;
  gap: 6px;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.empty-state.hidden,
.hidden {
  display: none;
}

.filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  gap: 10px;
  min-height: 108px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.thumb {
  position: relative;
  display: grid;
  grid-template-rows: 58px auto 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  overflow: hidden;
}

.thumb.active {
  border-color: var(--accent);
  color: var(--text);
}

.thumb img {
  width: 100%;
  height: 58px;
  object-fit: cover;
}

.thumb span {
  padding: 0 5px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.thumb-kind {
  padding: 0 5px;
  color: var(--accent);
  font-size: 10px;
}

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  min-height: 22px;
  height: 22px;
  border-radius: 999px;
  border-color: rgba(0, 0, 0, 0.45);
  background: rgba(12, 15, 17, 0.85);
  color: var(--text);
  line-height: 1;
}

.controls {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
}

.control-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1b2024;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input[type="file"],
input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111518;
  color: var(--text);
  padding: 7px 9px;
}

input[type="color"] {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111518;
  padding: 4px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
}

.file-picker {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.segmented button.active {
  border-color: var(--accent);
  background: #3a3323;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .controls {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topbar {
    display: grid;
  }

  .actions {
    flex-wrap: wrap;
  }

  canvas {
    width: min(88vw, 560px);
    height: min(88vw, 560px);
  }
}
