/* Hallmark · shape: app screen · redesign: polish · posture: restrained */
:root {
  --ink: #172d32;
  --muted: #52696e;
  --line: #cbd6d3;
  --surface: #fcfdfb;
  --paper: #f2f4ef;
  --nav: #152b30;
  --nav-deep: #102327;
  --nav-text: #f2f7f2;
  --nav-dim: #b0c6c4;
  --nav-edge: #385456;
  --selected: #e1efdf;
  --brand: #176745;
  --mark: #b9e090;
  --blue: #145e63;
  --focus: #2281b2;
  --button-hover: #115337;
  --control-fill: #e6ece6;
  --divider: #a9bbb6;
  --backdrop: #142a33a6;
  --body: "Inter","Helvetica Neue",Arial,sans-serif;
  --mono: "SFMono-Regular",Consolas,monospace;
}
* { box-sizing: border-box }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.48 var(--body); font-variant-numeric: tabular-nums }
button,select,input,textarea { font: inherit; color: inherit }
button,select,.filelabel,summary { cursor: pointer }
:where(button,select,a,input,summary,textarea,.filelabel):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px }
button:disabled,select:disabled { cursor: default }
button:not(:disabled):active,.filelabel:active { transform: translateY(1px) }
.skiplink { position: absolute; left: 12px; top: -80px; background: var(--surface); padding: 8px; z-index: 3 }
.skiplink:focus { top: 8px }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0 }
.studio-layout { display: grid; grid-template-columns: 252px minmax(0,1fr); min-height: 100dvh; max-width: 2200px; margin: auto }
.library { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 0; height: 100dvh; background: var(--nav); color: var(--nav-text) }
.wordmark { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 20px; font-size: 24px; font-weight: 640; letter-spacing: -.05em }
.pulse { display: inline-flex; align-items: center; justify-content: center; gap: 2px; width: 32px; height: 32px; background: var(--mark); color: var(--nav-deep); border-radius: 8px }
.pulse i { width: 2px; background: currentColor; height: 6px; border-radius: 2px }
.pulse i:nth-child(2) { height: 14px }.pulse i:nth-child(3){ height: 21px }.pulse i:nth-child(4){ height: 12px }
.library-body { display:flex; flex-direction:column; min-height:0; flex:1; padding:0 12px }
.rail-tabs { display:flex; gap:4px; background:var(--nav-deep); padding:4px; border-radius:6px; margin:4px 0 12px }
.rail-tabs button { border:0; color:var(--nav-dim); flex:1; background:transparent; min-height:32px; font-size:12px; font-weight:550; border-radius:4px }
.rail-tabs button[aria-pressed=true] { color:var(--nav-text); background:var(--nav-edge) }
.rail-search { position:relative }
.rail-search::before { content:""; position:absolute; width:10px; height:10px; left:12px; top:12px; border:1.5px solid var(--nav-dim); border-radius:50%; pointer-events:none }
.rail-search::after { content:""; position:absolute; height:1.5px; width:6px; left:21px; top:24px; background:var(--nav-dim); transform:rotate(45deg); pointer-events:none }
.library input { width:100%; min-height:40px; padding:8px 12px 8px 36px; border:1px solid var(--nav-edge); border-radius:5px; background:var(--nav); color:var(--nav-text); font-size:13px }
.library input::placeholder { color:var(--nav-dim) }
#screen-list { overflow:auto; flex:1; scrollbar-width:thin; padding:12px 0; scrollbar-color:var(--nav-edge) var(--nav) }
.catalog-group { margin-bottom:8px }
.catalog-group summary { padding:8px 4px; font-size:13px; font-weight:600; color:var(--nav-dim) }
.catalog-group summary small { float:right; font:12px var(--body); padding-top:2px }
.library button[data-id] { display:flex; align-items:baseline; gap:8px; width:100%; background:transparent; color:var(--nav-text); border:0; border-left:3px solid transparent; text-align:left; border-radius:4px; padding:8px; font-size:13px; line-height:1.4 }
.library button[data-id] small { font:11px var(--mono); color:var(--nav-dim); min-width:20px }
.library button[data-id]:hover,.rail-tabs button:hover { background:var(--nav-edge) }
.library button[aria-current] { background:var(--nav-deep); border-left-color:var(--mark) }
.rail-foot { display:grid; gap:4px; border-top:1px solid var(--nav-edge); padding:12px 8px 16px }
.rail-foot a { font-size:12px; text-decoration:none; color:var(--nav-dim); width:fit-content; padding:4px 0 }
.rail-foot a:hover { color:var(--nav-text); text-decoration:underline }
.workarea { min-width:0 }
.context { min-height:68px; display:flex; gap:clamp(12px,2.4vw,36px); align-items:center; background:var(--surface); border-bottom:1px solid var(--line); padding:8px clamp(20px,3vw,48px) }
.context label { display:grid; flex:0 1 auto; gap:2px; color:var(--muted); font-size:11px; line-height:1.2; min-width:0 }
.context select { display:block; min-width:0; max-width:100%; font-size:14px; font-weight:600; padding:4px 4px 4px 0; color:var(--ink); background:transparent; border:0; border-radius:2px }
.context label:hover select { color:var(--brand) }
.context [hidden],.modebar [hidden] { display:none }
#review-book { margin-left:auto; display:flex; gap:8px; align-items:center; flex-shrink:0; color:var(--muted); font-size:13px; padding:8px 0 8px 8px; min-height:40px; background:transparent; border:0 }
.book-icon { width:14px; height:16px; border:1.5px solid currentColor; border-left-width:3px; border-radius:2px }
#count { font:12px/20px var(--mono); text-align:center; min-width:20px; padding:0 4px; border-radius:4px; background:var(--control-fill); color:var(--ink) }
#work { padding:28px clamp(20px,3vw,48px) 12px; max-width:1536px; margin:auto }
.title-row { display:flex; align-items:center; justify-content:space-between; gap:16px }
.title-row>div { min-width:0 }
#crumb { margin:0 0 8px; font-size:12px; color:var(--muted) }
.title-row h1 { margin:0; font-size:clamp(30px,3.2vw,48px); line-height:1.08; letter-spacing:-.05em; font-weight:600; text-wrap:balance; overflow-wrap:break-word }
#briefing { margin:8px 0 20px; color:var(--muted); max-width:83ch; line-height:1.5 }
#briefing strong { display:none }
#record,.solid,.dialog-actions button,.filelabel { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--ink); padding:8px 12px; min-height:40px; font-size:13px; font-weight:550 }
.solid { color:var(--surface)!important; background:var(--brand)!important; border-color:var(--brand)!important }
#record { flex-shrink:0; color:var(--brand); border-color:var(--divider); background:var(--surface) }
#record:hover { background:var(--selected) }
.solid:hover { background:var(--button-hover)!important }
#record::before { content:"+"; display:inline-block; font:20px/1 var(--body) }
.modebar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; border-block:1px solid var(--line); padding:8px 0 }
.view-control { display:inline-flex; flex-wrap:wrap; gap:8px; align-items:center; max-width:100%; color:var(--muted); font-size:13px }
.view-control select,.pane-label select,dialog select { min-height:36px; max-width:100%; min-width:0; padding:4px 8px; border:1px solid var(--divider); color:var(--ink); background:var(--surface); border-radius:5px; font-size:13px; font-weight:560 }
.view-control select { max-width:min(100%,36ch) }
.switches { display:flex; flex-wrap:wrap; align-items:center; gap:4px; margin-left:auto }
.switches button { border:1px solid transparent; display:flex; align-items:center; gap:8px; background:transparent; color:var(--muted); font-size:12px; padding:8px; min-height:36px; border-radius:4px }
.switches button:disabled { color:var(--muted); background:var(--control-fill); cursor:default; border-style:dashed; border-color:var(--line) }
.switches button:hover:not(:disabled),#review-book:hover { color:var(--ink); background:var(--control-fill) }
.switches button[aria-pressed=true] { border-color:var(--divider); color:var(--ink); background:var(--surface); font-weight:600 }
.switches i { display:block; width:14px; height:12px; border:1.5px solid currentColor; border-radius:2px; position:relative }
#compare i::after,#rolecompare i::after { content:""; height:100%; position:absolute; left:5px; border-left:1.5px solid currentColor }
#rolecompare i { border-style:dashed }
#baseline i { border-style:double; border-width:3px }
#canvas { display:grid; gap:16px; margin-top:20px; min-width:0 }
#canvas.twin { grid-template-columns:repeat(2,minmax(0,1fr)) }
.pane { min-width:0 }
.pane-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px }
.pane-label { min-width:0; display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:13px; color:var(--muted) }
.pane-head a,.study a { color:var(--blue); font-size:13px }
.pane iframe { width:100%; min-height:680px; height:75vh; border:1px solid var(--line); background:var(--surface); border-radius:4px }
.baseline-note,#notice,.studio-foot { font-size:13px; color:var(--muted) }
.study { margin-top:24px; border-block:1px solid var(--line); padding:16px 0 }
.study summary { font-size:14px; font-weight:600 }
.study p { max-width:72ch }
.studio-foot { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:8px clamp(20px,3vw,48px) 24px }
.studio-foot span+span { font-size:12px }
dialog { width:100%; max-width:min(640px,92vw); max-height:85dvh; padding:24px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:8px }
dialog::backdrop { background:var(--backdrop) } dialog h2 { margin:0; letter-spacing:-.03em }
dialog form>label { display:grid; gap:4px; margin:16px 0 }
dialog textarea { resize:vertical; border:1px solid var(--line); border-radius:4px; padding:8px }
.dialog-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; margin-top:16px }
.filelabel input { width:1px; height:1px; opacity:0 }
.filelabel:focus-within { outline:3px solid var(--focus) }
#decisions article { padding:12px 0; border-bottom:1px solid var(--line) }
#decisions article p { margin:4px 0 }
.gate { border:1px solid var(--line); background:var(--surface); padding:24px }
.gate p { color:var(--muted) }
.trial-grant { display:block; margin-top:12px }
.trial-grant input { width:18px; height:18px; vertical-align:middle }
#mobile-menu { display:none }
@media (min-width:1650px) { .studio-layout { grid-template-columns:280px minmax(0,1fr) } }
@media (max-width:1220px) {
  .studio-layout { grid-template-columns:228px minmax(0,1fr) }
  .context { gap:16px }
  .view-control { gap:4px }
}
@media (max-width:1100px) {
  #canvas.twin { grid-template-columns:1fr }
  .view-control>span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%) }
  .view-control select { max-width:29ch }
  .context { flex-wrap:wrap }
  .context select { max-width:200px }
}
@media (max-width:820px) {
  .studio-layout { display:block }
  .library { position:relative; height:auto; display:block }
  .wordmark { min-height:56px; padding:12px 16px; font-size:21px }
  #mobile-menu { display:block; position:absolute; top:6px; right:12px; padding:8px 12px; min-height:44px; background:var(--nav-deep); color:var(--nav-text); border:1px solid var(--nav-edge); border-radius:5px; font-size:14px }
  .library-body { display:none; max-height:70dvh }
  .library.open .library-body { display:flex }
  .library button[data-id],.library .obj-rail button[data-id],.rail-tabs button { min-height:44px }
  .context { padding:12px 16px }
  .context select,.view-control select,.pane-label select,.switches button,#record,#review-book { min-height:44px }
}
@media (max-width:590px) {
  .context { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px }
  .context select { width:100%; font-size:13px; min-height:34px }
  #review-book { margin-left:0; padding:4px 0; width:fit-content; font-size:12px }
  #work { padding:20px 16px 8px }
  .title-row { flex-wrap:wrap; gap:12px; align-items:start }
  .title-row h1 { font-size:32px }
  #briefing { font-size:14px; margin:8px 0 16px }
  #record { font-size:12px; min-height:40px }
  .modebar { display:grid; gap:8px; justify-content:stretch }
  .switches { margin:0; display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:4px }
  .switches button { font-size:12px; line-height:1.15; justify-content:center; padding:4px }
  .switches i { display:none }
  .view-control { display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px }
  .view-control>span { position:static; width:auto; height:auto; overflow:visible; clip-path:none }
  .view-control select { max-width:100%; width:100% }
  #canvas { margin-top:16px }
  .pane-head { flex-wrap:wrap }
}
#context-settings { display:contents }
#context-toggle { display:none }
@media (max-width:590px) {
  .context { grid-template-columns:minmax(0,1fr) auto; align-items:start; padding-block:4px }
  #context-toggle { display:flex; text-align:left; align-items:center; gap:8px; border:0; background:transparent; min-height:44px; padding:4px 0; font-size:12px; font-weight:550; color:var(--ink) }
  #context-toggle::after { content:""; border:solid currentColor; border-width:0 1.5px 1.5px 0; width:6px; height:6px; transform:rotate(45deg); flex-shrink:0 }
  #context-toggle[aria-expanded=true]::after { transform:rotate(225deg) }
  #context-settings { display:none }
  #context-toggle[aria-expanded=true]+#context-settings { grid-column:1/-1; grid-row:2; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding:4px 0 12px }
  #review-book { grid-column:2; grid-row:1 }
  .team-word { display:none }
  #work { display:flex; flex-direction:column }
  .title-row { display:contents }
  #record { order:4; margin-top:16px; width:fit-content }
  .study { order:5 }
  #notice { order:6 }
}
