:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #101010;
  --panel-strong: #151515;
  --line: #303030;
  --text: #f4f4f4;
  --muted: #a8adb7;
  --yellow: #ffd84d;
  --green: #7ee66b;
  --sky: #74d4ff;
  --red: #ff4b4b;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(560px, 1.18fr);
  gap: 20px;
  align-items: start;
}

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

.editor-panel {
  padding: 26px;
  position: sticky;
  top: 20px;
}

.preview-panel {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--sky);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(46px, 7vw, 90px);
  line-height: 0.95;
  letter-spacing: 0;
}

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

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.lead {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.input-label {
  display: block;
  margin-bottom: 10px;
  color: #d7dbe4;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #3b3b3b;
  border-radius: 8px;
  background: #070707;
  color: var(--text);
  padding: 16px;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--yellow);
}

.example-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 24px;
}

.photo-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.photo-control input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-button,
.photo-control button {
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171717;
  color: var(--text);
  cursor: pointer;
}

.photo-control span {
  grid-column: 1 / -1;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.photo-control button:disabled {
  color: #656565;
  cursor: not-allowed;
}

.example-row button,
.segmented-button,
.position-button,
.option-button,
.primary-button,
.guide-head button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171717;
  color: var(--text);
  cursor: pointer;
}

.example-row button:hover,
.segmented-button:hover,
.position-button:hover,
.option-button:hover,
.guide-head button:hover {
  border-color: #626262;
}

.control-group {
  margin-top: 24px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

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

.position-button {
  padding: 0 8px;
  font-weight: 800;
}

.segmented-button[aria-pressed="true"] {
  border-color: var(--yellow);
  background: #2c260f;
}

.position-button[aria-pressed="true"] {
  border-color: var(--sky);
  background: #0d2530;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.range-head span {
  color: var(--yellow);
  font-weight: 900;
}

[data-overlay-range] {
  width: 100%;
  accent-color: var(--yellow);
}

.option-grid {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 12px;
  text-align: left;
}

.option-button strong {
  font-size: 15px;
}

.option-button span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.option-button[aria-pressed="true"] {
  border-color: var(--green);
  background: #122111;
}

.preview-toolbar,
.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary-button {
  min-width: 150px;
  padding: 0 16px;
  border-color: #ffffff;
  background: #ffffff;
  color: #050505;
  font-weight: 900;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 420px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0a0a;
  padding: 16px;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  max-height: 680px;
  object-fit: contain;
  border-radius: 6px;
  background: #050505;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.analysis-box {
  min-width: 0;
  padding: 16px;
}

.analysis-box p {
  min-height: 44px;
  color: #d7dbe4;
  line-height: 1.5;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.formula-chip {
  display: inline-grid;
  gap: 2px;
  min-width: 74px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--chip-color), #ffffff 20%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--chip-color), #000000 84%);
}

.formula-chip span {
  color: var(--chip-color);
  font-weight: 900;
}

.formula-chip small {
  color: #c6cbd4;
  font-size: 11px;
}

.guide-head button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

[data-guide] {
  min-height: 210px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 16px;
  }

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

  .editor-panel {
    position: static;
  }

  .analysis-grid,
  .example-row,
  .position-grid {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 280px;
  }

  h1 {
    font-size: 52px;
  }
}
