:root {
  --ink: #171b15;
  --muted: #596254;
  --paper: #eef1ea;
  --panel: #f9fbf6;
  --panel-muted: #e8ece4;
  --line: #cfd5cb;
  --accent: #b6e45e;
  --accent-dark: #1a2a11;
  --danger: #b42318;
  --success: #177244;
}

* { box-sizing: border-box; }

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

html { scrollbar-color: #9da795 var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { color: inherit; }

::selection { color: var(--ink); background: var(--accent); }

:focus-visible {
  outline: 3px solid #50721b;
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) clamp(540px, 42vw, 640px);
  min-height: 100dvh;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 clamp(24px, 4vw, 64px) 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -.04em;
  text-decoration: none;
}

.brand img { width: 25px; height: 25px; }

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(360px, 52vh, 560px);
  margin-block: clamp(24px, 3vh, 40px);
  padding: 38px;
  overflow: hidden;
  text-align: center;
  background: rgba(255,255,255,.62);
  border: 1.5px dashed #a6aea0;
  border-radius: 22px;
  outline: none;
  transition: border-color .18s, background .18s, transform .18s;
}

.dropzone::after {
  position: absolute;
  right: -40px;
  bottom: -85px;
  width: 210px;
  height: 210px;
  background: var(--accent);
  border-radius: 50%;
  content: "";
  opacity: .65;
  pointer-events: none;
}

.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging {
  background: #fff;
  border-color: var(--ink);
}

.dropzone.is-dragging { transform: scale(1.008); }

.dropzone.is-busy {
  background: #f5f8ef;
  border-color: #77816f;
  border-style: solid;
  cursor: wait;
}

.dropzone-content,
.processing-state {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
}

.dropzone-content[hidden],
.processing-state[hidden] { display: none; }

.processing-state { gap: 12px; max-width: 440px; }

.processing-spinner {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border: 4px solid #d6ddcf;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: processing-spin .8s linear infinite;
}

.processing-state strong {
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -.03em;
}

.processing-state > span:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

@keyframes processing-spin { to { transform: rotate(360deg); } }

.drop-filetype {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  background: var(--ink);
  color: var(--panel);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
}

.dropzone h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; }

.dropzone p { margin: 10px 0 20px; color: var(--muted); }

.browse-link {
  color: var(--ink);
  border-bottom: 1px solid;
  cursor: pointer;
}

.notice {
  margin-top: 14px;
  padding: 13px 16px;
  color: #354032;
  background: #e8ecdf;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.notice.error { color: #7a271a; background: #fee4e2; }

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 0;
  padding: 24px 24px 20px;
  overflow: hidden;
  background: var(--panel);
  color: var(--ink);
  border-left: 1px solid var(--line);
}

.sidebar-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 4px 2px 18px; }
.sidebar-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.count { padding: 6px 10px; color: var(--muted); background: var(--panel-muted); border-radius: 999px; font-size: 11px; font-weight: 700; }

.level-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.level-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  background: var(--panel-muted);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color .18s, background .18s;
}

.level-slot.has-file { background: #f0f5e9; border-color: #a7b99a; }
.level-slot.success { border-color: #307b51; }
.level-slot.failed { border-color: #8b4038; }

.slot-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; min-width: 0; }
.slot-head strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.slot-copy { min-width: 0; margin-top: 8px; }
.slot-filename, .slot-error { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.slot-error { color: #9e2f24; }
.slot-state { color: var(--muted); font-size: 10px; font-weight: 750; }
.has-file .slot-state { color: #35402f; }

.remove-button {
  display: none;
  position: absolute;
  right: 7px;
  top: 7px;
  width: 44px;
  height: 29px;
  padding: 0;
  color: #3d4639;
  background: #dbe2d6;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  line-height: 29px;
}

.level-slot.has-file:hover .remove-button,
.level-slot.has-file:focus-within .remove-button { display: block; }
.level-slot.uploading .remove-button, .level-slot.success .remove-button { display: none; }

.sidebar-footer { padding-top: 18px; }
.summary-line { display: flex; justify-content: space-between; margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.summary-line strong { color: var(--ink); }

.publish-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  color: var(--accent-dark);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  font-weight: 850;
  cursor: pointer;
}

.publish-button:hover:not(:disabled) { filter: brightness(1.05); }
.publish-button:disabled { color: #70796c; background: #dfe4dc; cursor: not-allowed; }
@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .workspace { min-height: auto; padding-bottom: 36px; }
  .dropzone { min-height: clamp(360px, 56vh, 520px); }
  .sidebar { height: auto; min-height: auto; overflow: visible; }
  .level-slots { grid-template-rows: repeat(4, minmax(84px, auto)); }
  .sidebar-footer { padding-top: 24px; }
}

@media (max-width: 560px) {
  .workspace { padding-inline: 20px; }
  .dropzone { min-height: 340px; margin-block: 24px; padding: 30px 18px; }
  .sidebar { padding: 28px 14px 22px; }
  .level-slots { gap: 6px; }
  .level-slot { padding: 10px 9px; }
  .slot-head { gap: 4px; }
  .slot-state { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
