/* SMAU FILE
 * Path: css/smau-studio2-world.css
 * Owns: Creator Studio 2.0 — World workspace visuals ONLY. Generic Studio 2.0
 *       primitives (.s2-screen, .s2-head, .s2-row, .s2-card, .s2-field,
 *       .s2-btn, .s2-chip, .s2-seg, .s2-empty, .s2-count, .s2-save-state, …)
 *       are owned by css/smau-studio2.css; every rule here is scoped to a
 *       w2- prefixed class so the two files never fight over the same name.
 * Depends: css/smau-studio2.css tokens on #studio-root — --s2-accent,
 *          --s2-accent-strong, --s2-accent-soft, --s2-ok, --s2-warn,
 *          --s2-danger, --s2-ink, --s2-muted, --s2-card, --s2-card-border,
 *          --s2-radius. Falls back to sane defaults if a token is ever
 *          missing so this file never renders blank.
 */

#studio-root {
  --w2-accent: var(--s2-accent, #8b7cf8);
  --w2-accent-strong: var(--s2-accent-strong, #a297ff);
  --w2-accent-soft: var(--s2-accent-soft, rgba(139, 124, 248, 0.16));
  --w2-ok: var(--s2-ok, #3ecf8e);
  --w2-warn: var(--s2-warn, #ffb454);
  --w2-danger: var(--s2-danger, #ff5c5c);
  --w2-ink: var(--s2-ink, rgba(238, 240, 248, 0.94));
  --w2-muted: var(--s2-muted, rgba(238, 240, 248, 0.55));
  --w2-card: var(--s2-card, rgba(255, 255, 255, 0.035));
  --w2-card-border: var(--s2-card-border, rgba(255, 255, 255, 0.09));
  --w2-radius: var(--s2-radius, 16px);
}

@media (prefers-color-scheme: light) {
  #studio-root {
    --w2-card: var(--s2-card, rgba(20, 20, 30, 0.035));
    --w2-card-border: var(--s2-card-border, rgba(20, 20, 30, 0.12));
    --w2-ink: var(--s2-ink, rgba(20, 20, 30, 0.92));
    --w2-muted: var(--s2-muted, rgba(20, 20, 30, 0.55));
  }
}

/* Explicit theme toggle wins over the OS media query in both directions —
   specificity (:root[data-theme] #studio-root) beats the plain #studio-root
   selector above regardless of source order. */
:root[data-theme="light"] #studio-root {
  --w2-card: var(--s2-card, rgba(20, 20, 30, 0.035));
  --w2-card-border: var(--s2-card-border, rgba(20, 20, 30, 0.12));
  --w2-ink: var(--s2-ink, rgba(20, 20, 30, 0.92));
  --w2-muted: var(--s2-muted, rgba(20, 20, 30, 0.55));
}

:root[data-theme="dark"] #studio-root {
  --w2-card: var(--s2-card, rgba(255, 255, 255, 0.035));
  --w2-card-border: var(--s2-card-border, rgba(255, 255, 255, 0.09));
  --w2-ink: var(--s2-ink, rgba(238, 240, 248, 0.94));
  --w2-muted: var(--s2-muted, rgba(238, 240, 248, 0.55));
}

/* ── Home ──────────────────────────────────────────────────────── */

.w2-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.w2-summary-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--w2-ink);
}

/* ── Avatars ───────────────────────────────────────────────────── */

.w2-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
}

.w2-avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

/* ── Badges ────────────────────────────────────────────────────── */

.w2-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.w2-badge--resident {
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
}

.w2-badge--character {
  background: rgba(255, 255, 255, 0.08);
  color: var(--w2-muted);
}

.w2-badge--player {
  background: rgba(62, 207, 142, 0.16);
  color: var(--w2-ok);
}

/* Relationship status badges (relationCardHTML) — real read of a real
   status word, not a fabricated health score. */
.w2-badge--ok {
  background: rgba(62, 207, 142, 0.16);
  color: var(--w2-ok);
}

.w2-badge--warn {
  background: rgba(255, 180, 84, 0.16);
  color: var(--w2-warn);
}

.w2-badge--danger {
  background: rgba(255, 92, 92, 0.14);
  color: var(--w2-danger);
}

.w2-badge--accent {
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
}

/* ── People list ───────────────────────────────────────────────── */

.w2-banner {
  padding: 10px 14px;
  border-radius: var(--w2-radius);
  background: var(--w2-accent-soft);
  color: var(--w2-ink);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.w2-search-input {
  margin-bottom: 12px;
}

.w2-people-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.w2-person-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  cursor: pointer;
  min-height: 44px;
}

.w2-person-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.w2-person-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.w2-person-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--w2-ink);
}

.w2-person-sub {
  font-size: 12.5px;
  color: var(--w2-muted);
}

.w2-person-status {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--w2-ok);
}

.w2-person-role {
  font-size: 11px;
  color: var(--w2-muted);
}

.w2-add-person-btn {
  width: 100%;
}

/* ── Person overview ───────────────────────────────────────────── */

.w2-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 24px 16px;
  margin-bottom: 12px;
}

.w2-profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--w2-ink);
}

.w2-profile-role {
  font-size: 12.5px;
  color: var(--w2-muted);
}

.w2-profile-phone {
  font-size: 12.5px;
  color: var(--w2-muted);
  font-variant-numeric: tabular-nums;
}

.w2-status-line {
  text-align: center;
  font-size: 12.5px;
  color: var(--w2-muted);
  margin-bottom: 16px;
}

.w2-status-line.w2-ok {
  color: var(--w2-ok);
  font-weight: 600;
}

.w2-section-num {
  border-radius: 50%;
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
  font-size: 12px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.w2-pct-badge {
  font-variant-numeric: tabular-nums;
}

/* ── Section editors ───────────────────────────────────────────── */

.w2-section-sub {
  font-size: 12.5px;
  color: var(--w2-muted);
  margin: -8px 0 16px;
}

.w2-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.w2-helper {
  font-size: 12px;
  color: var(--w2-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.w2-info-card {
  padding: 12px 14px;
  border-radius: var(--w2-radius);
  background: var(--w2-card);
  border: 1px solid var(--w2-card-border);
  color: var(--w2-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.w2-footnote {
  font-size: 12px;
  color: var(--w2-muted);
  line-height: 1.4;
  margin-top: 14px;
  text-align: center;
}

.w2-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--w2-ink);
  cursor: pointer;
}

.w2-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--w2-accent);
}

/* ── Chips (aliases, traits, values, media filters) ──────────────── */

.w2-chiplist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.w2-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
}

.w2-chip-x {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: inherit;
}

.w2-chip-add {
  cursor: pointer;
  background: transparent;
  border: 1px dashed var(--w2-card-border);
  color: var(--w2-muted);
}

.w2-chip-add-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.w2-chip-input {
  width: 160px;
}

.w2-chip--ok {
  background: rgba(62, 207, 142, 0.16);
  color: var(--w2-ok);
}

.w2-chip--warn {
  background: rgba(255, 180, 84, 0.16);
  color: var(--w2-warn);
}

.w2-chip--muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--w2-muted);
}

/* ── Personality accordion ────────────────────────────────────────── */

.w2-acc-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.w2-acc {
  overflow: hidden;
  padding: 0;
}

.w2-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--w2-ink);
  cursor: pointer;
  text-align: left;
  min-height: 44px;
}

.w2-acc-title {
  font-size: 13.5px;
  font-weight: 700;
}

.w2-acc-body {
  display: none;
  padding: 0 16px 16px;
}

.w2-acc[data-state="open"] .w2-acc-body {
  display: block;
}

.w2-acc[data-state="open"] .w2-acc-head {
  border-bottom: 1px solid var(--w2-card-border);
}

/* ── Behavior examples ─────────────────────────────────────────── */

.w2-examples {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.w2-example-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.w2-example-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.w2-example-head input {
  flex: 1 1 auto;
}

/* ── Sliders (OCEAN + voice) ───────────────────────────────────── */

.w2-sliders {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.w2-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.w2-slider-val {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--w2-muted);
  white-space: nowrap;
}

.w2-range {
  width: 100%;
  accent-color: var(--w2-accent);
  height: 32px;
  cursor: pointer;
}

.w2-slider-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--w2-muted);
  margin-top: 2px;
}

/* ── Filter chip row (Media library + Relationships list) ─────────── */

.w2-chiprow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.w2-filter-chip {
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--w2-card-border);
  color: var(--w2-muted);
}

.w2-filter-chip[data-state="on"] {
  background: var(--w2-accent-soft);
  border-color: var(--w2-accent);
  color: var(--w2-accent-strong);
}

/* ── Media library ─────────────────────────────────────────────── */

.w2-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.w2-media-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 16px 10px;
}

.w2-media-icon {
  color: var(--w2-accent-strong);
}

.w2-media-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--w2-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.w2-media-type {
  font-size: 10.5px;
  color: var(--w2-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Numbered cards (Presence groups, Relationship editor sections) ── */

.w2-numbered-card {
  margin-bottom: 10px;
}

.w2-numbered-card:last-of-type {
  margin-bottom: 0;
}

/* ── Generic key/value list rows (schedule, places, secrets, promises,
   conflicts) — a text field, an optional control, and a remove button. ── */

.w2-list-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.w2-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.w2-list-row .s2-input {
  flex: 1 1 auto;
  min-width: 0;
}

.w2-sched-time {
  flex: 0 0 96px !important;
}

.w2-place-name {
  flex: 1 1 auto;
}

.w2-num-input {
  flex: 0 0 88px !important;
  min-width: 0;
}

.w2-seg-mini {
  flex: 0 0 auto;
}

.w2-seg-mini .s2-seg-btn {
  padding: 6px 10px;
  min-height: 36px;
  font-size: 11.5px;
}

/* ── Consistency check (Presence) ─────────────────────────────────── */

.w2-issue-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--w2-warn);
  line-height: 1.4;
}

/* ── Relationships list ────────────────────────────────────────── */

.w2-rel-add-row {
  width: 100%;
}

.w2-rel-add-row .s2-input {
  flex: 1 1 auto;
}

.w2-rel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.w2-rel-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  cursor: pointer;
}

.w2-rel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.w2-rel-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--w2-ink);
}

.w2-rel-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.w2-rel-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.w2-rel-mini-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--w2-ink);
  min-width: 0;
}

.w2-rel-mini-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--w2-muted);
}

.w2-muted-inline {
  color: var(--w2-muted);
  font-style: italic;
}

.w2-rel-counts {
  font-size: 11.5px;
  color: var(--w2-muted);
}

/* ── Relationship editor ──────────────────────────────────────────── */

.w2-glance-card {
  margin-bottom: 12px;
}

.w2-glance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--w2-muted);
  border-top: 1px solid var(--w2-card-border);
}

.w2-glance-row:first-of-type {
  border-top: none;
}

.w2-glance-row strong {
  color: var(--w2-ink);
  font-weight: 700;
  text-align: right;
}

.w2-dims-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px 24px;
}

@media (min-width: 560px) {
  .w2-dims-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.w2-dims-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Focus & motion ────────────────────────────────────────────── */

#studio-root .w2-person-card:focus-visible,
#studio-root .w2-rel-card:focus-visible,
#studio-root .w2-chip-x:focus-visible,
#studio-root .w2-chip-add:focus-visible,
#studio-root .w2-acc-head:focus-visible,
#studio-root .w2-filter-chip:focus-visible {
  outline: 2px solid var(--w2-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #studio-root .w2-acc-body,
  #studio-root .w2-chip,
  #studio-root .w2-person-card,
  #studio-root .w2-rel-card,
  #studio-root .w2-filter-chip {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Memory & Promises ─────────────────────────────────────────── */

.w2-mem-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--s2-muted);
}
.w2-tone-pos, .w2-promise-active { color: var(--s2-ok); }
.w2-tone-neg, .w2-promise-broken { color: var(--s2-danger); }
.w2-promise-pending, .w2-promise-overdue { color: var(--s2-warn); }

.w2-mem-card { border-left: 3px solid rgba(255, 255, 255, 0.12); }
.w2-mem-card[data-tone="positive"] { border-left-color: var(--s2-ok); }
.w2-mem-card[data-tone="negative"] { border-left-color: var(--s2-danger); }

.w2-mem-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.w2-mem-meta .s2-select { flex: 1 1 120px; min-width: 110px; }
.w2-mem-date { flex: 1 1 110px; min-width: 100px; }
.w2-mem-narrow { flex: 0 1 130px; min-width: 90px; }

.w2-mem-star { font-size: 15px; color: var(--s2-muted); }
.w2-mem-star[data-state="on"] { color: var(--s2-warn); }

.w2-promise-row[data-status="broken"] { border-left: 3px solid var(--s2-danger); }
.w2-promise-row[data-status="overdue"] { border-left: 3px solid var(--s2-warn); }

.w2-timeline { display: flex; flex-direction: column; gap: 8px; }
.w2-timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.w2-timeline-dot {
  flex: 0 0 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--s2-accent);
}

/* ── Phones & Reach ────────────────────────────────────────────── */

.w2-phone-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.w2-phone-card[data-visibility="private"] { border-color: rgba(255, 180, 84, 0.35); }
.w2-phone-card[data-visibility="secret"] { border-color: rgba(255, 92, 92, 0.35); }
.w2-phone-primary-btn { min-height: 34px; padding: 4px 12px; font-size: 12px; }

/* ── Resident Intelligence ─────────────────────────────────────── */

.w2-priority-row .w2-priority-num {
  flex: 0 0 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--s2-accent);
}

.w2-goal-row .s2-select { flex: 0 1 120px; min-width: 100px; }

.w2-consistency .w2-consistency-ok { font-size: 13px; color: var(--s2-ok); }
.w2-consistency .w2-consistency-flag {
  font-size: 13px;
  color: var(--s2-warn);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.w2-consistency .w2-consistency-flag:last-child { border-bottom: none; }

/* ── Voice preview (Voice & Conversation) ──────────────────────── */

.w2-voice-preview { display: flex; flex-direction: column; gap: 10px; }
.w2-voice-preview-row { display: flex; gap: 10px; flex-wrap: wrap; }
/* .s2-btn sets display, which would defeat the hidden attribute. */
.w2-voice-stop[hidden] { display: none; }
.w2-voice-status { font-size: 13px; color: var(--w2-muted); }
.w2-voice-status:empty { display: none; }

/* ── Pictures & Media (per person) ─────────────────────────────── */

.w2-pm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.w2-pm-card { display: flex; flex-direction: column; gap: 8px; }
.w2-pm-card[data-promised="1"] { border-style: dashed; }
.w2-pm-promises { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.w2-pm-promises-toggle { width: 100%; }

.w2-pm-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--w2-card);
  border: 1px solid var(--w2-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.w2-pm-thumb-wait {
  font-size: 12px;
  color: var(--w2-muted);
  padding: 8px;
  text-align: center;
}
.w2-pm-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.w2-pm-promised-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.w2-pm-prompt {
  font-size: 12.5px;
  color: var(--w2-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.w2-pm-meta { display: flex; align-items: center; gap: 8px; }
.w2-pm-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--w2-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w2-pm-roleslot { flex: 0 0 auto; font-size: 11.5px; color: var(--w2-muted); }

.w2-pm-menu { display: flex; gap: 8px; flex-wrap: wrap; }
.w2-pm-menu .s2-btn,
.w2-pm-generate { min-height: 34px; padding: 4px 12px; font-size: 12.5px; }

.w2-pm-note { font-size: 12.5px; color: var(--w2-warn); }

.w2-pm-add { display: flex; flex-direction: column; gap: 10px; }
.w2-pm-add-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Looks (the wardrobe: a second outfit or form) ─────────────────── */

.w2-look-row { margin-bottom: 6px; }
.w2-look-chip--add {
  border-style: dashed;
}
.w2-look-scope-note { margin-bottom: 14px; }
.w2-look-add { margin-bottom: 14px; }

.w2-pm-look-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--w2-accent-soft);
  color: var(--w2-accent-strong);
  border: 1px solid var(--w2-accent);
}

/* "set · slot", on a look chip that departs from Base/unslotted — a footnote
   on the chip, not another badge competing with it. */
.w2-look-chip-tag {
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.7;
}

.w2-look-group-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--w2-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 4px 0 8px;
}
