/* =============================================================================
   SPACE CRUSADE 2026 — dark sci-fi tactical UI
   ============================================================================= */
:root {
    --bg: #05080d;
    --bg-2: #0a1018;
    --panel: rgba(13, 20, 30, 0.82);
    --panel-solid: #0d141e;
    --panel-2: rgba(20, 30, 44, 0.75);
    --line: rgba(120, 190, 255, 0.14);
    --line-strong: rgba(120, 200, 255, 0.32);
    --text: #e6eef8;
    --muted: #8ea1b6;
    --dim: #5d6f83;
    --accent: #3ee8ff;
    --accent-2: #2aa3ff;
    --amber: #ffb547;
    --danger: #ff4d5e;
    --ok: #46e39a;
    --hive: #c05cff;
    --glow: 0 0 0 1px rgba(62, 232, 255, 0.35), 0 0 24px rgba(62, 232, 255, 0.18);
    --radius: 14px;
    --radius-sm: 9px;
    --font-head: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    background: radial-gradient(1200px 700px at 70% -10%, #102236 0%, transparent 60%), var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.app { min-height: 100%; }
kbd { font-family: var(--font-head); font-size: 0.72em; padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.6; margin-left: 6px; }

/* ------------------------------------------------------------------ views */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body.in-game { overflow: hidden; }
#view-game.active { display: block; position: fixed; inset: 0; animation: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--panel-2);
    cursor: pointer; font-weight: 600; letter-spacing: 0.02em;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s;
    user-select: none; text-decoration: none;
}
.btn:hover { border-color: var(--accent); box-shadow: var(--glow); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, #1bc8e6, #2a7dff); border-color: transparent; color: #031018; }
.btn-primary:hover { box-shadow: 0 0 0 1px #7ff3ff, 0 8px 30px rgba(42, 160, 255, 0.45); }
.btn-secondary { background: linear-gradient(135deg, rgba(255, 181, 71, 0.18), rgba(255, 120, 60, 0.12)); border-color: rgba(255, 181, 71, 0.5); }
.btn-secondary:hover { border-color: var(--amber); box-shadow: 0 0 22px rgba(255, 181, 71, 0.25); }
.btn-ghost { background: transparent; }
.btn.danger, .btn-ghost.danger { border-color: rgba(255, 77, 94, 0.45); color: #ffb3bb; }
.btn-xl { width: 100%; flex-direction: column; align-items: flex-start; padding: 14px 18px; margin-bottom: 10px; }
.btn-title { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; }
.btn-sub { font-size: 0.8rem; opacity: 0.8; font-weight: 500; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong);
    background: rgba(8, 14, 22, 0.72); cursor: pointer; font-size: 1.05rem; display: inline-flex;
    align-items: center; justify-content: center; backdrop-filter: blur(8px); transition: 0.2s;
}
.icon-btn:hover { border-color: var(--accent); box-shadow: var(--glow); }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.8rem; padding: 4px; }

/* ------------------------------------------------------------------ panels & fields */
.panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-title { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel-head .panel-title { margin: 0; }
.pt-icon { color: var(--accent); font-size: 0.9em; }
.section-title { font-family: var(--font-head); font-size: 0.95rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.section-title small { color: var(--dim); letter-spacing: 0; text-transform: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
input[type=text], select {
    width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: rgba(4, 9, 15, 0.7); outline: none; transition: 0.2s;
}
input[type=text]:focus, select:focus { border-color: var(--accent); box-shadow: var(--glow); }
select option { background: var(--panel-solid); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; min-height: 1.2em; }
.kicker { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; margin: 16px 0 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.empty { color: var(--dim); font-size: 0.85rem; padding: 10px 0; }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(4, 9, 15, 0.6); }
.segmented button { border: none; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.06em; color: var(--muted); min-height: 34px; }
.segmented button.on { background: linear-gradient(135deg, rgba(62, 232, 255, 0.2), rgba(42, 125, 255, 0.25)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(62, 232, 255, 0.45); }
.segmented button[data-v=NIGHTMARE].on { background: linear-gradient(135deg, rgba(255, 77, 94, 0.3), rgba(192, 92, 255, 0.25)); box-shadow: inset 0 0 0 1px rgba(255, 77, 94, 0.6); }

/* ------------------------------------------------------------------ hero */
.hero { position: relative; min-height: 340px; height: 44vh; max-height: 470px; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 40%; animation: heroDrift 40s ease-in-out infinite alternate; }
@keyframes heroDrift { from { object-position: 50% 35%; } to { object-position: 70% 45%; } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3, 6, 10, 0.94) 0%, rgba(3, 6, 10, 0.55) 45%, rgba(3, 6, 10, 0.1) 75%), linear-gradient(0deg, var(--bg) 0%, transparent 40%); }
.hero-content { position: absolute; left: clamp(16px, 5vw, 64px); bottom: 48px; max-width: 560px; }
.hero-kicker { font-family: var(--font-head); color: var(--accent); letter-spacing: 0.3em; text-transform: uppercase; font-weight: 700; font-size: 0.85rem; }
.hero-title { font-family: var(--font-head); font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 0.95; margin: 8px 0 10px; letter-spacing: 0.06em; text-shadow: 0 0 40px rgba(62, 232, 255, 0.25); }
.hero-title span { color: var(--accent); }
.hero-sub { color: #c4d3e3; font-size: 1.02rem; max-width: 470px; margin: 0; }
.hero-topbar { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.topbar-actions { display: flex; gap: 8px; }
.profile-chip { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 40px; border: 1px solid var(--line-strong); background: rgba(5, 10, 16, 0.7); backdrop-filter: blur(10px); cursor: pointer; min-height: 44px; }
.rank-badge { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--amber), var(--accent)); color: #031018; }
.profile-meta { display: flex; flex-direction: column; align-items: flex-start; min-width: 110px; }
.profile-name { font-weight: 700; font-size: 0.9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-rank { font-size: 0.7rem; color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase; }
.xp-bar { width: 100%; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); margin-top: 3px; overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--amber)); transition: width 0.6s; }

/* ------------------------------------------------------------------ home grid */
.home-grid { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(280px, 340px); gap: 16px; padding: 0 clamp(12px, 3vw, 32px); margin-top: -36px; position: relative; z-index: 2; max-width: 1640px; margin-left: auto; margin-right: auto; }
.home-footer { text-align: center; color: var(--dim); font-size: 0.75rem; padding: 28px 16px 36px; }
.chapter-picker { display: grid; grid-template-columns: 1fr; gap: 6px; }
.chapter-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(4, 9, 15, 0.5); cursor: pointer; text-align: left; transition: 0.2s; min-height: 44px; }
.chapter-card:hover { border-color: var(--line-strong); }
.chapter-card.on { border-color: var(--c, var(--accent)); box-shadow: 0 0 0 1px var(--c, var(--accent)), 0 0 18px color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); }
.chapter-swatch { width: 14px; height: 28px; border-radius: 4px; background: var(--c); flex: none; box-shadow: 0 0 10px var(--c); }
.chapter-text { display: flex; flex-direction: column; min-width: 0; }
.chapter-name { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.05em; }
.chapter-perk { font-size: 0.72rem; color: var(--muted); line-height: 1.25; }
.color-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); cursor: pointer; background: var(--c); transition: 0.15s; }
.color-dot.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c), 0 0 14px var(--c); transform: scale(1.1); }
.squad-preview-wrap { border-radius: 10px; background: radial-gradient(circle at 50% 70%, rgba(62, 232, 255, 0.08), transparent 70%); border: 1px dashed var(--line); padding: 4px; }
#squad-preview { width: 100%; height: auto; display: block; }

.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.mission-card { position: relative; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(20, 32, 48, 0.8), rgba(6, 11, 18, 0.8)); cursor: pointer; text-align: left; min-height: 74px; transition: 0.18s; display: flex; flex-direction: column; gap: 4px; }
.mission-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.mission-card.on { border-color: var(--accent); box-shadow: var(--glow); }
.mission-num { font-family: var(--font-head); font-weight: 700; color: var(--accent); font-size: 0.8rem; letter-spacing: 0.14em; }
.mission-name { font-weight: 700; font-size: 0.86rem; line-height: 1.2; }
.mission-done { position: absolute; top: 8px; right: 10px; color: var(--ok); font-size: 0.9rem; }
.mission-detail { margin-top: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 9, 15, 0.55); min-height: 150px; }
.md-title { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; letter-spacing: 0.04em; margin: 0 0 4px; }
.md-lore { color: #b8c7d8; margin: 0 0 10px; font-size: 0.92rem; }
.md-objs { display: grid; gap: 6px; margin-bottom: 10px; }
.md-obj { display: flex; align-items: flex-start; gap: 8px; font-size: 0.88rem; }
.md-obj b { font-family: var(--font-head); letter-spacing: 0.08em; font-size: 0.75rem; padding: 2px 7px; border-radius: 5px; flex: none; margin-top: 1px; }
.md-obj.primary b { background: rgba(62, 232, 255, 0.18); color: var(--accent); }
.md-obj.secondary b { background: rgba(255, 181, 71, 0.16); color: var(--amber); }
.md-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 0.74rem; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill.warn { border-color: rgba(255, 181, 71, 0.5); color: var(--amber); }
.threats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.threat { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 20px; background: rgba(192, 92, 255, 0.1); border: 1px solid rgba(192, 92, 255, 0.3); font-size: 0.74rem; }
.threat img { width: 24px; height: 24px; }

.advanced { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: rgba(4, 9, 15, 0.35); }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; font-weight: 600; min-height: 28px; display: flex; align-items: center; }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-top: 10px; }
.join-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.join-form select { width: 128px; }
.open-rooms { margin-top: 14px; }
.open-rooms-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.room-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 210px; overflow-y: auto; }
.room-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(4, 9, 15, 0.5); }
.room-item .ri-main { min-width: 0; }
.room-item .ri-code { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.08em; }
.room-item .ri-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-box { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(70, 227, 154, 0.4); background: rgba(70, 227, 154, 0.08); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; }

/* ------------------------------------------------------------------ staging */
.staging-wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px; }
.room-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.room-code { font-family: var(--font-head); font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 2px 0 0; letter-spacing: 0.12em; color: var(--accent); text-shadow: 0 0 22px rgba(62, 232, 255, 0.4); }
.room-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.staging-mission { margin-top: 14px; }
.seat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 9, 15, 0.5); min-height: 64px; }
.seat .seat-color { width: 8px; align-self: stretch; border-radius: 4px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.seat .seat-main { flex: 1; min-width: 0; }
.seat .seat-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .seat-sub { font-size: 0.76rem; color: var(--muted); }
.seat .badge { font-size: 0.68rem; padding: 2px 7px; border-radius: 10px; font-weight: 700; letter-spacing: 0.06em; }
.badge.ready { background: rgba(70, 227, 154, 0.16); color: var(--ok); }
.badge.wait { background: rgba(255, 181, 71, 0.14); color: var(--amber); }
.badge.host { background: rgba(62, 232, 255, 0.14); color: var(--accent); }
.badge.bot { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.badge.dm { background: rgba(192, 92, 255, 0.18); color: var(--hive); }
.seat .kick { border: none; background: none; color: var(--dim); cursor: pointer; font-size: 1.1rem; width: 32px; height: 32px; }
.staging-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ------------------------------------------------------------------ armory */
.armory-wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; max-width: 1500px; margin: 0 auto; padding: 20px 16px 32px; }
.budget { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-head); }
.budget span { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.budget strong { font-size: 1.6rem; color: var(--amber); }
.budget small { color: var(--dim); }
.budget.over strong { color: var(--danger); }
.budget-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin-bottom: 12px; }
.budget-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--danger)); transition: width 0.3s; }
.roster-slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 9, 15, 0.5); cursor: pointer; transition: 0.15s; }
.slot.on { border-color: var(--accent); box-shadow: var(--glow); }
.slot canvas { width: 72px; height: 72px; border-radius: 10px; background: radial-gradient(circle, rgba(62, 232, 255, 0.12), transparent 70%); }
.slot-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; }
.slot-weapon { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.slot-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.75rem; color: var(--muted); margin-top: 3px; }
.slot-eq { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 3px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); font-size: 0.74rem; }
.chip img { width: 20px; height: 20px; }
.chip button { background: none; border: none; color: var(--dim); cursor: pointer; padding: 0 2px; font-size: 0.85rem; }
.orders-slots { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.armory-footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.06em; min-height: 40px; color: var(--muted); }
.tab.on { color: var(--text); border-color: var(--accent); background: rgba(62, 232, 255, 0.1); }
.catalog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(20, 32, 48, 0.7), rgba(6, 11, 18, 0.7)); }
.item.disabled { opacity: 0.45; }
.item img, .item canvas { width: 56px; height: 56px; object-fit: contain; }
.item-name { font-weight: 700; font-size: 0.9rem; line-height: 1.2; }
.item-cost { font-family: var(--font-head); color: var(--amber); font-weight: 700; }
.item-perk { font-size: 0.74rem; color: var(--muted); line-height: 1.3; margin: 3px 0 6px; }
.item-dice { display: flex; gap: 8px; font-size: 0.72rem; color: var(--muted); align-items: center; flex-wrap: wrap; }
.item .btn { min-height: 34px; padding: 5px 10px; font-size: 0.8rem; grid-column: 1 / -1; }
.chapter-rules { margin-top: 12px; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.die-ico { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 2px; }
.die-ico.W { background: #e9eef5; }
.die-ico.R { background: #e3343f; }

/* ------------------------------------------------------------------ game HUD */
.board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; outline: none; background: #020406; }
.hud-top { position: absolute; top: 10px; left: 10px; right: 10px; display: grid; grid-template-columns: minmax(0, auto) auto minmax(0, 1fr) auto; gap: 10px; align-items: center; pointer-events: none; z-index: 5; }
.hud-top > * { pointer-events: auto; }
.hud-mission, .hud-turn, .hud-objectives { background: rgba(6, 11, 18, 0.78); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); padding: 7px 12px; min-width: 0; }
.hud-mission-title { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.hud-round { font-size: 0.75rem; color: var(--muted); display: flex; gap: 8px; }
.hud-diff { color: var(--amber); font-weight: 700; letter-spacing: 0.08em; }
.hud-turn { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.turn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 10px currentColor; }
.hud-turn.mine { border-color: var(--accent); box-shadow: var(--glow); }
.hud-turn.mine .turn-dot { background: var(--accent); animation: pulse 1.4s infinite; }
.hud-turn.hive { border-color: rgba(192, 92, 255, 0.6); color: #e2b6ff; }
.hud-turn.hive .turn-dot { background: var(--hive); animation: pulse 0.9s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.7); } }
.hud-objectives { display: flex; gap: 8px; flex-wrap: wrap; justify-self: start; }
.obj-chip { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; white-space: nowrap; }
.obj-chip b { font-family: var(--font-head); letter-spacing: 0.08em; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; }
.obj-chip.p b { background: rgba(62, 232, 255, 0.18); color: var(--accent); }
.obj-chip.s b { background: rgba(255, 181, 71, 0.18); color: var(--amber); }
.obj-chip.x b { background: rgba(70, 227, 154, 0.2); color: var(--ok); }
.obj-chip.done { opacity: 0.6; text-decoration: line-through; }
.obj-chip .prog { color: var(--muted); }
.hud-buttons { display: flex; gap: 6px; }

.hud-roster { position: absolute; left: 10px; top: 78px; width: 210px; max-height: calc(100% - 290px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; z-index: 4; padding-right: 2px; }
.r-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: rgba(6, 11, 18, 0.78); border: 1px solid var(--line); cursor: pointer; backdrop-filter: blur(8px); transition: 0.15s; min-height: 50px; text-align: left; }
.r-card:hover { border-color: var(--line-strong); }
.r-card.on { border-color: var(--accent); box-shadow: var(--glow); }
.r-card.spent { opacity: 0.55; }
.r-card.dead { opacity: 0.3; filter: grayscale(1); cursor: default; }
.r-card canvas { width: 40px; height: 40px; }
.r-name { font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-sub { display: flex; align-items: center; gap: 5px; font-size: 0.68rem; color: var(--muted); }
.hp-pips { display: flex; gap: 2px; }
.hp-pips i { width: 7px; height: 7px; border-radius: 2px; background: var(--ok); }
.hp-pips i.lost { background: rgba(255, 255, 255, 0.12); }
.r-flags { margin-left: auto; display: flex; gap: 3px; }
.r-flag { font-size: 0.66rem; padding: 0 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }
.r-flag.ow { background: rgba(255, 181, 71, 0.25); color: var(--amber); }

.hud-panel { position: absolute; right: 10px; top: 78px; width: 300px; max-height: calc(100% - 88px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; z-index: 6; padding: 12px; background: rgba(6, 11, 18, 0.84); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(12px); }
.sheet-handle { display: none; }
.inspector-empty { color: var(--dim); font-size: 0.85rem; padding: 10px 0; }
.insp-head { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: center; }
.insp-head canvas { width: 84px; height: 84px; border-radius: 12px; background: radial-gradient(circle, rgba(62, 232, 255, 0.12), transparent 70%); }
.insp-name { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.insp-type { font-size: 0.74rem; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.insp-type.hive { color: var(--hive); }
.insp-blurb { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-top: 10px; }
.stat { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.05rem; }
.stat span { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.dice-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.78rem; color: var(--muted); margin-top: 6px; }
.dice-line .dl-dice { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.eq-line { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.target-preview { border-radius: 10px; padding: 9px 10px; border: 1px solid rgba(255, 77, 94, 0.45); background: rgba(255, 77, 94, 0.08); font-size: 0.8rem; }
.target-preview .tp-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.tp-bars { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; }
.tp-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.tp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--danger)); }
.tp-note { color: var(--muted); font-size: 0.72rem; margin-top: 4px; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); cursor: pointer; transition: 0.15s; padding: 4px; }
.act i { font-style: normal; font-size: 1.1rem; line-height: 1; }
.act span { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.act:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(62, 232, 255, 0.06); }
.act.on { border-color: var(--accent); box-shadow: var(--glow); background: rgba(62, 232, 255, 0.1); }
.act.on span { color: var(--text); }
.act:disabled { opacity: 0.28; cursor: not-allowed; }
.act[hidden], [hidden] { display: none !important; }
.act .badge-n { position: absolute; }
.orders-pop { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(4, 9, 15, 0.9); }
.order-btn { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; min-height: 44px; }
.order-btn img { width: 30px; height: 30px; }
.order-btn small { display: block; color: var(--muted); font-size: 0.7rem; }
.end-turn { width: 100%; min-height: 48px; font-family: var(--font-head); font-size: 1.05rem; letter-spacing: 0.1em; text-transform: uppercase; }
.end-turn.pulse { animation: glowPulse 1.6s infinite; }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(62, 232, 255, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(62, 232, 255, 0); } }

.hud-log { position: absolute; left: 10px; bottom: calc(10px + var(--safe-b)); width: 320px; z-index: 4; }
.log-toggle { border: 1px solid var(--line); background: rgba(6, 11, 18, 0.8); border-radius: 8px 8px 0 0; padding: 4px 10px; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.log-body { height: 150px; overflow-y: auto; background: rgba(6, 11, 18, 0.78); border: 1px solid var(--line); border-radius: 0 10px 10px 10px; padding: 6px 8px; font-size: 0.74rem; backdrop-filter: blur(8px); }
.hud-log.collapsed .log-body { display: none; }
.log-line { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); color: #c2cfdc; }
.log-line .t { color: var(--dim); margin-right: 5px; font-family: var(--font-head); }
.log-line.hive { color: #dcb3ff; }
.log-line.good { color: #9ff5cb; }
.log-line.bad { color: #ffb0b8; }
.log-line.sys { color: var(--accent); }
.minimap { position: absolute; right: 320px; bottom: calc(10px + var(--safe-b)); width: 168px; height: 168px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 8, 12, 0.85); z-index: 4; cursor: pointer; }

.dice-tray { position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 7; padding: 10px 16px; border-radius: 14px; background: rgba(6, 11, 18, 0.9); border: 1px solid var(--line-strong); backdrop-filter: blur(10px); display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 240px; max-width: calc(100vw - 20px); pointer-events: none; animation: trayIn 0.25s ease; }
@keyframes trayIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dt-title { font-size: 0.78rem; color: var(--muted); text-align: center; }
.dt-rows { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: center; }
.dt-row { display: flex; gap: 6px; align-items: center; }
.die { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.4); animation: dieRoll 0.55s cubic-bezier(.2, .8, .3, 1.2) both; }
.die.W { background: linear-gradient(145deg, #ffffff, #c9d3df); color: #0b1520; }
.die.R { background: linear-gradient(145deg, #ff5a63, #b3151f); color: #fff; }
.die.zero { opacity: 0.55; }
@keyframes dieRoll { 0% { transform: rotate(-200deg) scale(0.3); opacity: 0; } 70% { transform: rotate(12deg) scale(1.08); opacity: 1; } 100% { transform: rotate(0) scale(1); } }
.dt-result { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.08em; font-size: 1.05rem; }
.dt-result.kill { color: var(--danger); }
.dt-result.miss { color: var(--muted); }
.dt-vs { color: var(--dim); font-family: var(--font-head); }

.banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 8; text-align: center; pointer-events: none; padding: 18px 40px; background: linear-gradient(90deg, transparent, rgba(4, 9, 15, 0.92) 15%, rgba(4, 9, 15, 0.92) 85%, transparent); width: min(900px, 100vw); animation: bannerIn 2.2s ease both; }
.banner h2 { font-family: var(--font-head); font-size: clamp(1.8rem, 5vw, 3rem); margin: 0; letter-spacing: 0.14em; text-transform: uppercase; }
.banner p { margin: 4px 0 0; color: var(--muted); letter-spacing: 0.1em; }
.banner.hive h2 { color: #e2b6ff; text-shadow: 0 0 30px rgba(192, 92, 255, 0.6); }
.banner.mine h2 { color: var(--accent); text-shadow: 0 0 30px rgba(62, 232, 255, 0.5); }
@keyframes bannerIn { 0% { opacity: 0; letter-spacing: 0.4em; } 15% { opacity: 1; letter-spacing: 0.14em; } 80% { opacity: 1; } 100% { opacity: 0; } }
.hive-card { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); z-index: 8; width: min(440px, calc(100vw - 20px)); padding: 14px 18px; border-radius: 14px; border: 1px solid rgba(192, 92, 255, 0.7); background: linear-gradient(160deg, rgba(60, 10, 70, 0.92), rgba(12, 4, 20, 0.92)); box-shadow: 0 0 40px rgba(192, 92, 255, 0.35); text-align: center; animation: hiveIn 3.6s ease both; pointer-events: none; }
.hive-card .hc-k { font-size: 0.7rem; letter-spacing: 0.3em; color: var(--hive); text-transform: uppercase; font-weight: 700; }
.hive-card h3 { font-family: var(--font-head); font-size: 1.6rem; margin: 2px 0; letter-spacing: 0.08em; }
.hive-card p { margin: 0; color: #e4cdf2; font-size: 0.9rem; }
@keyframes hiveIn { 0% { opacity: 0; transform: translate(-50%, -20px) scale(0.95); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.tooltip { position: absolute; z-index: 9; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: rgba(4, 9, 15, 0.94); border: 1px solid var(--line-strong); font-size: 0.75rem; max-width: 240px; }
.tooltip b { font-family: var(--font-head); letter-spacing: 0.04em; }
.busy { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 9; }
.busy span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(62, 232, 255, 0.25); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ modal & toasts */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(1, 3, 6, 0.72); backdrop-filter: blur(6px); animation: viewIn 0.2s ease; }
.modal-card { width: min(680px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 18px; border: 1px solid var(--line-strong); background: linear-gradient(170deg, #111c2a, #070c13); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); padding: 22px; }
.modal-card h2 { font-family: var(--font-head); letter-spacing: 0.06em; margin: 0 0 6px; font-size: 1.7rem; }
.modal-card h3 { font-family: var(--font-head); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); font-size: 0.95rem; margin: 16px 0 6px; }
.modal-card p, .modal-card li { color: #c3d0dd; font-size: 0.9rem; }
.modal-card ul { padding-left: 18px; margin: 6px 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal-x { float: right; }
.outcome { text-align: center; padding: 10px 0 4px; }
.outcome .o-k { letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.75rem; font-weight: 700; }
.outcome h2 { font-size: clamp(2rem, 7vw, 3.2rem); margin: 4px 0; }
.outcome.win h2 { color: var(--ok); text-shadow: 0 0 30px rgba(70, 227, 154, 0.5); }
.outcome.loss h2 { color: var(--danger); text-shadow: 0 0 30px rgba(255, 77, 94, 0.5); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.stat-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; background: rgba(255, 255, 255, 0.03); }
.stat-box b { display: block; font-family: var(--font-head); font-size: 1.5rem; }
.stat-box span { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.reward-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); margin-top: 6px; font-size: 0.88rem; }
.reward-row .xp { color: var(--amber); font-family: var(--font-head); font-weight: 700; }
.rankup { color: var(--ok); font-weight: 700; }
.slider-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; margin: 8px 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; width: min(460px, calc(100vw - 20px)); pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 10px; background: rgba(8, 14, 22, 0.95); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); font-size: 0.88rem; animation: toastIn 0.25s ease; pointer-events: auto; }
.toast.error { border-color: rgba(255, 77, 94, 0.7); color: #ffd0d5; }
.toast.ok { border-color: rgba(70, 227, 154, 0.6); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.noscript { padding: 40px; text-align: center; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
    .home-grid { grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); }
    .deploy-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
    .deploy-panel .panel-title, .deploy-panel .divider { grid-column: 1 / -1; }
    .hud-roster { width: 180px; }
    .hud-panel { width: 270px; }
    .minimap { right: 290px; width: 132px; height: 132px; }
    .hud-log { width: 270px; }
}
@media (max-width: 1100px) {
    .hud-top { grid-template-columns: minmax(0, 1fr) auto auto; }
    .hud-objectives { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
    .hud-roster { top: 128px; }
    .hud-panel { top: 128px; max-height: calc(100% - 138px); }
}
@media (max-width: 900px) {
    .home-grid { grid-template-columns: minmax(0, 1fr); margin-top: -24px; }
    .deploy-panel { display: block; }
    .armory-wrap { grid-template-columns: minmax(0, 1fr); }
    .catalog-list { max-height: none; }
    .adv-grid { grid-template-columns: 1fr; }
    .hero { height: 38vh; min-height: 300px; }
    .hero-content { bottom: 36px; right: 16px; }
}
@media (max-width: 820px) {
    /* mobile game layout: roster strip on top, panel as bottom sheet */
    .hud-top { top: 6px; left: 6px; right: 6px; gap: 6px; grid-template-columns: minmax(0, 1fr) auto; }
    .hud-mission { display: none; }
    .hud-turn { font-size: 0.8rem; padding: 6px 10px; }
    .hud-buttons .icon-btn { width: 36px; height: 36px; }
    .hud-objectives { grid-column: 1 / -1; grid-row: 2; padding: 5px 8px; gap: 4px 8px; }
    .obj-chip { font-size: 0.7rem; white-space: normal; }
    .hud-roster { top: auto; bottom: calc(242px + var(--safe-b)); left: 6px; right: 6px; width: auto; max-height: 104px; flex-direction: row; flex-wrap: wrap; overflow: hidden auto; gap: 4px; }
    .r-card { flex: none; width: 52px; grid-template-columns: 1fr; justify-items: center; gap: 2px; min-height: 48px; padding: 3px; }
    .r-card canvas { width: 30px; height: 30px; }
    .r-card .r-name, .r-card .r-flags .r-flag:not(.ow) { display: none; }
    .r-card .r-sub { justify-content: center; }
    .hp-pips i { width: 5px; height: 5px; }
    .hud-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 236px; border-radius: 16px 16px 0 0; padding: 8px 10px calc(8px + var(--safe-b)); transition: max-height 0.3s ease; }
    .hud-panel.expanded { max-height: 72vh; }
    .sheet-handle { display: block; width: 52px; height: 18px; margin: -4px auto 0; border: none; background: none; cursor: pointer; position: relative; flex: none; }
    .sheet-handle::after { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 3px; background: var(--line-strong); }
    .hud-panel:not(.expanded) .inspector .insp-blurb, .hud-panel:not(.expanded) .inspector .eq-line, .hud-panel:not(.expanded) .inspector .dice-line, .hud-panel:not(.expanded) .inspector .stats, .hud-panel:not(.expanded) .target-preview { display: none; }
    .hud-panel:not(.expanded) .insp-head { grid-template-columns: 34px minmax(0, 1fr); }
    .hud-panel:not(.expanded) .insp-head canvas { width: 34px; height: 34px; }
    .hud-panel:not(.expanded) .insp-name { font-size: 0.95rem; }
    .insp-head { grid-template-columns: 48px minmax(0, 1fr); }
    .insp-head canvas { width: 48px; height: 48px; }
    .stats { margin-top: 6px; }
    .actions { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
    .act { min-height: 46px; }
    .act span { font-size: 0.58rem; }
    .end-turn { min-height: 44px; position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -8px 16px rgba(6, 11, 18, 0.9); }
    .hud-log { display: none; }
    .minimap { display: none; }
    .dice-tray { bottom: calc(350px + var(--safe-b)); }
    .hero-kicker { letter-spacing: 0.16em; font-size: 0.75rem; }
    .hive-card { top: 110px; }
    .banner { top: 30%; }
}
@media (max-width: 520px) {
    body { font-size: 14px; }
    .panel { padding: 14px; }
    .join-form { grid-template-columns: minmax(0, 1fr) auto; }
    .join-form button { grid-column: 1 / -1; }
    .mission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 280px; }
    .profile-meta { min-width: 0; }
    .profile-name { max-width: 110px; }
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .slider-row { grid-template-columns: 80px 1fr 34px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ v3.1: room setup, lobby, extensions */
.room-setup { display: grid; gap: 8px; margin-bottom: 12px; }
.ext-toggle { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(62, 232, 255, 0.05); cursor: pointer; }
.ext-toggle input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.ext-text b { display: block; font-family: var(--font-head); letter-spacing: 0.04em; }
.ext-text small { display: block; color: var(--muted); font-size: 0.74rem; line-height: 1.35; margin-top: 2px; }

.room-code { user-select: all; }
.room-presence { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.pill.on { border-color: var(--accent); color: var(--accent); }
.seat-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 150px; }
.badge.online { background: rgba(70, 227, 154, 0.16); color: var(--ok); }
.badge.offline { background: rgba(255, 77, 94, 0.16); color: #ff8a96; }
.badge.group { background: rgba(255, 211, 106, 0.16); color: #ffd36a; }
.seat-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.seat-pick { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--muted); }
.seat-select { min-height: 36px; max-width: 130px; padding: 4px 6px; font-size: 0.8rem; }
.group-summary { display: grid; gap: 4px; margin-top: 10px; font-size: 0.8rem; }
.group-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: 8px; background: rgba(255, 211, 106, 0.06); border: 1px solid var(--line); }
.group-row b { color: #ffd36a; }

/* Spent actions: the card goes grey from the left, proportional to the actions used */
.r-card, .insp-head { position: relative; overflow: hidden; }
.spent-shade { position: absolute; left: 0; top: 0; bottom: 0; pointer-events: none; background: rgba(40, 44, 50, 0.32); -webkit-backdrop-filter: grayscale(1) brightness(0.72); backdrop-filter: grayscale(1) brightness(0.72); border-right: 1px solid rgba(255, 255, 255, 0.22); transition: width 0.25s ease; }
.insp-head .spent-shade { border-radius: 12px; }
.r-flag.cv { background: rgba(120, 220, 255, 0.2); color: #9fe6ff; }

.actions.ext { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.actions.ext .act { min-height: 48px; }

.chip .chip-drop { background: rgba(255, 181, 71, 0.14); border: none; border-radius: 50%; color: var(--amber); cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0; margin-left: 3px; width: 24px; height: 24px; }
.chip-pick { cursor: pointer; border-color: #ffd36a; color: #ffe9a8; font: inherit; font-size: 0.74rem; min-height: 28px; }

.hud-seats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.hud-seat { font-size: 0.66rem; padding: 0 6px; border-radius: 8px; border-left: 3px solid var(--c); background: rgba(255, 255, 255, 0.06); }
.hud-seat.off { opacity: 0.45; text-decoration: line-through; }

.tile-card { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 8; width: min(440px, calc(100% - 660px)); min-width: 300px; max-height: 44%; overflow-y: auto; padding: 12px 34px 12px 12px; border-radius: 14px; background: rgba(6, 11, 18, 0.95); border: 1px solid var(--line-strong); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55); display: grid; gap: 10px; }
.tc-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: start; }
.tc-row img, .tc-row canvas { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: rgba(255, 255, 255, 0.04); }
.tc-kind { font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.tc-title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; line-height: 1.15; }
.tc-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.38; margin-top: 2px; }
.tc-pick { margin-top: 6px; min-height: 36px; padding: 4px 12px; }
.tc-close { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

@media (max-width: 1280px) {
    .tile-card { width: min(400px, calc(100% - 590px)); }
    .deploy-panel .room-setup { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .deploy-panel .room-setup { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
    .actions.ext { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
    .actions.ext .act { min-height: 44px; padding: 2px; }
    .actions.ext .act span { font-size: 0.52rem; letter-spacing: 0.02em; }
    .tile-card { left: 8px; right: 8px; width: auto; min-width: 0; transform: none; top: 106px; bottom: auto; max-height: 38vh; }
    .seat { flex-wrap: wrap; }
    .seat .seat-main { flex: 1 1 70%; }
    .seat-badges { max-width: none; justify-content: flex-start; }
}
