:root {
  --ps-red: #C8102E;
  --ps-red-dark: #9B0D22;
  --bg: #0A0A0A;
  --surface: #141414;
  --text: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-muted: #666;
  --success: #22C55E;
  --error: #EF4444;
  --warning: #F59E0B;
  --border: #2A2A2A;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.projection-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

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

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

.ps-logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
}

.header-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-clock {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.projection-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
}

.hidden { display: none !important; }

.mode-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 40px;
}

.mode-intro {
  text-align: center;
  animation: fadeIn 1s ease;
}

.intro-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
}

.intro-title {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.intro-subtitle {
  font-size: 28px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 24px;
}

.intro-details {
  font-size: 18px;
  color: var(--text-muted);
}

.intro-sep { margin: 0 12px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.mode-quorum {
  text-align: center;
  width: 100%;
  max-width: 800px;
}

.quorum-display {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.quorum-circle {
  position: relative;
  width: 280px;
  height: 280px;
}

.quorum-circle svg {
  width: 100%;
  height: 100%;
}

.quorum-circle circle {
  transition: stroke-dashoffset 1s ease;
}

.quorum-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.quorum-value {
  font-size: 64px;
  font-weight: 900;
}

.quorum-status {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.quorum-status.reached { color: var(--success); }
.quorum-status.not-reached { color: var(--error); }

.quorum-details {
  display: flex;
  justify-content: center;
  gap: 60px;
}

.quorum-detail { text-align: center; }

.qd-value {
  display: block;
  font-size: 48px;
  font-weight: 800;
}

.qd-label {
  display: block;
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 4px;
}

.mode-voting {
  text-align: center;
  width: 100%;
  max-width: 900px;
}

.voting-motion {
  margin-bottom: 48px;
}

.vm-code {
  font-size: 28px;
  font-weight: 800;
  color: var(--ps-red);
  margin-bottom: 12px;
}

.vm-title {
  font-size: 48px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 12px;
}

.vm-proposer {
  font-size: 20px;
  color: var(--text-secondary);
}

.voting-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(34, 197, 94, 0.15);
  border: 2px solid var(--success);
  border-radius: 12px;
  font-size: 24px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: 2px;
}

.pulse-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
  animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.voting-countdown {
  margin-top: 24px;
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  text-align: center;
  min-height: 60px;
}

.mode-live-results {
  width: 100%;
  max-width: 900px;
}

.live-motion-info {
  text-align: center;
  margin-bottom: 40px;
}

.lm-code {
  font-size: 22px;
  font-weight: 800;
  color: var(--ps-red);
  margin-right: 16px;
}

.lm-title {
  font-size: 28px;
  font-weight: 700;
}

.live-bars {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.live-bar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lb-label {
  width: 140px;
  font-size: 22px;
  font-weight: 600;
  text-align: right;
}

.lb-track {
  flex: 1;
  height: 56px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lb-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 16px;
  font-weight: 800;
  font-size: 20px;
  color: white;
  min-width: 0;
}

.lb-fill.favor { background: var(--success); }
.lb-fill.contra { background: var(--error); }
.lb-fill.abstencao { background: var(--warning); }

.lb-value {
  width: 60px;
  font-size: 28px;
  font-weight: 800;
  text-align: right;
}

.live-total {
  text-align: center;
  margin-top: 32px;
  font-size: 20px;
  color: var(--text-secondary);
}

.live-total strong {
  color: var(--text);
  font-size: 24px;
}

.mode-final-results {
  width: 100%;
  max-width: 1000px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

.final-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.final-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.final-result-card:hover {
  border-color: var(--ps-red);
  background: rgba(200, 16, 46, 0.05);
}

.fr-code {
  font-size: 16px;
  font-weight: 800;
  color: var(--ps-red);
  margin-bottom: 4px;
}

.fr-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.fr-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.fr-bar-seg {
  transition: width 0.6s ease;
  min-width: 0;
}

.fr-bar-seg.favor { background: var(--success); }
.fr-bar-seg.contra { background: var(--error); }
.fr-bar-seg.abstencao { background: var(--warning); }

.fr-legend {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.fr-legend span { display: flex; align-items: center; gap: 6px; }

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

.fr-dot.favor { background: var(--success); }
.fr-dot.contra { background: var(--error); }
.fr-dot.abstencao { background: var(--warning); }

.fr-approved {
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  display: inline-block;
}

.fr-approved.yes { background: rgba(34,197,94,0.15); color: var(--success); }
.fr-approved.no { background: rgba(239,68,68,0.15); color: var(--error); }

.mode-message {
  text-align: center;
  width: 100%;
  max-width: 900px;
}

.message-content p {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.4;
}

.message-content.info p { color: var(--text); }
.message-content.warning p { color: var(--warning); }
.message-content.success p { color: var(--success); }
.message-content.error p { color: var(--error); }

.projection-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 40px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.audio-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.audio-btn.activate { border-color: var(--ps-red); color: var(--ps-red); animation: pulseGlow 2s infinite; }
.audio-btn.active { border-color: var(--success); color: var(--success); background: rgba(34,197,94,0.1); }
.audio-btn.test { border-color: #007AFF; color: #007AFF; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,16,46,0.4); }
  50% { box-shadow: 0 0 8px 2px rgba(200,16,46,0.3); }
}

.audio-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
}

.audio-status.active { color: var(--success); background: rgba(34,197,94,0.1); }
.audio-status.inactive { color: var(--text-muted); }

.countdown-warning {
  color: var(--warning) !important;
  animation: countdownPulse 1s ease-in-out infinite;
}

.countdown-critical {
  color: var(--error) !important;
  animation: countdownPulse 0.5s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(239,68,68,0.5);
}

@keyframes countdownPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}

.mode-credentialing,
.mode-debate,
.mode-pause,
.mode-resumed {
  text-align: center;
  width: 100%;
  max-width: 700px;
  animation: fadeIn 0.6s ease;
}

.state-icon-wrapper {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
}

.state-icon-wrapper.credentialing { background: rgba(88,86,214,0.15); color: #5856D6; }
.state-icon-wrapper.debate { background: rgba(0,122,255,0.15); color: #007AFF; }
.state-icon-wrapper.pause { background: rgba(255,149,0,0.15); color: #FF9500; }
.state-icon-wrapper.resumed { background: rgba(34,197,94,0.15); color: #22C55E; }

.state-title {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.state-subtitle {
  font-size: 22px;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.5;
}

.fullscreen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 100;
  opacity: 0.5;
}

.fullscreen-btn:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.fullscreen-btn svg { width: 24px; height: 24px; }

.vm-title,
.lm-title,
.fr-title {
  cursor: pointer;
  transition: color 0.2s;
}

.vm-title:hover,
.lm-title:hover,
.fr-title:hover {
  color: var(--ps-red);
}

.vm-title::after,
.lm-title::after {
  content: ' ▸';
  font-size: 0.6em;
  color: var(--text-muted);
  vertical-align: middle;
  transition: color 0.2s;
}

.vm-title:hover::after,
.lm-title:hover::after {
  color: var(--ps-red);
}

.motion-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.3s ease;
}

.motion-overlay.hidden { display: none !important; }

.motion-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.motion-overlay-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: overlaySlideUp 0.35s ease;
}

.motion-overlay-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  z-index: 1;
}

.motion-overlay-close:hover { color: var(--text); }

.motion-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 32px 0;
}

.motion-overlay-code {
  font-size: 20px;
  font-weight: 800;
  color: var(--ps-red);
}

.motion-overlay-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 6px;
}

.motion-overlay-title {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.2;
  padding: 12px 32px 0;
  letter-spacing: -0.5px;
}

.motion-overlay-proposer {
  font-size: 16px;
  color: var(--text-secondary);
  padding: 6px 32px 20px;
  border-bottom: 1px solid var(--border);
}

.motion-overlay-body {
  padding: 24px 32px 32px;
  overflow-y: auto;
  flex: 1;
}

.motion-overlay-section {
  margin-bottom: 24px;
}

.motion-overlay-section:last-child { margin-bottom: 0; }

.motion-overlay-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ps-red);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.motion-overlay-section p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.motion-overlay-section ul,
.motion-overlay-section ol {
  padding-left: 24px;
}

.motion-overlay-section li {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.motion-overlay-section li::marker {
  color: var(--ps-red);
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlaySlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1024px) {
  .intro-title { font-size: 40px; }
  .intro-subtitle { font-size: 22px; }
  .vm-title { font-size: 36px; }
  .quorum-value { font-size: 48px; }
  .qd-value { font-size: 36px; }
  .final-results-grid { grid-template-columns: 1fr; }
  .motion-overlay-title { font-size: 24px; }
  .motion-overlay-section p { font-size: 16px; }
  .motion-overlay-section li { font-size: 15px; }
}
