/* Lanternworks — interface styles.
   Warm "after-hours office" palette: ink plum surfaces, cream text, lantern-amber accent (swaps per office theme). */

:root {
  --accent: #ffb347;
  --accent-ink: #1d1328;
  --ink: #120b1c;
  --bg: #1b1226;
  --panel: #251a34;
  --panel2: #2e2140;
  --panel3: #3a2a50;
  --line: #4a3a63;
  --line2: #62507f;
  --text: #f8efe0;
  --muted: #bdb0d3;
  --dim: #8e82a8;
  --good: #6ee7a0;
  --bad: #ff6b6b;
  --info: #7cc7ff;
  --ui-scale: 1;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 3px 0 rgba(8, 4, 14, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--ui-scale)); height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; position: fixed; inset: 0; width: 100%;
  background: var(--ink); color: var(--text); font-family: var(--font); line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font-family: var(--mono); font-size: 0.7rem; padding: 0 5px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; background: var(--ink); color: var(--text); line-height: 1.5; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
canvas.pixel-title, #wordmark, #intro-mark, .theme-art, .lantern-art { image-rendering: pixelated; }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 0.85rem; }
.flip { transform: scaleX(-1); }

#app { position: fixed; inset: 0; height: 100dvh; overflow: hidden; }
#stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: #120b1c; }
#game { display: block; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; outline: none; touch-action: none; }

/* ---------- HUD ---------- */
.panel-glass { background: rgba(30, 20, 44, 0.84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 2px solid var(--line); box-shadow: var(--shadow), 0 10px 30px rgba(0, 0, 0, 0.35); }
#topbar { position: absolute; z-index: 10; top: calc(10px + var(--sat)); left: calc(10px + var(--sal)); display: flex; align-items: center; gap: 12px; padding: 7px 12px 7px 10px; border-radius: 14px; background: rgba(30, 20, 44, 0.84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 2px solid var(--line); box-shadow: var(--shadow); max-width: calc(100vw - 150px - var(--sal) - var(--sar)); }
.brand { background: none; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center; }
.brand canvas { display: block; }
.company { display: flex; flex-direction: column; line-height: 1.1; border-left: 2px solid var(--line); padding-left: 12px; min-width: 0; }
.co-label { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); font-weight: 800; }
#company-name { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

#minimap-wrap { position: absolute; z-index: 10; top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); border-radius: 12px; overflow: hidden; border: 2px solid var(--line); box-shadow: var(--shadow); background: #120b1c; line-height: 0; }
#minimap { width: 168px; height: auto; image-rendering: pixelated; cursor: pointer; display: block; }
.no-minimap #minimap-wrap { display: none; }

#feed-dock { position: absolute; z-index: 10; left: calc(10px + var(--sal)); bottom: calc(10px + var(--sab)); width: 300px; border-radius: 14px; overflow: hidden; background: rgba(30, 20, 44, 0.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 2px solid var(--line); box-shadow: var(--shadow); }
#feed-dock { display: flex; flex-direction: column; }
#feed-dock header { border-top: 2px solid var(--line); }
#feed-dock.collapsed header { border-top: 0; }
.feed-toggle { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 0.72rem; letter-spacing: 0.1em; font-weight: 800; }
.feed-toggle kbd { margin-left: auto; }
.feed-latest { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 600; font-size: 0.8rem; letter-spacing: 0; margin-left: 2px; }
.feed-toggle:hover { background: rgba(255, 255, 255, 0.05); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
#feed-dock .feed-list { max-height: 230px; overflow: auto; padding: 6px; }
.no-feed-dock #feed-dock { display: none; }

#dock { position: absolute; z-index: 12; left: 50%; bottom: calc(10px + var(--sab)); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 18px; background: rgba(30, 20, 44, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 2px solid var(--line); box-shadow: var(--shadow), 0 10px 30px rgba(0, 0, 0, 0.4); }
.hud-btn { position: relative; width: 62px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: var(--panel2); border: 2px solid var(--line); border-radius: 13px; cursor: pointer; color: var(--text); box-shadow: 0 3px 0 rgba(8, 4, 14, 0.55); transition: transform 0.08s, background 0.12s, border-color 0.12s; }
.hud-btn span { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); line-height: 1; }
.hud-btn kbd { position: absolute; top: 3px; right: 4px; font-size: 0.55rem; padding: 0 3px; opacity: 0.7; border-bottom-width: 1px; }
.hud-btn:hover { background: var(--panel3); border-color: var(--accent); transform: translateY(-2px); }
.hud-btn:hover .ic { color: var(--accent); }
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(8, 4, 14, 0.55); }
.hud-btn.d-hire { background: color-mix(in srgb, var(--accent) 22%, var(--panel2)); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.hud-btn.d-more { display: none; }
.hud-btn.small { width: 44px; height: 44px; }
.hud-btn[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px); white-space: nowrap; background: var(--ink); border: 2px solid var(--line2); border-radius: 8px; padding: 4px 9px; font-size: 0.74rem; font-weight: 700; color: var(--text); opacity: 0; pointer-events: none; transition: opacity 0.12s, transform 0.12s; z-index: 5; }
@media (hover: hover) { .hud-btn[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); } .no-tips .hud-btn[data-tip]::after { display: none; } }
#zoom-ctrl .hud-btn[data-tip]::after { bottom: 50%; left: auto; right: calc(100% + 10px); transform: translate(4px, 50%); }
#zoom-ctrl .hud-btn[data-tip]:hover::after { transform: translate(0, 50%); }

#zoom-ctrl { position: absolute; z-index: 10; right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); display: flex; flex-direction: column; gap: 6px; }

.action-btn { position: absolute; z-index: 11; left: 50%; bottom: calc(86px + var(--sab)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px 9px 10px; border: 2px solid var(--accent); border-radius: 99px; background: rgba(30, 20, 44, 0.94); color: var(--text); font-weight: 800; font-size: 0.9rem; cursor: pointer; box-shadow: var(--shadow), 0 0 22px color-mix(in srgb, var(--accent) 40%, transparent); animation: pop 0.18s ease-out; }
.action-btn kbd { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 0.8rem; padding: 1px 8px; }
.action-btn:active { transform: translateX(-50%) translateY(2px); }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.95); } }

#touch-ui { position: absolute; inset: 0; pointer-events: none; z-index: 9; display: none; }
#joystick { position: absolute; left: calc(18px + var(--sal)); bottom: calc(100px + var(--sab)); width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)); border: 2px solid rgba(255, 255, 255, 0.28); pointer-events: auto; touch-action: none; display: grid; place-items: center; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#joystick::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.15); }
#stick { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); border: 2px solid var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); }
#joystick.on #stick { filter: brightness(1.15); }
body[data-joy-side="right"] #joystick { left: auto; right: calc(18px + var(--sar)); }
@media (pointer: coarse) { body[data-joy="auto"] #touch-ui { display: block; } }
body[data-joy="on"] #touch-ui { display: block; }
body[data-joy="off"] #touch-ui { display: none; }

#chips { position: absolute; z-index: 13; left: 50%; bottom: calc(82px + var(--sab)); transform: translateX(-50%); display: flex; gap: 6px; max-width: calc(100vw - 20px); overflow-x: auto; padding: 2px; }
#chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 8px 7px 12px; border-radius: 99px; background: var(--panel2); border: 2px solid var(--line2); cursor: pointer; font-weight: 700; font-size: 0.84rem; white-space: nowrap; box-shadow: var(--shadow); animation: pop 0.18s ease-out; }
.chip:hover { border-color: var(--accent); }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.chip-x:hover { background: var(--bad); }

/* ---------- Windows ---------- */
#windows { position: absolute; inset: 0 0 calc(82px + var(--sab)) 0; z-index: 30; pointer-events: none; }
.win { position: absolute; pointer-events: auto; display: flex; flex-direction: column; max-height: calc(100% - 20px); max-width: calc(100% - 16px); background: linear-gradient(180deg, var(--panel), #1f1530); border: 2px solid var(--line2); border-radius: 18px; box-shadow: 0 0 0 2px var(--ink), 0 22px 60px rgba(0, 0, 0, 0.6); overflow: hidden; transition: opacity 0.16s ease, transform 0.16s ease; transform-origin: 50% 40%; }
.win.opening, .win.closing { opacity: 0; transform: translateY(10px) scale(0.97); }
.win.dragging { transition: none; cursor: grabbing; }
.win-sm { width: 400px; } .win-md { width: 540px; } .win-lg { width: 780px; height: min(660px, calc(100% - 20px)); } .win-xl { width: 980px; height: min(680px, calc(100% - 20px)); }
.win-head { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 8px 0 14px; background: linear-gradient(180deg, var(--panel3), var(--panel2)); border-bottom: 2px solid var(--line); cursor: grab; touch-action: none; flex: none; }
.win-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); flex: none; }
.win-title { flex: 1; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.win-title canvas { max-width: 100%; height: 14px !important; width: auto; object-fit: contain; object-position: left; }
.win-actions { display: flex; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background 0.1s, color 0.1s; flex: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.icon-btn[data-wa="close"]:hover { background: var(--bad); color: #fff; }
.win-body { flex: 1; min-height: 0; overflow: auto; padding: 16px; overscroll-behavior: contain; touch-action: pan-y; }
.win-body.fill { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0.58rem 1rem; min-height: 44px; border-radius: 12px; border: 2px solid var(--line2); background: var(--panel3); color: var(--text); font-weight: 800; font-size: 0.92rem; cursor: pointer; box-shadow: 0 3px 0 rgba(8, 4, 14, 0.55); transition: transform 0.06s, background 0.12s, border-color 0.12s, filter 0.12s; text-align: center; }
.btn:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(8, 4, 14, 0.55); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 70%, #000); }
.btn.primary:hover:not(:disabled) { border-color: #fff; }
.btn.danger { background: #6a2236; border-color: #a63a54; color: #ffe2e8; }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.small { min-height: 36px; padding: 0.35rem 0.7rem; font-size: 0.82rem; border-radius: 10px; }
.btn.big { font-size: 1.1rem; padding: 0.8rem 1.6rem; min-height: 52px; }
.btn.icon-only { padding: 0; width: 46px; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px 0; font-size: 0.82rem; text-decoration: underline; text-underline-offset: 3px; }

input[type="text"], input[type="search"], textarea, select { width: 100%; font: inherit; font-size: max(16px, 1rem); color: var(--text); background: #170f22; border: 2px solid var(--line); border-radius: 12px; padding: 0.62rem 0.8rem; min-height: 46px; outline: none; transition: border-color 0.12s, box-shadow 0.12s; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23bdb0d3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
option { background: #1d1328; color: var(--text); }
.field { margin-bottom: 14px; min-width: 0; }
.field > label { display: block; font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.field .opt { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--dim); margin-left: 4px; }
.field .hint { font-size: 0.78rem; color: var(--dim); margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }
.field .err { color: var(--bad); font-size: 0.8rem; font-weight: 700; min-height: 0; margin-top: 4px; }
.field .err:empty { display: none; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--bad); }
.count { font-variant-numeric: tabular-nums; color: var(--dim); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row.end { justify-content: flex-end; }
.row.sticky { position: sticky; bottom: -16px; margin: 4px -16px -16px; padding: 12px 16px; background: linear-gradient(180deg, transparent, #1f1530 30%); }
.fill > .row.sticky { position: static; margin: 0; border-top: 2px solid var(--line); background: var(--panel); padding: 10px 14px; }
.shake { animation: shake 0.32s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; padding: 6px 10px; border-radius: 11px; border: 2px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 800; font-size: 0.86rem; color: var(--text); transition: background 0.1s, border-color 0.1s; }
.seg > button span { font-size: 0.72rem; font-weight: 600; opacity: 0.75; }
.seg > button:hover { border-color: var(--line2); background: var(--panel3); }
.seg > button[aria-checked="true"], .seg > button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 70%, #000); }
.seg.compact > button { min-height: 38px; flex-direction: row; gap: 6px; font-size: 0.82rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.claude { background: #e08a5a; } .dot.codex { background: #6ec6ff; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: 0.74rem; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; vertical-align: middle; }
.badge.manager { background: #5a4410; color: #ffd25a; border: 1px solid #a07c1c; }
.badge.worker { background: #1f3a55; color: #9fd0ff; border: 1px solid #3c6a97; }
.badge.ceo { background: var(--accent); color: var(--accent-ink); }
.prov { font-weight: 800; font-size: 0.78rem; } .prov-claude { color: #f0a070; } .prov-codex { color: #7ccfff; }
.model { color: var(--muted); font-size: 0.78rem; }
.portrait { image-rendering: pixelated; border-radius: 12px; border: 2px solid var(--line2); background: var(--panel2); flex: none; display: block; }
.portrait.big { border-radius: 14px; border-width: 3px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 28px 18px; color: var(--muted); }
.empty b { color: var(--text); font-size: 1rem; }
.empty span { font-size: 0.88rem; max-width: 30ch; }
.empty .ic { opacity: 0.6; }
.empty.small { padding: 16px 10px; }
.empty .btn { margin-top: 8px; }

.tabs { display: flex; gap: 6px; padding: 10px 12px 0; border-bottom: 2px solid var(--line); flex: none; overflow-x: auto; background: var(--panel); }
.tabs > button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; min-height: 42px; border: 2px solid transparent; border-bottom: 0; border-radius: 12px 12px 0 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 0.88rem; cursor: pointer; margin-bottom: -2px; }
.tabs > button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tabs > button[aria-selected="true"] { color: var(--text); background: #221733; border-color: var(--line); border-bottom: 2px solid #221733; box-shadow: inset 0 3px 0 var(--accent); }
.tab-panels { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.tab-panel { flex: 1; min-height: 0; overflow: auto; padding: 16px; overscroll-behavior: contain; touch-action: pan-y; }

.card { background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.card h4, .ho-list h4 { margin: 0 0 10px; font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 900; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hint-inline { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dim); font-size: 0.76rem; }

/* ---------- hire / form ---------- */
.hire-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 4px; }
.hire-portrait { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.hire-portrait .portrait { width: 96px; height: 96px; }
.hire-id { flex: 1; min-width: 0; }
.hire .seg > button { min-height: 54px; }

/* ---------- agent ---------- */
.agent-head { display: flex; gap: 14px; padding: 14px 16px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent); flex: none; }
.agent-head .portrait { width: 72px; height: 72px; }
.agent-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agent-name { font-size: 1.25rem; font-weight: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-sub { color: var(--muted); font-weight: 700; }
.agent-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; }
.loc { color: var(--dim); font-size: 0.78rem; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-grid button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); cursor: pointer; min-height: 52px; }
.status-grid button i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); grid-row: span 2; box-shadow: 0 0 8px var(--c); }
.status-grid button b { font-size: 0.86rem; }
.status-grid button span { font-size: 0.7rem; color: var(--dim); line-height: 1.15; }
.status-grid button:hover { border-color: var(--c); }
.status-grid button[aria-checked="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--panel)); }
.task-card { background: #1b122a; border: 2px dashed var(--line2); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.task-text { white-space: pre-wrap; word-break: break-word; max-height: 9em; overflow: auto; font-size: 0.92rem; }
.task-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 0.76rem; color: var(--dim); align-items: center; flex-wrap: wrap; }
.chipx { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line2); font-size: 0.76rem; font-weight: 700; color: var(--text); }
.chipx.muted { color: var(--dim); }
.chipx.link { cursor: pointer; padding: 2px 10px 2px 3px; } .chipx.link:hover { border-color: var(--accent); }
.chipx .portrait { width: 22px; height: 22px; border-radius: 50%; border-width: 1px; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 0.9rem; }
.prompt-view { margin: 0 0 6px; font-size: 0.9rem; color: var(--muted); white-space: pre-wrap; max-height: 8em; overflow: auto; }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.handoff-mini { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; margin-top: 6px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 0.84rem; flex-wrap: wrap; }
.handoff-mini span { color: var(--dim); font-weight: 500; flex-basis: 100%; }

/* chat */
.tab-panel[data-panel="chat"] { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-log { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, 0.02) 23px 24px); overscroll-behavior: contain; touch-action: pan-y; }
.chat-log .empty { margin: auto; }
.msg { display: flex; flex-direction: column; max-width: 82%; animation: pop2 0.18s ease-out; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.bubble { background: var(--accent); color: var(--accent-ink); padding: 8px 13px; border-radius: 16px 16px 4px 16px; font-weight: 600; word-break: break-word; font-size: 0.95rem; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); user-select: text; }
.msg time { font-size: 0.68rem; color: var(--dim); margin: 3px 4px 4px; }
.day-sep { text-align: center; margin: 6px 0; } .day-sep span { font-size: 0.7rem; color: var(--dim); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 10px; background: var(--panel); border-radius: 99px; }
@keyframes pop2 { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 2px solid var(--line); background: var(--panel); align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 120px; resize: none; overflow: auto; }
.composer .btn { height: 46px; flex: none; }
.chat-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 14px 8px; background: var(--panel); font-size: 0.7rem; color: var(--dim); }

/* ---------- staff ---------- */
.staff-top { padding: 12px 14px 8px; border-bottom: 2px solid var(--line); flex: none; display: flex; flex-direction: column; gap: 10px; }
.staff-count { font-size: 0.9rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .seg { flex: 0 0 auto; }
.search { position: relative; flex: 1; min-width: 150px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search input { padding-left: 2.3rem; }
.bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: color-mix(in srgb, var(--accent) 14%, var(--panel2)); border: 2px solid color-mix(in srgb, var(--accent) 50%, var(--line)); border-radius: 12px; }
.bulk select { width: auto; min-height: 36px; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 0.86rem; }
input[type="checkbox"].plain, .check input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex: none; margin: 0; }
.check.small { font-size: 0.78rem; }
.staff-list { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; }
.srow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; transition: border-color 0.1s; }
.srow:hover { border-color: var(--line2); }
.srow.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel2)); }
.srow-main { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; cursor: pointer; min-width: 0; padding: 2px; border-radius: 10px; }
.srow-main:focus-visible { outline: 3px solid var(--accent); }
.srow-main .portrait { width: 48px; height: 48px; }
.srow-id { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.srow-id b { font-size: 1rem; margin-right: 6px; } .srow-id small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-select { position: relative; display: inline-flex; align-items: center; }
.status-select i { position: absolute; left: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); pointer-events: none; }
.status-select select { width: 128px; min-height: 40px; padding-left: 28px; font-size: 0.86rem; font-weight: 800; border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.srow-actions { display: flex; gap: 2px; }

/* ---------- org ---------- */
.org-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 2px solid var(--line); flex: none; flex-wrap: wrap; }
.org-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.org-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.org-zoom { display: flex; align-items: center; gap: 2px; } .org-zoom span { min-width: 3.4em; text-align: center; font-size: 0.8rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.org-view { position: relative; flex: 1; min-height: 0; overflow: auto; cursor: grab; background-color: #1a1126; background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px); background-size: 28px 28px; touch-action: none; outline: none; }
.org-view.panning { cursor: grabbing; }
.org-view::after { content: ""; display: block; width: var(--sw, 100%); height: var(--sh, 100%); pointer-events: none; }
.org-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.org-lines { position: absolute; inset: 0; pointer-events: none; }
.org-lines path { fill: none; stroke: var(--line2); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ocard { position: absolute; }
.ocard > button { all: unset; box-sizing: border-box; position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 6px 7px; text-align: center; cursor: pointer; background: var(--panel2); border: 2px solid var(--line2); border-radius: 14px; box-shadow: 0 4px 0 rgba(8, 4, 14, 0.5); transition: transform 0.1s, border-color 0.1s; }
.ocard > button:hover { transform: translateY(-3px); border-color: var(--accent); }
.ocard > button:focus-visible { outline: 3px solid var(--accent); }
.ocard.manager > button { border-color: #a07c1c; background: linear-gradient(180deg, #3c2f18, var(--panel2)); }
.ocard.ceo > button { border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--panel2)), var(--panel2)); cursor: default; }
.ocard .portrait { width: 44px; height: 44px; margin-top: -26px; border-width: 3px; background: var(--panel); }
.ocard b { font-size: 0.92rem; line-height: 1.1; }
.ocard small { font-size: 0.7rem; color: var(--muted); line-height: 1.1; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ocard .badge { font-size: 0.58rem; padding: 0 6px; }
.ocard .rep { font-size: 0.66rem; color: var(--dim); font-weight: 700; }
.ocard .sdot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.org-hint { padding: 6px 12px; font-size: 0.72rem; color: var(--dim); text-align: center; border-top: 2px solid var(--line); flex: none; }

/* ---------- tasks ---------- */
.tasks { display: grid !important; grid-template-columns: 250px minmax(0, 1fr); overflow: hidden; }
.tasks-side { border-right: 2px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 8px; }
.task-list { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; }
.trow { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; position: relative; }
.trow:hover { background: rgba(255, 255, 255, 0.05); } .trow:focus-visible { outline: 3px solid var(--accent); }
.trow.on { background: var(--panel3); border-color: var(--accent); }
.trow .portrait { width: 40px; height: 40px; border-radius: 10px; }
.trow span { display: flex; flex-direction: column; min-width: 0; } .trow b { font-size: 0.92rem; } .trow small { color: var(--dim); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .has { margin-left: auto; color: var(--accent); }
.tasks-main { overflow: auto; padding: 16px; min-height: 0; touch-action: pan-y; }
.tm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.tm-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; align-items: flex-start; } .tm-head small { color: var(--muted); }
.back-btn { display: none; }

/* ---------- chats / feed ---------- */
.chat-index { display: flex; flex-direction: column; gap: 6px; }
.crow { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 13px; background: var(--panel2); border: 2px solid var(--line); cursor: pointer; }
.crow:hover { border-color: var(--accent); } .crow:focus-visible { outline: 3px solid var(--accent); }
.crow .portrait { width: 48px; height: 48px; }
.crow > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; } .crow b { font-size: 0.98rem; } .crow small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 0.7rem; color: var(--dim); }
.count-dot { font-style: normal; background: var(--accent); color: var(--accent-ink); font-weight: 900; border-radius: 99px; padding: 0 7px; font-size: 0.7rem; }
.feed-list { display: flex; flex-direction: column; gap: 4px; }
.fitem { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-left: 3px solid var(--c); background: rgba(255, 255, 255, 0.04); border-radius: 4px 10px 10px 4px; animation: pop2 0.2s ease-out; }
.ficon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); flex: none; }
.ftext { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 0.84rem; line-height: 1.25; } .ftext small { font-size: 0.68rem; color: var(--dim); font-weight: 700; }
.fwho { all: unset; cursor: pointer; flex: none; } .fwho .portrait { width: 28px; height: 28px; border-radius: 8px; border-width: 1px; }
.feed-empty { padding: 14px 8px; } .feed-empty .lantern-art { width: 56px; height: 56px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.feed-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ---------- handoffs ---------- */
.relation { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 12px; background: #1b122a; border: 2px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.ho-item .relation { margin-bottom: 8px; padding: 8px; }
.rnode { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; flex: 0 0 96px; text-align: center; }
.rnode b { font-size: 0.9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rnode small { font-size: 0.7rem; color: var(--dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-p { width: 56px; height: 56px; border-radius: 14px; border: 3px dashed var(--line2); }
.rlink { flex: 1; min-width: 60px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .rarrow::before { animation: none; } }
.rref { font-size: 0.72rem; font-weight: 800; color: var(--text); background: var(--panel3); border: 1px solid var(--line2); padding: 1px 10px; border-radius: 99px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rarrow { position: relative; display: block; width: 100%; height: 14px; }
.rarrow::before { content: ""; position: absolute; left: 0; right: 10px; top: 5px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, currentColor 0 8px, transparent 8px 14px); background-size: 14px 4px; animation: dash 0.9s linear infinite; }
.rarrow::after { content: ""; position: absolute; right: 0; top: 0; border: 7px solid transparent; border-left: 11px solid currentColor; border-right: 0; }
@keyframes dash { to { background-position: 14px 0; } }
.ho-list { margin-top: 6px; } .ho-items { display: flex; flex-direction: column; gap: 10px; }
.ho-item { background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 10px; } .ho-item p { margin: 0 0 8px; font-size: 0.88rem; color: var(--muted); white-space: pre-wrap; }
.ho-item footer { display: flex; justify-content: space-between; align-items: center; } .ho-item footer small { color: var(--dim); }
.handoffs { padding: 16px; }

/* ---------- settings ---------- */
.settings .tab-panel { padding: 16px; }
.lead { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel2); cursor: pointer; position: relative; transition: transform 0.1s, border-color 0.1s; }
.theme-card:hover { transform: translateY(-2px); border-color: var(--line2); } .theme-card:focus-visible { outline: 3px solid var(--accent); }
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.theme-art { width: 100%; height: auto; aspect-ratio: 96 / 60; border-radius: 9px; border: 2px solid var(--ink); display: block; }
.theme-meta { display: flex; flex-direction: column; padding: 0 2px; } .theme-meta b { font-size: 0.95rem; } .theme-meta small { color: var(--muted); font-size: 0.74rem; line-height: 1.25; }
.swatches { display: flex; gap: 4px; padding: 0 2px 2px; } .swatches i { width: 18px; height: 10px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.2); }
.theme-on { position: absolute; top: 14px; right: 14px; display: none; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; background: var(--accent); color: var(--accent-ink); padding: 2px 8px; border-radius: 99px; }
.theme-card[aria-checked="true"] .theme-on { display: inline-flex; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; min-height: 56px; }
.t-text { display: flex; flex-direction: column; min-width: 0; } .t-text b { font-size: 0.94rem; } .t-text small { color: var(--dim); font-size: 0.78rem; }
.toggle input { position: absolute; opacity: 0; right: 0; width: 52px; height: 30px; margin: 0; cursor: pointer; }
.knob { flex: none; width: 52px; height: 30px; border-radius: 99px; background: #170f22; border: 2px solid var(--line2); position: relative; transition: background 0.15s; }
.knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.toggle input:checked + .knob { background: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, #000); }
.toggle input:checked + .knob::after { transform: translateX(22px); background: var(--accent-ink); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--accent); outline-offset: 2px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px; border-bottom: 1px solid var(--line); min-height: 56px; flex-wrap: wrap; }
.setrow .seg { min-width: 220px; flex: 0 1 280px; }
.setrow.vol input[type="range"] { flex: 1; min-width: 140px; max-width: 280px; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 30px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 99px; background: #170f22; border: 2px solid var(--line2); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 99px; background: #170f22; border: 2px solid var(--line2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ink); margin-top: -10px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ink); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; padding: 12px 14px; border: 2px dashed #a63a54; border-radius: 14px; background: rgba(106, 34, 54, 0.2); } .danger-zone small { display: block; color: var(--muted); font-size: 0.78rem; }

/* ---------- menu sheet ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 800; font-size: 0.82rem; box-shadow: var(--shadow); color: var(--text); }
.menu-item:hover { border-color: var(--accent); color: var(--accent); } .menu-item:active { transform: translateY(2px); }

/* ---------- toasts / modal ---------- */
#toasts { position: absolute; z-index: 60; top: calc(68px + var(--sat)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 9px; padding: 9px 16px 9px 11px; border-radius: 99px; background: rgba(30, 20, 44, 0.96); border: 2px solid var(--line2); box-shadow: var(--shadow), 0 10px 26px rgba(0, 0, 0, 0.4); font-weight: 700; font-size: 0.9rem; animation: toast-in 0.2s ease-out; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: 0.3s; }
.toast-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); flex: none; }
.toast.success .toast-ic { background: var(--good); } .toast.error .toast-ic { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
.modal-scrim { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(10, 5, 18, 0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade 0.15s; }
.modal { width: min(400px, 100%); background: var(--panel); border: 2px solid var(--line2); border-radius: 18px; padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); animation: pop3 0.18s ease-out; }
.modal h3 { margin: 0 0 6px; font-size: 1.1rem; } .modal p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
@keyframes fade { from { opacity: 0; } } @keyframes pop3 { from { opacity: 0; transform: scale(0.95) translateY(6px); } }

/* ---------- intro ---------- */
#intro { position: fixed; inset: 0; z-index: 200; overflow: hidden; transition: opacity 0.4s; --shade: 0.3; }
#intro.leaving { opacity: 0; pointer-events: none; }
.intro-bg { position: absolute; inset: 0; background: #120b1c; }
#intro-scene { position: absolute; left: 50%; top: 0; translate: -50% 0; image-rendering: pixelated; will-change: transform, opacity; }
.intro-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 80%, #fff1c8 0%, #ffcf80 35%, rgba(255, 170, 80, 0) 75%); }
.intro-shade { position: absolute; inset: 0; pointer-events: none; opacity: var(--shade); background: radial-gradient(ellipse at 50% 24%, rgba(18, 11, 28, 0.95) 0%, rgba(18, 11, 28, 0.7) 40%, rgba(18, 11, 28, 0.15) 80%), linear-gradient(180deg, rgba(18, 11, 28, 0.55), transparent 45%); }
#intro.final .intro-shade { opacity: 1; }
.intro-skip { position: absolute; z-index: 3; top: calc(12px + var(--sat)); right: calc(14px + var(--sar)); min-height: 44px; padding: 0 14px; background: rgba(18, 11, 28, 0.45); color: #f0dfc8; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 99px; font-weight: 700; font-size: 0.82rem; cursor: pointer; opacity: 0.8; }
.intro-skip:hover { opacity: 1; }
.intro-card { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; text-align: center; padding: calc(9vh + var(--sat)) calc(20px + var(--sar)) calc(20px + var(--sab)) calc(20px + var(--sal)); pointer-events: none; }
.intro-card > * { pointer-events: auto; animation: rise 0.7s ease-out both; }
#intro-mark { max-width: 100%; height: auto !important; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.4)) drop-shadow(0 0 22px rgba(255, 179, 71, 0.5)); animation-delay: 0.15s; }
.intro-line { margin: 0; font-size: clamp(1.35rem, 4.6vw, 2.2rem); font-weight: 900; line-height: 1.15; color: #fff3dc; text-wrap: balance; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 0, 0, 0.6); animation-delay: 0.45s; }
.intro-tag { margin: 0; max-width: 34ch; color: #f0dfc8; font-size: clamp(0.98rem, 3.4vw, 1.12rem); line-height: 1.45; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 16px rgba(0, 0, 0, 0.7); animation-delay: 0.65s; }
#enter { margin-top: 6px; min-width: min(320px, 100%); letter-spacing: 0.08em; font-size: 1.15rem; padding: 0.95rem 1.8rem; min-height: 58px; animation-delay: 0.7s; box-shadow: 0 4px 0 rgba(8, 4, 14, 0.7), 0 0 34px color-mix(in srgb, var(--accent) 50%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
#intro.final .intro-card > * { animation: none; }
@media (prefers-reduced-motion: reduce) { .intro-card > * { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  #feed-dock { bottom: calc(86px + var(--sab)); width: 270px; }
  #feed-dock .feed-list { max-height: 140px; }
}
@media (max-width: 900px) {
  .win-lg, .win-xl { width: calc(100% - 20px); }
  #company-name { max-width: 120px; }
  .tasks { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  #topbar { top: calc(8px + var(--sat)); left: calc(8px + var(--sal)); padding: 5px 10px 5px 8px; gap: 8px; max-width: calc(100vw - 132px - var(--sal) - var(--sar)); }
  .co-label { display: none; } #company-name { max-width: 90px; font-size: 0.82rem; } .company { padding-left: 8px; }
  #wordmark { transform: scale(0.8); transform-origin: left center; margin-right: -26px; }
  #minimap-wrap { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); } #minimap { width: 112px; }
  #feed-dock { display: none; }
  #dock { left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(8px + var(--sab)); transform: none; justify-content: space-between; padding: 5px; border-radius: 16px; }
  .hud-btn { width: auto; flex: 1; min-width: 0; height: 56px; }
  .hud-btn kbd, .hud-btn[data-tip]::after { display: none; }
  .hud-btn.d-org, .hud-btn.d-handoffs, .hud-btn.d-decor, .hud-btn.d-settings { display: none; }
  .hud-btn.d-more { display: flex; }
  #zoom-ctrl { bottom: calc(150px + var(--sab)); right: calc(10px + var(--sar)); flex-direction: column; }
  #zoom-ctrl .hud-btn.small { width: 42px; height: 42px; flex: none; }
  .action-btn { left: auto; right: calc(12px + var(--sar)); bottom: calc(76px + var(--sab)); transform: none; max-width: calc(100vw - 24px); padding: 12px 18px 12px 12px; }
  .action-btn:active { transform: translateY(2px); }
  @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.95); } }
  body[data-joy-side="right"] #joystick { right: calc(14px + var(--sar)); }
  body[data-joy-side="right"] .action-btn { right: auto; left: calc(12px + var(--sal)); }
  #joystick { left: calc(14px + var(--sal)); bottom: calc(82px + var(--sab)); width: 124px; height: 124px; }
  #chips { bottom: calc(76px + var(--sab)); left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); transform: none; max-width: none; }
  #toasts { top: calc(62px + var(--sat)); }
  #windows { inset: 0; position: fixed; }
  .win { position: fixed !important; inset: 0 !important; left: 0 !important; top: 0 !important; width: 100% !important; max-width: none; height: 100dvh !important; max-height: none; border-radius: 0; border: 0; box-shadow: none; transform-origin: 50% 100%; }
  .win.opening, .win.closing { transform: translateY(24px); }
  .win-head { padding-top: var(--sat); min-height: calc(54px + var(--sat)); cursor: default; padding-left: calc(14px + var(--sal)); padding-right: calc(8px + var(--sar)); }
  .win-body, .tab-panel, .tasks-main { padding-left: calc(14px + var(--sal)); padding-right: calc(14px + var(--sar)); }
  .win-body { padding-bottom: calc(16px + var(--sab)); }
  .win-body.fill { padding: 0; }
  .tab-panel { padding-bottom: calc(18px + var(--sab)); }
  .tab-panel[data-panel="chat"] { padding: 0; }
  .composer { padding-bottom: calc(10px + var(--sab)); }
  .chat-foot { display: none; }
  .row.sticky { margin: 4px -14px calc(-16px - var(--sab)); padding: 12px 14px calc(12px + var(--sab)); }
  .fill > .row.sticky { padding-bottom: calc(10px + var(--sab)); margin: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .hire-top { gap: 12px; } .hire-portrait .portrait { width: 80px; height: 80px; }
  .agent-head { padding: 12px 14px; } .agent-head .portrait { width: 64px; height: 64px; } .agent-name { font-size: 1.1rem; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .btn-grid { grid-template-columns: 1fr 1fr; }
  .tabs { padding-left: calc(10px + var(--sal)); } .tabs > button { flex: 1; justify-content: center; padding: 9px 8px; } .tabs > button span { font-size: 0.8rem; }
  .srow { grid-template-columns: auto minmax(0, 1fr); } .srow .status-select { grid-column: 1 / 2; } .srow .status-select select { width: 100%; } .srow-actions { justify-content: flex-end; }
  .srow .status-select { grid-column: 2; grid-row: 2; } .srow-actions { grid-column: 2; grid-row: 3; justify-self: stretch; justify-content: space-between; }
  .srow > .check { grid-row: 1 / span 3; align-self: start; padding-top: 14px; }
  .tasks { grid-template-columns: 1fr; } .tasks .tasks-main { display: none; } .tasks.detail .tasks-side { display: none; } .tasks.detail .tasks-main { display: block; } .back-btn { display: inline-flex; margin-left: auto; }
  .themes { grid-template-columns: 1fr; }
  .setrow .seg { min-width: 0; flex: 1 1 100%; }
  .menu-grid { gap: 8px; }
  .org-legend { display: none; }
  .relation { padding: 8px; } .rnode { flex-basis: 78px; }
  .intro-card { gap: 18px; }
}
@media (max-width: 380px) {
  .hud-btn span { font-size: 0.58rem; } .hud-btn { height: 52px; } #topbar { max-width: calc(100vw - 124px); }
  .status-grid button span { display: none; } .status-grid button { min-height: 44px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .win { max-height: calc(100% - 8px); } .win-lg, .win-xl { height: calc(100% - 8px); }
  #feed-dock { display: none; } #topbar { top: calc(6px + var(--sat)); }
  .hud-btn { height: 48px; width: 54px; } .hud-btn span { display: none; }
  #joystick { width: 110px; height: 110px; bottom: calc(66px + var(--sab)); }
  #zoom-ctrl { flex-direction: row; bottom: calc(66px + var(--sab)); }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
@media (prefers-reduced-motion: reduce) { .rline, .feed-empty .lantern-art, #intro::before { animation: none; } }
@media (max-width: 360px) { .tabs > button span { display: none; } .tabs > button { min-width: 0; } }
