
:root {
  --accent: #b94a3b;
  --paper: #f1ece4;
  --ink: #242424;
  --muted: #77736e;
  --line: #dfd9cf;
  --control: #ffffff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #171716;
  font-family: Inter, Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

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

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100vh;
  overflow: auto;
  padding: 28px;
  background: #faf8f4;
  border-right: 1px solid #ddd6ca;
}

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

.controls h1,
.controls h2 {
  margin: 0;
}

.controls h1 {
  font-size: 28px;
  line-height: 1.05;
}

.controls h2 {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--control);
  border: 1px solid #e5dfd5;
  border-radius: 8px;
}

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

.control-grid label:has(textarea),
.control-grid label:last-child {
  grid-column: 1 / -1;
}

label,
.file-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #615d58;
}

input[type='text'],
input[type='file'],
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9d2c8;
  border-radius: 7px;
}

textarea {
  resize: vertical;
}

input[type='color'] {
  width: 100%;
  height: 42px;
  padding: 4px;
  background: #fff;
  border: 1px solid #d9d2c8;
  border-radius: 7px;
}

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

.hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #827d75;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--accent);
  background: #fff;
  border: 1px solid #ded6cb;
  border-radius: 8px;
  cursor: pointer;
}

.export-button,
.download-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.download-link {
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--accent);
}

.download-link[hidden] {
  display: none;
}

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

.option-row {
  display: grid;
  grid-template-columns: 18px minmax(96px, 0.8fr) minmax(150px, 1.2fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fbfaf7;
  border: 1px solid #e4ded4;
  border-radius: 8px;
}

.option-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.option-row span {
  color: #4f4b46;
  font-size: 12px;
  font-weight: 800;
}

.stage {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 32px;
  overflow: auto;
}

.phone {
  width: min(405px, calc(100vw - 48px));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
  border-radius: 0;
}

.story-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

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

  .controls {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid #ddd6ca;
  }

  .stage {
    min-height: 760px;
  }
}

@media (max-width: 560px) {
  .controls {
    padding: 18px;
  }

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

  .stage {
    padding: 18px;
  }
}
