/* Hallmark: app / graphite workspace / one blue accent */
/* Critique: give the video wall the space and keep its control surfaces quiet. */
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 300px; height: 100%; overflow-x: clip; }
body { background: var(--page); color: var(--ink); font: 15px/1.45 var(--font); display: flex; flex-direction: column; }
button, input, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; background: var(--rail); color: var(--dim); border-color: transparent; }
button, input { color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1, h2 { text-wrap: balance; }
svg { display: block; width: 19px; height: 19px; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.topbar { height: 48px; flex: none; padding: 0 24px 0 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--topbar); border-bottom: 1px solid var(--line); }
.identity, .top-actions, .wordmark, .workspace-title, .workspace-actions, .segmented { display: flex; align-items: center; }
.identity { gap: 20px; }
.top-actions { gap: 12px; }
.wordmark { gap: 8px; font-size: 16px; font-weight: 750; white-space: nowrap; letter-spacing: -.045em; }
.brand-mark { color: var(--accent); }
.brand-mark svg { width: 25px; height: 25px; }
.icon-button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; height: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.icon-button { width: 34px; height: 34px; padding: 0; color: var(--muted); }
.icon-button:hover, .button:hover { background: var(--raised); color: var(--ink); }
.icon-button:active, .button:active { transform: translateY(1px); }
.button-plain, .sidebar-toggle { background: transparent; border-color: transparent; color: var(--muted); }
.sidebar-toggle { margin-left: -2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.account svg { color: var(--twitch-accent); width: 17px; height: 17px; }

.app-frame { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 262px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--rail); min-height: 0; }
.tabs { display: flex; padding: 0 16px; gap: 16px; border-bottom: 1px solid var(--line); flex: none; }
.tab { height: 46px; flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; position: relative; color: var(--muted); background: transparent; border: 0; font-size: 14px; font-weight: 630; }
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; height: 2px; bottom: -1px; background: var(--accent); inset-inline: 0; border-radius: 2px 2px 0 0; }
.side-view { padding: 16px 16px; overflow: auto; scrollbar-width: thin; }
.search { display: flex; align-items: center; min-height: 40px; gap: 8px; padding: 0 12px; color: var(--dim); background: var(--field); border: 1px solid var(--line); border-radius: 8px; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; }
.search input { width: 100%; min-width: 0; background: none; border: 0; outline: 0; font-size: 13px; }
.search input::placeholder { color: var(--dim); }
.side-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 24px 4px 12px; }
.side-heading h2 { font-size: 13px; font-weight: 690; }
.side-heading > span { color: var(--dim); font-size: 12px; }
#clips-view .side-heading { margin-top: 4px; }
.side-caption { margin: 0 4px 16px; color: var(--dim); font-size: 12px; }
.channel-list, .clip-list { display: grid; gap: 8px; }
.clip-group { min-width: 0; }
.clip-group > summary { padding: 8px 4px; cursor: pointer; font-size: 13px; font-weight: 690; overflow-wrap: anywhere; }
.clip-group > summary small { float: right; color: var(--dim); font-size: 12px; }
.channel { width: 100%; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 8px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 8px; }
.channel:hover { background: var(--raised); }
.channel.is-open { background: var(--channel-active); border-color: var(--channel-line); }
.channel.is-open:hover { background: var(--accent-soft); }
.channel-avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 8px; background: var(--avatar, var(--accent)); color: var(--avatar-ink); font-weight: 800; font-size: 12px; overflow: hidden; }
.channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.channel-label { display: grid; flex: 1; min-width: 0; }
.channel-label strong, .channel-label small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.channel-label strong { font-size: 13px; }
.channel-label small { color: var(--muted); font-size: 11px; }
.channel-end { color: var(--dim); flex: none; }
.channel.is-open .channel-end { color: var(--accent); }
.channel-end svg { width: 15px; height: 15px; }
.add-link { width: 100%; justify-content: flex-start; background: transparent; color: var(--muted); border-color: transparent; margin-top: 16px; }
.add-link svg { width: 17px; height: 17px; }
.side-message { color: var(--muted); padding: 8px 4px; font-size: 13px; }
.clip-row { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); }
.clip-row:hover { background: var(--raised); }
.clip-thumb { width: 80px; height: 48px; position: relative; flex: none; border-radius: 5px; background: var(--page); overflow: hidden; }
.clip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.clip-thumb time { position: absolute; bottom: 2px; right: 2px; background: var(--timestamp); color: white; border-radius: 3px; padding: 0 4px; font-size: 10px; }
.clip-row strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; line-height: 1.28; }

.workspace { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; padding: 0 12px; }
.workspace-top { min-height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workspace-title { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pane-count { font-size: 11px; color: var(--muted); border-radius: 20px; border: 1px solid var(--line); background: var(--rail); padding: 4px 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.workspace-actions { flex: none; gap: 8px; }
.segmented { padding: 4px; gap: 4px; background: var(--rail); border: 1px solid var(--line); border-radius: 9px; }
.segmented .icon-button { height: 30px; width: 33px; background: transparent; border: 0; border-radius: 5px; }
.segmented .icon-button:hover { background: var(--raised); }
.segmented .icon-button[aria-pressed="true"] { background: var(--raised); color: var(--accent); }
.segmented svg { width: 17px; height: 17px; }

.board-viewport { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
.board { height: 100%; min-height: 362px; width: 100%; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); gap: 12px; position: relative; --x: 54%; --y: 50%; }
.board[data-layout="split"], .board[data-layout="grid"], .board[data-layout="columns"] { grid-template-columns: minmax(0, var(--x)) minmax(0, 1fr); }
.board[data-layout="split"], .board[data-layout="grid"], .board[data-layout="stack"] { grid-template-rows: minmax(0, var(--y)) minmax(0, 1fr); }
.board[data-layout="split"] .pane[data-slot="0"] { grid-row: span 2; }
.board[data-layout="wall"], .board[data-layout="external"] { height: auto; min-height: 100%; grid-template: none / minmax(0, 1fr); }
.board[data-layout="wall"] { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); grid-auto-rows: minmax(362px, 1fr); }
.board[data-layout="wall"][data-featured] .pane[data-slot="0"] { grid-column: 1 / -1; }
.board[data-layout="external"] { grid-auto-rows: minmax(180px, auto); }
.board[data-layout="free"] { display: block; width: var(--canvas-width); height: var(--canvas-height); cursor: grab; touch-action: none; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.board[data-layout="free"].is-panning { cursor: grabbing; }
.board[data-layout="free"] .pane { position: absolute; left: var(--pane-x); top: var(--pane-y); width: var(--pane-width); height: var(--pane-height); z-index: var(--pane-layer); cursor: default; }
.board[data-layout="free"] .pane:fullscreen { inset: 0; }
.pane { display: grid; grid-template-rows: 35px minmax(0, 1fr) 27px; min-width: 0; min-height: 0; order: var(--order); border-radius: var(--radius); overflow: hidden; background: var(--rail); outline: 1px solid var(--line); outline-offset: -1px; }
.board .pane:fullscreen { width: 100%; height: 100%; border-radius: 0; }
.pane.is-active { outline: 1px solid var(--pane-active); }
.pane.is-active .pane-header { background: var(--accent-soft); }
.pane.drop-target { outline: 2px solid var(--accent); outline-offset: 1px; }
.pane-header { display: flex; gap: 8px; align-items: center; min-width: 0; padding: 0 8px 0 8px; background: var(--panel); cursor: grab; touch-action: none; user-select: none; }
.pane-header:active { cursor: grabbing; }
.pane:fullscreen .pane-header { cursor: default; }
.pane-header > .grip { color: var(--dim); }
.pane-header > .grip svg { width: 15px; height: 15px; }
.pane-title { min-width: 0; flex: 1; display: flex; gap: 8px; align-items: center; }
.pane-title strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-title small { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-tools { display: flex; align-items: center; gap: 4px; }
.pane-tools .icon-button, .pane-footer .icon-button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 5px; }
.pane-tools .icon-button:hover, .pane-footer .icon-button:hover { background: var(--raised); }
.pane-tools .icon-button[aria-pressed="true"], .pane-footer .icon-button[aria-pressed="false"] { color: var(--accent); }
.pane-tools svg, .pane-footer svg { width: 16px; height: 16px; }
.media { background: var(--media); position: relative; overflow: hidden; min-height: 0; }
.twitch-surface, .twitch-mount, .twitch-mount iframe { display: block; width: 100%; height: 100%; border: 0; }
.twitch-surface { position: absolute; inset: 0; margin: auto; }
.media-stub { display: grid; place-content: center; gap: 12px; text-align: center; height: 100%; color: var(--muted); font-size: 13px; padding: 16px; }
.pane-footer { display: flex; min-width: 0; align-items: center; gap: 8px; padding: 0 8px; color: var(--ink); background: var(--panel); }
.pane-volume { width: 62px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.pane-status { display: flex; align-items: center; justify-content: end; gap: 4px; margin-left: auto; color: var(--muted); font-size: 11px; min-width: 0; overflow: hidden; white-space: nowrap; }
.sound-mark { color: var(--accent); font-size: 11px; font-weight: 650; white-space: nowrap; }
.pane-status svg { width: 13px; height: 13px; }
.pane-footer .pane-size { display: none; flex: none; cursor: nwse-resize; touch-action: none; }
.board[data-layout="free"] .pane:not(:fullscreen) .pane-size { display: inline-flex; }
.divider { background: transparent; position: absolute; z-index: 2; border-radius: 6px; touch-action: none; }
.divider:hover, .divider:focus-visible { background: var(--accent-soft); }
.divider-x { left: var(--x); inset-block: 0; width: 12px; cursor: col-resize; }
.divider-y { top: var(--y); inset-inline: 0; height: 12px; cursor: row-resize; }
.board[data-layout="split"] .divider-y { left: calc(var(--x) + 12px); }
.empty { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--rail); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.empty h2 { font-size: 24px; letter-spacing: -.04em; }
.empty p { color: var(--muted); }
.empty-icon { color: var(--accent); }
.empty-icon svg { width: 34px; height: 34px; }
.workspace-footer { display: flex; min-height: 32px; flex: none; justify-content: space-between; align-items: center; color: var(--dim); font-size: 12px; gap: 8px; }
.footer-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.drag-hint { display: flex; align-items: center; gap: 8px; }
.drag-hint svg { width: 14px; height: 14px; }
.workspace-footer .button { height: 28px; font-size: 12px; padding-inline: 4px; }
.workspace-footer .button svg { width: 15px; height: 15px; }

.switcher { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.switcher .button { height: 30px; flex: none; max-width: 157px; color: var(--muted); background: var(--rail); border-color: transparent; }
.switcher .button i { width: 6px; height: 6px; flex: none; background: var(--dim); border-radius: 50%; }
.switcher .button span { overflow: hidden; text-overflow: ellipsis; }
.switcher .button:hover { background: var(--raised); }
.switcher .button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--line); }
.switcher .button[aria-pressed="true"] i { background: var(--accent); }
#sound-follow[aria-pressed="true"] { color: var(--accent); }


.notice { position: fixed; right: 18px; bottom: 44px; z-index: 4; max-width: min(390px, calc(100vw - 36px)); background: var(--raised); border: 1px solid var(--notice-line); padding: 12px 16px; border-radius: 8px; font-size: 13px; }
.dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--dialog-line); border-radius: 12px; max-width: min(420px, calc(100vw - 28px)); width: 100%; padding: 20px; }
.dialog::backdrop { background: var(--backdrop); }
.dialog form, .dialog[open] { display: grid; gap: 16px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog h2 { font-size: 21px; letter-spacing: -.03em; }
.dialog label { font-size: 13px; font-weight: 650; margin-bottom: -8px; }
.dialog p { color: var(--muted); }
.dialog input { background: var(--page); border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; width: 100%; }
.dialog .primary { justify-self: start; }
.dialog .form-error { color: var(--danger); font-size: 13px; }
@media (max-width: 900px) {
  .sidebar { width: 236px; }
  .workspace { padding: 0 12px; }
  .workspace-actions { gap: 8px; }
}
@media (max-width: 710px) {
  .topbar { padding: 0 8px; height: 48px; }
  .identity, .top-actions { gap: 4px; }
  .wordmark { font-size: 15px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .account { padding: 0 8px; font-size: 12px; }
  .app-frame { flex-direction: column; overflow: auto; }
  .sidebar { width: 100%; height: min(34vh, 250px); border-right: 0; border-bottom: 1px solid var(--line); }
  .tab { height: 39px; }
  .side-view { padding: 8px 12px; }
  .side-heading { margin-top: 12px; }
  .workspace-top { min-height: 52px; gap: 4px; }
  .segmented .icon-button { width: 26px; }
  .workspace-actions .primary { font-size: 12px; padding: 0 8px; }
  .drag-hint { display: none; }
  .workspace-footer .button { padding-inline: 4px; }
}
@media (max-width: 380px) {
  .brand-mark { display: none; }
}
