/*
 * Voice Web Bridge — Simple Voice Chat style UI & Configurable Overlay
 * Uses vendored Pixelify Sans (SIL OFL 1.1) for pixel typography.
 */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('lib/PixelifySans.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --mc-font: 'Pixelify Sans', 'Courier New', monospace;
  --bg-deep: #111317;
  --bg-grid-a: #15181d;
  --bg-grid-b: #12151a;

  --gui-bg: #262626;
  --gui-panel: #1c1c1e;
  --gui-slot: #141416;
  --gui-well: #0d0d0f;
  --gui-border-outer: #000000;
  --gui-bevel-light: #4e4e52;
  --gui-bevel-dark: #101012;

  --btn-bg: #58585c;
  --btn-bg-hover: #5c72ad;
  --btn-light: #8d8d92;
  --btn-dark: #323236;
  --btn-hover-light: #8ca3e0;
  --btn-hover-dark: #384978;

  --text-main: #ffffff;
  --text-muted: #aaaaaa;
  --text-dim: #707075;
  --text-hover: #ffffa0;

  --mc-green: #55ff55;
  --mc-green-dark: #226622;
  --mc-green-bg: #1b4d1e;
  --mc-red: #ff5555;
  --mc-red-dark: #6b1d1d;
  --mc-red-bg: #5a1c1c;
  --mc-gold: #ffaa00;
  --mc-gold-bg: #593f11;
  --mc-aqua: #55ffff;
  --mc-aqua-bg: #17464a;
  --mc-purple: #c57dff;

  --shadow-text: 2px 2px 0 #141414;
  --shadow-sm: 1px 1px 0 #101010;
}

*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(45deg, var(--bg-grid-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-grid-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-grid-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-grid-b) 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0;
  color: var(--text-main);
  font-family: var(--mc-font);
  font-size: 14px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

button, input, select, textarea {
  font-family: var(--mc-font);
  font-size: 14px;
  line-height: 1.25;
  color: var(--text-main);
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.px-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  flex-shrink: 0;
  shape-rendering: crispEdges;
}

.px-icon--lg {
  width: 24px;
  height: 24px;
}

.px-icon--xl {
  width: 32px;
  height: 32px;
}

.hidden {
  display: none !important;
}

/* --- Minecraft GUI Containers --- */

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px 84px;
}

.mc-window {
  background: var(--gui-bg);
  border: 2px solid var(--gui-border-outer);
  box-shadow:
    inset 2px 2px 0 var(--gui-bevel-light),
    inset -2px -2px 0 var(--gui-bevel-dark),
    0 12px 32px rgba(0, 0, 0, 0.65);
}

.mc-panel {
  background: var(--gui-panel);
  border: 2px solid var(--gui-border-outer);
  box-shadow:
    inset 2px 2px 0 #343438,
    inset -2px -2px 0 #0d0d0e;
  padding: 12px;
}

.mc-slot {
  background: var(--gui-slot);
  border: 2px solid #080809;
  box-shadow:
    inset 2px 2px 0 #070708,
    inset -2px -2px 0 #2e2e32;
}

/* --- Minecraft Buttons --- */

.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 36px;
  background: var(--btn-bg);
  border: 2px solid var(--gui-border-outer);
  box-shadow:
    inset 2px 2px 0 var(--btn-light),
    inset -2px -2px 0 var(--btn-dark);
  color: var(--text-main);
  text-shadow: var(--shadow-text);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background-color 0.08s linear;
}

.mc-btn:hover:not(:disabled) {
  background: var(--btn-bg-hover);
  color: var(--text-hover);
  box-shadow:
    inset 2px 2px 0 var(--btn-hover-light),
    inset -2px -2px 0 var(--btn-hover-dark);
}

.mc-btn:active:not(:disabled),
.mc-btn.is-pressed:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 0 var(--btn-dark),
    inset -2px -2px 0 var(--btn-light);
}

.mc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mc-btn--sm {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
  gap: 6px;
}

.mc-btn--xs {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 11px;
  gap: 4px;
}

.mc-btn--green {
  background: #2b6b2f;
  box-shadow: inset 2px 2px 0 #4aa84f, inset -2px -2px 0 #19421c;
}
.mc-btn--green:hover:not(:disabled) {
  background: #36873b;
  color: #e8ffe8;
  box-shadow: inset 2px 2px 0 #5cd463, inset -2px -2px 0 #1e5222;
}
.mc-btn--green.is-speaking {
  background: #2f8f35;
  box-shadow:
    inset 2px 2px 0 #6bff72,
    inset -2px -2px 0 #184d1b,
    0 0 0 2px #55ff55;
}

.mc-btn--red {
  background: #762525;
  box-shadow: inset 2px 2px 0 #ad4242, inset -2px -2px 0 #451212;
}
.mc-btn--red:hover:not(:disabled) {
  background: #913030;
  color: #ffe4e4;
  box-shadow: inset 2px 2px 0 #cf5757, inset -2px -2px 0 #571818;
}

.mc-btn--amber {
  background: #785719;
  box-shadow: inset 2px 2px 0 #b88a2e, inset -2px -2px 0 #47320b;
}
.mc-btn--amber:hover:not(:disabled) {
  background: #946c20;
  color: #fff6d1;
  box-shadow: inset 2px 2px 0 #d9a741, inset -2px -2px 0 #59400e;
}

.mc-btn--aqua {
  background: #235d66;
  box-shadow: inset 2px 2px 0 #3f93a1, inset -2px -2px 0 #12363b;
}
.mc-btn--aqua:hover:not(:disabled) {
  background: #2c7480;
  color: #e0ffff;
  box-shadow: inset 2px 2px 0 #55b5c4, inset -2px -2px 0 #18464d;
}

.key-chip {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #dfdfdf;
  font-size: 11px;
  text-shadow: none;
}

/* --- Header Bar --- */

.top-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #1d1d20;
  border-bottom: 2px solid var(--gui-border-outer);
  box-shadow: inset 0 -2px 0 #111113;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mc-green-bg);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #3f8f45, inset -2px -2px 0 #0e2e10;
  color: var(--mc-green);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--text-main);
  text-shadow: var(--shadow-text);
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  text-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.identity-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  min-height: 32px;
  background: var(--gui-slot);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #070708, inset -1px -1px 0 #2e2e32;
}

.player-head-canvas {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  border: 1px solid #000;
  flex-shrink: 0;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  min-height: 32px;
  border: 2px solid #000;
  font-size: 12px;
  text-shadow: var(--shadow-sm);
}

.conn-badge--connected {
  background: var(--mc-green-bg);
  color: var(--mc-green);
}

.conn-badge--connecting {
  background: var(--mc-gold-bg);
  color: var(--mc-gold);
}

.conn-badge--disconnected {
  background: var(--mc-red-bg);
  color: var(--mc-red);
}

.conn-dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border: 1px solid #000;
}

/* --- Notices & Banners --- */

.notice-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 0;
}

.mc-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.14), inset -2px -2px 0 rgba(0, 0, 0, 0.4);
  text-shadow: var(--shadow-sm);
}

.mc-banner--amber {
  background: #47320d;
  color: #ffe39c;
}

.mc-banner--red {
  background: #4e1717;
  color: #ffcccc;
}

.mc-banner--aqua {
  background: #143d42;
  color: #ccfaff;
}

.mc-banner__content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
}

.session-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* --- Hero Mic Dock --- */

.main-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-dock {
  display: grid;
  grid-template-columns: minmax(250px, 1.15fr) minmax(260px, 1.85fr);
  gap: 12px;
  align-items: stretch;
}

.mic-state-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.mic-state-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mic-avatar-box {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #18181b;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #2e2e34, inset -2px -2px 0 #09090a;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mic-avatar-box.state-speaking {
  background: #153c18;
  color: var(--mc-green);
  box-shadow:
    inset 2px 2px 0 #378f3e,
    inset -2px -2px 0 #0b240d,
    0 0 0 2px var(--mc-green);
}

.mic-avatar-box.state-ready {
  background: #1b2f1d;
  color: #b7ffb7;
  box-shadow: inset 2px 2px 0 #37633b, inset -2px -2px 0 #0f1b10;
}

.mic-avatar-box.state-waiting {
  background: #362912;
  color: var(--mc-gold);
  box-shadow: inset 2px 2px 0 #664e20, inset -2px -2px 0 #1c1509;
}

.mic-avatar-box.state-muted,
.mic-avatar-box.state-deafened,
.mic-avatar-box.state-error {
  background: #3c1414;
  color: var(--mc-red);
  box-shadow: inset 2px 2px 0 #6e2626, inset -2px -2px 0 #1f0a0a;
}

.mic-state-title {
  font-size: 16px;
  text-shadow: var(--shadow-text);
  margin: 0;
}

.mic-state-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mic-level-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mic-level-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.meter-track {
  position: relative;
  height: 14px;
  background: var(--gui-well);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #050506, inset -1px -1px 0 #2b2b30;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: #48484e;
  transition: width 0.04s linear;
}

.meter-fill.is-active {
  background: repeating-linear-gradient(
    90deg,
    #45db45 0px,
    #45db45 8px,
    #2fa82f 8px,
    #2fa82f 10px
  );
}

.meter-fill.is-preview {
  background: repeating-linear-gradient(
    90deg,
    #d6941e 0px,
    #d6941e 8px,
    #9e6c13 8px,
    #9e6c13 10px
  );
}

.meter-threshold-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #000;
  pointer-events: none;
  z-index: 2;
}

/* --- Control Buttons Grid --- */

.control-dock {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.primary-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.action-btn {
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px;
  min-height: 68px;
  text-align: left;
}

.action-btn__top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.action-btn__label {
  font-size: 13px;
}

.action-btn__state {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
}

.quick-sliders-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-slider-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: var(--gui-slot);
  border: 2px solid #080809;
}

/* --- Tabs --- */

.mc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid #000;
  padding-bottom: 0;
}

.mc-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #1b1b1d;
  border: 2px solid #000;
  border-bottom: none;
  box-shadow: inset 2px 2px 0 #2e2e32;
  color: var(--text-muted);
  cursor: pointer;
  text-shadow: var(--shadow-sm);
}

.mc-tab:hover {
  color: var(--text-hover);
  background: #2b2b30;
}

.mc-tab.is-active {
  background: var(--gui-panel);
  color: var(--text-main);
  box-shadow: inset 2px 2px 0 #4a4a50, inset -2px 0 0 #0e0e10;
  position: relative;
  top: 2px;
  padding-bottom: 11px;
}

.tab-panel {
  display: none;
  padding: 14px;
  background: var(--gui-panel);
  border: 2px solid #000;
  border-top: none;
  box-shadow: inset 2px 0 0 #343438, inset -2px -2px 0 #0d0d0e;
}

.tab-panel.is-active {
  display: block;
}

/* --- Settings Grid & Controls --- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.section-box {
  background: #171719;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #29292d, inset -2px -2px 0 #0b0b0c;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-box--full {
  grid-column: 1 / -1;
}

.section-title {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 2px solid #2b2b30;
  font-size: 14px;
  color: var(--mc-gold);
  text-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.field-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 12px;
  color: #dddddd;
  text-shadow: var(--shadow-sm);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.field-val {
  font-size: 12px;
  color: var(--mc-aqua);
  text-shadow: var(--shadow-sm);
}

.mc-select,
.mc-input {
  width: 100%;
  padding: 6px 8px;
  min-height: 34px;
  background: #0d0d0f;
  color: var(--text-main);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #050506, inset -1px -1px 0 #3a3a40;
  outline: none;
}

.mc-select:focus,
.mc-input:focus {
  border-color: var(--mc-aqua);
}

.input-with-btn {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.input-with-btn > select,
.input-with-btn > input {
  flex: 1 1 auto;
  min-width: 0;
}

/* Minecraft Slider */

.mc-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  background: #0d0d0f;
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #050506, inset -1px -1px 0 #2e2e33;
  cursor: pointer;
  margin: 2px 0;
}

.mc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 22px;
  background: #77777d;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #b3b3b8, inset -2px -2px 0 #3e3e42;
  cursor: pointer;
}

.mc-range::-webkit-slider-thumb:hover {
  background: #6c83bf;
  box-shadow: inset 2px 2px 0 #9db3eb, inset -2px -2px 0 #384978;
}

.mc-range::-moz-range-thumb {
  width: 14px;
  height: 22px;
  background: #77777d;
  border: 2px solid #000;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 #b3b3b8, inset -2px -2px 0 #3e3e42;
  cursor: pointer;
}

/* Toggle Switch Button */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.toggle-pill {
  min-width: 64px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Speakers & Log --- */

.speakers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speaker-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--gui-slot);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #26262a, inset -1px -1px 0 #070708;
}

.speaker-card.is-speaking {
  border-color: var(--mc-green);
  box-shadow: inset 1px 1px 0 #2a6e2d, inset -1px -1px 0 #0a1f0b;
}

.speaker-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex: 1 1 200px;
}

.speaker-avatar {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  border: 2px solid #000;
  flex-shrink: 0;
}

.speaker-name {
  font-size: 13px;
  color: var(--text-main);
}

.speaker-uuid {
  font-size: 10px;
  color: var(--text-dim);
}

.speaker-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  justify-content: flex-end;
}

.speaker-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 150px;
}

.event-log {
  height: 180px;
  overflow-y: auto;
  padding: 8px 10px;
  background: #0a0a0c;
  border: 2px solid #000;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  word-break: break-word;
}

.log-line--info { color: #d8d8d8; }
.log-line--ok { color: var(--mc-green); }
.log-line--warn { color: var(--mc-gold); }
.log-line--error { color: var(--mc-red); }

/* --- Footer Bar --- */

.status-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: #18181b;
  border-top: 2px solid #000;
  font-size: 12px;
}

#status {
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e2e2;
  flex: 1 1 260px;
}

.codec-badge {
  color: var(--text-muted);
  font-size: 11px;
}

/* =========================================================
   CONFIGURABLE FLOATING OVERLAY (SVC HUD Style)
   ========================================================= */

.voice-overlay {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  min-width: 56px;
  max-width: 320px;
  transform-origin: top left;
  transform: scale(var(--overlay-scale, 1));
  opacity: var(--overlay-opacity, 0.95);
  user-select: none;
  touch-action: none;
  transition: opacity 0.15s linear;
}

.voice-overlay.pos-top-left {
  top: 14px;
  left: 14px;
  transform-origin: top left;
}

.voice-overlay.pos-top-right {
  top: 14px;
  right: 14px;
  transform-origin: top right;
}

.voice-overlay.pos-bottom-left {
  bottom: 14px;
  left: 14px;
  transform-origin: bottom left;
}

.voice-overlay.pos-bottom-right {
  bottom: 14px;
  right: 14px;
  transform-origin: bottom right;
}

.voice-overlay.pos-custom {
  transform-origin: top left;
}

/* Overlay Themes */

.voice-overlay.theme-svc-dark {
  background: rgba(20, 20, 24, 0.92);
  border: 2px solid #000000;
  box-shadow: inset 2px 2px 0 #3f3f46, inset -2px -2px 0 #0a0a0c, 0 6px 18px rgba(0,0,0,0.65);
  color: #ffffff;
}

.voice-overlay.theme-mc-stone {
  background: #3a3a3e;
  border: 2px solid #000000;
  box-shadow: inset 2px 2px 0 #6b6b70, inset -2px -2px 0 #1f1f22, 0 6px 18px rgba(0,0,0,0.65);
  color: #ffffff;
}

.voice-overlay.theme-transparent {
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color: #ffffff;
}

.voice-overlay.theme-high-contrast {
  background: #000000;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px #000000;
  color: #ffffff;
}

.voice-overlay.is-dimmed {
  opacity: calc(var(--overlay-opacity, 0.95) * 0.45);
}

.voice-overlay:hover {
  opacity: var(--overlay-opacity, 0.95);
}

.voice-overlay.is-speaking {
  border-color: var(--mc-green);
}

.overlay-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overlay-icon-wrap {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid #000;
  flex-shrink: 0;
  color: var(--text-muted);
}

.voice-overlay.state-speaking .overlay-icon-wrap {
  background: #174a1b;
  color: var(--mc-green);
  box-shadow: 0 0 0 2px var(--mc-green);
}

.voice-overlay.state-ready .overlay-icon-wrap {
  background: #18301b;
  color: #b7ffb7;
}

.voice-overlay.state-waiting .overlay-icon-wrap {
  background: #3b2d12;
  color: var(--mc-gold);
}

.voice-overlay.state-muted .overlay-icon-wrap,
.voice-overlay.state-deafened .overlay-icon-wrap,
.voice-overlay.state-error .overlay-icon-wrap {
  background: #471414;
  color: var(--mc-red);
}

.overlay-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.overlay-state-line {
  font-size: 13px;
  text-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.overlay-sub-line {
  font-size: 10px;
  color: #c2c2c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s linear;
}

.voice-overlay:hover .overlay-tools,
.voice-overlay:focus-within .overlay-tools {
  opacity: 1;
}

.overlay-drag-handle {
  cursor: grab;
  padding: 2px;
  color: var(--text-muted);
}

.overlay-drag-handle:active {
  cursor: grabbing;
}

.voice-overlay.is-locked .overlay-drag-handle {
  display: none;
}

.overlay-meter {
  height: 6px;
  background: #0a0a0c;
  border: 1px solid #000;
  overflow: hidden;
}

.overlay-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--mc-green);
  transition: width 0.04s linear;
}

.overlay-controls {
  display: flex;
  gap: 6px;
}

.overlay-controls .mc-btn {
  flex: 1;
}

.overlay-speakers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 6px;
}

.overlay-speaker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.overlay-speaker-dot {
  width: 6px;
  height: 6px;
  background: var(--mc-green);
  border: 1px solid #000;
  flex-shrink: 0;
}

.voice-overlay:not(.is-locked) {
  cursor: grab;
}

.voice-overlay:not(.is-locked):active {
  cursor: grabbing;
}

.voice-overlay button,
.voice-overlay input,
.voice-overlay select {
  cursor: pointer;
}

/* Style variants */
.voice-overlay.style-icon {
  padding: 6px;
  min-width: 0;
}

.voice-overlay.style-icon .overlay-text,
.voice-overlay.style-icon .overlay-meter,
.voice-overlay.style-icon .overlay-speakers {
  display: none;
}

.voice-overlay.style-icon .overlay-tools {
  position: absolute;
  top: -28px;
  left: 0;
  background: rgba(20, 20, 24, 0.94);
  border: 2px solid #000;
  padding: 2px 4px;
}

body.pip-window .overlay-tools {
  display: none !important;
}

/* --- Overlay Focus Mode & PiP Window --- */

body.overlay-focus-mode {
  background: #0b0c0e;
  background-image: none;
}

html.obs-transparent,
html.obs-transparent body {
  background: transparent !important;
  background-image: none !important;
}

body.overlay-focus-mode .app-shell {
  display: none;
}

body.overlay-focus-mode .focus-exit-bar {
  display: flex;
}

.focus-exit-bar {
  display: none;
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(20, 20, 24, 0.9);
  border: 2px solid #000;
  opacity: 0.35;
  transition: opacity 0.15s linear;
}

.focus-exit-bar:hover {
  opacity: 1;
}

body.pip-window {
  background: #141418;
  background-image: none;
  padding: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.pip-window .voice-overlay {
  position: static;
  transform: none !important;
  width: 100%;
  max-width: none;
}

.speaker-name-input {
  padding: 2px 6px;
  font-size: 12px;
  background: #0d0d0f;
  border: 2px solid var(--mc-aqua);
  color: #fff;
  width: 140px;
}

.speaker-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.players-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.players-search-wrap {
  flex: 1 1 200px;
  min-width: 180px;
}

.mod-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border: 1px solid #000;
  text-shadow: none;
}

.mod-badge--svc {
  background: #143f47;
  color: var(--mc-aqua);
}

.mod-badge--pv {
  background: #3a1f52;
  color: var(--mc-purple);
}

.mod-badge--dual {
  background: #19451d;
  color: var(--mc-green);
}

.mod-badge--web {
  background: #4f380d;
  color: var(--mc-gold);
}

.mod-badge--none {
  background: #232328;
  color: #8c8c94;
}

.sync-pill {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  border: 1px solid #000;
  text-shadow: none;
}

.sync-pill--ok {
  background: var(--mc-green-bg);
  color: var(--mc-green);
}

.sync-pill--warn {
  background: #333338;
  color: var(--text-muted);
}

.empty-state {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  border: 2px dashed #323238;
  background: #121214;
  font-size: 12px;
}

.pip-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: var(--mc-aqua-bg);
  border: 2px solid #000;
  color: #dffeff;
  font-size: 12px;
}

/* --- Responsive --- */

@media (max-width: 780px) {
  .hero-dock {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .quick-sliders-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 8px 8px 92px;
  }
  .primary-buttons-grid {
    grid-template-columns: 1fr;
  }
}
