/* Room Studio sheet. Desktop: a right-hand panel while the room reflows beside
   it. Phone: a bottom sheet that collapses so the preview stays visible. */
.studio { position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: 420px; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-left: 1px solid var(--rule); box-shadow: -18px 0 50px #0003; }
.studio[hidden] { display: none; }
body.studio-open { padding-right: 420px; }
.studio-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; }
.studio-head > div { flex: 1; min-width: 0; }
.studio-head h2 { font: 600 19px/1.2 var(--sans); letter-spacing: -0.02em; }
.grab { display: none; }
.studio-state { display: flex; gap: 9px; align-items: flex-start; margin: 0 18px; padding: 9px 11px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; line-height: 1.45; }
.studio-state.draft { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.studio-state .dot { flex: none; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.studio-state .dot.live { background: var(--live); }
.studio-tabs { display: flex; gap: 18px; padding: 0 18px; margin-top: 10px; border-bottom: 1px solid var(--rule); }
.studio-tabs button { padding: 10px 0 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; min-height: 42px; }
.studio-tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.studio-body { flex: 1; overflow-y: auto; padding: 14px 18px 24px; overscroll-behavior: contain; }
.studio-thread { display: grid; gap: 10px; }
.turn { max-width: 92%; padding: 10px 12px; border-radius: calc(var(--r) * 0.9); font-size: 14px; line-height: 1.5; }
.turn.me { justify-self: end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.turn.reply { background: var(--surface-2); border-bottom-left-radius: 4px; }
.changes { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; }
.changes li { display: grid; grid-template-columns: 104px auto auto 1fr; gap: 6px; align-items: baseline; }
.changes b { font-weight: 600; }
.changes .from { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.changes .to { font-weight: 600; color: var(--accent-text); }
.studio .turn.reply .changes .to { color: var(--ink); }
.notes { display: grid; gap: 6px; margin-top: 8px; }
.notes li { font-size: 13px; padding: 7px 9px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 4px 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.chip-btn { text-align: left; font-size: 12.5px; line-height: 1.35; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); min-height: 34px; }
.chip-btn:hover { border-color: var(--ink); }
.studio-ask { display: flex; gap: 8px; align-items: flex-end; }
.studio-ask textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 140px; resize: vertical; padding: 10px 12px; font-size: 15px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); }
.studio-ask .primary { min-height: 48px; }
.studio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.studio-perm { font-size: 13px; color: var(--muted); margin-top: 6px; }
.studio-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.studio-sec h3 { font-size: 14px; margin-bottom: 6px; }
.studio-sec .muted { font-size: 13px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sec-head h3 { margin: 0; }
.outline.sm, .quiet.sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.danger { color: var(--accent-text); }
.fine summary { cursor: pointer; font-weight: 600; font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.fine-row { display: grid; gap: 6px; margin-top: 12px; }
.fine-label { font: 500 10px/1.5 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fine-opts { display: flex; flex-wrap: wrap; gap: 5px; }
.opt, .swatch { font-size: 12.5px; padding: 5px 10px; min-height: 32px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); display: inline-flex; align-items: center; gap: 7px; }
.opt[aria-pressed="true"], .swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #0003; }
.sw-house .sw { background: conic-gradient(#f5f1e8 0 33%, #181512 0 66%, #f2f4f7 0); }
.sw-paper .sw { background: linear-gradient(135deg, #f5f1e8 50%, #b23a1c 50%); }
.sw-midnight .sw { background: linear-gradient(135deg, #0f0d16 50%, #ff4f8b 50%); }
.sw-dusk .sw { background: linear-gradient(135deg, #181512 50%, #ff7440 50%); }
.sw-riso .sw { background: linear-gradient(135deg, #f3ede0 50%, #d81b5c 50%); }
.sw-moss .sw { background: linear-gradient(135deg, #edf0e6 50%, #2c6a43 50%); }
.sw-chalk .sw { background: linear-gradient(135deg, #f2f4f7 50%, #2152d0 50%); }
.sw-signal .sw { background: linear-gradient(135deg, #0b0b0a 50%, #d4ff3f 50%); }
.motto-row { display: flex; gap: 6px; }
.motto-row input { flex: 1; min-width: 0; min-height: 38px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); font-size: 14px; }
.history { display: grid; gap: 2px; }
.history li { display: flex; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.history .v { font: 500 12px/1.6 var(--mono); color: var(--muted); min-width: 28px; }
.history small { display: block; color: var(--muted); font-size: 12px; }
.editors li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }

/* Address */
.addr-url { font-size: 17px; font-weight: 600; margin: 4px 0 8px; overflow-wrap: anywhere; }
.addr-host { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; margin-bottom: 4px; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 8px; margin: 8px 0; }
.inline-form > input { flex: 1; min-width: 0; min-height: 42px; padding: 8px 11px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); font-size: 15px; }
.slug-field { flex: 1; min-width: 0; display: flex; align-items: center; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg); }
.slug-field input { flex: 1; min-width: 0; border: 0; background: none; min-height: 40px; padding: 8px 4px 8px 11px; font: 500 15px var(--mono); color: var(--ink); }
.slug-field span { padding-right: 11px; color: var(--muted); font: 500 13px var(--mono); white-space: nowrap; }
.checks { display: grid; gap: 8px; margin: 10px 0; }
.checks div { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: baseline; }
.checks dt { font: 500 10px/1.8 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.checks small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.badge { display: inline-block; font: 600 11px/1.6 var(--sans); padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.badge.ok { color: var(--live); }
.badge.warn { color: var(--accent-text); }
.badge.bad { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.badge.info { color: var(--muted); }
.records { display: grid; gap: 8px; margin: 10px 0; }
.rec { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "type name copy" "type val copy" ". why why"; gap: 4px 10px; padding: 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg); }
.rec-type { grid-area: type; font: 600 12px var(--mono); }
.rec-name { grid-area: name; } .rec-val { grid-area: val; } .rec button { grid-area: copy; align-self: start; } .rec-why { grid-area: why; color: var(--muted); font-size: 12px; }
.rec small { display: block; font: 500 9.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rec code { font: 500 12px/1.45 var(--mono); overflow-wrap: anywhere; }
.sandbox { margin-top: 14px; padding: 12px; border: 1px dashed var(--rule); border-radius: var(--r-sm); font-size: 13px; }
.sandbox .btns { margin-top: 8px; gap: 6px; }
.boundary ul { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.boundary b { color: var(--ink); }
.small { font-size: 12px; }

@media (max-width: 1100px) {
  .studio { width: 380px; }
  body.studio-open { padding-right: 380px; }
}
@media (max-width: 720px) {
  body.studio-open { padding-right: 0; padding-bottom: 62dvh; }
  body.studio-open.studio-peek { padding-bottom: 84px; }
  .studio { top: auto; left: 0; width: auto; height: 62dvh; border-left: 0; border-top: 1px solid var(--rule); border-radius: 18px 18px 0 0; box-shadow: 0 -18px 50px #0005; }
  body.studio-peek .studio { height: 84px; }
  body.studio-peek .studio > :not(.studio-head) { display: none; }
  .studio-head { padding: 6px 14px 8px; flex-wrap: wrap; }
  .grab { display: grid; place-items: center; width: 100%; min-height: 22px; order: -1; }
  .grab span { width: 44px; height: 5px; border-radius: 3px; background: var(--rule); }
  .studio-head h2 { font-size: 17px; }
  .studio-state { margin: 0 14px; }
  .studio-tabs { padding: 0 14px; }
  .studio-body { padding: 12px 14px 20px; }
  .changes li { grid-template-columns: 92px auto auto 1fr; }
  .mobile-bar { display: none; }
  body:not(.studio-open) .mobile-bar { display: flex; }
}
.studio-body { position: relative; }
.studio-dock { border-top: 1px solid var(--rule); padding: 12px 18px 14px; background: var(--surface); }
.studio-dock .studio-actions { margin: 10px 0 0; }
.studio-dock .studio-perm { margin-top: 8px; }
@media (max-width: 720px) {
  .studio-dock { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .studio-dock .studio-ask textarea { min-height: 44px; }
  .studio-dock .studio-actions .outline, .studio-dock .studio-actions .primary { min-height: 40px; padding: 7px 12px; }
}
