/* The studio (docs/STUDIO.md): a bright desk. Chats are paper notes, previews sit on a checkerboard mat, Locky holds the
   pencil while Claude works. Mode cards are plain buttons; your messages sit right, Claude's left. One column under
   720px, the box sticks to the bottom on phones, previews never wider than the screen. */
:root { --st-mat-a: #FFFFFF; --st-mat-b: #ECEEF6; --st-me: var(--face-sky); }
:root[data-theme="dark"] { --st-mat-a: #2A2D3A; --st-mat-b: #343848; --st-me: var(--sunk); }

.view[data-page="studio"] { --locky: url("/img/locky-pencil.png"); --locky-shows: block; }
.view[data-page="owner-studio"] { --locky: url("/img/locky-zen.png"); --locky-shows: block; }

.st-flex { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.st-flex[hidden] { display: none; }
.st-grow { flex: 1 1 auto; }
.st-sub { margin: 16px 0 6px; font-size: 1em; }
.st-warn { padding: 8px 10px; border: 1px solid var(--danger); border-radius: var(--radius-s); background: var(--surface); }
.st-banner { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--sunk); font-weight: 600; }

.st-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 10px; }
.st-mode { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--raised); color: var(--ink); font: inherit; cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.st-mode:hover, .st-mode:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.st-mode:disabled { opacity: .6; cursor: default; transform: none; }
.st-mode-label { font-weight: 800; }
.st-mode-line { font-size: 12.5px; color: var(--muted); }
.st-allowance { margin: 4px 0; font-weight: 600; }

.st-chats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.st-chat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--raised); }
.st-chat-link { flex: 1 1 200px; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.st-x { margin-left: auto; }

.st-sees summary { cursor: pointer; font-weight: 700; }
.st-sees ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.st-copy-box, .st-box { width: 100%; box-sizing: border-box; resize: vertical; }
.st-hits { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }

.st-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.st-title-input { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 1.3em; font-weight: 800; border: 1px solid transparent;
  border-radius: var(--radius-s); background: transparent; color: inherit; padding: 4px 6px; }
.st-title-input:hover, .st-title-input:focus { border-color: var(--line); background: var(--surface); color: var(--ink); }
.st-mode-label-wrap { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

.st-messages { display: grid; gap: 12px; margin: 12px 0; }
.st-msg { max-width: min(760px, 100%); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); min-width: 0; overflow-wrap: anywhere; }
.st-msg-me { justify-self: end; background: var(--st-me); color: var(--ink); }
.st-msg-claude { justify-self: start; background: var(--raised); }
.st-msg-text { margin: 0; white-space: pre-wrap; }
.st-msg-body > .md > :first-child { margin-top: 0; }
.st-rule-note { margin-top: 8px; padding: 6px 10px; border-left: 3px solid var(--danger); background: var(--sunk); border-radius: 4px; }
.st-drive-refs { margin: 6px 0 0; }
.st-first { margin: 8px 0; }
.st-lost { font-weight: 600; }

.st-output { margin: 10px 0; display: grid; gap: 6px; max-width: 100%; }
.st-mat { padding: 10px; border-radius: var(--radius-s); max-width: 100%; box-sizing: border-box;
  background-color: var(--st-mat-a);
  background-image: linear-gradient(45deg, var(--st-mat-b) 25%, transparent 25%, transparent 75%, var(--st-mat-b) 75%),
    linear-gradient(45deg, var(--st-mat-b) 25%, transparent 25%, transparent 75%, var(--st-mat-b) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.st-picture { display: block; max-width: 100%; max-height: 520px; height: auto; margin: 0 auto; }
.st-frame-box { position: relative; overflow: hidden; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--st-mat-a); }
.st-frame { border: 0; transform-origin: 0 0; display: block; }
.st-output-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.st-output-title { font-weight: 700; flex: 1 1 auto; overflow-wrap: anywhere; }
.st-output-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }

.st-draft { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--radius-s); background: var(--surface); }
.st-draft p { margin: 0 0 6px; }
.st-draft-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.st-working { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.st-working p { margin: 0; }
.st-dots { display: inline-flex; gap: 3px; margin-left: 6px; }
.st-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: st-pulse 1.2s ease-in-out infinite; }
.st-dots i:nth-child(2) { animation-delay: .2s; }
.st-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes st-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.st-composer { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line); }
.st-file-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--raised); font-size: 12.5px; max-width: 100%; overflow-wrap: anywhere; }
.st-chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; }
.st-chip-x:hover { color: var(--danger); }

.st-meter { height: 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; margin: 6px 0 12px; }
.st-meter span { display: block; height: 100%; background: var(--muted); }
.st-num { width: 12em; }
.st-usage-list, .st-folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.st-usage-list li, .st-folders li { overflow-wrap: anywhere; }
.st-link-input { flex: 1 1 260px; min-width: 0; }
.st-state { font-weight: 700; }

@media (max-width: 720px) {
  .st-modes { grid-template-columns: 1fr; }
  .st-msg { max-width: 100%; }
  /* The phone's tab bar owns the bottom edge, so the box scrolls with the page there. */
  .st-composer { position: static; }
}
@media (max-width: 560px) {
  .st-num { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .st-dots i { animation: none; opacity: .7; }
  .st-mode { transition: none; }
  .st-mode:hover, .st-mode:focus-visible { transform: none; }
}
