:root {
  --bg: #f4f1eb;
  --panel: #fffaf2;
  --panel-strong: #ffffff;
  --ink: #1d1d1f;
  --muted: #6f6a61;
  --line: #ddd5c9;
  --accent: #116a5b;
  --accent-ink: #0c4b41;
  --danger: #be123c;
  --shadow: 0 20px 60px rgba(44, 35, 20, 0.14);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

input,
select,
textarea {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  line-height: 1.5;
  resize: vertical;
}

.app {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(300px, 330px) minmax(520px, 1fr) minmax(300px, 340px);
  height: 100vh;
  overflow: hidden;
  padding: 14px;
}

.sidebar,
.editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.sidebar {
  grid-column: 1;
}

.brand {
  padding: 10px 4px 0;
}

.brand p,
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 32px;
  line-height: 1.05;
  margin-bottom: 0;
}

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

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

.panel,
.editor {
  padding: 14px;
}

.panel label,
.edit-card label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 900;
  gap: 7px;
  margin-top: 10px;
}

.primary,
.panel button:not(.style-chip),
.caption-box button {
  background: var(--accent);
  color: white;
  margin-top: 12px;
  width: 100%;
}

.primary:hover,
.panel button:not(.style-chip):hover {
  background: var(--accent-ink);
}

.two-col {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

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

.style-chip {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0 12px;
  text-align: left;
}

.secondary {
  background: var(--panel-strong) !important;
  border: 1px solid var(--line);
  color: var(--ink) !important;
}

.style-chip.is-active {
  background: var(--accent);
  color: white;
}

.collapsible-panel {
  display: block;
}

.collapsible-panel summary {
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 18px;
  font-weight: 950;
  justify-content: space-between;
  list-style: none;
  min-height: 32px;
}

.collapsible-panel summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel summary::after {
  color: var(--accent);
  content: "+";
  font-size: 22px;
  font-weight: 950;
}

.collapsible-panel[open] summary {
  margin-bottom: 12px;
}

.collapsible-panel[open] summary::after {
  content: "−";
}

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

.button-grid button {
  margin-top: 0 !important;
}

.button-grid .primary {
  grid-column: 1 / -1;
}

.status-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  margin: 10px 0 0;
  min-height: 18px;
}

.festival-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  scrollbar-width: thin;
}

.festival-item {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 4px;
  min-height: auto;
  padding: 10px;
  text-align: left;
}

.festival-item:hover {
  border-color: var(--accent);
}

.festival-item strong {
  font-size: 14px;
  line-height: 1.3;
}

.festival-item span,
.festival-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.stage {
  display: grid;
  grid-column: 2;
  grid-template-rows: auto minmax(0, 1fr) 92px;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

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

.stage-head h2 {
  font-size: 23px;
  margin-bottom: 0;
}

.pager {
  align-items: center;
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.pager button {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  font-size: 28px;
  justify-content: center;
  width: 42px;
}

.pager span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.preview-wrap {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 10px 0;
}

.card-preview {
  aspect-ratio: 4 / 5;
  border-radius: 10px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: min(100%, 700px);
  max-width: min(560px, 100%);
  overflow: hidden;
  padding: 42px;
  position: relative;
  width: auto;
}

.card-top,
.card-bottom {
  align-items: center;
  display: flex;
  font-size: 18px;
  font-weight: 950;
  justify-content: space-between;
}

.card-main {
  align-content: center;
  display: grid;
  gap: 24px;
}

.card-main h3 {
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 950;
  line-height: 1.08;
  margin: 0;
  word-break: keep-all;
}

.card-main p {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 750;
  line-height: 1.38;
  margin: 0;
  white-space: pre-line;
  word-break: keep-all;
}

.style-cream {
  background: #fff4df;
  color: #171717;
}

.style-cream::before {
  background: #116a5b;
  content: "";
  height: 12px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.style-cream .card-main h3 {
  color: #0c4b41;
}

.style-mono {
  background: #111111;
  color: #f8f8f5;
}

.style-mono .card-main p {
  color: #d7d7cf;
}

.style-mono .card-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 18px;
}

.style-pop {
  background: #ffdf4d;
  color: #141414;
}

.style-pop::after {
  background: #ef3d5b;
  border-radius: 999px;
  content: "";
  height: 160px;
  position: absolute;
  right: -60px;
  top: 120px;
  width: 160px;
}

.style-pop .card-main h3,
.style-pop .card-main p {
  position: relative;
  z-index: 1;
}

.style-pop .card-main p {
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 16px;
}

.style-premium {
  background: #061020;
  color: #fff;
  display: grid;
  grid-template-rows: 69% 31%;
  padding: 0;
}

.style-premium::before {
  border: 1px solid rgba(212, 175, 55, 0.52);
  border-radius: 8px;
  content: "";
  inset: 16px;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.style-premium::after {
  display: none;
}

.premium-image-stage {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.premium-image-stage::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.08) 58%, rgba(0, 0, 0, 0.46));
  content: "";
  inset: 0;
  position: absolute;
}

.premium-image-stage img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.premium-topline {
  align-items: center;
  color: #ffffff;
  display: flex;
  font-size: 18px;
  font-weight: 950;
  justify-content: space-between;
  left: 34px;
  position: absolute;
  right: 34px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
  text-transform: uppercase;
  top: 32px;
  z-index: 2;
}

.premium-copy-panel {
  background: linear-gradient(135deg, #071426, #05070d);
  border-top: 4px solid #d4af37;
  display: grid;
  gap: 7px;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  padding: 18px 34px 22px;
}

.premium-copy-panel h3 {
  color: #ffffff;
  font-size: clamp(22px, 2.85vw, 32px);
  font-weight: 950;
  line-height: 1.08;
  margin: 0;
  word-break: keep-all;
}

.premium-copy-panel p {
  color: #f9f3df;
  font-size: clamp(13px, 1.48vw, 17px);
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  white-space: pre-line;
  word-break: keep-all;
}

.premium-bottomline {
  align-items: center;
  color: #f7e8b1;
  display: flex;
  font-size: 16px;
  font-weight: 950;
  justify-content: space-between;
  text-transform: uppercase;
}

.style-premium.text-medium .premium-copy-panel {
  gap: 6px;
  padding: 17px 32px 20px;
}

.style-premium.text-medium .premium-copy-panel h3 {
  font-size: clamp(20px, 2.45vw, 29px);
  line-height: 1.06;
}

.style-premium.text-medium .premium-copy-panel p {
  font-size: clamp(12px, 1.3vw, 15px);
  line-height: 1.24;
}

.style-premium.text-dense {
  grid-template-rows: 62% 38%;
}

.style-premium.text-dense .premium-copy-panel {
  gap: 5px;
  padding: 14px 30px 18px;
}

.style-premium.text-dense .premium-copy-panel h3 {
  font-size: clamp(18px, 2.15vw, 25px);
  line-height: 1.04;
}

.style-premium.text-dense .premium-copy-panel p {
  font-size: clamp(11px, 1.15vw, 13px);
  line-height: 1.2;
}

.style-premium.text-dense .premium-bottomline {
  font-size: 14px;
}

.style-photo {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.18) 38%, rgba(0, 0, 0, 0.78)),
    var(--photo-bg),
    linear-gradient(135deg, #777, #222);
  background-position: center;
  background-size: cover;
  color: #fff;
  padding: 0;
}

.style-photo::before {
  background: rgba(0, 0, 0, 0.18);
  content: "";
  inset: 0;
  position: absolute;
}

.photo-brand {
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 0;
  position: absolute;
  right: 36px;
  text-align: right;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  text-transform: uppercase;
  top: 34px;
  z-index: 1;
}

.photo-copy {
  bottom: 118px;
  left: 44px;
  position: absolute;
  right: 44px;
  z-index: 1;
}

.photo-copy h3 {
  color: #fff;
  font-size: clamp(36px, 4.7vw, 56px);
  font-weight: 950;
  line-height: 1.12;
  margin: 0 0 10px;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.72);
  word-break: keep-all;
}

.photo-copy p {
  background: #c00000;
  box-decoration-break: clone;
  color: #fff;
  display: inline;
  font-size: clamp(23px, 2.8vw, 33px);
  font-weight: 950;
  line-height: 1.42;
  padding: 3px 9px 5px;
  text-shadow: none;
  white-space: pre-line;
  word-break: keep-all;
}

.photo-footer {
  align-items: center;
  bottom: 38px;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  font-size: 15px;
  font-weight: 900;
  justify-content: space-between;
  left: 44px;
  position: absolute;
  right: 44px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.filmstrip {
  display: grid;
  gap: 10px;
  grid-auto-flow: column;
  grid-auto-columns: 128px;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 10px;
  scrollbar-width: thin;
}

.thumb {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 6px;
  height: 78px;
  min-height: 0;
  padding: 10px;
  text-align: left;
}

.thumb span {
  color: var(--accent);
  font-size: 12px;
}

.thumb strong {
  font-size: 13px;
  line-height: 1.25;
  max-height: 34px;
  overflow: hidden;
}

.thumb.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.editor {
  grid-column: 3;
  max-height: none;
  overflow: auto;
}

.editor header {
  display: block;
}

.card-editors {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.edit-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.edit-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.edit-card-head span {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.edit-card-head strong {
  color: var(--muted);
  font-size: 13px;
}

.edit-card.is-active {
  border-color: var(--accent);
}

.caption-box {
  border-left: 0;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  min-width: 0;
  padding-left: 0;
  padding-top: 18px;
}

.caption-box textarea {
  min-height: 150px;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    overflow: visible;
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .editor {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 12px;
  }

  .sidebar,
  .stage,
  .editor {
    grid-column: auto;
    grid-row: auto;
  }

  .stage {
    order: -1;
  }

  .editor {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .caption-box {
    border-left: 0;
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-left: 0;
    padding-top: 14px;
  }

  .stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-preview {
    padding: 28px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}
