:root {
  --bg-primary: #2a2a2e;
  --bg-secondary: #1e1e22;
  --bg-panel: #3a3a40;
  --accent-cyan: #00d4ff;
  --accent-purple: #b347ea;
  --accent-amber: #ff6b35;
  --accent-red: #ff2d55;
  --accent-green: #00e676;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: blur(20px);
  --text-primary: #e8e8e8;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --panel-bg: rgba(60, 60, 68, 0.85);
  --btn-bg: linear-gradient(180deg, #5a5a62 0%, #44444c 100%);
  --btn-border: rgba(255, 255, 255, 0.18);
  --radius: 12px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  background-image:
    radial-gradient(circle at 15% 50%, rgba(0, 212, 255, 0.05), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(179, 71, 234, 0.05), transparent 25%);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ==================== SCREENS ==================== */
.screen {
  display: none;
  position: relative;
  z-index: 10;
  height: 100vh;
  width: 100vw;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: transparent; /* Rely on body or video background */
}
.screen.active {
  display: flex;
  animation: screenFadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

.clip-transition {
  animation: clipSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes clipSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== BUTTONS ==================== */
.chk-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0;
  font-size: 0.75rem;
  color: #aaa;
  cursor: pointer;
}
.chk-container input {
  cursor: pointer;
}

button {
  min-height: 44px;
  padding: 12px 22px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}

@media (hover: hover) {
  button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
  }
}
button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 3px rgba(0,0,0,0.2);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(0,212,255,0.25) 0%, rgba(0,160,200,0.2) 100%);
  border-color: rgba(0,212,255,0.4);
}

.btn-secondary {
  background: var(--btn-bg);
}

.btn-danger {
  border-color: rgba(255,45,85,0.5);
  background: linear-gradient(180deg, rgba(255,45,85,0.2) 0%, rgba(200,30,65,0.15) 100%);
  color: #ff8a9e;
}
@media (hover: hover) {
  .btn-danger:hover {
    box-shadow: 0 4px 12px rgba(255,45,85,0.2);
    border-color: var(--accent-red);
    background: rgba(255,45,85,0.25);
  }
}

.glow-btn {
  animation: subtleGlow 2s infinite alternate;
}
@keyframes subtleGlow {
  from { box-shadow: 0 0 8px rgba(0,212,255,0.15); }
  to { box-shadow: 0 0 16px rgba(0,212,255,0.35); }
}

/* ==================== HEADERS ==================== */
.header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  gap: 16px;
  flex-shrink: 0;
}
.header h2 {
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.panel-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 24px;
}

/* ==================== LANDING ==================== */
#screen-landing {
  position: relative;
  overflow: hidden;
  justify-content: center;
  align-items: flex-start;
  padding-left: 10%;
}
#screen-landing.active {
  display: flex;
  flex-direction: column;
}
#menu-bg-video {
  position: fixed;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  z-index: -10;
  object-fit: cover;
  opacity: 1; /* Fully visible unless overridden */
}
#screen-settings {
  background: rgba(18, 18, 20, 0.95);
  backdrop-filter: blur(10px);
}
.settings-container {
  margin: 60px auto;
  width: 90%;
  max-width: 650px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(30, 30, 36, 0.85);
  border: 1px solid rgba(80, 80, 100, 0.4);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  padding: 40px;
}
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-group label {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-cyan);
}
.settings-group select {
  width: 100%;
  padding: 12px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
}
.settings-group input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  outline: none;
}
.settings-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}
.settings-container h2 {
  font-size: 2rem;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 2px;
}
.settings-group .chk-container {
  justify-content: flex-start;
  margin-top: 10px;
}
.chk-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #fff !important;
  font-weight: 400 !important;
  text-transform: none !important;
  font-size: 1rem !important;
}
.chk-container input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.menu-top-left {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 1.2rem;
  color: #ccc;
  font-family: sans-serif;
  z-index: 10;
}
.menu-top-right {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 0.9rem;
  color: #ccc;
  text-align: right;
  font-family: sans-serif;
  line-height: 1.4;
  z-index: 10;
}
.main-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 10;
  margin-left: 30px; /* Offset from left edge */
}
.btn-glossy {
  width: 280px;
  height: 70px;
  background: linear-gradient(180deg, #2b3238 0%, #171d22 100%);
  border: 2px solid #556270;
  box-shadow: inset 0 2px 10px rgba(255,255,255,0.2), 0 5px 15px rgba(0,0,0,0.8);
  border-radius: 12px;
  color: #fff;
  font-size: 1.4rem;
  font-family: sans-serif;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
}
.btn-glossy:hover {
  filter: brightness(1.2);
  transform: scale(1.02);
}

/* ==================== GRIDS & CARDS ==================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}
.small-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.pack-card {
  display: flex;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.pack-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 20px rgba(0,212,255,0.12);
}
.pack-icon {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.pack-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.pack-title {
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pack-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.pack-badge {
  display: inline-block;
  background: rgba(179,71,234,0.2);
  color: var(--accent-purple);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: bold;
  margin-top: 6px;
  align-self: flex-start;
}
.btn-panel {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  padding: 10px;
}
.btn-panel:hover:not(:disabled):not(.btn-is-disabled) {
  background: rgba(255, 255, 255, 0.2);
}
.btn-panel:disabled, .btn-panel.btn-is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}
.btn-delete-pack {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,45,85,0.15);
  border: 1px solid rgba(255,45,85,0.4);
  color: var(--accent-red);
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.8rem;
}

/* ==================== MANAGE PACKS ==================== */
#screen-manage-packs {
  background: rgba(18, 18, 20, 0.95);
  backdrop-filter: blur(10px);
}
.manage-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 1000px;
  margin: 60px auto;
  width: 90%;
  background: rgba(30, 30, 36, 0.85);
  border: 1px solid rgba(80, 80, 100, 0.4);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
}
.manage-content h3 {
  color: var(--accent-cyan);
  margin-bottom: 15px;
  font-size: 1.2rem;
  letter-spacing: 1px;
}
.installed-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
#upload-zone {
  border: 2px dashed rgba(0,212,255,0.5);
  border-radius: var(--radius);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0,212,255,0.03);
  transition: var(--transition);
  padding: 24px;
  text-align: center;
}
#upload-zone.drag-over {
  border-style: solid;
  background: rgba(0,212,255,0.1);
  box-shadow: 0 0 16px rgba(0,212,255,0.15);
}
#upload-input { display: none; }
.upload-icon { font-size: 2.5rem; }
#upload-progress {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}
#upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  transition: width 0.3s ease;
}

/* ==================== LOBBY ==================== */
#screen-lobby {
  background: var(--bg-primary); /* Ensure it has a dark background covering the video */
}
.lobby-layout {
  display: flex;
  gap: 24px;
  padding: 30px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.flex-1 {
  flex: 1;
}
.lobby-content {
  padding: 20px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.lobby-panel {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lobby-panel h3 {
  color: var(--accent-purple);
  margin-bottom: 4px;
}
.lobby-panel input[type="text"] {
  width: 100%;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.25);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}
.lobby-panel input[type="text"]:focus { border-color: var(--accent-cyan); }
.lobby-panel hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 8px 0;
}
#room-code-display {
  font-size: 3.5rem;
  letter-spacing: 0.2em;
  font-weight: bold;
  text-align: center;
  color: var(--accent-amber);
  text-shadow: 0 0 16px rgba(255,107,53,0.3);
}
#player-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.player-item {
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-host-badge {
  background: var(--accent-amber);
  color: #000;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
}

/* ====================================================
   DUBBING ROOM — THE MAIN GAME SCREEN
   ==================================================== */
.dubbing-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background: #222;
  background-image: repeating-radial-gradient(circle at 50% -50%, #292929, #292929 20px, #202020 20px, #202020 40px);
}

.dubbing-left-panel {
  position: absolute;
  left: 20px;
  top: 0;
  z-index: 40;
  width: 190px;
  flex-shrink: 0;
  background: rgba(30, 30, 30, 0.7);
  border: 3px solid #444;
  border-radius: 16px;
  flex-direction: column;
  gap: 8px;
  padding: 15px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 5px 15px rgba(0,0,0,0.6);
}

/* --- Main Area (video + bottom row) --- */
.dubbing-content-wrapper {
  display: grid;
  grid-template-columns: 1fr minmax(auto, 800px) 1fr;
  grid-template-rows: auto auto;
  gap: 10px 0;
  justify-content: center;
  align-content: center;
  width: 100vw;
  height: 100%;
  padding-bottom: 60px; /* Bring everything up a little */
}

/* --- Video Frame --- */
.video-frame-container {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.video-frame {
  background: #000;
  border-top: 18px solid #777;
  border-left: 18px solid #666;
  border-right: 18px solid #444;
  border-bottom: 18px solid #333;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,1);
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#dub-video, #clip-character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
}

.results-view {
  position: absolute;
  inset: 0;
  background: #0033ff; /* Bright blue */
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  z-index: 200;
  overflow-y: auto;
}
#results-title {
  font-size: 1.8rem;
  font-family: sans-serif;
  margin-bottom: 5px;
  font-weight: normal;
}
#results-score {
  font-size: 2.2rem;
  margin-bottom: 0px;
}
#results-critique {
  font-size: 1.8rem;
  margin-bottom: 15px;
}
#results-list {
  width: 100%;
  max-width: 500px;
}
.result-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  width: 100%;
}
.result-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1px solid #fff;
}
.res-score {
  font-size: 0.9rem;
  white-space: nowrap;
  width: 70px;
  text-align: right;
}
.res-wave {
  flex: 1;
  height: 45px;
  background: #000;
  border: 2px solid #5de4e0;
  border-radius: 6px;
  position: relative;
  display: flex;
}
.res-wave canvas {
  width: 100%;
  height: 100%;
}
.video-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  font-size: 2rem;
  color: white;
}

/* --- Bottom: caption + waveform --- */
.dubbing-lower {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  width: 100%;
  align-items: center;
}

#clip-caption {
  font-size: 1.1rem;
  font-style: italic;
  font-weight: bold;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
  text-shadow: 1px 1px 2px #000;
}

.waveform-frame-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}
.waveform-frame {
  height: 100px;
  flex-shrink: 0;
  border: 4px solid #5de4e0; /* cyan border */
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 10px rgba(93,228,224,0.3);
  position: relative;
  width: 100%; /* max width */
  max-width: 800px; /* same as video */
  transition: width 0.3s;
}
.waveform-frame::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #ff2a2a;
  z-index: 5;
}
.waveform-frame::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 4px;
  background: #ff2a2a;
  z-index: 5;
}
#waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Right Controls Panel --- */
.dubbing-panel-wrapper {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Multiplayer-only layout: keep side panels fixed and center video/caption/waveform stack. */
#screen-dubbing.multiplayer-mode .dubbing-panel-wrapper {
  position: absolute;
  right: 0;
  top: 0;
  padding-right: 20px;
  z-index: 40;
}
.dubbing-panel {
  width: 190px;
  flex-shrink: 0;
  background: rgba(30, 30, 30, 0.7);
  border: 3px solid #444;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  padding: 15px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 5px 15px rgba(0,0,0,0.6);
}

.panel-header-label {
  color: white;
  text-align: center;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-shadow: 1px 1px 2px #000;
}

.panel-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-panel-styled {
  background: linear-gradient(to bottom, #dff6f6, #addede);
  border: 1px solid #444;
  border-radius: 8px;
  color: #222;
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 10px 8px;
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  width: 100%;
  transition: all 0.1s;
}
.btn-panel-styled:active:not(:disabled):not(.btn-is-disabled) {
  background: linear-gradient(to bottom, #addede, #dff6f6);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
  transform: translateY(1px);
}
.btn-panel-styled:disabled, .btn-panel-styled.btn-is-disabled {
  background: linear-gradient(to bottom, #888, #555);
  color: #bbb;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.5);
  cursor: not-allowed;
}
.btn-styled-primary {
  background: linear-gradient(to bottom, #b4ece9, #6cd9d6);
}
.btn-styled-small {
  padding: 6px 8px;
  font-size: 0.85rem;
}
.btn-panel-styled.recording {
  background: linear-gradient(180deg, rgba(255,45,85,0.8) 0%, rgba(200,30,65,0.6) 100%);
  color: #fff;
  border-color: #ff2d55;
  animation: pulse-red 1.5s infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: inset 0 2px 3px rgba(255,255,255,0.4), 0 0 0 0 rgba(255,45,85,0.4); }
  50% { box-shadow: inset 0 2px 3px rgba(255,255,255,0.4), 0 0 12px 4px rgba(255,45,85,0.3); }
}

/* Pill buttons for Exit / Options */
.pill-btn {
  background: linear-gradient(to bottom, #f0f0f0, #999);
  border: 2px solid #fff;
  border-radius: 25px;
  padding: 6px 20px;
  color: #222;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.6), inset 0 -2px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.pill-btn:hover {
  background: linear-gradient(to bottom, #fff, #aaa);
}
.bottom-corner-btn-left {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 50;
}
.bottom-corner-btn-right {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 50;
}

#recording-status {
  text-align: center;
  font-size: 0.8rem;
  color: #00ff00;
  min-height: 20px;
  margin-top: 5px;
}

/* ==================== CINEMA MODE ==================== */
#screen-cinema {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: none;
  flex-direction: column;
}
#screen-cinema.active { display: flex; }

.cinema-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}
.cinema-header h2 {
  color: var(--accent-cyan);
  letter-spacing: 4px;
  text-shadow: 0 0 10px var(--accent-cyan);
  animation: blink 2s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cinema-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cinema-video {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
}
#cinema-speaker {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(1.2rem, 3.5vw, 2.2rem);
  color: #fff;
  text-shadow: 2px 2px 4px #000, 0 0 16px var(--accent-purple);
  text-align: center;
  width: 80%;
  pointer-events: none;
  font-style: italic;
}

/* ==================== RESULTS ==================== */
#screen-results {
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1a1025, var(--bg-primary));
}
.results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  max-width: 550px;
  width: 90%;
  padding: 36px;
}
#result-percentage {
  font-size: clamp(2.5rem, 10vw, 7rem);
  font-weight: bold;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
#result-stars {
  font-size: 2.8rem;
  color: rgba(255,255,255,0.15);
  display: flex;
  gap: 6px;
}
.star { display: inline-block; }
.star-filled {
  color: #ffd700;
  text-shadow: 0 0 16px rgba(255,215,0,0.4);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
#result-critique {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.25);
  padding: 16px;
  border-radius: 8px;
  border-left: 3px solid var(--accent-purple);
}
.results-buttons {
  display: flex;
  gap: 14px;
  margin-top: 16px;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  padding: 28px;
  border-radius: var(--radius);
  max-width: 380px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ==================== TOASTS ==================== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  padding: 14px 20px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast-info { border-left: 3px solid var(--accent-cyan); }
.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error { border-left: 3px solid var(--accent-red); }
.toast-exit { animation: slideOut 0.3s ease-in forwards; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* ==================== RESPONSIVE ==================== */

/* Tablets and smaller */
@media (max-width: 900px) {
  .dubbing-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .dubbing-main {
    flex: none;
  }
  .video-frame {
    height: 40vh;
    flex: none;
  }
  .dubbing-lower {
    padding: 4px;
  }
  .dubbing-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
  }
  #clip-counter {
    width: 100%;
  }
  .panel-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .btn-panel {
    width: auto;
    flex: 1 1 45%;
    min-width: 120px;
  }
  .btn-quit {
    margin-top: 0;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .video-frame {
    height: 30vh;
    margin: 4px;
  }
  .dubbing-lower {
    padding: 4px;
  }
  .dubbing-panel {
    padding: 8px;
  }
  .btn-panel {
    flex: 1 1 100%;
    min-width: 0;
  }
  .landing-buttons button {
    font-size: 1rem;
    min-height: 50px;
  }
  .game-title {
    letter-spacing: 0.1em;
  }
}

#main-menu-logo {
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  max-width: 45vw;
  max-height: 80vh;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 30px rgba(0, 0, 0, 0.7));
}
