:root {
  --ink: #1d2125;
  --muted: #687078;
  --line: #e4e6e8;
  --card: #ffffff;
  --bg: #cfdcd2;
  --accent: #e0703a;
  --green: #3fbf6b;
  --panel-w: 520px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
button { font: inherit; cursor: pointer; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

/* ---------- HUD: glass top bar, dock, roster, minimap ---------- */
:root { --glass: rgba(18, 22, 28, 0.55); --glass-line: rgba(255,255,255,0.12); --hud-ink: #f3f5f7; --hud-muted: rgba(243,245,247,.62); }
.topbar {
  position: fixed; top: 14px; left: 14px; right: 14px; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 12px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-line); border-radius: 18px; color: var(--hud-ink); box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--hud-muted); font-size: 12px; }
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #ff8a4c, #e0573a); color: #fff; font-weight: 800; font-size: 15px; flex: none; box-shadow: 0 6px 18px rgba(224,87,58,.45); }
.logo.big { width: 58px; height: 58px; font-size: 22px; border-radius: 16px; }
.time-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 13px; background: rgba(255,255,255,.1); border: 1px solid var(--glass-line); white-space: nowrap; }
.time-chip .tc-ic { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #ffd56b, #ff9f43); font-size: 14px; }
.time-chip b { font-size: 14px; } .time-chip small { color: var(--hud-muted); font-size: 11.5px; }
.time-chip[data-phase="night"] .tc-ic, .time-chip[data-phase="dusk"] .tc-ic { background: linear-gradient(135deg, #3b4a8c, #1c2350); }
.time-chip[data-phase="sunset"] .tc-ic { background: linear-gradient(135deg, #ff9a5a, #d1495b); }
.time-chip[data-phase="sunrise"] .tc-ic { background: linear-gradient(135deg, #ffb38a, #b77ccf); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; white-space: nowrap; padding: 4px 10px 4px 4px; border-radius: 12px; background: rgba(255,255,255,.08); }
.me-av { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #fff; color: #1d2125; font-weight: 800; }
.clock { display: none; }

.dock {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border-radius: 20px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-line); box-shadow: 0 10px 40px rgba(0,0,0,.28); transition: left .3s ease;
}
.dock button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 68px; padding: 7px 10px; border: 0; border-radius: 14px; background: transparent; font-size: 11px; color: var(--hud-muted); font-weight: 600; transition: background .15s, color .15s, transform .15s; }
.dock button span { font-size: 18px; filter: saturate(1.2); }
.dock button:hover { background: rgba(255,255,255,.12); color: var(--hud-ink); transform: translateY(-2px); }
body.panel-open .dock { left: calc((100% - var(--panel-w)) / 2); }

.roster { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); z-index: 19; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--glass-line); width: 56px; overflow: hidden; transition: width .25s cubic-bezier(.2,.8,.2,1); }
.roster:hover { width: 230px; }
.r-item { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: 12px; padding: 4px; cursor: pointer; text-align: left; color: var(--hud-ink); min-width: 218px; }
.r-item:hover { background: rgba(255,255,255,.1); }
.r-av { position: relative; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--c); display: grid; place-items: center; font-weight: 800; color: #fff; }
.r-dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #3fbf6b; border: 2px solid #1f252c; }
.r-item.away .r-dot { background: #f4b740; }
.r-text b { display: block; font-size: 13px; } .r-text small { color: var(--hud-muted); font-size: 11px; white-space: nowrap; }
.minimap { position: fixed; right: 14px; bottom: 18px; z-index: 19; width: 240px; height: 150px; border-radius: 16px; border: 1px solid var(--glass-line); box-shadow: 0 10px 30px rgba(0,0,0,.3); cursor: crosshair; background: #1f252c; }
body.panel-open .minimap, body.panel-open .roster { opacity: 0; pointer-events: none; }
.minimap, .roster { transition: opacity .25s, width .25s cubic-bezier(.2,.8,.2,1); }

.loader { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% 30%, #2b3a55, #0f141b); color: #fff; transition: opacity .6s; }
.loader.out { opacity: 0; pointer-events: none; }
.loader-card { text-align: center; width: min(340px, 86vw); }
.loader-card h2 { margin: 14px 0 4px; font-size: 22px; }
.loader-card p { margin: 0 0 16px; color: rgba(255,255,255,.65); font-size: 13.5px; }
.bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 4%; border-radius: inherit; background: linear-gradient(90deg, #ff8a4c, #ffd56b); transition: width .3s; }

.team-list {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 21;
  width: min(360px, calc(100% - 32px)); max-height: 60vh; overflow: auto;
  background: #fff; border-radius: 14px; padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
body.panel-open .team-list { left: calc((100% - var(--panel-w)) / 2); }
.team-list .status { display: block; font-size: 11px; color: #3a8f5c; }
.team-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: transparent; border-radius: 10px; text-align: left; }
.team-list button:hover { background: #f3f4f5; }
.team-list .mini { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--c); flex: none; }
.team-list b { font-size: 14px; display: block; }
.team-list small { color: var(--muted); font-size: 12px; }
.team-list .zone { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 8px 4px; font-weight: 600; }

/* ---------- avatars ---------- */
.avatar-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.avatar {
  position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; padding: 0; background: none;
  width: 64px; height: 64px; transform-origin: center; will-change: transform;
}
.avatar .face {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, white), var(--c));
  border: 4px solid var(--green); box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  display: grid; place-items: center; color: #fff; transition: transform .15s ease;
}
.avatar .initial { font-weight: 700; font-size: 26px; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.avatar .icon { position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.avatar .tag {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap;
  background: rgba(255,255,255,0.96); border-radius: 8px; padding: 3px 8px; font-size: 12px; line-height: 1.25;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15); opacity: 0; transition: opacity .15s; pointer-events: none; text-align: center;
}
.avatar .tag b { display: block; color: var(--ink); }
.avatar .tag small { color: var(--muted); font-size: 11px; }
.avatar:hover .face, .avatar.active .face { transform: scale(1.1); }
.avatar:hover .tag, .avatar.active .tag, .avatar.working .tag { opacity: 1; }
.avatar.active .face { border-color: #fff; box-shadow: 0 0 0 4px var(--c), 0 8px 22px rgba(0,0,0,0.3); }
.avatar.working .face { border-color: #ffb020; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,176,32,0.6), 0 6px 18px rgba(0,0,0,0.28); } 50% { box-shadow: 0 0 0 10px rgba(255,176,32,0), 0 6px 18px rgba(0,0,0,0.28); } }
.avatar .bubble { position: absolute; left: 70%; bottom: 82%; display: none; gap: 3px; background: #fff; border-radius: 12px 12px 12px 3px; padding: 7px 9px; box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
.avatar.working .bubble { display: flex; }
.bubble i { width: 6px; height: 6px; border-radius: 50%; background: #9aa1a8; animation: blink 1s infinite; }
.bubble i:nth-child(2) { animation-delay: .15s; } .bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.avatar .unread { position: absolute; top: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; background: #e5484d; border: 3px solid #fff; display: none; }
.avatar.has-unread .unread { display: block; }

/* ---------- chat panel (Claude-style) ---------- */
.panel {
  --paper: #faf9f5; --line2: #e8e4da; --soft: #f0eee6; --ink2: #3d3929;
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 30;
  background: var(--paper); display: flex; flex-direction: column; color: var(--ink2);
  box-shadow: -14px 0 50px rgba(20,20,10,0.18); transform: translateX(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
}
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line2); background: rgba(250,249,245,.9); backdrop-filter: blur(8px); }
.p-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.p-title { flex: 1; min-width: 0; }
.p-title b { display: block; font-size: 15px; }
.p-title small { display: block; color: #8a8470; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-actions { display: flex; gap: 2px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2); font-size: 15px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--soft); }
.chat-list { position: absolute; top: 68px; right: 12px; left: 12px; z-index: 5; max-height: 55vh; overflow: auto; background: #fff; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.14); padding: 6px; }
.chat-new { width: 100%; text-align: left; border: 0; background: var(--soft); border-radius: 10px; padding: 10px 12px; font-weight: 600; margin-bottom: 4px; }
.chat-row { display: flex; align-items: center; border-radius: 10px; }
.chat-row.on { background: #f6f3ea; }
.chat-open { flex: 1; text-align: left; border: 0; background: none; padding: 8px 10px; min-width: 0; }
.chat-open b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-open small { color: #8a8470; font-size: 11px; }
.chat-del { border: 0; background: none; opacity: .45; padding: 8px; } .chat-del:hover { opacity: 1; }
.pin-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 16px; }
.pin-bar:not(:empty) { padding: 8px 16px; border-bottom: 1px solid var(--line2); }
.pin-label { font-size: 11px; color: #8a8470; text-transform: uppercase; letter-spacing: .06em; }
.pin { font-size: 11.5px; background: #fff; border: 1px solid var(--line2); border-radius: 999px; padding: 2px 9px; }
.thread { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.hello { margin: auto 0; text-align: center; padding: 10px; }
.hello-avatar { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 10px; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700; background: var(--c); }
.hello h3 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 22px; }
.hello p { margin: 0 auto 14px; color: #8a8470; font-size: 13.5px; max-width: 320px; line-height: 1.5; }
.hello-chips { display: flex; flex-direction: column; gap: 6px; }
.hello-chips button { border: 1px solid var(--line2); background: #fff; border-radius: 12px; padding: 9px 12px; text-align: left; font-size: 13px; color: var(--ink2); }
.hello-chips button:hover { border-color: var(--c); }
.msg { font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble { background: var(--soft); border-radius: 18px 18px 4px 18px; padding: 10px 14px; white-space: pre-wrap; }
.att-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.att-img { max-width: 160px; max-height: 120px; border-radius: 10px; display: block; }
.att-file { font-size: 12px; background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 3px 8px; }
.use-note { font-size: 12px; color: #8a6b1f; margin-bottom: 4px; }
.msg.assistant { align-self: stretch; }
.a-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.a-av { width: 22px; height: 22px; border-radius: 7px; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.a-body :first-child { margin-top: 0; } .a-body :last-child { margin-bottom: 0; }
.a-body h1, .a-body h2, .a-body h3 { font-size: 15.5px; margin: 14px 0 6px; }
.a-body ul, .a-body ol { padding-left: 22px; margin: 6px 0; }
.a-body table { border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; margin: 8px 0; }
.a-body th, .a-body td { border: 1px solid var(--line2); padding: 5px 9px; text-align: left; }
.a-body th { background: #f3f0e7; }
.a-body code { background: #efece3; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.a-body a { color: #b45a2c; }
.a-body blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line2); color: #6b6550; }
.code-box { margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid #2b2d31; background: #1e1f22; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: #2b2d31; color: #b8bcc4; font-size: 11.5px; }
.code-copy { border: 0; background: none; color: #d7dae0; font-size: 11.5px; cursor: pointer; }
.code-box pre { margin: 0; padding: 12px; overflow-x: auto; color: #e6e6e6; font-size: 12.5px; line-height: 1.5; }
.code-box pre code { background: none; padding: 0; color: inherit; }
.thinking { margin: 4px 0 8px; border-left: 2px solid var(--line2); padding-left: 10px; }
.thinking summary { cursor: pointer; color: #8a8470; font-size: 12.5px; list-style: none; }
.thinking summary::before { content: "▸ "; } .thinking[open] summary::before { content: "▾ "; }
.thinking.live summary { background: linear-gradient(90deg, #8a8470, #d8d2c0, #8a8470); background-size: 200% 100%; -webkit-background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.think-body { white-space: pre-wrap; color: #8a8470; font-size: 12.5px; margin-top: 4px; max-height: 220px; overflow: auto; }
.tool { margin: 6px 0; border: 1px solid var(--line2); border-radius: 10px; background: #fff; font-size: 12.5px; }
.tool summary { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none; }
.tool-ic { width: 18px; text-align: center; }
.tool summary > span:nth-child(2) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-state { color: #3a8f5c; font-weight: 700; }
.tool.running .tool-state::after { content: ""; display: inline-block; width: 12px; height: 12px; border: 2px solid #d8d2c0; border-top-color: #8a8470; border-radius: 50%; animation: spin .8s linear infinite; }
.tool.error .tool-state { color: #c0392b; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-detail { padding: 0 10px 8px 36px; color: #8a8470; }
.typing { display: flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #c9c2ad; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:last-child .msg-actions { opacity: 1; }
.act { border: 0; background: none; color: #8a8470; font-size: 12px; padding: 3px 7px; border-radius: 7px; cursor: pointer; }
.act:hover { background: var(--soft); color: var(--ink2); }
.err-box { background: #fff1f0; border: 1px solid #f5c2bf; color: #9b2c25; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.sources { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line2); font-size: 12px; }
.sources a { display: block; color: #b45a2c; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-wrap { position: relative; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); }
.composer { background: #fff; border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 4px 20px rgba(30,25,10,.07); padding: 10px 10px 8px 14px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--c) 55%, var(--line2)); box-shadow: 0 6px 26px rgba(30,25,10,.1); }
.composer textarea { width: 100%; border: 0; resize: none; outline: none; font: inherit; font-size: 14.5px; line-height: 1.5; max-height: 220px; background: transparent; color: var(--ink2); }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.composer-bar .hint { flex: 1; font-size: 11px; color: #b0a991; text-align: right; padding-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--c); color: #fff; font-size: 16px; font-weight: 700; flex: none; cursor: pointer; }
.send.stop { background: #3d3929; font-size: 12px; }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-row:not(:empty) { margin-bottom: 8px; }
.att-chip { position: relative; display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 10px; padding: 4px 22px 4px 4px; font-size: 12px; }
.att-chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; }
.att-chip button, .use-chip button { position: absolute; right: 3px; top: 3px; border: 0; background: none; font-size: 11px; cursor: pointer; color: #8a8470; }
.use-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.use-chip { position: relative; font-size: 11.5px; background: #fff6dd; border: 1px solid #f0dc9c; color: #7a5a10; border-radius: 999px; padding: 2px 20px 2px 8px; }
.slash { position: absolute; left: 14px; right: 14px; bottom: calc(100% - 6px); max-height: 300px; overflow: auto; background: #fff; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 -10px 30px rgba(0,0,0,.12); padding: 6px; }
.slash button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.slash button.on, .slash button:hover { background: var(--soft); }
.slash b { display: block; font-size: 13px; } .slash small { color: #8a8470; font-size: 11.5px; }
.slash-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: #b0a991; padding: 6px 10px 2px; }
.drop { position: absolute; inset: -60vh 0 0 0; display: none; place-items: center; background: rgba(250,249,245,.9); border: 2px dashed var(--c); border-radius: 18px; font-weight: 600; color: var(--ink2); pointer-events: none; }
.drop.on { display: grid; }

/* ---------- skills dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(20,20,10,.35); backdrop-filter: blur(4px); padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: min(680px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: #faf9f5; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.3); overflow: hidden; color: #3d3929; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; font-size: 16px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid #e8e4da; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: #8a8470; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.on { color: #3d3929; border-bottom-color: #3d3929; }
.modal-card section[hidden] { display: none; }
.modal-card section { padding: 12px 16px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-card input, .modal-card textarea { width: 100%; border: 1px solid #e8e4da; border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px; background: #fff; }
.modal-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; }
.sk-note { margin: 0; font-size: 12px; color: #8a8470; }
.sk-list { display: flex; flex-direction: column; gap: 6px; }
.sk-row { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid #ece8de; border-radius: 12px; padding: 9px 11px; }
.sk-info { flex: 1; min-width: 0; }
.sk-info b { font-size: 13.5px; } .sk-info small { display: block; color: #8a8470; font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sk-tags { display: flex; gap: 4px; margin-top: 4px; }
.tag { font-size: 10.5px; background: #eef4ff; color: #3554a5; border-radius: 999px; padding: 1px 7px; } .tag.own { background: #eafaf0; color: #23784a; }
.sk-acts { display: flex; gap: 4px; flex: none; }
.sk-acts button, .ghost-btn { border: 1px solid #e8e4da; background: #fff; border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer; }
.sk-acts button.on { background: #3d3929; color: #fff; border-color: #3d3929; }
.sk-acts button.danger { color: #b4281e; }
.sk-actions { display: flex; justify-content: space-between; align-items: center; }
.primary { border: 0; background: #3d3929; color: #fff; border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 84px; left: 16px; z-index: 40; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; border: 0; background: rgba(255,255,255,.96); border-radius: 14px; padding: 8px 14px 8px 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 13px; font-weight: 600; cursor: pointer; animation: toastIn .35s cubic-bezier(.2,.8,.2,1); transition: opacity .5s, transform .5s; }
.toast .mini { width: 28px; height: 28px; border-radius: 9px; background: var(--c); color: #fff; display: grid; place-items: center; }
.toast.out { opacity: 0; transform: translateX(-20px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(30,36,32,0.45); backdrop-filter: blur(6px); padding: 16px; }
.login[hidden] { display: none; }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.login-card input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 15px; font-weight: 400; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { margin-top: 6px; border: 0; border-radius: 10px; padding: 12px; background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; }
.login-card .err { color: #c0392b; min-height: 1em; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --panel-w: 100vw; }
  .topbar { top: 10px; left: 10px; right: 10px; padding: 8px 12px; }
  .brand small { display: none; }
  .time-chip small, .roster, .minimap { display: none; }
  .dock button { min-width: 54px; padding: 6px 6px; }
  .dock { bottom: 12px; }
  .dock button { min-width: 62px; }
  body.panel-open .dock, body.panel-open .team-list { display: none; }
  .avatar { width: 52px; height: 52px; }
  .avatar .initial { font-size: 21px; }
}

/* ---------- walk mode ---------- */
body.walking .roster, body.walking .avatar .tag { display: none; }
.walk-hud { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
.walk-hud[hidden] { display: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,.9); box-shadow: 0 0 3px rgba(0,0,0,.6); }
.crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; } .crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
.walk-prompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); pointer-events: auto; border: 1px solid var(--glass-line); background: var(--glass); backdrop-filter: blur(14px); color: #fff; border-radius: 12px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; animation: toastIn .2s ease; }
.walk-bar { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; pointer-events: auto; background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--glass-line); border-radius: 14px; padding: 6px 6px 6px 12px; color: var(--hud-ink); font-size: 12px; white-space: nowrap; max-width: calc(100vw - 32px); }
.walk-who { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; } .walk-who::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.walk-keys { color: var(--hud-muted); overflow: hidden; text-overflow: ellipsis; }
kbd { font: 600 10.5px Inter, system-ui, sans-serif; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; margin: 0 2px 0 6px; color: #fff; }
.walk-prompt kbd { margin: 0 6px 0 0; }
.walk-bar button { border: 0; border-radius: 10px; padding: 6px 10px; background: rgba(255,255,255,.14); color: #fff; font-weight: 600; cursor: pointer; }
.walk-bar button:last-child { background: #e0573a; }
.touch-ui { display: none; }
@media (pointer: coarse) {
  .walk-keys { display: none; }
  .touch-ui { display: block; }
  .stick { position: absolute; left: 22px; bottom: 120px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); pointer-events: auto; touch-action: none; display: grid; place-items: center; }
  .stick i { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 4px 14px rgba(0,0,0,.3); }
  .touch-btns { position: absolute; right: 18px; bottom: 130px; display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
  .touch-btns button { width: 62px; height: 62px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(20,24,30,.55); color: #fff; font-weight: 700; }
  .touch-btns button.on { background: #e0573a; }
}

/* ---------- first-person games ---------- */
.charge { position: absolute; left: 50%; top: calc(50% + 70px); transform: translateX(-50%); width: 160px; height: 8px; border-radius: 999px; background: rgba(0,0,0,.35); overflow: hidden; border: 1px solid rgba(255,255,255,.4); }
.charge[hidden] { display: none; }
.charge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4ade80, #facc15, #ef4444); }
.game-score { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--glass-line); color: #fff; border-radius: 12px; padding: 7px 14px; font-weight: 700; font-size: 14px; }
.game-score[hidden] { display: none; }
.toast.game { justify-content: center; font-size: 15px; padding: 10px 16px; background: rgba(20,24,30,.85); color: #fff; }
.arcade { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(5,8,14,.75); backdrop-filter: blur(6px); padding: 12px; }
.arcade[hidden] { display: none; }
.arcade-cab { width: min(680px, 100%); background: linear-gradient(180deg, #2b2d42, #1b1c2b); border-radius: 22px; padding: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 0 3px #3d405b; color: #e9ecef; text-align: center; }
.arcade-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.arcade-top b { letter-spacing: .2em; color: #ffd166; }
.arcade-top button { border: 0; border-radius: 9px; padding: 6px 10px; background: #e0573a; color: #fff; font-weight: 700; cursor: pointer; }
.arcade canvas { width: 100%; height: auto; border-radius: 12px; display: block; background: #0b0f1a; cursor: none; touch-action: none; }
.arcade p { margin: 8px 0 0; font-size: 12px; color: #adb5bd; }

/* ---------- sound toggle (features/sound.js) ---------- */
.dock button.snd em { font-style: normal; }
.dock button.snd.off { color: rgba(243,245,247,.42); }
.dock button.snd.off span { filter: grayscale(1) opacity(.7); }
@media (max-width: 760px) { .dock button.snd { min-width: 46px; } .dock button.snd em { display: none; } }

/* ---------- speech bubbles (features/social.js) ---------- */
.talk-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.talk-bubble {
  position: absolute; left: 0; top: 0; max-width: 240px; width: max-content; padding: 6px 11px 8px;
  background: rgba(255,255,255,.97); color: var(--ink); border-radius: 13px; border-top: 3px solid var(--c, #888);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); font-size: 12.5px; line-height: 1.35; font-weight: 500; text-align: left;
  transform-origin: 50% 100%; will-change: transform, opacity; opacity: 0; transition: opacity .25s ease;
}
.talk-bubble.show { opacity: 1; }
.talk-bubble b { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--c, #888); filter: brightness(.85); margin-bottom: 1px; }
.talk-bubble::after { content: ""; position: absolute; left: 50%; margin-left: -6px; bottom: -6px; border: 6px solid transparent; border-top-color: rgba(255,255,255,.97); border-bottom: 0; }
