/* ============================================
   Vistream Recorder — Modern Premium Design
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  /* Deep dark palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(24, 34, 56, 0.8);
  --bg-card-border: rgba(255, 255, 255, 0.06);
  --bg-card-border-hover: rgba(255, 255, 255, 0.12);

  /* Text colors */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand accents */
  --accent-blue: #3fa9f5;
  --accent-light-blue: #b2dffc;
  --accent-red: #ef1c24;
  --accent-gradient: linear-gradient(135deg, #3fa9f5 0%, #1d8ce0 100%);
  --accent-gradient-hover: linear-gradient(135deg, #1d8ce0 0%, #0d6fc4 100%);

  /* Status */
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.35);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---------- Animated Background ---------- */
.bg-mesh {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(63, 169, 245, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(239, 28, 36, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(178, 223, 252, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.bg-orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-blue);
  top: -200px;
  right: -150px;
  animation: float-orb-1 20s ease-in-out infinite;
}

.bg-orb-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-red);
  bottom: -100px;
  left: -100px;
  animation: float-orb-2 25s ease-in-out infinite;
}

.bg-orb-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-light-blue);
  top: 50%;
  left: 50%;
  animation: float-orb-3 18s ease-in-out infinite;
}

@keyframes float-orb-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-80px, 60px) scale(1.1); }
  66% { transform: translate(40px, -40px) scale(0.9); }
}

@keyframes float-orb-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -80px) scale(1.15); }
}

@keyframes float-orb-3 {
  0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.08; }
  50% { transform: translate(-40%, -60%) scale(1.2); opacity: 0.15; }
}

/* ---------- App Container ---------- */
#app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ---------- Header ---------- */
header {
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: rgba(10, 14, 26, 0.75);
  margin: 0 calc(-1 * var(--space-lg));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  border-bottom: 1px solid var(--bg-card-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal);
}

.logo-icon:hover {
  transform: scale(1.1);
}

.logo h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-email-display {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 12px;
  height: 32px;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  border: 1px solid var(--bg-card-border);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px rgba(63, 169, 245, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  box-shadow: 0 4px 24px rgba(63, 169, 245, 0.4);
  transform: translateY(-1px);
}

.btn-record {
  background: var(--accent-gradient);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  box-shadow: 0 2px 16px rgba(63, 169, 245, 0.25);
  letter-spacing: 0.01em;
}

.btn-record:hover:not(:disabled) {
  box-shadow: 0 4px 24px rgba(63, 169, 245, 0.45);
  transform: translateY(-1px);
}

.btn-record.recording {
  background: var(--danger);
  box-shadow: 0 2px 20px var(--danger-glow);
  animation: pulse-danger 2s ease-in-out infinite;
}

.btn-record.recording:hover:not(:disabled) {
  box-shadow: 0 4px 28px var(--danger-glow);
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 2px 20px var(--danger-glow); }
  50% { box-shadow: 0 6px 36px var(--danger-glow); }
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--bg-card-border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--bg-card-border-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
  padding: 14px 20px;
}

.btn-download-action {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-download-action:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.35);
}

/* ---------- Hero Input Section ---------- */
.hero-section {
  margin-top: var(--space-xl);
  animation: slideUp 0.6s var(--ease-out) both;
}

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

.hero-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: border-color var(--transition-normal);
}

.hero-card:hover {
  border-color: var(--bg-card-border-hover);
}

.hero-card-glow {
  position: absolute;
  top: -2px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 0 0 100% 100%;
  filter: blur(1px);
  opacity: 0.6;
}

.hero-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(63, 169, 245, 0.08);
  color: var(--accent-blue);
  flex-shrink: 0;
  border: 1px solid rgba(63, 169, 245, 0.12);
}

.hero-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-wrapper {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

textarea {
  flex: 1;
  min-height: 56px;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

textarea:focus {
  border-color: rgba(63, 169, 245, 0.4);
  box-shadow: 0 0 0 3px rgba(63, 169, 245, 0.08);
}

.btn-load {
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  padding: 0 24px;
}

/* ---------- Player Section ---------- */
.player-section {
  margin-top: var(--space-lg);
  animation: slideUp 0.6s var(--ease-out) 0.1s both;
}

.player-wrapper {
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--bg-card-border);
  background: #000;
  box-shadow: var(--shadow-lg);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.player-wrapper:hover {
  border-color: var(--bg-card-border-hover);
}

.player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
}

.player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-xl);
  background: rgba(10, 14, 26, 0.6);
}

.placeholder-icon {
  opacity: 0.15;
  margin-bottom: var(--space-sm);
}

.player-placeholder p {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.player-placeholder span {
  font-size: 0.78rem;
  max-width: 380px;
  opacity: 0.7;
}

/* ---------- Integrated Controls Panel ---------- */
.controls-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  gap: var(--space-md);
}

.controls-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 140px;
}

.recording-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition-fast);
}

.rec-dot.active {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

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

.timer {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  min-width: 75px;
}

.file-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.controls-center {
  flex-shrink: 0;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 100px;
  justify-content: flex-end;
}

.quality-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quality-select-wrapper label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(148,163,184,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

select:focus {
  border-color: var(--accent-blue);
}

select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- History Section ---------- */
.history-section {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  animation: slideUp 0.6s var(--ease-out) 0.2s both;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-header h2 svg {
  color: var(--accent-blue);
  opacity: 0.7;
}

.recordings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  gap: var(--space-sm);
}

.empty-state svg {
  opacity: 0.15;
}

.empty-state p {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state span {
  font-size: 0.78rem;
  max-width: 340px;
  opacity: 0.7;
}

/* Recording Item */
.recording-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  animation: fadeInSlide 0.4s var(--ease-out) both;
}

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

.recording-item:hover {
  border-color: var(--bg-card-border-hover);
  background: var(--bg-card-hover);
}

.recording-thumbnail {
  width: 100px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.recording-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recording-thumbnail .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity var(--transition-fast);
  cursor: pointer;
}

.recording-thumbnail:hover .play-overlay {
  opacity: 1;
}

.recording-info {
  flex: 1;
  min-width: 0;
}

.recording-info .rec-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.recording-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.recording-meta span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ---------- How-To Section ---------- */
.howto-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-3xl);
  animation: slideUp 0.6s var(--ease-out) 0.3s both;
}

.howto-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.howto-step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(63, 169, 245, 0.1);
  color: var(--accent-blue);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(63, 169, 245, 0.15);
}

.howto-step p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.howto-divider {
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

/* ---------- Notifications ---------- */
.notifications {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: all;
  animation: notifIn 0.4s var(--ease-out) both;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
}

.notification.removing {
  animation: notifOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes notifIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes notifOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

.notification.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.notification.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.notification.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.notification.info {
  background: rgba(63, 169, 245, 0.1);
  border-color: rgba(63, 169, 245, 0.2);
  color: var(--accent-light-blue);
}

.notification svg {
  flex-shrink: 0;
}

/* ---------- Mini Controls (Floating) ---------- */
.mini-controls {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(10, 14, 26, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-full);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7), 0 0 20px var(--danger-glow);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-slow);
}

.mini-controls.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.mini-controls .timer {
  font-size: 0.85rem;
}

/* ---------- Video Preview Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.2s ease both;
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  animation: modalIn 0.3s var(--ease-out) both;
  box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content video {
  width: 100%;
  display: block;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--bg-card-border);
}

.modal-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* ---------- Recording Indicator Overlay ---------- */
.recording-overlay {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 12px;
  background: rgba(239, 68, 68, 0.85);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 10;
  pointer-events: none;
  animation: fadeIn 0.3s ease both;
}

.recording-overlay .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ---------- Countdown Overlay ---------- */
.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  font-size: 8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(63, 169, 245, 0.5);
  pointer-events: none;
}

.countdown-number {
  animation: countPop 1s var(--ease-spring) infinite;
}

@keyframes countPop {
  0% { opacity: 0; transform: scale(0.3); }
  30% { opacity: 1; transform: scale(1.15); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}

/* ---------- Fullscreen Countdown ---------- */
#playerContainer:fullscreen .countdown-overlay {
  font-size: 16rem;
  background: rgba(0, 0, 0, 0.92);
}

/* ---------- Performance during recording ---------- */
body.recording-active .bg-orb {
  display: none !important;
  animation: none !important;
}

body.recording-active #playerContainer,
body.recording-active #playerContainer iframe {
  cursor: none !important;
}

/* ---------- Login Screen ---------- */
.login-screen-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: var(--space-xl) 0;
  animation: fadeIn 0.5s var(--ease-out) both;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
  position: relative;
}

.login-logo-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(63, 169, 245, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-logo-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.login-logo h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.login-logo p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.login-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.form-group label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.92rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.form-group input:focus {
  border-color: rgba(63, 169, 245, 0.45);
  box-shadow: 0 0 0 3px rgba(63, 169, 245, 0.08);
  background: rgba(0, 0, 0, 0.45);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: var(--space-xs);
  opacity: 0.8;
}

.btn-group-row {
  display: flex;
  gap: var(--space-md);
}

.btn-group-row .btn {
  flex: 1;
}

.login-step {
  animation: fadeIn 0.3s var(--ease-out) both;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  #app {
    padding: 0 var(--space-md);
  }

  header {
    margin: 0 calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .controls-panel {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
  }

  .controls-left,
  .controls-right {
    min-width: auto;
    width: 100%;
    justify-content: center;
  }

  .controls-center {
    width: 100%;
  }

  .btn-record {
    width: 100%;
  }

  .recording-item {
    flex-direction: column;
    align-items: stretch;
  }

  .recording-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }

  .recording-actions {
    justify-content: flex-end;
  }

  .hero-card {
    padding: var(--space-lg);
  }

  .input-wrapper {
    flex-direction: column;
  }

  .btn-load {
    width: 100%;
    height: auto;
    padding: 12px 20px;
  }

  .notifications {
    left: var(--space-md);
    right: var(--space-md);
  }

  .notification {
    max-width: none;
  }

  .howto-steps {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .howto-divider {
    display: none;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 0.95rem;
  }

  .tagline {
    display: none;
  }

  .user-email-display {
    display: none !important;
  }

  .recording-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(63, 169, 245, 0.25);
  color: white;
}
