:root {
  --bg: #120718; --panel: #1d0f26; --line: #3a2348; --text: #f4ecf7; --muted: #b8a6c4;
  --pink: #ff3480; --gold: #ffd65c; --cyan: #5ff0ff;
  --display: Impact, "Haettenschweiler", "Arial Narrow Bold", "Arial Black", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #4a1650 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 10%, #2a1460 0%, transparent 55%), var(--bg);
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px clamp(16px, 4vw, 40px); }
.brand { font-family: var(--display); font-size: 26px; letter-spacing: .5px; color: #fff; text-decoration: none; }
.brand span { color: var(--pink); }
.langs { display: flex; gap: 4px; }
.langs button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; cursor: pointer; color: var(--muted); font-size: 14px; }
.langs button[aria-pressed="true"] { color: #fff; border-color: var(--line); }

main { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 40px; }
.hero { padding: 12px 0 22px; max-width: 820px; }
.hero h1 {
  font-family: var(--display); font-weight: normal; font-size: clamp(34px, 6vw, 64px); line-height: 1.02; margin: 0 0 12px;
  text-transform: uppercase; text-shadow: 4px 4px 0 var(--pink);
}
.hero p { color: var(--muted); font-size: 18px; margin: 0; }

.studio { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 24px; align-items: start; }
.controls { display: flex; flex-direction: column; gap: 14px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.step h2 { font-family: var(--display); font-weight: normal; font-size: 22px; letter-spacing: .4px; margin: 0 0 12px; text-transform: uppercase; }
.small { color: var(--muted); font-size: 14px; margin: 10px 0 8px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: 22px 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--pink); background: rgba(255, 52, 128, .07); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-ico { font-size: 28px; color: var(--pink); line-height: 1; }
.samples { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sample { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: #000; }
.sample:hover, .sample:focus-visible { border-color: var(--pink); }
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #12081a; border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 8px 6px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--pink); color: #fff; }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style {
  display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px; border-radius: 10px; cursor: pointer;
  background: #150a1d; border: 1px solid var(--line); font-size: 14px; line-height: 1.2;
}
.style .sw { flex: 0 0 34px; height: 34px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .15); }
.style[aria-pressed="true"] { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink) inset; }
.style:hover { border-color: #6a4180; }

.consent, .check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 12px 0; cursor: pointer; }
.consent input, .check input { margin-top: 3px; accent-color: var(--pink); }
.field { display: block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: #12081a; color: #fff; }
.field input:focus { outline: 2px solid var(--pink); outline-offset: 0; }

.btn { border: 1px solid var(--line); background: #241330; padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover:not(:disabled) { border-color: #6a4180; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
#aiGo { width: 100%; }

.preview { position: sticky; top: 16px; }
.stage {
  position: relative; border-radius: 14px; overflow: hidden; background: #0b0410; border: 1px solid var(--line);
  min-height: 320px; display: flex; align-items: center; justify-content: center;
}
.stage canvas { display: block; max-width: 100%; max-height: 78vh; width: auto; height: auto; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.busy {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
  background: rgba(10, 3, 14, .6); backdrop-filter: blur(2px); font-weight: 600;
}
.busy[hidden], .empty[hidden], canvas[hidden] { display: none; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--pink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.msg { min-height: 1.5em; color: var(--gold); margin: 8px 0 0; text-align: right; }

.gallery { margin-top: 56px; }
.gallery h2 { font-family: var(--display); font-weight: normal; font-size: 34px; margin: 0; text-transform: uppercase; text-shadow: 3px 3px 0 var(--pink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.grid a { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: #000; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.grid a:hover img { transform: scale(1.04); }
.privacy { margin-top: 40px; color: var(--muted); font-size: 14px; max-width: 820px; }
.foot { text-align: center; padding: 24px; font-size: 14px; }
.foot a { color: var(--muted); }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .grid img { transition: none; } }
