:root {
  color-scheme: dark;
  --page: #000000;
  --ink: #fed002;
  --muted: #c8a600;
  --line: #3a3000;
  --field: #0a0a0a;
  --bg: var(--page);
  --panel: #050500;
  --panel-2: var(--field);
  --text: var(--ink);
  --accent: var(--ink);
  --accent-strong: #ffd93a;
  --danger: #ff5b6b;
  --shadow: 0 18px 60px rgba(254, 208, 2, .08);
}

body.light {
  color-scheme: dark;
  --bg: var(--page);
  --panel: #050500;
  --panel-2: var(--field);
  --text: var(--ink);
  --accent: var(--ink);
  --accent-strong: #ffd93a;
  --shadow: 0 18px 60px rgba(254, 208, 2, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.ghost-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover,
.ghost-link:hover {
  border-color: var(--accent);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #07100b;
  font-size: 13px;
}

.top-actions,
.button-row,
.sticker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  text-decoration: none;
}

.ghost-button {
  padding: 0 13px;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 34px) 34px;
}

.panel,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  align-self: start;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.control-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.control-section:last-child {
  border-bottom: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.file-drop {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 102px;
  margin-bottom: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-drop span {
  color: var(--accent);
  font-weight: 800;
}

.file-drop small {
  color: var(--muted);
}

.button-row button {
  flex: 1 1 100px;
  padding: 0 12px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tool,
.sticker,
.format-button {
  padding: 0 8px;
}

.tool.active,
.sticker.active,
.format-button.active,
.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #07100b;
  font-weight: 800;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.color-control {
  display: grid;
  gap: 8px;
}

input[type="text"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--text);
}

input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

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

.color-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.color-tools button {
  padding: 0 10px;
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.swatch {
  min-height: 30px;
  border-color: var(--line);
  background: var(--swatch);
}

.swatch.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body.picking-color canvas {
  cursor: copy;
}

.sticker-row {
  margin-bottom: 12px;
}

.text-options {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.format-button {
  width: 42px;
  font-weight: 900;
}

.format-button:nth-child(2) {
  font-style: italic;
}

.format-button:nth-child(3) {
  text-decoration: underline;
}

.format-button:nth-child(4) {
  text-decoration: line-through;
}

.sticker {
  width: 44px;
  font-size: 20px;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.canvas-wrap {
  position: relative;
  display: grid;
  min-height: min(68vh, 760px);
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--panel-2);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 40%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 40%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 40%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 40%, transparent) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.text-editor {
  position: absolute;
  z-index: 5;
  display: none;
  min-width: 40px;
  min-height: 28px;
  resize: none;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 0;
  background: rgba(0, 0, 0, .72);
  color: var(--accent);
  outline: 0;
  line-height: 1.22;
}

.text-editor.active {
  display: block;
}

.file-drop.drag-active,
.canvas-wrap.drag-active {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
}

canvas {
  display: block;
  max-width: 100%;
  max-height: 74vh;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 14px 45px rgba(0, 0, 0, .25);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.tips {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tips strong {
  color: var(--text);
  white-space: nowrap;
}

.seo-content,
.doc-page {
  line-height: 1.7;
}

.seo-content {
  margin-top: 18px;
  color: var(--muted);
}

.seo-content h2,
.doc-page h2 {
  color: var(--text);
}

.seo-content p,
.doc-page p {
  margin-top: 10px;
}

.doc-page {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 34px) 60px;
}

.doc-page h1 {
  margin-bottom: 16px;
}

.doc-page h2 {
  margin-top: 30px;
}

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

  .workspace {
    order: -1;
  }

  .controls {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .topbar,
  .preview-header,
  .tips {
    align-items: stretch;
    flex-direction: column;
  }

  .app {
    padding-inline: 10px;
  }

  .tool-grid,
  .two-cols {
    grid-template-columns: 1fr 1fr;
  }

  .meta {
    text-align: left;
  }
}
