/* Layout: control column on the left, large live preview on the right; stacks on phones. */
:root {
  --bg: #f2f1f8;
  --panel: #ffffff;
  --fg: #15123a;
  --muted: #64608a;
  --line: #dedcef;
  --accent: #4c44cf;
  --accent-ink: #ffffff;
  --chip: #ecebfd;
  --font-display: "Unbounded", "Archivo", Arial, sans-serif;
  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0930; --panel: #15114a; --fg: #f1efff; --muted: #a9a3e0;
    --line: #2a2570; --accent: #9b93ff; --accent-ink: #0c0930; --chip: #221d66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0930; --panel: #15114a; --fg: #f1efff; --muted: #a9a3e0;
  --line: #2a2570; --accent: #9b93ff; --accent-ink: #0c0930; --chip: #221d66;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body);
  font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 48px;
}
.wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 28px; }
header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.brand { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 5vw, 46px); line-height: 1; margin: 4px 0 0; letter-spacing: .01em; text-wrap: balance; }
.promo { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--chip); color: var(--accent); font-weight: 600; }
.app { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 820px) { .app { grid-template-columns: minmax(0, 1fr); } }
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: grid; gap: 22px; }
.field { display: grid; gap: 8px; min-width: 0; }
label, .label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
input[type=text] {
  font: 800 22px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--fg); width: 100%;
}
input[type=text]:focus-visible { outline: none; border-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.templates { display: grid; gap: 8px; }
.tpl {
  display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 12px; align-items: center;
  text-align: left; padding: 8px; border-radius: 10px; border: 1.5px solid var(--line);
  background: transparent; color: var(--fg); cursor: pointer; font: inherit;
}
.tpl img { width: 44px; height: 55px; object-fit: cover; border-radius: 4px; display: block; }
.tpl strong { display: block; font-size: 14px; }
.tpl span { display: block; font-size: 12px; color: var(--muted); }
.tpl[aria-pressed="true"] { border-color: var(--accent); background: var(--chip); }
.tpl:focus-visible, .seg button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.seg button {
  padding: 10px 6px; border-radius: 8px; border: 1.5px solid var(--line); background: transparent;
  color: var(--fg); font: 600 13px/1.2 var(--font-body); cursor: pointer;
}
.seg button small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--chip); }
.btn {
  display: block; width: 100%; padding: 15px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: 800 16px/1 var(--font-body); letter-spacing: .02em;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.status { font-size: 13px; color: var(--muted); min-height: 1.5em; margin: 0; }
.preview { display: grid; gap: 12px; justify-items: center; min-width: 0; }
.stage { width: 100%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.stage img { max-width: 100%; max-height: 78vh; height: auto; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.meta { font-size: 13px; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: no-preference) { .stage img { transition: opacity .15s; } }
a { color: var(--accent); }
.btn.secondary { background: transparent; color: var(--fg); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; padding: 12px; }
.btn.small { display: inline-block; width: auto; padding: 8px 12px; font-size: 13px; }
.notice { padding: 14px 16px; border-radius: 10px; background: var(--chip); color: var(--fg); font-size: 14px; }

/* ---------- team editor ---------- */
.ed-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 28px; align-items: start; }
@media (max-width: 920px) { .ed-app { grid-template-columns: minmax(0, 1fr); } }
.ed-app .preview { position: sticky; top: 16px; }
@media (max-width: 920px) { .ed-app .preview { position: static; } }
.ed-col { display: grid; gap: 18px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 16px; min-width: 0; }
.panel h2 { font-family: var(--font-display); font-weight: 600; font-size: 17px; margin: 0; }
.ed-input, .ed-area {
  font: 500 15px/1.35 var(--font-body); padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--fg); width: 100%;
}
.ed-area { resize: vertical; min-height: 64px; }
.ed-input:focus-visible, .ed-area:focus-visible { outline: none; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.card { border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel); min-width: 0; }
.card[data-active="true"] { border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.card-head button.title { flex: 1 1 160px; text-align: left; background: none; border: 0; color: var(--fg); font: 700 15px/1.3 var(--font-body); cursor: pointer; padding: 0; min-width: 0; }
.card-head button.title span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.icon-btn { border: 1.5px solid var(--line); background: transparent; color: var(--fg); border-radius: 8px; padding: 6px 9px; font: 600 12px/1 var(--font-body); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.danger:hover { border-color: #d6455d; color: #d6455d; }
.card-body { padding: 0 14px 16px; display: grid; gap: 12px; }
.card-body[hidden] { display: none; }
.publish { display: grid; gap: 12px; }
.publish-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.publish-row .ed-input { flex: 1 1 180px; width: auto; }
.publish-row .btn { flex: 1 1 180px; width: auto; }
.dirty { font-size: 13px; font-weight: 600; color: #c7791a; }
