:root {
  --bg: #05090c;
  --ink: #e9f6fa;
  --dim: #8aa3ad;
  --surface: rgba(8, 19, 25, 0.82);
  --surface-2: rgba(12, 28, 36, 0.9);
  --line: rgba(120, 175, 190, 0.16);
  --accent: #35c2d6;
  --good: #35d07f;
  --warn: #f2c94c;
  --bad: #ff6b6b;
  --off: #7d97a3;
  --blue: #7aa7ff;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.26) 100%),
    linear-gradient(180deg, rgba(2, 7, 10, 0.4), transparent 18%, transparent 78%, rgba(2, 7, 10, 0.55));
}

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(4, 11, 15, 0.92), rgba(4, 11, 15, 0.55));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 20;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #35c2d6, #1d7280);
  color: #041115;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px rgba(53, 194, 214, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: 0.4px;
}

.brand-text span {
  font-size: 11px;
  color: var(--dim);
  margin-top: 3px;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
}

.dim {
  color: var(--dim);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid var(--line);
  background: rgba(12, 28, 36, 0.7);
  color: var(--dim);
}

.chip.small {
  padding: 3px 8px;
  font-size: 10px;
}

.chip.phase {
  color: var(--accent);
  border-color: rgba(53, 194, 214, 0.35);
  background: rgba(53, 194, 214, 0.1);
}

.chip.sim {
  color: var(--warn);
  border-color: rgba(242, 201, 76, 0.35);
  background: rgba(242, 201, 76, 0.08);
}

.chip.live {
  color: var(--good);
  border-color: rgba(53, 208, 127, 0.4);
  background: rgba(53, 208, 127, 0.09);
}

.chip.disconnected {
  color: var(--bad);
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
}

.ghost-btn,
.primary-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: rgba(15, 33, 41, 0.72);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.ghost-btn:hover,
.icon-btn:hover {
  background: rgba(35, 65, 78, 0.82);
  border-color: rgba(53, 194, 214, 0.4);
}

.ghost-btn.active {
  color: var(--accent);
  border-color: rgba(53, 194, 214, 0.45);
  background: rgba(53, 194, 214, 0.12);
}

.ghost-btn:active,
.primary-btn:active,
.icon-btn:active {
  transform: translateY(1px);
}

.primary-btn {
  background: linear-gradient(145deg, rgba(53, 194, 214, 0.92), rgba(24, 118, 134, 0.92));
  color: #041115;
  font-weight: 700;
  border-color: rgba(53, 194, 214, 0.5);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.panel {
  position: absolute;
  z-index: 12;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

#left-panel {
  left: 16px;
  top: 82px;
  width: 310px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 4px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 175, 190, 0.28) transparent;
}

#right-panel {
  right: 16px;
  top: 82px;
  width: 318px;
  max-height: calc(100vh - 356px);
  overflow-y: auto;
  padding: 4px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 175, 190, 0.28) transparent;
}

.panel-block {
  padding: 10px 15px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-block:last-child {
  border-bottom: 0;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.block-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(222, 242, 247, 0.88);
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 10px var(--good);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kpi {
  border: 1px solid rgba(120, 175, 190, 0.12);
  border-radius: 9px;
  padding: 9px 10px;
  background: rgba(5, 14, 18, 0.5);
}

.kpi .k-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.4px;
}

.kpi .k-value {
  margin-top: 5px;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi .k-value small {
  font-size: 10px;
  font-weight: 400;
  color: var(--dim);
  margin-left: 3px;
}

.kpi.accent .k-value {
  color: var(--accent);
}
.kpi.good .k-value {
  color: var(--good);
}
.kpi.warn .k-value {
  color: var(--warn);
}

.agenda-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agenda-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 11px;
  color: rgba(214, 233, 239, 0.72);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}

.agenda-list li:hover {
  background: rgba(53, 194, 214, 0.06);
}

.agenda-list li.active {
  background: rgba(53, 194, 214, 0.1);
  border-color: rgba(53, 194, 214, 0.24);
  color: var(--ink);
}

.agenda-list .idx {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 10px;
  color: var(--accent);
  width: 18px;
  flex: 0 0 18px;
  padding-top: 1px;
}

.agenda-list li.done .idx {
  color: var(--good);
}

.motion-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

.motion-desc {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.55;
  color: var(--dim);
}

.vote-bars {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vote-row {
  display: grid;
  grid-template-columns: 34px 1fr 26px;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--dim);
}

.vote-row .bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.vote-row .bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  width: 0%;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.vote-row.yes .bar i {
  background: var(--good);
}
.vote-row.no .bar i {
  background: var(--bad);
}
.vote-row.abstain .bar i {
  background: var(--off);
}

.vote-row .num {
  text-align: right;
  color: var(--ink);
  font-family: "SF Mono", Menlo, monospace;
}

.motion-actions {
  margin-top: 11px;
  display: flex;
  gap: 7px;
}

.motion-actions button {
  flex: 1;
  font-size: 11px;
}

.legend {
  margin-top: 9px;
  display: flex;
  gap: 12px;
  font-size: 9px;
  color: var(--dim);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.good {
  background: var(--good);
}
.dot.bad {
  background: var(--bad);
}
.dot.off {
  background: var(--off);
}

.env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.env-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(5, 14, 18, 0.36);
  font-size: 10px;
  color: var(--dim);
}

.env-item b {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

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

.seat-chip {
  position: relative;
  border: 1px solid rgba(120, 175, 190, 0.14);
  border-radius: 8px;
  padding: 7px 6px 6px;
  background: rgba(5, 14, 18, 0.46);
  cursor: pointer;
  transition: all 0.16s ease;
  overflow: hidden;
}

.seat-chip:hover {
  border-color: rgba(53, 194, 214, 0.4);
  background: rgba(24, 55, 66, 0.6);
}

.seat-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(53, 194, 214, 0.3), 0 0 18px rgba(53, 194, 214, 0.18);
}

.seat-chip.chair {
  border-color: rgba(201, 163, 91, 0.38);
}

.seat-chip .s-id {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 8px;
  color: var(--dim);
  letter-spacing: 0.3px;
}

.seat-chip .s-name {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-chip .s-state {
  margin-top: 3px;
  font-size: 8px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--off);
}

.seat-chip[data-status="present"]::before {
  background: var(--good);
}
.seat-chip[data-status="absent"]::before {
  background: #4b5a63;
}
.seat-chip[data-status="request"]::before {
  background: var(--warn);
}
.seat-chip[data-status="speaking"]::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.seat-chip[data-status="voted"]::before {
  background: var(--blue);
}
.seat-chip[data-status="muted"]::before {
  background: #ff9d5c;
}
.seat-chip[data-status="stale"]::before {
  background: var(--bad);
}

.detail-card.hidden {
  display: none;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #051014;
  background: linear-gradient(145deg, #35c2d6, #1a6b78);
  flex: 0 0 42px;
}

.detail-name {
  font-size: 14px;
  font-weight: 700;
}

.detail-sub {
  margin-top: 3px;
  font-size: 10px;
  color: var(--dim);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.tag {
  font-size: 9px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
}

.tag.good {
  color: var(--good);
  border-color: rgba(53, 208, 127, 0.3);
}
.tag.warn {
  color: var(--warn);
  border-color: rgba(242, 201, 76, 0.3);
}
.tag.bad {
  color: var(--bad);
  border-color: rgba(255, 107, 107, 0.3);
}
.tag.accent {
  color: var(--accent);
  border-color: rgba(53, 194, 214, 0.3);
}

.rename-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.rename-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(4, 12, 16, 0.7);
  border-radius: 7px;
  color: var(--ink);
  font-size: 11px;
  padding: 7px 8px;
  outline: none;
}

.rename-row input:focus {
  border-color: rgba(53, 194, 214, 0.45);
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.detail-actions button {
  font-size: 10px;
  padding: 7px 6px;
}

.vote-actions {
  grid-template-columns: repeat(3, 1fr);
}

.vote-btn {
  border: 1px solid var(--line);
  background: rgba(15, 33, 41, 0.72);
  color: var(--ink);
  border-radius: 7px;
  padding: 8px 4px;
  font-size: 10px;
  cursor: pointer;
}

.vote-btn.yes {
  border-color: rgba(53, 208, 127, 0.32);
  color: var(--good);
}
.vote-btn.no {
  border-color: rgba(255, 107, 107, 0.32);
  color: var(--bad);
}
.vote-btn.abstain {
  border-color: rgba(126, 151, 163, 0.32);
  color: var(--off);
}

.vote-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.detail-foot {
  margin-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
  color: var(--dim);
}

.detail-foot label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.screen-controls {
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 999px;
}

.screen-controls .screen-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
  line-height: 1.2;
}

.screen-controls .screen-label span {
  font-size: 8px;
  letter-spacing: 0.5px;
}

.screen-controls .screen-label strong {
  font-size: 11px;
  font-family: "SF Mono", Menlo, monospace;
}

.screen-controls .divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.screen-controls .ghost-btn {
  font-size: 10px;
  padding: 6px 9px;
  border-radius: 999px;
}

.cctv-panel {
  right: 16px;
  bottom: 58px;
  width: 282px;
  padding: 8px;
  border-radius: 11px;
}

.cctv-head {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--dim);
  margin-bottom: 6px;
}

.cctv-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.cctv-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.cctv-labels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  pointer-events: none;
}

.cctv-labels span {
  align-self: start;
  justify-self: start;
  margin: 4px;
  font-size: 7px;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(220, 240, 245, 0.8);
  letter-spacing: 0.4px;
}

.camera-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(8, 19, 25, 0.75);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.cam-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.cam-btn:hover {
  color: var(--ink);
  background: rgba(53, 194, 214, 0.08);
}

.cam-btn.active {
  color: #041115;
  background: var(--accent);
  font-weight: 700;
}

.statusbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 15;
  display: flex;
  gap: 1px;
  padding: 0 1px;
  background: rgba(0, 0, 0, 0.4);
}

.statusbar span {
  flex: 1;
  cursor: pointer;
  background: #4b5a63;
  opacity: 0.75;
  transition: opacity 0.16s ease;
}

.statusbar span:hover {
  opacity: 1;
}

.statusbar span[data-status="present"] {
  background: var(--good);
}
.statusbar span[data-status="absent"] {
  background: #4b5a63;
}
.statusbar span[data-status="request"] {
  background: var(--warn);
}
.statusbar span[data-status="speaking"] {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.statusbar span[data-status="voted"] {
  background: var(--blue);
}
.statusbar span[data-status="muted"] {
  background: #ff9d5c;
}
.statusbar span[data-status="stale"] {
  background: var(--bad);
}

.toast {
  position: absolute;
  left: 50%;
  top: 84px;
  transform: translate(-50%, -8px);
  z-index: 40;
  padding: 9px 16px;
  border-radius: 9px;
  background: rgba(8, 22, 28, 0.95);
  border: 1px solid rgba(53, 194, 214, 0.35);
  color: var(--ink);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.bad {
  border-color: rgba(255, 107, 107, 0.45);
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(14, 32, 41, 0.92), rgba(3, 8, 11, 0.98));
  transition: opacity 0.5s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.loading-mark {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(53, 194, 214, 0.4);
}

.loading-card strong {
  font-size: 15px;
  font-weight: 600;
}

.loading-card span {
  font-size: 11px;
}

@media (max-width: 1180px) {
  #left-panel {
    width: 268px;
  }
  #right-panel {
    width: 272px;
    max-height: calc(100vh - 174px);
  }
  .seat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .cctv-panel {
    display: none;
  }
  #screen-controls {
    bottom: 58px;
  }
}

@media (max-width: 860px) {
  #right-panel {
    display: none;
  }
  #left-panel {
    width: 238px;
  }
  .brand-text strong {
    font-size: 13px;
  }
  .top-status .mono:first-of-type {
    display: none;
  }
  .camera-bar {
    max-width: calc(100vw - 32px);
    overflow-x: auto;
  }
}
