:root {
  --bg: #05071a;
  --panel: #0a0f2c;
  --panel-2: #0f1638;
  --line: #1e2858;
  --line-2: #2c3878;
  --text: #e9eeff;
  --muted: #8f9bcf;
  --accent: #7fdcff;
  --accent-ink: #03122b;
  --blue: #3d7bff;
  --violet: #9b6bff;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Archivo", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, input, textarea, output { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header + footer */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #03040f;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px var(--line-2); }
.brand-name { font-weight: 700; letter-spacing: .18em; font-size: 15px; }
.brand-tag { color: var(--accent); font-size: 13px; }
.x-link {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2);
}
.x-link svg { width: 16px; height: 16px; stroke: none; }
.x-link:hover { border-color: var(--accent); }

.site-footer {
  margin-top: auto;
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 26px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.site-footer strong { color: var(--text); letter-spacing: .18em; font-size: 13px; }

/* page */
.studio { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 48px; }
.intro h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -.01em; }
.intro h1 span { color: var(--accent); }
.intro p { margin: 8px 0 28px; color: var(--muted); }

.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }

/* settings panel */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 18px; font-weight: 600; }
.panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.block { padding: 16px 0; border-top: 1px solid var(--line); }
.block:first-of-type { border-top: 0; padding-top: 4px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.row-head h3 { margin: 0; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.processing { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; color: var(--muted); padding: 4px 6px; font-size: 13px;
}
.ghost svg { width: 15px; height: 15px; }
.ghost:hover { color: var(--text); }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text);
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 10px; font-weight: 600;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.primary:hover:not(:disabled) { background: #a6e8ff; }
.secondary { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); }
.secondary:hover:not(:disabled) { border-color: var(--accent); }
.small { height: 36px; padding: 0 12px; font-size: 14px; font-weight: 500; }
.link { background: none; border: 0; color: var(--muted); padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }

/* segmented buttons */
.seg {
  display: grid; gap: 4px; padding: 4px;
  background: #070b22; border: 1px solid var(--line); border-radius: 10px;
}
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg button {
  background: none; border: 0; border-radius: 7px; padding: 8px 6px; color: var(--muted); font-size: 14px;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: #17215a; color: var(--text); }

.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* frames */
.frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.frames button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #070b22; border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px 7px;
  color: var(--muted); font-size: 12.5px;
}
.frames button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: #0d1540; }
.frames canvas { width: 100%; max-width: 72px; aspect-ratio: 1; border-radius: 50%; display: block; }

/* swatches */
.swatches { display: flex; gap: 10px; }
.swatches button {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2);
  display: grid; place-items: center; padding: 0;
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.swatches svg { opacity: 0; }
.swatches button[aria-pressed="true"] svg { opacity: 1; }

/* banner text */
.field { display: block; margin: 0 0 6px; }
.field-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); }
.field-label em { color: var(--muted); font-style: normal; font-size: 12px; }
.at-input {
  display: flex; align-items: center; gap: 4px; margin-bottom: 14px;
  background: #070b22; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px;
}
.at-input span { color: var(--muted); }
.at-input input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; height: 42px; }
.at-input:focus-within, textarea:focus { border-color: var(--accent); }
textarea {
  width: 100%; resize: none; background: #070b22; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; outline: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button {
  background: #070b22; border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 11px;
  font-size: 12.5px; color: var(--muted);
}
.chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }

/* work area */
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { grid-template-columns: repeat(3, auto); }
.tabs button { padding: 8px 16px; }
.status { margin: 0; color: var(--muted); font-size: 13px; }

.stage {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 64px 20px 20px;
  min-height: 420px;
  display: flex; flex-direction: column; align-items: center;
}
.history { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }

.view { width: 100%; display: flex; justify-content: center; }
.pfp-disc {
  position: relative; width: min(440px, 100%); aspect-ratio: 1;
  border-radius: 50%; padding: 14px; background: #03040f;
  box-shadow: inset 0 0 0 1px var(--line);
}
#pfp { width: 100%; height: 100%; border-radius: 50%; display: block; cursor: grab; touch-action: none; }
#pfp.empty { cursor: pointer; }
#pfp.dragging, #banner.dragging { cursor: grabbing; }
.photo-btns { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(3,6,20,.82); color: #fff; font-size: 14px; backdrop-filter: blur(6px);
  white-space: nowrap;
}
.pill.round { width: 38px; padding: 0; justify-content: center; }
.pill:hover { border-color: var(--accent); }

#banner { width: 100%; aspect-ratio: 3; display: block; border-radius: 8px; cursor: grab; touch-action: none; }

.profile-card { width: min(600px, 100%); background: #000; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pc-banner { width: 100%; aspect-ratio: 3; display: block; }
.pc-body { position: relative; padding: 0 18px 18px; }
.pc-avatar {
  width: 25%; aspect-ratio: 1; border-radius: 50%; display: block;
  margin-top: -12.5%; border: 4px solid #000; background: #000;
}
.pc-name { margin-top: 10px; font-weight: 700; font-size: 19px; }
.pc-handle { color: #71767b; font-size: 15px; }
.pc-bio { margin: 10px 0 0; font-size: 15px; }

.framing { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; }
.zoom { display: flex; align-items: center; gap: 8px; }
.zoom output { min-width: 52px; text-align: center; font-size: 13px; color: var(--muted); }
.framing-hint { margin: 0; font-size: 13px; color: var(--muted); }

.drop {
  position: absolute; inset: 0; border-radius: var(--radius);
  border: 2px dashed var(--accent); background: rgba(5,7,26,.85);
  display: grid; place-items: center; font-weight: 600; pointer-events: none;
}

.caption { margin: 10px 2px 0; color: var(--muted); font-size: 13px; }

.looks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.looks:empty { display: none; }
.looks button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 8px;
  color: var(--muted); font-size: 12.5px;
}
.looks button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.looks canvas { width: 100%; max-width: 84px; aspect-ratio: 1; border-radius: 50%; display: block; }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }

/* cutout editor */
.editor {
  width: min(500px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 18px;
}
.editor::backdrop { background: rgba(2,3,12,.75); }
.ed-head { display: flex; align-items: center; justify-content: space-between; }
.ed-head h2 { margin: 0; font-size: 20px; }
.ed-sub { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.ed-size { display: grid; grid-template-columns: auto 1fr 52px; align-items: center; gap: 12px; margin: 14px 0 10px; font-size: 13px; }
.ed-size input { accent-color: var(--accent); width: 100%; }
.ed-size output { color: var(--accent); font-size: 13px; }
.ed-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ed-brush { width: 190px; }
.spacer { flex: 1; }
.ed-wrap {
  position: relative; width: min(100%, calc(100vh - 300px)); min-width: 220px; margin: 0 auto;
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background-color: #10163a;
  background-image: linear-gradient(45deg, #182157 25%, transparent 25%), linear-gradient(-45deg, #182157 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #182157 75%), linear-gradient(-45deg, transparent 75%, #182157 75%);
  background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.ed-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: none; }
.ed-cursor {
  position: absolute; border: 2px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6); transform: translate(-50%, -50%);
}
.ed-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.ed-foot .primary, .ed-foot .secondary { height: 40px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .work { order: -1; }
  .stage { padding: 60px 12px 16px; min-height: 0; }
}
@media (max-width: 520px) {
  .looks { grid-template-columns: repeat(3, 1fr); }
  .downloads { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
  .tabs button { padding: 8px 12px; }
}
