:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f8f1dc;
  background: #0b0c12;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 25% 0%, #27123a 0, #0b0c12 42rem); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
main { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 64px; }
.hidden { display: none !important; }

.hero { min-height: 390px; display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; padding: 72px 0 52px; }
.hero h1 { max-width: 880px; margin: 8px 0 18px; font-size: clamp(3rem, 7vw, 6.4rem); line-height: .87; letter-spacing: -.065em; text-transform: uppercase; }
.hero-copy { max-width: 720px; margin: 0; color: #d7cfe0; font-size: clamp(1rem, 2vw, 1.28rem); line-height: 1.55; }
.eyebrow { margin: 0; color: #ffdd55; font-size: .77rem; font-weight: 900; letter-spacing: .22em; text-transform: uppercase; }
.hero-sticker { transform: rotate(6deg); border: 7px double #1c1730; background: #f7efc9; color: #17111d; padding: 24px 20px; border-radius: 8px; box-shadow: 12px 14px 0 #ff2d8d; font-weight: 1000; font-size: 1.22rem; line-height: 1.05; text-align: center; }

.template-section, .creator-layout, .next-strip { border: 1px solid rgba(255,255,255,.12); background: rgba(20,20,31,.82); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.template-section { padding: 28px; border-radius: 24px 24px 0 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h2, .controls-panel h2, .next-strip h2, .lead-modal h2 { margin: 6px 0 0; font-size: clamp(1.8rem, 4vw, 3rem); line-height: .96; text-transform: uppercase; }
.section-heading > span { color: #aaa2b7; font-size: .86rem; }
.template-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.template-card { position: relative; min-height: 270px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 16px; background: #151420; color: white; text-align: left; transition: transform .18s ease, border-color .18s ease; }
.template-card:hover { transform: translateY(-3px); }
.template-card.active { border-color: #ffdd55; box-shadow: 0 0 0 3px rgba(255,221,85,.16); }
.template-card img { width: 100%; height: 270px; object-fit: cover; object-position: center 34%; filter: saturate(.92) contrast(1.04); }
.template-card div { position: absolute; inset: auto 0 0; padding: 52px 14px 14px; background: linear-gradient(transparent, rgba(0,0,0,.96)); }
.template-card small { display: block; color: #ffdd55; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.template-card strong { display: block; margin-top: 4px; font-size: 1rem; line-height: 1.1; }

.creator-layout { display: grid; grid-template-columns: minmax(300px, 430px) 1fr; gap: 28px; padding: 28px; border-top: 0; border-radius: 0 0 24px 24px; }
.controls-panel { display: flex; flex-direction: column; gap: 15px; }
.controls-panel label { display: grid; gap: 7px; color: #e3ddea; font-size: .88rem; font-weight: 800; }
.upload-box { min-height: 120px; place-content: center; padding: 20px; border: 2px dashed rgba(255,255,255,.28); border-radius: 16px; background: linear-gradient(135deg, rgba(255,45,141,.1), rgba(37,243,255,.07)); text-align: center; cursor: pointer; }
.upload-box input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-box strong { color: #fff3a1; font-size: 1rem; }
.upload-box span { color: #a9a1b3; font-size: .8rem; font-weight: 500; }
.original-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); color: #aaa2b7; font-size: .78rem; }
.original-preview img { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; }
.range-control > span { display: flex; justify-content: space-between; gap: 12px; }
.range-control > span strong { color: #ffdd55; }
.controls-panel input[type="range"] { width: 100%; height: 28px; accent-color: #ffdd55; }
.button-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; margin-top: 5px; }
.primary, .secondary { min-height: 48px; border-radius: 10px; padding: 10px 14px; font-weight: 1000; letter-spacing: .04em; }
.primary { border: 0; background: #ffdd55; color: #17111d; box-shadow: 5px 6px 0 #ff2d8d; }
.primary:hover:not(:disabled) { transform: translate(-1px,-1px); box-shadow: 7px 8px 0 #ff2d8d; }
.secondary { border: 1px solid rgba(255,255,255,.25); background: transparent; color: white; }
.wide { width: 100%; }
.notice, .error-box { margin: 0; padding: 11px 12px; border-radius: 10px; font-size: .83rem; line-height: 1.4; }
.notice { background: rgba(55,242,255,.09); color: #bdfaff; }
.error-box { background: rgba(255,68,68,.13); color: #ffc2c2; }

.cover-column { min-width: 0; display: grid; justify-items: center; align-content: start; }
.cover-shell { width: min(100%, 600px); overflow: hidden; border: 10px solid #18141b; border-radius: 6px; background: #111; box-shadow: 20px 22px 0 rgba(0,0,0,.42), 0 0 55px rgba(255,45,141,.15); }
.cover-shell canvas { display: block; width: 100%; height: auto; touch-action: none; }
.editor-tip { margin: 16px 0 0; color: #9f98aa; font-size: .85rem; text-align: center; }
.next-strip { margin-top: 28px; padding: 28px; border-radius: 22px; }
.next-strip h2 { max-width: 900px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,3,8,.82); backdrop-filter: blur(8px); }
.lead-modal { position: relative; width: min(680px, 100%); max-height: 92vh; overflow: auto; padding: 30px; border: 1px solid rgba(255,255,255,.16); border-radius: 22px; background: #161520; box-shadow: 0 30px 120px rgba(0,0,0,.65); }
.lead-modal h2 { margin-bottom: 22px; }
.modal-close { position: absolute; top: 12px; right: 15px; border: 0; background: transparent; color: white; font-size: 2rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-grid label { display: grid; gap: 7px; color: #e3ddea; font-size: .86rem; font-weight: 800; }
.field-grid label span { color: #88818f; font-weight: 500; }
.field-grid input { width: 100%; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: #0c0d14; color: white; padding: 11px 12px; outline: none; }
.field-grid input:focus { border-color: #ffdd55; box-shadow: 0 0 0 3px rgba(255,221,85,.12); }
.full-field { grid-column: 1 / -1; }
.consent-list { display: grid; gap: 12px; margin: 20px 0; }
.check-row { display: grid; grid-template-columns: 20px 1fr; gap: 10px; color: #c9c2d1; font-size: .83rem; line-height: 1.4; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: #ffdd55; }
.fine-print { margin: 13px 0 0; color: #817a88; font-size: .72rem; text-align: center; }

@media (max-width: 1060px) {
  .template-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  main { width: min(100% - 20px, 700px); }
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-sticker { justify-self: start; font-size: .95rem; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .template-card, .template-card img { height: 220px; min-height: 220px; }
  .creator-layout { grid-template-columns: 1fr; }
  .cover-column { grid-row: 1; }
  .controls-panel { grid-row: 2; }
}

@media (max-width: 520px) {
  .hero h1 { font-size: 3.1rem; }
  .template-section, .creator-layout, .next-strip { padding: 18px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .template-grid { grid-template-columns: 1fr; }
  .template-card, .template-card img { height: 180px; min-height: 180px; }
  .field-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .button-row { grid-template-columns: 1fr; }
  .lead-modal { padding: 25px 18px; }
}
