@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/space-grotesk-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "StarzoomShavian";
  src: url("/assets/starzoom-shavian.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --base-100: oklch(15% .04 270);
  --base-200: oklch(10% .02 270);
  --base-300: oklch(5% .01 270);
  --content: oklch(98% 0 0);
  --primary: oklch(70% .3 330);
  --secondary: oklch(75% .3 85);
  --accent: oklch(70% .3 180);
  --dark-200: oklch(65% .15 270);
  --dark-400: oklch(45% .15 270);
  --dark-600: oklch(25% .08 270);
  font-family: "Space Grotesk", sans-serif;
  color: var(--content);
  background: var(--base-300);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(oklch(5% .01 270 / .76), oklch(5% .01 270 / .95)),
    url("/assets/wts-bg.webp") center / cover fixed,
    var(--base-300);
}

body::before {
  content: "";
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .12) 3px 4px);
  mix-blend-mode: multiply;
  opacity: .48;
}

button,
input { font: inherit; }

button,
label[for] { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 46px;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 7px 4px 12px;
  border-bottom: 1px solid oklch(60% .25 330 / .62);
  background: oklch(5% .01 270 / .7);
  box-shadow: 0 10px 30px rgba(0,0,0,.26);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 39px; height: 50px; object-fit: contain; }

.brand-wordmark {
  margin: 0 0 -2px;
  color: var(--secondary);
  font-family: "StarzoomShavian", sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  letter-spacing: .015em;
}

.brand h1 {
  margin: 0;
  color: var(--secondary);
  font-family: "StarzoomShavian", sans-serif;
  font-size: .9rem;
  line-height: 1.2;
  letter-spacing: .11em;
}

.ticket-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  overflow: hidden;
  border: 2px solid color-mix(in oklch, var(--primary), transparent 50%);
  border-radius: 2px;
  color: #fff;
  background: color-mix(in oklch, var(--primary), transparent 90%);
  box-shadow: 0 0 15px color-mix(in oklch, var(--primary), transparent 70%);
  backdrop-filter: blur(5px);
  font-family: "StarzoomShavian", sans-serif;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  user-select: none;
  transition: all .4s ease;
}

.ticket-cta:hover,
.ticket-cta:focus-visible {
  background: color-mix(in oklch, var(--primary), transparent 80%);
  border-color: oklch(78% .25 330);
  box-shadow: 0 0 25px color-mix(in oklch, var(--primary), transparent 50%);
}

.btn-hologram .scan-line {
  position: absolute;
  top: 0;
  left: 20px;
  width: 100%;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  filter: blur(1px);
  opacity: .8;
  animation: scan-button 2s linear infinite;
}

.btn-hologram .text-content {
  position: relative;
  display: inline-block;
  text-shadow: 0 0 8px color-mix(in oklch, var(--primary), transparent 50%);
}

.btn-hologram .text-content::before,
.btn-hologram .text-content::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: blur(1px);
  opacity: 0;
  transition: all .3s ease;
}

.btn-hologram:hover .text-content::before {
  color: var(--accent);
  opacity: 1;
  transform: translateX(-2px);
  animation: glitch-button 2s infinite;
}

.btn-hologram:hover .text-content::after {
  color: oklch(75% .25 85);
  opacity: 1;
  transform: translateX(2px);
  animation: glitch-button 2s infinite reverse;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid oklch(80% .25 180 / .38);
  border-radius: 4px;
  color: oklch(90% .1 180);
  background: oklch(10% .02 270 / .74);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.privacy-note svg { width: 18px; fill: var(--accent); }

.workspace {
  min-height: calc(100vh - 122px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid oklch(60% .25 330 / .48);
  border-radius: 4px;
  background: oklch(5% .01 270 / .86);
  box-shadow: 0 0 0 1px oklch(80% .25 180 / .05), 0 30px 80px rgba(0,0,0,.6), 0 0 34px oklch(60% .25 330 / .08);
}

.preview-panel {
  min-width: 0;
  padding: 30px;
  border-right: 1px solid oklch(60% .25 330 / .35);
  background:
    radial-gradient(circle at 16% 16%, oklch(60% .25 330 / .11), transparent 26rem),
    radial-gradient(circle at 84% 84%, oklch(70% .3 180 / .08), transparent 26rem),
    linear-gradient(oklch(5% .01 270 / .88), oklch(8% .02 270 / .95));
}

.preview-heading {
  max-width: 790px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 20px;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--secondary);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .15em;
}

.preview-heading h2 {
  margin: 0;
  color: var(--primary);
  font-family: "StarzoomShavian", sans-serif;
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.size-label { color: oklch(82% .15 85); font-size: .75rem; font-weight: 600; letter-spacing: .06em; }

.canvas-stage {
  position: relative;
  width: min(100%, 690px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid oklch(65% .15 270 / .38);
  border-radius: 2px;
  background: #020303;
  box-shadow: 0 30px 70px rgba(0,0,0,.65), -10px 0 35px oklch(60% .25 330 / .08), 10px 0 35px oklch(70% .3 180 / .06);
}

#cardCanvas { width: 100%; height: auto; aspect-ratio: 4 / 5; display: block; }

.empty-photo {
  position: absolute;
  left: 28.5%;
  top: 29%;
  width: 45%;
  height: 29%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 5px;
  border: 1px dashed oklch(80% .25 180 / .64);
  border-radius: 4px;
  color: white;
  background: oklch(5% .01 270 / .54);
  backdrop-filter: blur(3px);
  cursor: pointer;
  transform: rotate(5deg);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.empty-photo:hover {
  border-color: var(--primary);
  background: oklch(15% .04 270 / .86);
  box-shadow: 0 0 20px oklch(70% .3 330 / .2);
}

.empty-photo.hidden { opacity: 0; pointer-events: none; }

.empty-photo-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border: 1px solid oklch(80% .25 180 / .5);
  border-radius: 3px;
  color: var(--accent);
  background: oklch(30% .1 180 / .25);
}

.empty-photo svg { width: 22px; fill: currentColor; }
.empty-photo strong { font-size: clamp(.78rem, 1.7vw, 1rem); text-transform: uppercase; letter-spacing: .04em; }
.empty-photo small { color: oklch(78% .04 270); font-size: clamp(.65rem, 1.35vw, .78rem); }

.drop-scrim {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 3px solid var(--accent);
  color: white;
  background: oklch(5% .01 270 / .86);
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.drop-scrim.visible { opacity: 1; }

.control-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 32px;
  background: linear-gradient(180deg, oklch(12% .035 270 / .97), oklch(7% .02 270 / .98));
}

.control-section { display: grid; gap: 16px; }
.control-heading { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 12px; }
.control-heading.compact { grid-template-columns: 34px 1fr auto; }

.control-heading h2 {
  margin: 0 0 3px;
  color: var(--primary);
  font-family: "StarzoomShavian", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.control-heading p { margin: 0; color: oklch(65% .05 270); font-size: .8rem; }

.step {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid oklch(80% .25 85 / .64);
  border-radius: 2px;
  color: var(--secondary);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
}

.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.button {
  position: relative;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 3px;
  color: white;
  background: oklch(10% .02 270 / .66);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.button::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  width: 120%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
}

.button:hover { transform: translateY(-1px); }
.button:hover::after { opacity: .9; animation: wts-scan 1.2s linear infinite; }
.button:active { transform: translateY(0); }
.button svg { width: 18px; fill: currentColor; }

.button-primary {
  border-color: oklch(70% .3 330 / .84);
  box-shadow: inset 0 0 18px oklch(70% .3 330 / .08);
}

.button-primary:hover { box-shadow: inset 0 0 22px oklch(70% .3 330 / .12), 0 0 18px oklch(70% .3 330 / .18); }
.button-secondary { border-color: oklch(80% .25 180 / .5); }

kbd {
  padding: 2px 5px;
  border: 1px solid oklch(45% .15 270 / .62);
  border-radius: 2px;
  color: oklch(65% .05 270);
  background: rgba(0,0,0,.3);
  font-family: inherit;
  font-size: .65rem;
}

.divider {
  height: 1px;
  margin: 26px 0;
  background: linear-gradient(90deg, oklch(70% .3 330 / .08), oklch(70% .3 330 / .48), oklch(80% .25 180 / .12));
}

.field-label {
  margin-bottom: -8px;
  color: oklch(85% .06 270);
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.text-field { position: relative; }

.text-field input {
  width: 100%;
  height: 50px;
  padding: 0 72px 0 14px;
  border: 1px solid oklch(45% .15 270 / .48);
  border-radius: 3px;
  outline: 0;
  color: var(--content);
  background: oklch(5% .01 270 / .82);
  font-size: .95rem;
  font-weight: 600;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.text-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px oklch(70% .3 330 / .35), 0 0 16px oklch(70% .3 330 / .12);
}

.text-field span { position: absolute; top: 50%; right: 13px; color: oklch(65% .05 270); font-size: .7rem; transform: translateY(-50%); }

.post-section textarea {
  width: 100%;
  min-height: 168px;
  padding: 13px 14px;
  resize: vertical;
  border: 1px solid oklch(45% .15 270 / .48);
  border-radius: 3px;
  outline: 0;
  color: var(--content);
  background: oklch(5% .01 270 / .82);
  font: 400 .84rem/1.5 "Space Grotesk", sans-serif;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.post-section textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px oklch(70% .3 330 / .35), 0 0 16px oklch(70% .3 330 / .12);
}

.caption-copy-button { width: 100%; }

.text-button {
  align-self: center;
  padding: 5px;
  border: 0;
  color: var(--secondary);
  background: none;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.adjust-section[data-disabled="true"] .range-control { opacity: .36; pointer-events: none; }
.range-control { display: grid; gap: 8px; }
.range-control label { display: flex; justify-content: space-between; color: oklch(78% .05 270); font-size: .75rem; }
.range-control output { color: oklch(65% .05 270); }

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 7px 0;
  appearance: none;
  border-radius: 0;
  outline: none;
  background: linear-gradient(90deg, var(--primary) var(--range-progress, 0%), var(--dark-600) var(--range-progress, 0%));
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid var(--primary);
  border-radius: 2px;
  background: white;
  box-shadow: 0 0 10px oklch(70% .3 330 / .42);
  cursor: grab;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--primary);
  border-radius: 2px;
  background: white;
  cursor: grab;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 30px;
}

.download-button {
  position: relative;
  width: 100%;
  min-height: 66px;
  padding: 11px 12px;
  overflow: hidden;
  border: 2px solid oklch(60% .25 330 / .9);
  border-radius: 3px;
  color: white;
  background: oklch(7% .02 270 / .74);
  box-shadow: inset 0 0 26px oklch(70% .3 330 / .08), 0 0 24px oklch(70% .3 330 / .12);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.download-button::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, oklch(80% .25 180 / .08), transparent 38%, oklch(70% .3 330 / .12), oklch(80% .25 85 / .08));
}

.download-button:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: inset 0 0 32px oklch(70% .3 330 / .16), 0 0 28px oklch(70% .3 330 / .2);
}

.copy-button {
  border-color: oklch(70% .3 180 / .72);
  box-shadow: inset 0 0 26px oklch(70% .3 180 / .07), 0 0 20px oklch(70% .3 180 / .08);
}

.copy-button:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 32px oklch(70% .3 180 / .14), 0 0 26px oklch(70% .3 180 / .16);
}

.download-button:active { transform: translateY(0); }

.download-button span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-shadow: 0 0 8px oklch(70% .3 330 / .55);
}

.download-button svg { width: 20px; fill: currentColor; }
.download-button small { display: block; margin-top: 2px; color: oklch(82% .12 85); font-size: .68rem; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border: 1px solid oklch(70% .3 330 / .58);
  border-radius: 3px;
  color: white;
  background: oklch(10% .02 270 / .97);
  box-shadow: 0 0 24px oklch(70% .3 330 / .16), 0 12px 40px rgba(0,0,0,.5);
  font-size: .82rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.visible { opacity: 1; transform: translate(-50%, 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

@keyframes wts-scan {
  from { transform: translateY(0); }
  to { transform: translateY(72px); }
}

@keyframes glitch-button {
  0%, 100% { transform: translateX(0); opacity: .3; }
  20% { transform: translateX(-5px); opacity: .5; }
  40% { transform: translateX(5px); opacity: .7; }
  60% { transform: translateX(-3px); opacity: .5; }
  80% { transform: translateX(3px); opacity: .3; }
}

@keyframes scan-button {
  from { top: -10%; }
  to { top: 110%; }
}

@media (max-width: 980px) {
  .app-shell { width: min(100% - 28px, 760px); }
  .workspace { grid-template-columns: 1fr; }
  .preview-panel { border-right: 0; border-bottom: 1px solid oklch(60% .25 330 / .35); }
  .export-actions { margin-top: 30px; padding-top: 0; }
}

@media (max-width: 560px) {
  .app-shell { width: 100%; padding: 12px 14px 28px; }
  .brand-logo { width: 32px; height: 42px; }
  .brand-wordmark { font-size: 1.05rem; }
  .brand h1 { font-size: .76rem; }
  .ticket-cta { min-height: 40px; padding: 9px 12px; font-size: .66rem; }
  .privacy-note { width: 35px; height: 35px; padding: 0; justify-content: center; font-size: 0; }
  .workspace { margin-top: 16px; border-radius: 3px; }
  .preview-panel { padding: 20px 14px 22px; }
  .preview-heading { margin-bottom: 14px; }
  .preview-heading h2 { font-size: 1.05rem; }
  .control-panel { padding: 26px 20px; }
  .photo-actions { grid-template-columns: 1fr; }
  .empty-photo-icon { width: 34px; height: 34px; }
  .empty-photo strong { font-size: .7rem; }
  .empty-photo small { display: none; }
}

@media (max-width: 390px) {
  .export-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .btn-hologram .scan-line,
  .btn-hologram:hover .text-content::before,
  .btn-hologram:hover .text-content::after { animation: none; opacity: 0; transform: none; }
}
