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

:root {
  --primary: #000000;
  --primary-light: #333333;
  --accent: #7C3AED;
  --accent-light: #EDE9FE;
  --bg: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --card: #FFFFFF;
  --card-border: #E5E7EB;
  --text: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --yellow: #F59E0B;
  --yellow-dark: #D97706;
  --yellow-light: #FEF3C7;
  --blue: #3B82F6;
  --dark: #111827;
  --darker: #000000;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}
.header-nav a.active { color: var(--primary); font-weight: 700; background: var(--bg-tertiary); }
.header-nav a:hover { color: var(--primary); background: var(--bg-tertiary); }

.status-badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  transition: all 0.3s;
}

.status-badge.live {
  background: var(--danger);
  color: white;
  animation: pulse-badge 2s infinite;
}

.status-badge.connecting {
  background: var(--yellow);
  color: var(--dark);
}

.status-badge.stopped {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #FECACA;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Main layout */
main {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 60px);
}

/* Stream container */
.stream-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-wrapper {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16/9;
  flex: 1;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  color: #999;
  transition: opacity 0.3s;
}

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

.overlay-icon { font-size: 48px; margin-bottom: 12px; }

.live-indicator {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--danger);
  color: white;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 6px;
}

.live-indicator.visible { display: flex; }

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.viewer-count {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0,0,0,0.6);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: white;
  display: none;
}

.viewer-count.visible { display: block; }

/* Controls */
.controls {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-go-live {
  background: var(--primary);
  color: white;
  flex: 1;
  justify-content: center;
  font-size: 17px;
  border-radius: 12px;
}

.btn-go-live:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-go-live.streaming {
  background: var(--danger);
  color: white;
}

.btn-go-live.streaming:hover:not(:disabled) {
  background: #DC2626;
}

.btn-mute, .btn-camera {
  background: var(--bg-tertiary);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-mute:hover:not(:disabled), .btn-camera:hover:not(:disabled) {
  background: var(--card-border);
}

.btn-mute.active, .btn-camera.active {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.item-showcase, .chat-panel, .stream-info {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--card-border);
}

.item-card {
  text-align: center;
  padding: 24px;
  border: 2px dashed var(--card-border);
  border-radius: 12px;
}

.item-placeholder { color: var(--text-muted); font-size: 14px; }
.item-hint { color: var(--text-light); font-size: 12px; margin-top: 8px; }

/* Chat */
.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 200px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-tertiary);
}

.chat-msg.system { color: var(--text-muted); font-style: italic; }
.chat-msg .user { color: var(--primary); font-weight: 600; }

/* Stream info */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-tertiary);
  font-size: 13px;
}

.info-row span:first-child { color: var(--text-muted); }

/* Violation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.modal-overlay.visible { display: flex; }

.modal {
  background: var(--card);
  border: 2px solid var(--danger);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}

.modal-icon { font-size: 56px; margin-bottom: 16px; }

.modal h2 {
  color: var(--danger);
  font-size: 24px;
  margin-bottom: 12px;
}

.modal-message {
  font-size: 16px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.modal-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn-appeal {
  background: var(--primary);
  color: white;
  width: 100%;
  justify-content: center;
  font-size: 16px;
  padding: 14px;
  border-radius: 12px;
}

.btn-appeal:hover { background: var(--primary-light); }

.modal-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.modal-link:hover { text-decoration: underline; }

.modal-footer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Test Configuration Card */
.test-config {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--card-border);
  position: relative;
  transition: opacity 0.3s;
}

.test-config.locked #intervalPills {
  opacity: 0.4;
  pointer-events: none;
}

.test-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.test-config-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.config-lock {
  font-size: 11px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 3px 8px;
  border-radius: 10px;
  display: none;
}

.test-config.locked .config-lock { display: inline; }

.config-section { margin-bottom: 12px; }

.config-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  font-weight: 600;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pill {
  padding: 6px 12px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
}

.pill:hover { border-color: var(--primary); color: var(--text); }

.pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.pill.switching { opacity: 0.4; pointer-events: none; }

.interval-note {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
  font-style: italic;
}

.config-estimate {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.config-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 10px;
  border-top: 1px solid var(--bg-tertiary);
}

.config-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.config-links a:hover { color: var(--primary); }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1100;
  transition: transform 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.toast.visible { transform: translateX(-50%) translateY(0); }

/* Auction Panel */
.auction-panel {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--card-border);
}

.auction-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.auction-input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 13px;
}

.auction-input::placeholder { color: var(--text-light); }
.auction-input:focus { outline: none; border-color: var(--primary); }

.btn-auction-start {
  width: 100%;
  background: var(--primary);
  color: white;
  justify-content: center;
  margin-bottom: 6px;
  border-radius: 12px;
}

.btn-auction-start:hover:not(:disabled) { background: var(--primary-light); }

.auction-hint {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  font-style: italic;
}

.hidden { display: none !important; }

.auction-live-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.auction-item-name { font-weight: 600; font-size: 14px; }
.auction-item-price { color: var(--primary); font-weight: 700; }

.auction-timer {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--danger);
  padding: 8px 0;
  font-variant-numeric: tabular-nums;
}

.auction-actions {
  display: flex;
  gap: 8px;
}

.btn-sold {
  flex: 1;
  background: var(--success);
  color: white;
  justify-content: center;
  font-weight: 700;
  border-radius: 12px;
}

.btn-sold:hover { filter: brightness(1.1); }

.btn-cancel-auction {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 10px 16px;
  border: 1px solid var(--card-border);
}

.btn-cancel-auction:hover { background: var(--card-border); color: var(--text); }

.auction-history {
  margin-top: 10px;
  max-height: 120px;
  overflow-y: auto;
}

.auction-history-row {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.auction-history-row.sold { color: var(--success); }
.auction-history-row.cancelled { color: var(--text-muted); }
.auction-history-row.voided { color: var(--danger); text-decoration: line-through; }
