:root {
  color-scheme: dark;
  --base: #040a14;
  --ink: #ebf4ff;
  --muted: #a9bcd1;
  --edge: #293c50;
  --desk: #a6b4ff;
  --world: #6ee7b7;
  --glass: rgba(15, 29, 44, .82);
  font-family: 'Avenir Next', Avenir, system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 86% 4%, #103348 0%, transparent 52%),
    radial-gradient(ellipse at 10% 110%, #192341 0%, transparent 60%),
    var(--base);
}
#app {
  position:relative;height:100dvh;min-height:280px;isolation:isolate;overflow:hidden;
  --mast:clamp(42px,8dvh,76px);--gutter:clamp(10px,2.4vw,36px);
}
.masthead {
  position:absolute;z-index:2;inset:0 0 auto;height:var(--mast);pointer-events:none;
  display:flex;align-items:center;gap:clamp(14px,3vw,46px);padding:0 var(--gutter);
}
.masthead a { pointer-events:auto; }
h1,h2,p { margin: 0; }
h1 { display:flex; align-items:center; gap:.23em; font-size: clamp(20px, 3.6vw, 43px); font-weight: 300; line-height: 1.05; letter-spacing: -.04em; }
h1 img { width:auto; height:1.3em; object-fit:contain; }
h1 small { font-size: .45em; color: var(--desk); vertical-align: super; }
.back,.scope,.kicker,.node-type,.desk-status { font-size: 11px; letter-spacing: .1em; }
.back { color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.embedded .masthead { visibility:hidden; }
.surfaces { position:absolute;inset:0; }
.pane {
  position:absolute;z-index:1;inset:0 0 auto;height:54%;min-height:0;min-width:0;
  display:flex;flex-direction:column;padding:var(--mast) var(--gutter) 0;
  background:linear-gradient(180deg,rgba(7,15,31,.78),rgba(13,31,50,.48) 43%,rgba(13,31,50,.19) 73%,transparent 100%);
  pointer-events:none;
}
.pane-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding:3px 0 9px;
}
.pane-head h2 { font-weight: 400; font-size: clamp(16px, 2.1vw, 27px); letter-spacing: -.025em; }
.kicker { color: var(--muted); margin-bottom: 3px; }
.scope { color: var(--desk); line-height: 1.3; text-align: right; }
.world { position:absolute;inset:0;background:#071819; }
.world iframe { display:block;width:100%;height:100%;border:0; }
.desk-head { justify-content:flex-start; gap:clamp(8px,2vw,28px); }
.desk-head > div:first-child { flex:none; }
.desk-tools { display:flex; align-items:center; flex-wrap:wrap; gap:6px; align-self:start; }
button {
  min-height: 34px; padding: 0 10px; font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--ink); background: #172941; border: 1px solid #39516e; border-radius: 8px; cursor: pointer;
}
button:hover { border-color: var(--desk); }
:is(button,a,input,textarea):focus-visible { outline: 2px solid var(--desk); outline-offset: -2px; }
button:disabled { opacity: .6; cursor: default; }
#add-node, #add-board { flex: none; }
#parked { flex: 1; min-width: 0; display: flex; gap: 5px; overflow: auto; scrollbar-width: thin; }
#parked button {
  flex: none; max-width: min(26ch, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 8px 8px 2px 2px; border-bottom-color: var(--desk); color: var(--desk);pointer-events:auto;
}
#parked button:first-child { margin-inline-start: auto; }
#desk-grid {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  align-content: start; align-items: start; gap: clamp(10px, 1.8vw, 23px);
  padding:6px 2px 12px;
}
.desk-tools,#desk-grid :is(.node,.empty){pointer-events:auto}
.node {
  min-width: 0; padding: 10px; display: grid; gap: 7px; border: 1px solid #354466;
  border-top-color: var(--desk); border-radius: 10px;
  background:
    repeating-linear-gradient(135deg, transparent 0 3px, #8fa8f107 3px 4px),
    linear-gradient(150deg, #182d49dd, #101d30d9);
  backdrop-filter:blur(10px);
}
.node-head { display:flex; align-items:center; justify-content:space-between; gap: 6px; }
.node-head .node-grip { cursor:grab; min-height:28px; min-width:26px; padding:0 4px; }
.node-type { color: var(--desk); margin-inline-end:auto; }
.node[data-kind="plan"] { border-top-color: var(--world); }
.node[data-kind="plan"] .node-type { color: var(--world); }
.steps { display:grid; gap:6px; margin:2px 0; padding:0; list-style:none; }
.steps label { display:flex; gap:8px; font-size:13px; overflow-wrap:anywhere; }
.steps input { accent-color: var(--world); align-self:start; }
.steps input:checked + span { text-decoration:line-through; color:var(--muted); }
.node details { font-size:12px; color:var(--muted); }
.node summary { cursor:pointer; }
.node details label { display:block; margin-top:6px; }
.node-title input, .node-copy textarea {
  width: 100%; min-width: 0; font: inherit; color: var(--ink);
  border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 6px;
}
.node-title input { font-size: 16px; font-weight: 500; }
.node-copy textarea { min-height: 58px; max-height:27dvh; resize: vertical; font-size: 14px; line-height: 1.45; background: #071222a0; }
.node-copy textarea::placeholder { color: var(--muted); }
.desk-status { min-height: 22px; padding: 3px 10px; color: var(--muted); }
.desk-status:empty { display:none; }
.empty { padding: 8px; color: var(--muted); font-size: 13px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
@media (max-width: 680px) and (orientation: portrait) {
  .pane-head { padding:4px 0 7px; }
  .desk-head .scope { display:none; }
  #desk-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .node-head button { min-width:32px; padding:0 6px; }
  .node-head button span { display:none; }
  .node-title input { font-size:14px; }
}
@media (max-height: 520px) {
  .pane-head { padding: 3px 0 6px; }
  .kicker { display:none; }
}
