/* Mado, Yoi (宵): the room at early evening. A wooden frame in shadow, a dim and nearly neutral tatami room
   behind it, and gold only where something is lit. Screens are the brightest things in the room.
   Source colors carry meaning: Live is young bamboo, Preview is wisteria, Local is sky, any URL is washi. */

:root {
  /* Wood: the frame (title bar and sill) */
  --wood-0: #171411;
  --wood-1: #221D18;
  --wood-2: #2E2720;
  --hinoki: #C8A97E;   /* lit wood: 1 px edges and lattice bars only */

  /* Ink: panels and controls */
  --ink-0: #121110;
  --ink-1: #1C1B19;
  --ink-2: #272523;
  --ink-3: #353330;
  --ink-4: #4A4743;
  --line:  #807B72;

  /* Room */
  --stage: #2B2A24;
  --ma:    #222221;
  --ma-lit: #282827;
  --heri:  #1B2234;
  --light: rgba(240, 228, 200, 0.05);

  /* Text */
  --text:   #EDEAE4;
  --text-2: #C0BAAE;
  --text-3: #A19B8F;

  /* Lit */
  --gold:      #F2B035;
  --gold-soft: #FFE2A0;
  --gold-wash: rgba(242, 176, 53, 0.14);
  --on-gold:   #1B1408;

  /* Status */
  --live:    #68BE8D;
  --preview: #B99CF2;
  --local:   #6FB3F2;
  --url:     #F3E7CC;
  --beni:    #F47A70;
  --on-status: #14110E;

  /* Lit washi: the one light surface */
  --washi:     #EFE8D8;
  --sumi:      #1A1917;
  --sumi-2:    #55504A;
  --beni-deep: #B4322B;

  /* Devices */
  --bezel:     #0E0E10;
  --bezel-rim: #4A4A50;

  /* Shape */
  --r-1: 3px;  --r-2: 6px;  --r-3: 10px;
  --bar-h: 46px;  --sill-h: 72px;

  /* Motion */
  --ease-door:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-door-out: cubic-bezier(0.5, 0, 0.9, 0.4);

  /* Older names still used in a few places */
  --tb-h: var(--bar-h);
  --r-s: var(--r-2); --r-m: var(--r-2); --r-l: var(--r-3);
  --ease: var(--ease-door);
  --bezel-edge: var(--bezel-rim);
  --gold-glow: var(--gold-wash);

  /* Textures: small grayscale tiles, strength baked in, blended soft-light so they take their color from CSS */
  --weave: url("../textures/tatami-weave.webp");
  --grain: url("../textures/wood-grain.webp");
  --fiber: url("../textures/washi-fiber.webp");

  --tb-x: env(titlebar-area-x, 0px);
  --tb-w: env(titlebar-area-width, 100%);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", sans-serif;
  --mincho: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  font: 400 13px/20px var(--sans);
  color: var(--text);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}
html[data-textures="off"] { --weave: none; --grain: none; --fiber: none; }
/* With the weave off, a CSS fallback keeps the mat from reading as flat paint */
html[data-textures="off"] body[data-stage="dusk"] .stage { --weave: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .02) 0 1px, transparent 1px 6px); }
@media (prefers-contrast: more) { :root { --weave: none; --grain: none; --fiber: none; } }

@font-face {
  font-family: "Shippori Mincho"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/shippori-mincho-600-mado.woff2") format("woff2"); /* Latin plus 窓 and 宵, SIL OFL */
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--wood-0); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Rails: the frame of the window ----------
   Wood in shadow, a lit hinoki edge where the frame meets the room, and a shadow falling into the room. */

.titlebar, .shelf {
  background-color: var(--wood-0);
  background-image: linear-gradient(to top, rgba(255, 240, 214, 0.04), transparent 50%), var(--grain, none);
  background-size: auto, 512px 128px; background-blend-mode: normal, soft-light;
}
.shelf { background-image: linear-gradient(to bottom, rgba(255, 240, 214, 0.04), transparent 50%), var(--grain, none); }
.rail-shadow { position: fixed; left: 0; right: 0; height: 24px; z-index: 19; pointer-events: none; }
.rail-shadow.top { top: var(--bar-h); background: linear-gradient(rgba(0, 0, 0, .38), transparent); }
.rail-shadow.bottom { bottom: var(--sill-h); background: linear-gradient(to top, rgba(0, 0, 0, .38), transparent); }
/* Kumiko: a 2 px lattice bar, dark beside lit wood */
.kumiko { flex: none; align-self: stretch; width: 2px; background: linear-gradient(90deg, rgba(0, 0, 0, .55) 50%, rgba(200, 169, 126, .16) 50%); }
.kumiko-h { height: 2px; background: linear-gradient(rgba(0, 0, 0, .55) 50%, rgba(200, 169, 126, .16) 50%); }

.titlebar {
  position: fixed; top: 0; left: var(--tb-x); width: var(--tb-w); height: var(--bar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 10px 0 14px;
  box-shadow: inset 0 -1px 0 #493E30;
  app-region: drag; -webkit-app-region: drag; z-index: 20;
}
.titlebar > :not(.brand):not(.readout):not(.kumiko) { app-region: no-drag; -webkit-app-region: no-drag; }
@media (display-mode: window-controls-overlay) { .titlebar { padding-left: 8px; } }

.brand { display: flex; align-items: center; gap: 8px; padding-right: 2px; user-select: none; }
.brand img { width: 20px; height: 20px; }
.wordmark { font: 600 17px/1 var(--mincho); color: var(--text); white-space: nowrap; }
.wordmark .kanji { color: var(--text-3); margin-left: 3px; }

.app-picker {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 5px;
  background: transparent; border: 0; border-radius: var(--r-2); max-width: 220px;
  font: 600 12px/16px var(--sans); transition: background-color 80ms linear;
}
.app-picker:hover { background: var(--wood-1); }
.app-picker:active, .app-picker[aria-expanded="true"] { background: var(--wood-2); }
.app-picker[aria-expanded="true"] .chev { rotate: 180deg; }
.app-icon { width: 20px; height: 20px; border-radius: 5px; flex: none; overflow: hidden; display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 10px; height: 6px; fill: none; stroke: var(--text-2); stroke-width: 1.5; stroke-linecap: butt; stroke-linejoin: miter; flex: none; }

/* The groove: a segmented control cut into the rail. The chosen panel slides along it. */
.sources, .seg {
  position: relative; display: flex; height: 30px; padding: 2px; gap: 2px; isolation: isolate;
  background: var(--ink-0); border: 0; border-radius: var(--r-2);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .6), inset 0 -1px 0 rgba(200, 169, 126, .10);
}
.sources button, .seg button {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text-2); font: 500 12px/16px var(--sans); white-space: nowrap;
  transition: background-color 80ms linear, color 80ms linear;
}
.sources button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .6; flex: none; }
.sources button.url::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--url); }
.sources button[aria-checked="true"], .seg button[aria-checked="true"] { background: var(--ink-3); color: var(--text); }
.sources button[aria-checked="true"]::before { opacity: 1; }
.sources button:not([aria-checked="true"]):hover, .seg button:not([aria-checked="true"]):hover { background: var(--ink-2); color: var(--text); }
.sources button:not([aria-checked="true"]):hover::before { opacity: 1; }
.sources button.missing { color: color-mix(in srgb, var(--text-3) 50%, transparent); }
.sources button.missing::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; opacity: 1; }
/* Once script measures the groove, one panel slides to the chosen segment (160 ms, door easing). */
.slid::after {
  content: ""; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 0; width: var(--tw, 0); border-radius: 4px;
  background: var(--ink-3); transform: translateX(var(--tx, 0)); transition: transform 160ms var(--ease-door), width 160ms var(--ease-door);
}
.slid.no-slide::after { transition: none; }
.slid button[aria-checked="true"] { background: transparent; }

.address {
  flex: 1 1 260px; min-width: 120px; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px;
  background: var(--ink-0); border: 1px solid var(--line); border-radius: var(--r-2);
}
.address:focus-within { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.address.unreachable { border-color: var(--beni); }
.address.unreachable .src-dot { background: var(--beni); }
.src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); flex: none; }
.src-dot.url { background: transparent; box-shadow: inset 0 0 0 1.5px var(--url); }
.address input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font: 400 13px/20px var(--sans); }
.address input::placeholder { color: var(--text-3); }

.readout { color: var(--text-2); font: 500 12px/16px var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums; user-select: none; }
.readout b { color: var(--text-2); font-weight: 500; }
.readout .lit { color: var(--gold-soft); }
.readout .zoom { color: var(--text-3); }

.tools { display: flex; gap: 2px; }
.icon-btn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-2); transition: background-color 80ms linear, color 80ms linear; }
.icon-btn:hover { background: var(--wood-1); color: var(--text); }
.icon-btn:active { background: var(--wood-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: butt; stroke-linejoin: miter; }

@media (max-width: 1100px) { .readout, .readout + .kumiko { display: none; } }
@media (max-width: 860px) { .wordmark { display: none; } .sources button { padding: 0 7px; } }

.note {
  position: fixed; top: calc(var(--bar-h) + 16px); left: 50%; translate: -50% 0; z-index: 15;
  max-width: min(420px, 90vw); padding: 8px 14px; border-radius: var(--r-1);
  background: var(--washi); color: var(--sumi); font: 500 12px/16px var(--sans); box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

/* ---------- Stage: the tatami room ----------
   A floor seen from straight above: the mat, heri where long edges meet, one soft light from the left,
   and a flat neutral pool (ma) under each device so nothing colors the screens. */

.stage {
  position: fixed; inset: var(--bar-h) 0 var(--sill-h) 0; overflow: auto; isolation: isolate;
  padding: 48px;
}
body[data-stage="dusk"] .stage {
  background-color: var(--stage);
  background-image:
    linear-gradient(100deg, var(--light), transparent 55%),
    linear-gradient(to bottom, transparent 168px, var(--heri) 168px 179.5px, rgba(0, 0, 0, .5) 179.5px 180.5px, var(--heri) 180.5px 192px, transparent 192px),
    linear-gradient(to right, transparent 359.5px, rgba(0, 0, 0, .22) 359.5px 360.5px, transparent 360.5px),
    var(--weave);
  background-size: 100% 100%, 100% 360px, 720px 100%, 256px 256px;
  background-position: 0 0, 0 calc(50% + 180px), calc(50% + 360px) 0, 0 0;
  background-blend-mode: normal, normal, normal, soft-light;
  background-attachment: local;
}
body[data-stage="day"] .stage { background: radial-gradient(120% 90% at 50% 20%, #ECE8E0, #D3CEC4); --ma: #E4E0D8; --ma-lit: #EAE6DE; }
body[data-stage="grid"] .stage {
  background: repeating-conic-gradient(#2E2D2A 0 25%, #262523 0 50%) 0 0 / 24px 24px; --ma: transparent; --ma-lit: transparent;
}
body[data-stage="day"] .caption { color: #2A2723; }
body[data-stage="day"] .caption .sub, body[data-stage="day"] .caption .owner { color: #5C564D; }

.units {
  min-height: 100%; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center;
  align-content: center; gap: 44px 40px;
}
/* Ma: flat --ma for about 40 px around each device, fading into the mat by about 136 px. It sits on the unscaled
   slot, below every device, so the pool is the same in screen pixels at any zoom and neighbors merge. */
.slot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: 12px;
  background: var(--pool, var(--ma)); box-shadow: 0 0 96px 88px var(--pool, var(--ma));
  transition: background-color 400ms linear, box-shadow 400ms linear;
}
.slot:has(> .device.leading) { --pool: var(--ma-lit); }
.slot:has(> .device.leading)::before { animation: leader-lift 840ms linear; }
@keyframes leader-lift {
  0% { background: var(--ma); box-shadow: 0 0 96px 88px var(--ma); }
  29% { background: #2E2E2D; box-shadow: 0 0 96px 88px #2E2E2D; }
  100% { background: var(--ma-lit); box-shadow: 0 0 96px 88px var(--ma-lit); }
}

.unit { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.unit-screens { display: flex; align-items: flex-end; gap: var(--pair-gap, 20px); }

/* A sized box holds each scaled device so layout sees the scaled size. */
.slot { position: relative; flex: none; transition: width .2s var(--ease-door), height .2s var(--ease-door); }
.dragging iframe { pointer-events: none; }
.dragging .slot, .dragging .device, .dragging .screen, .no-anim .slot, .no-anim .device, .no-anim .screen, .no-anim iframe { transition: none !important; }
.device {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  background: var(--bezel); border-radius: var(--outer-r);
  --px: calc(1px / var(--s, 1));
  box-shadow: inset 0 0 0 var(--px) rgba(255, 255, 255, .06), 0 0 0 var(--px) var(--bezel-rim),
    0 calc(24 * var(--px)) calc(48 * var(--px)) calc(-16 * var(--px)) rgba(0, 0, 0, .6);
  transition: width .2s var(--ease-door), height .2s var(--ease-door), border-radius .2s var(--ease-door), transform .2s var(--ease-door), box-shadow 180ms linear;
}
.screen {
  position: absolute; overflow: hidden; background: #fff; border-radius: var(--r);
  transition: width .2s var(--ease-door), height .2s var(--ease-door), border-radius .2s var(--ease-door);
}
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.unit.phone .screen iframe, .unit.tablet .screen iframe, .unit.fold .screen iframe { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Ccircle cx='14' cy='14' r='10' fill='rgba(120,120,130,.35)' stroke='rgba(255,255,255,.85)' stroke-width='1.5'/%3E%3C/svg%3E") 14 14, pointer; }

/* Overlays drawn on top of the screen: they never take clicks. */
.overlay { position: absolute; inset: 0; pointer-events: none; }
.safe-shade { position: absolute; background: repeating-linear-gradient(135deg, rgba(240, 100, 92, .16) 0 6px, rgba(240, 100, 92, .06) 6px 12px); }
.island { position: absolute; left: 50%; translate: -50% 0; background: #000; border-radius: 20px; }
.punch { position: absolute; left: 50%; translate: -50% 0; width: 12px; height: 12px; border-radius: 50%; background: #000; }
.home-ind { position: absolute; left: 50%; translate: -50% 0; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .72); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.ctl-strip { position: absolute; background: #0B0C10; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 26px; }
.ctl-strip i { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.ctl-strip::before { content: "System controls"; position: absolute; top: 50%; left: 50%; translate: -50% -50%; rotate: 90deg; white-space: nowrap; font: 500 12px/1 -apple-system, system-ui; color: rgba(255, 255, 255, .35); }
.ctl-strip i:nth-child(2) { margin: 120px 0; }
.crease { position: absolute; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .10), rgba(255, 255, 255, .18), rgba(0, 0, 0, .10), transparent); }
.status { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; font: 600 16px/1 -apple-system, system-ui, sans-serif; color: #000; mix-blend-mode: difference; filter: invert(1); }
.status .icons { display: flex; gap: 5px; align-items: center; }
.status .icons i { display: block; background: currentColor; border-radius: 2px; }
body:not(.show-safe) .safe-shade { display: none; }
body:not(.show-status) .status { display: none; }

/* Mac window */
.unit.desktop .device { background: #2A2B31; }
.win-bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #C9CBD3; font-size: 13px; }
.win-bar .lights { display: flex; gap: 8px; }
.win-bar .lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.win-bar .lights i:nth-child(1) { background: #FF5F57; }
.win-bar .lights i:nth-child(2) { background: #FEBC2E; }
.win-bar .lights i:nth-child(3) { background: #28C840; }
.win-bar .win-title { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 52px; }
.grip { position: absolute; z-index: 2; touch-action: none; }
.grip.e { top: 0; right: -9px; width: 18px; height: 100%; cursor: ew-resize; }
.grip.s { left: 0; bottom: -9px; height: 18px; width: 100%; cursor: ns-resize; }
.grip.se { right: -12px; bottom: -12px; width: 26px; height: 26px; cursor: nwse-resize; }
.grip.se::after { content: ""; position: absolute; right: 9px; bottom: 9px; width: 10px; height: 10px; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); border-radius: 0 0 3px 0; opacity: .8; }
.dragging .grip.se::after { opacity: 1; }
.size-badge {
  position: absolute; z-index: 3; left: 50%; top: 50%; translate: -50% -50%; padding: 6px 12px; border-radius: 999px;
  background: rgba(18, 17, 16, .9); color: var(--gold-soft); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.dragging .size-badge { opacity: 1; }

.down { display: none !important; }
/* Shoji: washi in shadow with a plain lattice. Fades out over 160 ms when the screen has loaded. */
.shoji { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background-color: var(--ink-1); background-image: var(--fiber, none); transition: opacity 160ms linear; }
.shoji.on { opacity: 1; transition: none; }
.shoji svg { display: block; }
body.shooting .shoji { visibility: hidden; }
.status-line .closed-chip { color: var(--text-3); }
/* The one card on the stage when the dev server is down */
.closed-card {
  position: fixed; left: 50%; top: calc(var(--bar-h) + (100vh - var(--bar-h) - var(--sill-h)) / 2); translate: -50% -50%; z-index: 18; width: 360px;
  padding: 20px 22px 18px; border: 1px solid var(--ink-4); border-radius: var(--r-3); background-color: var(--ink-1); background-image: var(--fiber, none);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.closed-card .ink { margin: 0 auto 14px; opacity: .75; }
.closed-card h2 { margin: 0 0 8px; font: 600 20px/26px var(--mincho); color: var(--text); }
.closed-card p { margin: 0 0 16px; color: var(--text-2); overflow-wrap: anywhere; }
.closed-card .acts { display: flex; justify-content: flex-end; gap: 8px; }

/* Breakpoint ruler, 20 px above a resizable device */
.ruler { position: relative; height: 24px; margin-bottom: -4px; }
.ruler .band { position: absolute; top: 18px; height: 2px; background: var(--ink-4); }
.ruler .band.on { background: var(--gold); }
.ruler .tick { position: absolute; top: 0; translate: -50% 0; font: 500 11px/14px var(--sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.ruler .tick::after { content: ""; position: absolute; left: 50%; top: 15px; width: 1px; height: 6px; background: var(--text-3); }

/* Caption, 16 px under the device, always on the quiet pool */
.caption { display: flex; align-items: center; gap: 10px; color: var(--text); font: 500 12px/16px var(--sans); white-space: nowrap; margin-top: 4px; }
.caption .name { font-weight: 600; }
.caption .sub { color: var(--text-2); font-variant-numeric: tabular-nums; }
.caption .owner { color: var(--text-3); }
.caption .lead-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-right: -4px; flex: none; }
.caption .lead-word { color: var(--gold-soft); font: 500 11px/14px var(--sans); }
.caption .acts { display: flex; gap: 2px; margin-left: 2px; }
.caption .acts button {
  height: 24px; min-width: 24px; display: grid; place-items: center; padding: 0 4px; border-radius: var(--r-1); border: 0;
  background: transparent; color: var(--text-2); transition: background-color 80ms linear, color 80ms linear;
}
.caption .acts button:hover { background: var(--ink-2); color: var(--text); }
.caption .acts svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: butt; stroke-linejoin: miter; }
.caption .seg { height: 26px; }
.caption .seg button { padding: 0 8px; height: 22px; font-size: 12px; }
/* Chips: radius 3, a 16% wash of their color with a 1 px border at 40%, words in --text */
.caption .chip {
  height: 22px; display: inline-grid; place-items: center; padding: 0 7px; border-radius: var(--r-1); cursor: pointer;
  font: 500 12px/16px var(--sans); color: var(--text);
  background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.caption .chip:hover { background: color-mix(in srgb, var(--c) 26%, transparent); }
.err-badge, .caption .issue-chip.warn, .caption .drift-chip { --c: var(--beni); }
.caption .issue-chip { --c: var(--local); }
.status-line { font: 500 11px/14px var(--sans); color: var(--text-3); font-variant-numeric: tabular-nums; min-height: 14px; margin-top: -6px; width: 0; min-width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-line .warn { color: var(--gold-soft); }
.screen-label { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); text-align: center; font: 500 11px/14px var(--sans); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- The sill (the shelf, docked as the bottom rail) ---------- */

.shelf {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--sill-h); z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 16px; padding: 0 16px;
  box-shadow: inset 0 1px 0 #493E30;
}
.shelf > .kumiko { margin: 8px 0; }
.shelf .mode button { padding: 0 12px; }

.devices, .shelf-tools { display: flex; align-items: center; gap: 4px; }
/* Each cell: 60 x 56, icon 24 on top, label 11 below */
.dev-btn, .tool {
  position: relative; width: 60px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: var(--r-2); background: transparent; color: var(--text-2); padding: 0;
  font: 500 11px/14px var(--sans); transition: background-color 80ms linear, color 80ms linear;
}
.dev-btn:hover, .tool:hover { background: var(--wood-1); color: var(--text); }
.dev-btn:active, .tool:active { background: var(--wood-2); color: var(--text); }
.dev-btn:active > :first-of-type, .tool:active svg { translate: 0 1px; }
.dev-btn .sil { height: 24px; display: flex; align-items: flex-end; }
.dev-btn .sil svg { height: 100%; width: auto; overflow: visible; }
.dev-btn .sil .body { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: miter; }
.dev-btn .sil .glass { fill: none; }
.dev-btn .sil .feat { fill: currentColor; }
.dev-btn .lbl { white-space: nowrap; }
.dev-btn.lit, .tool.on { background: var(--gold-wash); color: var(--gold-soft); }
.dev-btn.lit .sil, .tool.on svg { color: var(--gold); }
.dev-btn .count, .checks-tool .badge {
  position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--gold); color: var(--on-status); font: 700 11px/16px var(--sans); font-style: normal; text-align: center; font-variant-numeric: tabular-nums;
}
.dev-btn kbd { position: absolute; top: 4px; left: 6px; min-width: 0; padding: 0; background: none; border: 0; font: 500 11px/1 var(--sans); color: var(--text-3); opacity: 0; transition: opacity .15s; }
.shelf:hover .dev-btn kbd { opacity: 1; }
.tool svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: butt; stroke-linejoin: miter; }
.tool svg .fill { fill: currentColor; stroke: none; }
.tool:disabled, .tool.needs-ext { color: color-mix(in srgb, var(--text-3) 50%, transparent); }

@media (max-width: 1060px) { .shelf { gap: 8px; } .dev-btn, .tool { width: 52px; } }
@media (max-width: 900px) { .shelf-tools .tool span { display: none; } .tool { width: 40px; } }

/* Mirror */
.mirror-tool.needs-ext { opacity: .6; }
/* The leader: a 2 px gold ring 5 px outside the bezel, with the pool showing in the gap. No glow. */
.device.leading, .device.drifted {
  box-shadow: inset 0 0 0 var(--px) rgba(255, 255, 255, .06), 0 0 0 var(--px) var(--bezel-rim),
    0 0 0 calc(5 * var(--px)) var(--ma-lit), 0 0 0 calc(7 * var(--px)) var(--ring),
    0 calc(24 * var(--px)) calc(48 * var(--px)) calc(-16 * var(--px)) rgba(0, 0, 0, .6);
}
.device.leading { --ring: var(--gold); }
.device.drifted { --ring: var(--beni); }
.steps { margin: 0; padding: 4px 24px 18px 44px; display: grid; gap: 12px; color: var(--text-2); }
.steps b { color: var(--text); }
.steps .btn { margin-right: 6px; }
.linkish { border: 0; background: none; padding: 0; color: var(--gold-soft); text-decoration: underline; font: inherit; }

/* Layout checks */
.issues { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* Checks outlines: 2 px, radius 3, with a dark keyline both sides so they read on any app's colors.
   Sizes are in screen pixels: the overlay sits inside the scaled device. */
.issue {
  --c: var(--beni); --px: calc(1px / var(--s, 1));
  position: absolute; border-radius: calc(3 * var(--px));
  box-shadow: 0 0 0 var(--px) rgba(14, 14, 16, .7), inset 0 0 0 var(--px) rgba(14, 14, 16, .7);
  outline: calc(2 * var(--px)) solid var(--c); outline-offset: var(--px);
}
.issue.info { --c: var(--local); }
.issue b {
  position: absolute; top: 0; left: 0; translate: -50% -50%; min-width: calc(18 * var(--px)); height: calc(18 * var(--px)); padding: 0 calc(4 * var(--px));
  border-radius: calc(9 * var(--px)); background: var(--c); color: var(--on-status); text-align: center;
  font: 700 calc(11 * var(--px)) / calc(18 * var(--px)) var(--sans); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 calc(1.5 * var(--px)) var(--bezel);
}
.issue.flash { animation: issue-flash 1s ease 2; }
@keyframes issue-flash { 50% { outline-width: calc(5 * var(--px)); } }
.checks-tool { position: relative; }
.checks-tool .badge { background: var(--beni); }
.checks-tool .badge:not(.warn) { background: var(--local); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--local); }
.sev-dot.warn { background: var(--beni); }
.muted { color: var(--text-3); }

/* Fold lab */
.fold-ctl { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 4px 10px; width: min(100%, 520px); margin-top: -4px; }
.fold-ctl .fold-btn { height: 28px; padding: 0 14px; }
.fold-ctl .deg { color: var(--text); font: 500 11px/14px var(--sans); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.fold-ctl .fold-note { grid-column: 1 / -1; color: var(--text-3); font: 500 11px/14px var(--sans); text-align: center; }
/* Hinge slider: 4 px track, the filled part gold, a 14 px gold thumb ringed with the pool color */
.fold-ctl input[type=range] {
  --fill: 100%; width: 100%; height: 18px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.fold-ctl input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) var(--fill), var(--ink-4) var(--fill)); }
.fold-ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--gold); border: 2px solid var(--ma); }
.fold-ctl input[type=range]:focus-visible { outline: none; }
.fold-ctl input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.fold-shade { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.fold-shade b { position: absolute; top: 0; bottom: 0; width: 50%; opacity: 0; }
.fold-shade .fs-turn { left: 0; background: #000; }
.fold-shade .fs-cast { left: 50%; background: linear-gradient(90deg, #000, rgba(0, 0, 0, .7) 35%, rgba(0, 0, 0, .25)); }
.fold-shade.port b { left: 0; right: 0; width: auto; height: 50%; bottom: auto; }
.fold-shade.port .fs-cast { top: 50%; background: linear-gradient(180deg, #000, rgba(0, 0, 0, .7) 35%, rgba(0, 0, 0, .25)); }
/* The angle glyph: a 56 px fold rig with blank glass */
.fold-ctl .hinge.mini { --turn: 0deg; width: 56px; height: 36px; perspective: 260px; display: grid; place-items: center; }
.mini-body { position: relative; width: 44px; height: 28px; transform-style: preserve-3d; transform: rotateX(40deg) rotateY(-24deg) rotateZ(-10deg); }
.mini-half { position: absolute; top: 0; width: 22px; height: 28px; transform-style: preserve-3d; }
.mini-half.r { left: 22px; background: #262930; border-radius: 0 3px 3px 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); overflow: hidden; }
.mini-half.l { left: 0; transform-origin: 100% 50%; transform: rotateY(var(--turn)); }
.mini-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; outline: 1px solid transparent; }
.mini-face.front { background: #262930; border-radius: 3px 0 0 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); overflow: hidden; }
.mini-face.back { background: #3A3D44; border-radius: 0 3px 3px 0; transform: rotateY(180deg); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.mini-shade, .mini-cast { position: absolute; inset: 0; opacity: 0; }
.mini-shade { background: #000; }
.mini-cast { background: linear-gradient(90deg, #000, rgba(0, 0, 0, .25)); }
.slot .device { perspective: 2400px; }

/* ---------- Menus, sheets, toasts, buttons ---------- */

/* Washi in shadow: panels, menus, sheets */
.menu, .sheet, .shots, .shoji, .closed-card { background-color: var(--ink-1); background-image: var(--fiber, none); background-size: 256px 256px; background-blend-mode: soft-light; }

.menu {
  position: fixed; z-index: 50; min-width: 220px; max-width: 340px; max-height: 70vh; overflow: auto; padding: 4px;
  border: 1px solid var(--ink-4); border-radius: var(--r-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.menu:not([hidden]) { animation: door-wipe 160ms var(--ease-door); }
@keyframes door-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.menu.closing { animation: fade-out 100ms linear forwards; }
@keyframes fade-out { to { opacity: 0; } }
.menu .item {
  width: 100%; min-height: 30px; display: flex; align-items: center; gap: 10px; padding: 5px 10px; border: 0; border-radius: var(--r-1);
  background: transparent; text-align: left; color: var(--text); font: 400 13px/20px var(--sans);
}
.menu .item:hover, .menu .item:focus-visible { background: var(--ink-3); outline: none; }
.menu .item .hint { margin-left: auto; padding-left: 12px; color: var(--text-3); font: 500 11px/14px var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu .item .desc { display: block; color: var(--text-3); font: 500 11px/14px var(--sans); margin-top: 1px; }
.menu .item.on::after { content: ""; margin-left: auto; width: 14px; height: 14px; flex: none;
  background: var(--gold); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.menu .item.on .hint { margin-right: 8px; }
.menu .sep { height: 1px; margin: 4px 6px; background: var(--ink-4); }
.menu .head { padding: 8px 10px 4px; color: var(--text-2); font: 600 15px/20px var(--sans); }
.menu .item .app-icon { width: 24px; height: 24px; }
.menu .item .sev-dot { margin-top: 1px; }

/* Toasts: a slip of lit washi, 16 px above the sill */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sill-h) + 16px); translate: -50% 0; z-index: 60; max-width: 420px; padding: 8px 14px; border-radius: var(--r-1);
  background-color: var(--washi); color: var(--sumi); font: 500 12px/16px var(--sans);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.toast.error { box-shadow: inset 3px 0 0 var(--beni-deep), 0 8px 24px rgba(0, 0, 0, .45); padding-left: 17px; }
.toast.show { animation: toast-in 200ms var(--ease-door); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-24px); } }

.sheet { padding: 0; border: 1px solid var(--ink-4); border-radius: var(--r-3); color: var(--text); width: min(560px, 94vw); max-height: 88vh; box-shadow: 0 24px 64px rgba(0, 0, 0, .6); }
.sheet.narrow { width: min(480px, 94vw); }
.sheet::backdrop { background: rgba(10, 9, 8, .55); }
.sheet[open] { animation: sheet-in 260ms var(--ease-door); }
.sheet[open]::backdrop { animation: fade-in 200ms linear; }
@keyframes sheet-in { from { transform: translateX(56px); opacity: 0; } 60% { opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-inner { display: flex; flex-direction: column; max-height: 88vh; }
.sheet-head { padding: 16px 24px 14px; position: relative; color: var(--text-2); }
.sheet-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(rgba(0, 0, 0, .55) 50%, rgba(200, 169, 126, .16) 50%); }
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-head h2 { margin: 0; min-height: 26px; font: 600 20px/26px var(--mincho); color: var(--text); }
.sheet-head p { margin: 6px 0 0; color: var(--text-2); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; align-items: center; padding: 14px 24px; }
.sheet-foot > :first-child:not(.btn) { margin-right: auto; }
.foot-left { display: flex; gap: 8px; margin-right: auto; }

/* Buttons: primary (gold, at most one per surface), secondary, quiet. 32 tall, radius 6, label size. */
.btn {
  height: 32px; padding: 0 14px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--ink-2); color: var(--text);
  font: 500 12px/16px var(--sans); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none;
  transition: background-color 80ms linear, color 80ms linear;
}
.btn:hover { background: var(--ink-3); }
.btn:active { background: var(--ink-4); }
.btn:disabled { color: color-mix(in srgb, var(--text-3) 50%, transparent); background: var(--ink-2); cursor: default; }
.btn.primary { background: var(--gold); border-color: transparent; color: var(--on-gold); }
.btn.primary:hover { background: #F6BF58; }
.btn.primary:active { background: #D99A25; }
.btn.primary:disabled { background: var(--ink-3); color: color-mix(in srgb, var(--text-3) 50%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--ink-2); color: var(--text); }
.btn.ghost:active { background: var(--ink-3); }
.btn.danger { color: var(--beni); border-color: color-mix(in srgb, var(--beni) 50%, transparent); background: transparent; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.apps-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0; min-height: 0; overflow: hidden; }
#apps-dialog { width: min(680px, 94vw); }
.devices-pane { padding: 8px 24px 4px; overflow: auto; display: grid; gap: 4px; }
.dev-row { display: grid; grid-template-columns: 76px 160px minmax(0, 1fr); gap: 4px 12px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--ink-3); }
.dev-row .dev-sil { align-self: center; color: var(--text-2); font: 600 12px/16px var(--sans); }
.dev-row select { width: 100%; height: 32px; padding: 0 8px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--ink-0); color: var(--text); font: 400 13px/20px var(--sans); }
.dev-row select:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.field-static { height: 32px; display: flex; align-items: center; color: var(--text-2); }
.custom-size { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.custom-size input { width: 100%; }
.dev-room { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }
.app-list { list-style: none; margin: 0; padding: 10px; overflow: auto; border-right: 1px solid var(--ink-4); }
.app-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--r-1); background: transparent; text-align: left; }
.app-list button:hover { background: var(--ink-2); }
.app-list button[aria-current="true"] { background: var(--ink-3); }
.app-list .add { color: var(--gold-soft); }
.app-edit { padding: 16px 24px 20px; overflow: auto; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 5px; }
.field > span { color: var(--text-2); font: 500 12px/16px var(--sans); }
.field small { color: var(--text-3); font: 500 11px/14px var(--sans); }
.field input[type="text"], .field input[type="url"], .field textarea {
  height: 32px; padding: 0 10px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--ink-0); outline: none;
}
.field textarea { height: 56px; padding: 7px 10px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field { min-width: 0; }
.field input[type="text"], .field input[type="url"], .field textarea { width: 100%; min-width: 0; }
.src-field > span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type="color"] { width: 40px; height: 32px; padding: 2px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--ink-0); }
.edit-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding-top: 4px; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 0; padding: 4px 24px 20px; }
.keys dt { color: var(--text-2); white-space: nowrap; }
.keys dd { margin: 0; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: var(--r-1); background: var(--ink-3); border-bottom: 2px solid var(--ink-0); font: 500 11px/16px var(--sans); text-align: center; color: var(--text); }

.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 40px; }
.empty .glyph { width: 56px; height: 56px; color: var(--text-3); margin-bottom: 6px; }
/* Ink drawings: brushed in sumi, shipped as transparent masks so they take any token color */
.ink { display: block; flex: none; background: var(--ink-color, var(--text-3)); -webkit-mask: var(--ink) center / contain no-repeat; mask: var(--ink) center / contain no-repeat; }
.ink-room { --ink: url("../ink/room.webp"); width: 176px; aspect-ratio: 520 / 515; }
.ink-shoji { --ink: url("../ink/shoji.webp"); width: 112px; aspect-ratio: 520 / 420; }
.ink-window { --ink: url("../ink/window.webp"); width: 132px; aspect-ratio: 520 / 512; }
.ink-devices { --ink: url("../ink/devices.webp"); width: 200px; aspect-ratio: 520 / 331; }
.ink-tools { --ink: url("../ink/tools.webp"); width: 188px; aspect-ratio: 520 / 352; }
.empty .ink { margin-bottom: 8px; opacity: .8; }
.empty-title { margin: 0; font: 600 28px/36px var(--mincho); color: var(--text); }
.empty-body { margin: 0 0 8px; color: var(--text-2); max-width: 44ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .sheet[open], .shots:not([hidden]), .toast.show { animation: fade-in 120ms linear !important; }
}

/* ---------- First run: lit washi cards ---------- */
.welcome {
  position: fixed; left: 50%; top: calc(var(--bar-h) + (100vh - var(--bar-h) - var(--sill-h)) / 2); translate: -50% -50%; z-index: 40; width: min(400px, calc(100vw - 32px));
  padding: 22px 24px 18px; border-radius: var(--r-1); background-color: var(--washi); color: var(--sumi-2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55); animation: toast-in 200ms var(--ease-door);
}
.welcome .ink { --ink-color: var(--sumi); margin: 4px auto 6px; opacity: .85; }
.welcome h2 { margin: 12px 0 8px; font: 600 28px/36px var(--mincho); color: var(--sumi); }
.welcome h2 .kanji { color: var(--sumi-2); }
.welcome p { margin: 0 0 20px; font: 400 15px/24px var(--sans); color: var(--sumi-2); }
/* The step marker: three small lattice panes, the current one filled */
.welcome-steps { display: flex; gap: 2px; }
.welcome-steps i { width: 14px; height: 18px; box-shadow: inset 0 0 0 1.5px var(--sumi); }
.welcome-steps i.on { background: var(--sumi); }
.welcome-acts { display: flex; justify-content: space-between; align-items: center; }
.welcome-next { height: 32px; padding: 0 16px; border: 0; border-radius: var(--r-2); background: var(--sumi); color: var(--washi); font: 500 12px/16px var(--sans); }
.welcome-next:hover { background: #2E2C29; }
.welcome-skip { height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-2); background: transparent; color: var(--sumi-2); font: 500 12px/16px var(--sans); }
.welcome-skip:hover { background: rgba(26, 25, 23, .08); color: var(--sumi); }
.welcome :focus-visible { outline: 2px solid var(--sumi); outline-offset: 2px; }
body.shooting .welcome { visibility: hidden; }

/* ---------- Screenshots ---------- */

/* While Mado photographs its own window, everything but the devices steps out of frame. */
body.shooting :is(.caption, .status-line, .fold-ctl, .ruler, .issues, .size-badge, .screen-label, .grip, .toast, .note, .menu, .shelf, .shots, .shutter) { visibility: hidden !important; }
body.shooting .device.leading, body.shooting .device.drifted { box-shadow: inset 0 0 0 1.5px var(--bezel-edge), 0 30px 60px -20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .4); }
/* The clean pass: what a screenshot taken on the device would show. */
body.shoot-clean :is(.island, .punch, .home-ind, .safe-shade, .crease) { visibility: hidden !important; }
body.shoot-clean .screen { border-radius: 0 !important; }

.shutter { position: fixed; z-index: 30; pointer-events: none; background: #fff; border-radius: 12px; }

/* The tray fills the opening, inset 16 px from both rails */
.shots {
  position: fixed; left: 16px; right: 16px; top: calc(var(--bar-h) + 16px); bottom: calc(var(--sill-h) + 16px); z-index: 25;
  display: flex; flex-direction: column; border: 1px solid var(--ink-4); border-radius: var(--r-3); box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.shots[hidden] { display: none; }
.shots:not([hidden]) { animation: tray-in 320ms var(--ease-door); }
@keyframes tray-in { from { transform: translateX(120px); opacity: 0; } }
.shots-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 20px; }
.shots-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(rgba(0, 0, 0, .55) 50%, rgba(200, 169, 126, .16) 50%); }
.shots-head h2 { margin: 0; font: 600 20px/26px var(--mincho); }
.shots-hint { flex: 1; margin: 0; color: var(--text-2); font: 500 12px/16px var(--sans); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shots-body { overflow: auto; padding: 16px 20px 20px; display: grid; gap: 20px; align-content: start; }
.shot-when { margin: 0 0 8px; color: var(--text-3); font: 500 11px/14px var(--sans); }
.shot-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.shot { margin: 0; flex: none; display: grid; gap: 6px; justify-items: start; }
/* Screenshot wells are flat --ma: the neutral rule applies to screenshots as much as to live screens */
.shot-img { display: grid; place-items: center; height: 204px; min-width: 90px; padding: 12px; border: 0; border-radius: var(--r-2); background: var(--ma); cursor: zoom-in; }
.shot-img:hover { box-shadow: inset 0 0 0 1px var(--line); }
.shot-img img { max-height: 180px; max-width: 420px; display: block; }
.shot figcaption { display: flex; gap: 8px; align-items: baseline; font: 500 12px/16px var(--sans); max-width: 420px; }
.shot figcaption .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot figcaption .sub { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.shot-acts { display: flex; gap: 6px; }
.shot-acts .btn { height: 26px; padding: 0 10px; }

/* ---------- Reviews ---------- */
.batch-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.batch-head .shot-when { margin: 0; white-space: nowrap; }
.review-note {
  flex: 1; min-width: 120px; height: 30px; padding: 0 10px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: var(--ink-0); color: var(--text); font: 400 13px/20px var(--sans);
}
.review-note::placeholder { color: var(--text-3); }
.review-note:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.review-btn { white-space: nowrap; }
.review-btn:disabled { opacity: .6; cursor: progress; }

.shot-pic { position: relative; display: block; }
.mark {
  position: absolute; border-radius: 3px; pointer-events: none;
  outline: 2px solid var(--c); outline-offset: 1px; box-shadow: 0 0 0 1px rgba(14, 14, 16, .7), inset 0 0 0 1px rgba(14, 14, 16, .7);
  transition: outline-width .15s;
}
.mark b {
  position: absolute; left: 0; top: 0; translate: -50% -50%; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; font: 700 11px/1 var(--sans); background: var(--c); color: var(--on-status); box-shadow: 0 0 0 1.5px var(--bezel);
}
.mark.hot { outline-width: 3px; }
.sev-fix { --c: var(--beni); }
.sev-consider { --c: var(--local); }
.sev-polish { --c: var(--preview); }

.review { margin-top: 14px; padding-top: 14px; position: relative; }
.review::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--ink-4); }
.review-busy { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.review-secs { color: var(--text-3); font-variant-numeric: tabular-nums; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-4); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 1turn; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.review-msg p { margin: 0 0 10px; color: var(--text-2); max-width: 72ch; }
.review-msg.error p { color: var(--text); }
.review-acts { display: flex; gap: 8px; }
.review-summary { margin: 0 0 16px; max-width: 72ch; font: 400 15px/24px var(--sans); color: var(--text); }
.review-empty { margin: 0; color: var(--text-2); }
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 90ch; }
.finding { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 2px 0 2px 12px; box-shadow: inset 3px 0 0 var(--c); }
.finding .num { font: 600 15px/20px var(--sans); color: var(--c); font-variant-numeric: tabular-nums; }
.f-title { margin: 0; font: 600 15px/20px var(--sans); color: var(--text); }
.f-where { margin-left: 8px; font: 500 12px/16px var(--sans); color: var(--text-3); }
.f-detail { margin: 4px 0 0; color: var(--text-2); font: 400 14px/22px var(--sans); }
.chip { display: inline-block; padding: 0 6px; border-radius: var(--r-1); font: 600 11px/16px var(--sans); background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); vertical-align: 2px; }
.review-raw { white-space: pre-wrap; font-size: 12px; color: var(--text-2); background: var(--ink-0); padding: 10px; border-radius: var(--r-2); }
.review-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.review-meta { color: var(--text-3); font: 500 11px/14px var(--sans); }

/* ---------- Computers: Chromebook, MacBook Pro, Studio Display (device units are the computer's points) ---------- */
/* ---------- School Chromebook: lid, ChromeOS display, keyboard deck (device units: 135 per inch) ---------- */
.unit.desktop .device.cb-device { background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.cb { position: absolute; inset: 0; pointer-events: none; }
.cb-shelf {
  position: absolute; display: flex; align-items: center; gap: 16px; padding: 0 14px;
  background: rgba(32, 33, 36, .72); backdrop-filter: blur(20px); color: #E8EAED; font: 500 15px/1 system-ui, sans-serif;
}
.cb-launcher { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #E8EAED; opacity: .9; }
.cb-apps { flex: 1; display: flex; justify-content: center; gap: 14px; }
.cb-apps i { width: 30px; height: 30px; border-radius: 50%; background: #5F6368; display: block; }
.cb-apps i.chrome { background: conic-gradient(#EA4335 0 120deg, #FBBC04 0 240deg, #34A853 0); box-shadow: inset 0 0 0 9px transparent; position: relative; }
.cb-apps i.chrome::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #4285F4; box-shadow: 0 0 0 3px #fff; }
.cb-tray { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 16px; background: rgba(255, 255, 255, .1); }
.cb-tray i { width: 14px; height: 14px; border-radius: 3px; background: #E8EAED; opacity: .85; display: block; }
.cb-win { position: absolute; background: #DFE3E9; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.cb-tabs { display: flex; align-items: flex-end; gap: 6px; padding: 0 10px; }
.cb-tab {
  display: flex; align-items: center; gap: 8px; height: 28px; max-width: 240px; padding: 0 14px; border-radius: 10px 10px 0 0;
  background: #fff; color: #202124; font: 400 13px/1 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cb-tab i { width: 14px; height: 14px; border-radius: 3px; background: #8AB4F8; flex: none; }
.cb-plus { color: #5F6368; font: 400 20px/28px system-ui; padding: 0 6px; }
.cb-bar { display: flex; align-items: center; gap: 6px; padding: 0 10px; background: #fff; border-bottom: 1px solid #DADCE0; }
.cb-nav { width: 28px; text-align: center; color: #5F6368; font: 400 17px/1 system-ui; }
.cb-omni {
  flex: 1; height: 26px; margin-left: 6px; padding: 0 14px; border-radius: 13px; background: #F1F3F4; color: #3C4043;
  font: 400 13px/26px system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-lid {
  position: absolute; left: 0; top: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--body) 100%, #fff 6%), var(--body) 55%, color-mix(in srgb, var(--body) 100%, #000 10%));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .1), inset 0 0 0 4px rgba(0, 0, 0, .35), 0 40px 90px -30px rgba(0, 0, 0, .7);
}
/* Studio Display: aluminum edge around a black glass border. */
.pc-lid.edge { background: #0D0E10; box-shadow: 0 0 0 9px #C9CBCF, 0 0 0 10px #9EA1A7, 0 50px 110px -30px rgba(0, 0, 0, .75); }
.pc-cam { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #3D4A66, #0B0D12 70%); box-shadow: 0 0 0 3px rgba(0, 0, 0, .5); }
.pc-display { position: absolute; overflow: hidden; }
.pc-display.cros { background: linear-gradient(160deg, #A8C7E8 0%, #7FA6D6 35%, #4E73B8 70%, #3A5596 100%); }
.pc-display.mac { background: radial-gradient(120% 90% at 30% 20%, #7B6FD6 0%, #3E3A8C 45%, #1B1E4A 100%); }
.pc-brand { position: absolute; text-align: center; color: rgba(200, 203, 210, .55); font: 600 15px/20px system-ui, sans-serif; letter-spacing: .02em; }
.pc-menubar {
  position: absolute; display: flex; align-items: center; gap: 22px; padding: 0 18px; color: #fff;
  background: rgba(20, 20, 30, .28); backdrop-filter: blur(20px); font: 500 14px/1 -apple-system, system-ui, sans-serif;
}
.pc-menubar b { font-weight: 700; }
.pc-apple { width: 14px; height: 16px; border-radius: 50% 50% 45% 45%; background: #fff; display: block; }
.pc-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.pc-right i { width: 16px; height: 12px; border-radius: 3px; border: 1.6px solid #fff; display: block; }
.pc-notch { position: absolute; background: #000; border-radius: 0 0 12px 12px; }
.pc-dock {
  position: absolute; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 18px;
  background: rgba(255, 255, 255, .18); backdrop-filter: blur(24px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.pc-dock i { width: 42px; height: 42px; border-radius: 11px; display: block; background: linear-gradient(160deg, #F4F5F8, #C9CDD6); }
.pc-dock i:nth-child(3n + 2) { background: linear-gradient(160deg, #6FB3F2, #2F6FD0); }
.pc-dock i:nth-child(3n) { background: linear-gradient(160deg, #F2B035, #D8752A); }
.pc-win { position: absolute; border-radius: 10px 10px 0 0; background: #2A2B31; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 20px 50px -10px rgba(0, 0, 0, .55); }
.pc-win .win-bar { border-radius: 10px 10px 0 0; }
.pc-hinge { position: absolute; height: 10px; border-radius: 0 0 8px 8px; background: linear-gradient(180deg, #0F1012, #26272B); }
/* The keyboard comes toward you and fades, so the screen stays the subject. */
.pc-deck {
  position: absolute; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 45%, transparent 100%);
}
.pc-deck svg { display: block; }
.pc-stand {
  position: absolute; background: linear-gradient(90deg, #A7AAB0, #D6D8DC 30%, #E3E5E8 50%, #CFD1D5 70%, #9FA2A8);
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent 95%); mask-image: linear-gradient(180deg, #000 10%, transparent 95%);
}

/* ---------- Update notice: a slip of lit washi under the title bar ---------- */
.update {
  position: fixed; top: calc(var(--bar-h) + 16px); left: 50%; translate: -50% 0; z-index: 26;
  display: flex; align-items: center; gap: 10px; max-width: min(640px, calc(100vw - 32px)); padding: 6px 6px 6px 14px;
  border-radius: var(--r-1); background-color: var(--washi); color: var(--sumi);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.update[hidden] { display: none; }
.update:not([hidden]) { animation: toast-in 200ms var(--ease-door); }
.update p { margin: 0; font: 500 12px/16px var(--sans); color: var(--sumi-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update p b { color: var(--sumi); font-weight: 600; }
.update-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 1px rgba(26, 25, 23, .35); flex: none; }
/* On washi the main button is sumi, because gold on paper does not pass contrast */
.update .btn { height: 28px; flex: none; background: transparent; border-color: rgba(26, 25, 23, .35); color: var(--sumi); }
.update .btn:hover { background: rgba(26, 25, 23, .08); }
.update .btn.primary { background: var(--sumi); border-color: transparent; color: var(--washi); }
.update .btn.primary:hover { background: #2E2C29; }
.update .icon-btn { color: var(--sumi-2); }
.update .icon-btn:hover { background: rgba(26, 25, 23, .08); color: var(--sumi); }
.news { max-height: 52vh; overflow: auto; padding: 4px 24px 0; font: 400 13px/20px var(--sans); color: var(--text-2); }
.news h3 { margin: 14px 0 6px; font: 600 15px/20px var(--sans); color: var(--text); }
.news ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.news code { font-size: 12px; background: var(--ink-0); padding: 1px 5px; border-radius: var(--r-1); }

/* ---------- The fold (3D layer used only while the Duo closes or opens) ----------
   Crisp by construction: only transform and opacity move, no filter or blur on anything that moves; every
   shade and shadow is a pre-drawn layer whose opacity changes. */
.unit.fold-live-hidden .device { visibility: hidden; }
.fold-fx { position: fixed; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.fx-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.fx-cam { position: absolute; left: 0; top: 0; perspective-origin: 50% 45%; transform-origin: 50% 50%; transform-style: preserve-3d; }
.fx-body { position: relative; transform-style: preserve-3d; transform-origin: 50% 50%; }
.fx-half { position: absolute; top: 0; transform-style: preserve-3d; }
.fx-face { position: absolute; left: 0; top: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fx-face.turning { outline: 1px solid transparent; } /* keeps turning edges antialiased in Chrome */
/* Titanium frame: the glass sits in a black border with a 1 px lit rim */
.fx-face.front { background: #0E0E10; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), inset 0 0 0 3px #0B0C0F; }
.fx-face.back { background: linear-gradient(150deg, #4C4F58 0%, #34363D 45%, #24262C 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), inset 0 0 0 4px #2A2C32; }
.fx-glass { position: absolute; background-color: #000; background-repeat: no-repeat; overflow: hidden; }
/* The inner display is matte: a broad, faint reflection that drifts as the half turns */
.fx-matte { position: absolute; inset: -20% -40%; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .035) 50%, transparent 70%); }
.fx-off { position: absolute; inset: 0; background: #000; opacity: 0; }
.fx-shade { position: absolute; inset: 0; background: #000; opacity: 0; border-radius: inherit; pointer-events: none; }
/* The left half's shadow falling across the right half, darkest by the hinge */
.fx-cast { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .7) 35%, rgba(0, 0, 0, .25) 100%); }
/* The crease: a 1 px dark line with a soft highlight beside it (opacity 1 = the 5% peak) */
.fx-crease { position: absolute; left: 0; top: 0; bottom: 0; width: 13px; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .9) 0 1px, rgba(255, 255, 255, .05) 1px, transparent 13px); }
.fx-edge {
  position: absolute; display: block; backface-visibility: visible;
  background: linear-gradient(90deg, #4D5057, #A9ACB4 38%, #CDD0D6 50%, #8D9098 64%, #45474E);
}
.fx-edge.c { background: linear-gradient(90deg, #4D5057, #B3B6BE 45%, #7E8189); }
.fx-camera { position: absolute; right: 34px; top: 34px; width: 150px; height: 150px; border-radius: 42px; background: #1A1B20; box-shadow: inset 0 0 0 2px #4A4D55, 0 2px 0 rgba(255, 255, 255, .06); }
.fx-camera::before, .fx-camera::after { content: ""; position: absolute; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #2F3A55, #07080B 65%); box-shadow: 0 0 0 4px #2A2C33; }
.fx-camera::before { left: 18px; top: 18px; }
.fx-camera::after { right: 18px; bottom: 18px; }
/* The cover is glossy glass: black when asleep, the still of the live cover when opening */
.fx-cover { position: absolute; overflow: hidden; background: #050506; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.fx-cover-still { position: absolute; inset: 0; opacity: 0; background-repeat: no-repeat; }
.fx-cover-sheen { position: absolute; top: -10%; bottom: -10%; left: 0; width: 120px; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08) 50%, transparent); }
.fx-island { position: absolute; left: 50%; top: 14px; translate: -50% 0; width: 118px; height: 34px; border-radius: 17px; background: #000; z-index: 1; }
/* Matte hinge cover, no highlight */
.fx-hinge { position: absolute; opacity: 0; border-radius: 999px; background: #2B2C30; transform-origin: 50% 50%; }
/* Contact shadow: a pre-drawn soft ellipse; only its transform and opacity change */
.fx-shadow {
  position: absolute; left: 2%; top: 88%; width: 96%; height: 20%; transform-origin: 0 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, .25) 55%, transparent);
}
