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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a0f;
  color: #fff;
  user-select: none;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#css3d-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

.hero {
  text-align: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcbff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.hero .subtitle {
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  margin-bottom: 1.8rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 560px;
}

.source-row {
  display: flex;
  gap: 0.5rem;
}

.source-row select {
  flex: 0 0 160px;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.source-row select:focus {
  border-color: rgba(255,255,255,0.3);
}

.source-row select option {
  background: #1a1a2e;
  color: #fff;
}

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

.input-row input {
  flex: 1;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: rgba(255,255,255,0.3);
}

.input-row input::placeholder {
  color: rgba(255,255,255,0.3);
}

.input-row button {
  padding: 0.9rem 1.8rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.input-row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(238,90,36,0.3);
}

.input-row button:active {
  transform: translateY(0);
}

.input-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#error-msg {
  min-height: 1.3rem;
  font-size: 0.85rem;
  color: #ff6b6b;
}

/* ---- Feature Panel ---- */
#feature-panel {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  background: rgba(10,10,20,0.75);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  min-width: 210px;
  pointer-events: auto;
}

#feature-panel h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 0.8rem;
  font-weight: 600;
}

#feature-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#feature-panel li {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#feature-panel li .check {
  color: #4ade80;
  font-weight: 700;
  flex-shrink: 0;
}

#feature-panel li .cross {
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

#feature-panel li.coming-soon {
  color: rgba(255,255,255,0.3);
}

#feature-panel li.coming-soon .badge {
  font-size: 0.6rem;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 6px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Theater Screen (CSS3D content) ---- */
.theater-screen {
  width: 960px;
  height: 540px;
  border-radius: 16px;
  overflow: hidden;
  pointer-events: auto;
  background: #000;
}

.theater-screen iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.theater-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.theater-screen .movie-poster {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0a0f;
}

.theater-screen .movie-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.5rem 1.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  pointer-events: none;
}

.theater-screen .movie-info h2 {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

.theater-screen .movie-info p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}

.theater-screen .movie-info .trailer-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  pointer-events: auto;
  transition: transform 0.15s;
}

.theater-screen .movie-info .trailer-btn:hover {
  transform: scale(1.05);
}

.theater-screen .fallback-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  gap: 0.5rem;
}

.theater-screen .fallback-msg .icon {
  font-size: 2rem;
  opacity: 0.4;
}

/* ---- Status indicator ---- */
#status-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
  transition: opacity 0.4s;
  opacity: 0;
}

#status-bar.visible {
  opacity: 1;
}

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  #feature-panel {
    right: 12px;
    padding: 0.9rem 1rem;
    min-width: 160px;
  }

  #feature-panel h3 {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
  }

  #feature-panel li {
    font-size: 0.72rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .source-row select {
    flex: 0 0 130px;
    font-size: 0.8rem;
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .hero .subtitle {
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
  }

  .controls {
    max-width: 100%;
    padding: 0 1rem;
  }

  .source-row {
    flex-direction: row;
  }

  .source-row select {
    flex: 1;
  }

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

  .input-row button {
    padding: 0.8rem;
  }

  #feature-panel {
    right: 8px;
    top: auto;
    bottom: 80px;
    transform: none;
    padding: 0.7rem 0.8rem;
    min-width: 140px;
    border-radius: 12px;
  }

  #feature-panel li {
    font-size: 0.65rem;
    gap: 0.3rem;
  }

  #feature-panel li .badge {
    font-size: 0.5rem;
    padding: 0 4px;
  }

  .theater-screen {
    width: 90vw;
    height: calc(90vw * 9 / 16);
  }
}

@media (max-width: 400px) {
  #feature-panel {
    display: none;
  }

  .hero h1 {
    font-size: 1.5rem;
  }
}
