:root {
  color-scheme: dark;
  --page: #000000;
  --panel: #000000;
  --ink: #fed002;
  --muted: #b99900;
  --line: #3a3000;
  --accent: #fed002;
  --accent-strong: #fff1a8;
  --field: #0a0a0a;
  --focus: rgba(254, 208, 2, 0.24);
  --shadow: none;
}

body[data-theme="light"] {
  color-scheme: light;
  --page: #ffffff;
  --panel: #ffffff;
  --ink: #000000;
  --muted: #555555;
  --line: #000000;
  --accent: #000000;
  --accent-strong: #333333;
  --field: #ffffff;
  --focus: rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Noto Sans KR", Pretendard, Arial, sans-serif;
}

a {
  color: var(--ink);
}

button,
input,
select,
textarea,
.text-editor {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

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

.controls {
  align-self: start;
  padding: 24px;
}

.brand {
  margin-bottom: 24px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.nav-link {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

.control-form {
  display: grid;
  gap: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-full {
  grid-column: 1 / -1;
}

.size-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.color-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.size-inputs label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.color-control {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--field);
}

.field span,
.size-inputs span,
.color-inputs span,
.color-control > span,
.style-options legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.text-editor,
select,
input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
}

.text-editor,
select,
input[type="text"],
input[type="number"] {
  padding: 10px 12px;
}

.text-editor {
  min-height: 116px;
  max-height: 260px;
  overflow: auto;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-editor:focus,
select:focus,
input:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
  outline: none;
}

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

.swatch {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--swatch-color);
  cursor: pointer;
}

.swatch[data-color="#ffffff"] {
  box-shadow: inset 0 0 0 1px #777777;
}

.color-control.is-disabled {
  opacity: 0.45;
}

.color-control.is-disabled .swatch {
  pointer-events: none;
}

.style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.theme-options legend {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.creator-info {
  display: grid;
  gap: 6px;
  margin-top: 2px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.creator-info p {
  margin: 0;
}

.creator-info a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.creator-info a:hover {
  color: var(--accent-strong);
}

.policy-page {
  display: grid;
  gap: 20px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 48px 20px;
}

.policy-page h1,
.policy-page h2,
.policy-page p {
  margin: 0;
}

.policy-page section {
  display: grid;
  gap: 10px;
}

.guide-page {
  max-width: 820px;
}

.policy-page p {
  color: var(--muted);
  line-height: 1.7;
}

.back-link {
  width: fit-content;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.shape-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.shape-options legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shape-option,
.line-pattern {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--field);
  cursor: pointer;
}

.shape-option:has(input:checked),
.line-pattern:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.shape-option input,
.line-pattern input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shape-preview {
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent);
}

.shape-rounded {
  border-radius: 7px;
}

.shape-circle {
  border-radius: 50%;
}

.shape-pill {
  width: 32px;
  border-radius: 999px;
}

.shape-diamond {
  transform: rotate(45deg);
}

.style-options legend {
  flex-basis: 100%;
  margin-bottom: 2px;
}

.line-patterns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.line-patterns > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.line-preview {
  display: block;
  width: 48px;
  border-top: 3px solid var(--accent);
}

.line-dashed {
  border-top-style: dashed;
}

.line-dotted {
  border-top-style: dotted;
  border-top-width: 4px;
}

.style-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.style-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: #111111;
}

.style-button[data-command="underline"] {
  text-decoration: underline;
}

.style-button[data-command="strikeThrough"] {
  text-decoration: line-through;
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--field);
  cursor: pointer;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--field);
  cursor: pointer;
}

.radio-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.check-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.border-options {
  display: none;
}

.border-options.is-active {
  display: grid;
}

.download-button {
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: #000000;
  font-weight: 800;
  cursor: pointer;
}

.download-button:hover {
  background: var(--accent-strong);
}

body[data-theme="light"] .download-button {
  border: 1px solid #000000;
  background: #000000;
  color: #ffffff;
}

body[data-theme="light"] .download-button:hover {
  background: #333333;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.preview-size {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.canvas-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
  background:
    linear-gradient(45deg, #1a1600 25%, transparent 25%),
    linear-gradient(-45deg, #1a1600 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1600 75%),
    linear-gradient(-45deg, transparent 75%, #1a1600 75%);
  background-color: #050505;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

body[data-theme="light"] .canvas-wrap {
  background:
    linear-gradient(45deg, #eeeeee 25%, transparent 25%),
    linear-gradient(-45deg, #eeeeee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eeeeee 75%),
    linear-gradient(-45deg, transparent 75%, #eeeeee 75%);
  background-color: #ffffff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0;
  border: 2px solid var(--accent);
  box-shadow: none;
}

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

  .controls,
  .preview-panel {
    box-shadow: none;
  }

  .preview-panel {
    min-height: auto;
  }

  canvas {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .controls,
  .preview-header,
  .canvas-wrap {
    padding: 18px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .shape-options {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .color-inputs {
    grid-template-columns: 1fr;
  }

  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
