:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #111;
  color: #f5f5f5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 32px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  flex: 1 0 auto;
}

.panel {
  min-width: 0;
  background: #1b1b1b;
  border: 1px solid #2d2d2d;
  border-radius: 16px;
  padding: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.subtitle {
  margin: 0 0 24px;
  color: #b8b8b8;
  line-height: 1.5;
  overflow-wrap: break-word;
}

label {
  display: block;
  margin-bottom: 16px;
  font-size: 14px;
  color: #ddd;
}

textarea,
input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #101010;
  color: #f5f5f5;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.actions .primary {
  flex: 1 1 140px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  padding: 12px;
}

.icon-btn img {
  display: block;
  width: 22px;
  height: 22px;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #8a8a8a;
}

.status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 13px;
  color: #ffe566;
}

.format {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.format legend {
  margin-bottom: 8px;
  font-size: 14px;
  color: #ddd;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #ddd;
}

.chip input {
  width: auto;
  margin: 0;
  accent-color: #ffe566;
}

button {
  border: 1px solid #444;
  background: #222;
  color: #f5f5f5;
  border-radius: 10px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
}

button.primary {
  background: #ffe566;
  color: #111;
  border-color: #ffe566;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.05);
}

.preview-panel {
  min-width: 0;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  align-self: start;
}

.frame {
  position: relative;
  width: min(540px, 100%);
  aspect-ratio: 1 / 1;
  height: auto;
  background: #f7f3ec;
  overflow: hidden;
}

.frame.is-story {
  width: min(304px, 100%);
  aspect-ratio: 9 / 16;
}

#preview,
.placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.preview-img {
  display: none;
  object-fit: cover;
  border: 0;
}

.preview-img.is-on {
  display: block;
}

.placeholder {
  margin: 0;
  color: #666;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  line-height: 1.5;
}

.site-footer {
  width: 100%;
  margin: 0;
  padding: 8px 16px 28px;
  text-align: center;
  color: #8a8a8a;
  font-size: 14px;
  line-height: 1.5;
}

.site-footer .heart {
  color: #e25555;
}

.site-footer a {
  color: #f5f5f5;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: #ffe566;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 16px 16px 16px;
  }

  .panel {
    padding: 16px;
  }
}
