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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --border: #1e1e2e;
  --text: #e0e0e8;
  --muted: #6b6b80;
  --accent: #4f8cff;
  --accent-glow: rgba(79, 140, 255, 0.15);
  --danger: #ff4f4f;
  --success: #4fff8c;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.code-display {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  padding: 1.5rem;
  background: var(--accent-glow);
  border-radius: var(--radius);
  margin: 1rem 0;
  user-select: all;
}

.code-input {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.code-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-align: center;
  font-family: 'SF Mono', 'Fira Code', monospace;
  outline: none;
  transition: border-color 0.2s;
}

.code-input input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: #fff;
}

.btn-primary {
  background: var(--accent);
}

.btn-primary:hover {
  background: #3a7aff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #e63e3e;
}

.btn-success {
  background: #2a9d5c;
}

.btn-success:hover {
  background: #238b4f;
}

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

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  width: 100%;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin: 1rem 0;
}

.status-waiting {
  background: rgba(255, 165, 0, 0.1);
  color: orange;
  border: 1px solid rgba(255, 165, 0, 0.2);
}

.status-connected {
  background: rgba(79, 255, 140, 0.1);
  color: var(--success);
  border: 1px solid rgba(79, 255, 140, 0.2);
}

.status-error {
  background: rgba(255, 79, 79, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 79, 79, 0.2);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

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

.video-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  margin: 1rem 0;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.video-controls .btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
}

.video-controls .btn:hover {
  background: rgba(255,255,255,0.25);
}

.chat-panel {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.chat-messages {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.chat-msg {
  padding: 0.4rem 0;
  font-size: 0.85rem;
}

.chat-msg .role {
  font-weight: 600;
  color: var(--accent);
}

.chat-msg .role.sharer {
  color: var(--success);
}

.chat-input {
  display: flex;
  gap: 0.5rem;
}

.chat-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.chat-input input:focus {
  border-color: var(--accent);
}

.fullscreen-active .video-wrap {
  position: fixed;
  inset: 0;
  z-index: 1000;
  border-radius: 0;
  aspect-ratio: unset;
}

.timer {
  font-family: 'SF Mono', monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.mode-toggle .btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.mode-toggle .btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.control-notice {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  padding: 0.5rem;
}

@media (max-width: 600px) {
  .container { padding: 1rem; }
  .code-display { font-size: 2rem; letter-spacing: 0.3em; }
  h1 { font-size: 1.2rem; }
}
