:root {
  --bg: #0e0c0a;
  --bg-panel: #15120f;
  --bg-card: #1b1713;
  --bg-elevated: #231e18;
  --bg-input: #0f0d0a;
  --border: #2f271e;
  --border-brass: #4c3d2a;
  --brass: #c59b52;
  --brass-bright: #e4c27f;
  --crimson: #8f1d1d;
  --crimson-hover: #a72424;
  --crimson-deep: #621313;
  --text: #efe6d5;
  --text-muted: #9e917d;
  --text-dim: #6b6052;
  --speaking: #2fb36d;
  --danger: #c83737;
  --danger-bg: rgba(200, 55, 55, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow: hidden;
}

.albion-font {
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  letter-spacing: 0.05em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pip-hidden-video {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  bottom: 0;
  right: 0;
}

.hidden { display: none !important; }
.mobile-only { display: none !important; }

/* ===================== VIEWS ===================== */
.view {
  display: none;
  height: 100vh;
  height: 100dvh;
  position: relative;
}

.view.active { display: flex; }

/* ===================== LAUNCH GATE ===================== */
.albion-backdrop {
  position: fixed;
  inset: 0;
  background: url("albion-bg.jpg") center center / cover no-repeat;
  filter: brightness(0.36) saturate(0.88);
  z-index: 0;
}

.albion-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(14, 12, 10, 0.18) 0%, rgba(10, 8, 7, 0.92) 86%);
  z-index: 1;
  pointer-events: none;
}

#connect-view {
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  overflow-y: auto;
}

.connect-shell {
  width: 100%;
  max-width: 436px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
}

.connect-header {
  text-align: center;
  margin-bottom: 20px;
}

.hero-crest {
  width: 82px;
  height: 82px;
  border-radius: 10px;
  border: 1px solid var(--border-brass);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.72);
  display: block;
  margin: 0 auto 14px;
}

.guild-kicker {
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--brass);
}

.connect-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.ornament-rule {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rule-line {
  width: 68px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-brass), transparent);
}

.rule-diamond {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  background: var(--brass);
}

/* Engraved Forged Iron Gate Panel */
.gate-panel {
  width: 100%;
  position: relative;
  background: rgba(21, 18, 15, 0.94);
  border: 1px solid var(--border-brass);
  box-shadow: inset 0 1px 0 rgba(228, 194, 127, 0.1), 0 24px 60px rgba(0, 0, 0, 0.75);
  border-radius: 4px;
  padding: 24px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Subtle metallic corner ticks (authentic game HUD detail) */
.corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--brass);
  border-style: solid;
  pointer-events: none;
}
.corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* Warrior Bar & Vector Role Picker */
.warrior-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 11px 12px;
}

.warrior-emblem {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid var(--border-brass);
  display: grid;
  place-items: center;
  color: var(--text);
  flex-shrink: 0;
}

.warrior-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.warrior-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.warrior-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warrior-role-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass-bright);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.role-btn {
  height: 30px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.role-btn:hover {
  color: var(--text);
  border-color: var(--border-brass);
}

.role-btn.selected {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: rgba(197, 155, 82, 0.14);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-svg {
  position: absolute;
  left: 11px;
  color: var(--text-dim);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.input-wrap:focus-within .input-svg {
  color: var(--brass);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.14s ease;
  user-select: text;
}

.input-wrap input { padding-left: 34px; }
.password-wrap input { padding-right: 36px; letter-spacing: 0.12em; }

input:focus, select:focus {
  border-color: var(--brass);
}

input::placeholder {
  color: #554c41;
  letter-spacing: normal;
}

.eye-btn {
  position: absolute;
  right: 7px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  display: grid;
  place-items: center;
}

.eye-btn:hover { color: var(--text); }

.gate-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  font-weight: 500;
}

.check-label input {
  width: 14px;
  height: 14px;
  accent-color: var(--brass);
  cursor: pointer;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { color: var(--brass-bright); }

.forged-cta {
  width: 100%;
  background: linear-gradient(180deg, var(--crimson-hover) 0%, var(--crimson) 55%, var(--crimson-deep) 100%);
  color: var(--text);
  border: 1px solid var(--brass);
  box-shadow: inset 0 1px 0 rgba(255, 226, 168, 0.25), 0 4px 16px rgba(0, 0, 0, 0.45);
  border-radius: 3px;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.1s ease;
}

.forged-cta:hover:not(:disabled) { filter: brightness(1.1); }
.forged-cta:active:not(:disabled) { transform: translateY(1px); }
.forged-cta:disabled { opacity: 0.55; cursor: not-allowed; }
.forged-cta.compact { width: auto; padding: 8px 18px; font-size: 12.5px; }

.error-banner {
  background: var(--danger-bg);
  border: 1px solid rgba(200, 55, 55, 0.55);
  color: #f4b8b8;
  border-radius: 3px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.45;
}

.gate-footer {
  margin-top: 18px;
}

.signature-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.14s ease;
}

.signature-btn:hover { color: var(--brass-bright); }

/* ===================== WAR ROOM 3-PANE LAYOUT ===================== */
#room-view {
  flex-direction: row;
  background: var(--bg);
}

/* LEFT SIDEBAR */
.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.guild-brand-header {
  height: 58px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border);
  background: rgba(143, 29, 29, 0.09);
}

.guild-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border-brass);
  flex-shrink: 0;
}

.guild-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.guild-brand-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brass-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild-brand-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.roster-section {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.roster-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.channel-item svg { color: var(--brass); flex-shrink: 0; }

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 8px;
}

.sidebar-member {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 3px;
}

.sidebar-member:hover { background: rgba(255, 255, 255, 0.03); }

.sidebar-member-avatar {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--border-brass);
  flex-shrink: 0;
  transition: border-color 0.12s ease;
}

.sidebar-member.speaking .sidebar-member-avatar {
  border-color: var(--speaking);
  box-shadow: 0 0 0 1px var(--speaking);
}

.sidebar-member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-member.speaking .sidebar-member-name {
  color: var(--text);
  font-weight: 600;
}

.sidebar-member-icons {
  display: flex;
  gap: 4px;
  color: var(--danger);
}

.roster-invite-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 3px;
  border: 1px solid var(--border-brass);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.roster-invite-btn:hover {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: rgba(197, 155, 82, 0.08);
}

/* Sidebar Bottom */
.sidebar-bottom {
  background: #100e0c;
  border-top: 1px solid var(--border);
}

.conn-panel {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conn-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.conn-status-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--speaking);
}

.conn-metrics {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.signal-bars i {
  display: block;
  width: 2.5px;
  background: currentColor;
  opacity: 0.25;
}
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 7px; }
.signal-bars i:nth-child(3) { height: 11px; }

.ping-badge.good { color: var(--speaking); }
.ping-badge.good .signal-bars i { opacity: 1; }
.ping-badge.ok { color: var(--brass-bright); }
.ping-badge.ok .signal-bars i:nth-child(1),
.ping-badge.ok .signal-bars i:nth-child(2) { opacity: 1; }
.ping-badge.bad { color: var(--danger); }
.ping-badge.bad .signal-bars i:nth-child(1) { opacity: 1; }

.user-bar {
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.user-bar-id {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.user-bar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  border: 1px solid var(--border-brass);
  display: grid;
  place-items: center;
  color: var(--text);
  flex-shrink: 0;
}

.user-bar-avatar.speaking {
  border-color: var(--speaking);
  box-shadow: 0 0 0 1px var(--speaking);
}

.user-bar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-bar-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-bar-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.user-bar-actions { display: flex; gap: 2px; }

.panel-btn {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.panel-btn:hover { background: var(--bg-elevated); color: var(--text); }
.panel-btn.active-danger { color: #f08a8a; background: var(--danger-bg); }

.sidebar-signature {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 10px;
  cursor: pointer;
}

.sidebar-signature:hover { color: var(--brass-bright); }

/* ===================== CENTER STAGE ===================== */
.stage-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stage-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 12, 10, 0.86) 0%, rgba(14, 12, 10, 0.94) 100%),
    url("albion-bg.jpg") center center / cover no-repeat;
  z-index: 0;
  pointer-events: none;
}

.stage-header {
  position: relative;
  z-index: 4;
  height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(17, 14, 11, 0.92);
}

.stage-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stage-title-group h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-brass);
  border-radius: 3px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.header-btn:hover {
  color: var(--text);
  border-color: var(--brass);
  background: var(--bg-elevated);
}

.header-btn.pip-active {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: rgba(197, 155, 82, 0.14);
}

.tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.14s ease;
}

.tool-btn:hover {
  color: var(--text);
  border-color: var(--border-brass);
  background: var(--bg-elevated);
}

.tool-btn.active-pill {
  border-color: var(--brass);
  color: var(--brass-bright);
}

.tool-btn.danger-hover:hover {
  border-color: var(--danger);
  color: #f08a8a;
  background: var(--danger-bg);
}

.tool-btn.small { width: 28px; height: 28px; }

.unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--crimson-hover);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--bg);
}

/* WARRIOR TILES */
.room-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  padding: 26px 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.participants-grid {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.participant-card {
  width: 264px;
  min-height: 234px;
  background: var(--bg-card);
  border: 1px solid var(--border-brass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  padding: 22px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.participants-grid[data-count="1"] .participant-card {
  width: 336px;
  min-height: 260px;
}

.participants-grid[data-count="2"] .participant-card {
  width: min(344px, calc(50% - 10px));
  min-height: 256px;
}

.participant-card.speaking {
  border-color: var(--speaking);
  box-shadow: inset 0 0 0 1px rgba(47, 179, 109, 0.35), 0 12px 34px rgba(0, 0, 0, 0.55);
}

.role-corner-tag {
  position: absolute;
  top: 11px;
  left: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.status-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}

.mini-badge {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  background: var(--danger-bg);
  color: #f08a8a;
  border: 1px solid rgba(200, 55, 55, 0.4);
}

.card-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
}

.avatar-frame {
  width: 78px;
  height: 78px;
  border-radius: 6px;
  padding: 3px;
  border: 2px solid var(--border-brass);
  display: grid;
  place-items: center;
  position: relative;
  transition: border-color 0.12s ease;
}

.participant-card.speaking .avatar-frame {
  border-color: var(--speaking);
}

.avatar-fill {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.eq-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #101914;
  border: 1px solid var(--speaking);
  border-radius: 2px;
  padding: 2px 6px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.participant-card.speaking .eq-badge { opacity: 1; }

.eq-badge i {
  display: block;
  width: 2px;
  height: 3px;
  background: var(--speaking);
}

.participant-card.speaking .eq-badge i:nth-child(1) { animation: eq 0.5s ease-in-out infinite; }
.participant-card.speaking .eq-badge i:nth-child(2) { animation: eq 0.38s ease-in-out 0.1s infinite; }
.participant-card.speaking .eq-badge i:nth-child(3) { animation: eq 0.46s ease-in-out 0.18s infinite; }

@keyframes eq {
  0%, 100% { height: 3px; }
  50% { height: 8px; }
}

.peer-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.peer-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.self-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--brass-bright);
  border: 1px solid var(--border-brass);
  padding: 1px 5px;
  border-radius: 2px;
}

.conn-state {
  font-size: 11px;
  color: var(--text-dim);
}
.conn-state.connected { color: var(--speaking); }
.conn-state.connecting { color: var(--brass); }
.conn-state.failed { color: #f08a8a; }

/* Volume Fader & Self Level */
.volume-control {
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-mute-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  display: grid;
  place-items: center;
}

.vol-mute-btn:hover { color: var(--text); }
.vol-mute-btn.zero { color: var(--danger); }

.fader {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--brass) 0%,
    var(--brass-bright) var(--vol-pct, 50%),
    #2f271e var(--vol-pct, 50%)
  );
  outline: none;
  cursor: pointer;
}

.fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--text);
  border: 1px solid var(--brass);
}

.volume-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.self-meter-wrap {
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.self-meter-track {
  width: 100%;
  height: 4px;
  background: var(--border);
  overflow: hidden;
}

.self-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--speaking);
  transition: width 0.06s linear;
}

.self-meter-caption {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.solo-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  background: rgba(21, 18, 15, 0.85);
  border-radius: 3px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.inline-action-btn {
  background: none;
  border: none;
  color: var(--brass-bright);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.inline-action-btn:hover { text-decoration: underline; }

/* PTT Banner */
.ptt-banner {
  position: relative;
  z-index: 4;
  margin: 0 auto 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-brass);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 13px;
  border-radius: 3px;
}

.ptt-banner.transmitting {
  border-color: var(--speaking);
  color: var(--text);
}

.ptt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
}

.ptt-banner.transmitting .ptt-dot { background: var(--speaking); }

.ptt-banner kbd {
  font-family: inherit;
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border-brass);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--text);
}

/* BOTTOM DOCK */
.control-dock {
  position: relative;
  z-index: 5;
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.dock-frame {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-panel);
  border: 1px solid var(--border-brass);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  padding: 7px 10px;
  border-radius: 4px;
}

.dock-circle {
  width: 42px;
  height: 42px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.dock-circle:hover {
  border-color: var(--brass);
  background: #2c251e;
}

.dock-circle.active-danger {
  background: var(--text);
  color: #120f0c;
  border-color: var(--text);
}

.dock-circle.pip-active {
  border-color: var(--brass);
  color: var(--brass-bright);
  background: rgba(197, 155, 82, 0.14);
}

.dock-circle.danger {
  background: var(--crimson);
  border-color: #b54545;
  color: #fff;
}

.dock-circle.danger:hover { background: var(--crimson-hover); }

.dock-pill {
  height: 42px;
  padding: 0 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.dock-pill:hover { color: var(--text); border-color: var(--border-brass); }
.dock-pill.ptt-on { border-color: var(--brass); color: var(--brass-bright); background: rgba(197, 155, 82, 0.12); }

.dock-sep { width: 1px; height: 24px; background: var(--border); }

/* ===================== CHAT DRAWER ===================== */
.chat-drawer {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 12;
}

.chat-header {
  height: 58px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brass-bright);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: text;
}

.chat-note {
  font-size: 11.5px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 3px;
  text-align: center;
}

.chat-msg { display: flex; gap: 9px; align-items: flex-start; }

.chat-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 3px;
  border: 1px solid var(--border-brass);
  display: grid;
  place-items: center;
  color: var(--text);
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg-body { min-width: 0; flex: 1; }
.chat-msg-meta { display: flex; align-items: baseline; gap: 7px; }
.chat-msg-author { font-size: 12.5px; font-weight: 600; color: var(--brass-bright); }
.chat-msg-time { font-size: 10.5px; color: var(--text-dim); }
.chat-msg-text { margin-top: 2px; font-size: 13px; color: var(--text); line-height: 1.45; word-break: break-word; }
.chat-msg-text a { color: var(--brass-bright); text-decoration: underline; }
.chat-system-msg { font-size: 11.5px; color: var(--text-dim); text-align: center; }

.chat-composer {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 7px;
  background: #100e0c;
}

.chat-composer input { padding: 8px 10px; font-size: 13px; }

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  border: 1px solid var(--brass);
  background: var(--crimson);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-send:hover { background: var(--crimson-hover); }

/* ===================== MODALS ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 4, 0.8);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 18px;
}

.modal-card {
  width: 100%;
  max-width: 456px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-brass);
  border-radius: 4px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--brass-bright); }
.modal-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-dim); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 15px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 2px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--crimson);
  color: var(--text);
  border: 1px solid var(--brass);
}

.meter-block { display: flex; flex-direction: column; gap: 6px; }

.led-meter {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 3px;
  height: 10px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.led-seg { background: #26201a; }
.led-seg.on-low { background: var(--speaking); }
.led-seg.on-mid { background: var(--brass-bright); }
.led-seg.on-high { background: var(--danger); }

.switch-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.switch-copy { display: flex; flex-direction: column; gap: 2px; }
.switch-copy strong { font-size: 13px; font-weight: 600; color: var(--text); }
.switch-copy small { font-size: 11.5px; color: var(--text-dim); font-weight: 400; }

.switch { position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: #28221b;
  border: 1px solid var(--border-brass);
  transition: background 0.14s ease;
}
.switch-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 1px;
  left: 2px;
  top: 2px;
  background: var(--text);
  transition: transform 0.14s ease;
}
.switch input:checked + .switch-track { background: var(--crimson); border-color: var(--brass); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ABOUT */
.about-card { max-width: 388px; }
.about-body { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.about-crest { width: 76px; height: 76px; border-radius: 8px; border: 1px solid var(--border-brass); margin-bottom: 14px; }
.about-name { font-size: 18px; font-weight: 700; color: var(--brass-bright); }
.about-copy { margin: 8px 0 18px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.creator-seal {
  width: 100%;
  padding: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-brass);
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.seal-label { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; color: var(--text-dim); }
.seal-name { font-size: 18px; font-weight: 700; color: var(--text); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--brass);
  color: var(--text);
  padding: 8px 15px;
  border-radius: 3px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  z-index: 60;
  white-space: nowrap;
}

/* ===================== RESPONSIVE ===================== */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 15;
}

@media (max-width: 860px) {
  .mobile-only { display: grid !important; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
  }
  .sidebar.open { transform: translateX(0); }
  .chat-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(312px, 88vw);
    z-index: 20;
  }
}

@media (max-width: 600px) {
  .participants-grid[data-count="2"] .participant-card,
  .participants-grid[data-count="1"] .participant-card,
  .participant-card {
    width: 100%;
    max-width: 344px;
    min-height: 214px;
  }
  #pip-btn-text, #copy-invite-text { display: none; }
}
