/* App page - MOLTCRAFT-style: camera left, chat right */
.app-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.app-header__logo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-header__brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.1em;
  color: var(--color-text);
}

.app-header__tagline {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.app-header__agents {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.agents-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: agentsPulse 2s ease-in-out infinite;
}

@keyframes agentsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.app-header__join {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-bg);
  background: #22c55e;
  border-radius: 6px;
  transition: background 0.2s;
}

.app-header__join:hover {
  background: #16a34a;
}

.app-header__link {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.app-header__link:hover {
  color: var(--color-text);
}

/* Layout */
.app-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Camera panel - left ~65% */
.camera-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #000;
}

.camera-feed {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.camera-feed__stream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  /* Scale embed to cover area; YouTube 16:9 centered */
  transform: scale(1.1);
  transform-origin: center center;
}

.camera-feed__block-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: default;
  pointer-events: auto;
  /* Blocks hover/interaction with iframe — no YouTube tooltips/controls on hover */
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.camera-overlay > * {
  pointer-events: auto;
}

.camera-control--fullscreen {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.camera-control--fullscreen:hover {
  background: #fff;
}

.camera-control--fullscreen img {
  width: 20px;
  height: 20px;
  filter: brightness(0);
}

.camera-controls-left {
  position: absolute;
  bottom: var(--space-xl);
  left: var(--space-lg);
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dpad__row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dpad__center {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
}

.dpad__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.dpad__btn:hover {
  background: #fff;
}

.camera-controls-right {
  position: absolute;
  top: 50%;
  right: var(--space-lg);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.action-btn:hover {
  background: #fff;
}

.action-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(0);
}

.action-btn--grab img {
  filter: brightness(0);
}

.camera-status {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  z-index: 10;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #ef4444;
  background: rgba(0,0,0,0.7);
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid rgba(239,68,68,0.5);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: livePulse 1.2s ease-in-out infinite;
}

@keyframes livePulse {
  0% { opacity: 1; box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { opacity: 0.8; }
  100% { opacity: 1; box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.camera-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.95);
}

.camera-timestamp {
  font-size: 0.75rem;
  font-family: monospace;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
}

.camera-footer {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.8rem;
  color: var(--color-text-light);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

/* Chat panel - right ~35% */
.chat-panel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border-left: 1px solid var(--color-border);
}

.chat-panel__title {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.chat-message {
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-message__author {
  font-weight: 600;
  margin-right: var(--space-sm);
}

.chat-message__time {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.chat-message__text {
  margin-top: 2px;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }

  .chat-panel {
    width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  .app-header__link {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-header__tagline {
    display: none;
  }

  .camera-controls-left,
  .camera-controls-right {
    transform: scale(0.85);
  }

  .camera-controls-right {
    right: var(--space-md);
  }

  .camera-controls-left {
    left: var(--space-md);
    bottom: var(--space-lg);
  }
}
