/* Production app 화면 (landing/join/room) */

/* ---- 화면 라우팅 ---- */
body[data-screen="loading"] .screen[data-screen="loading"],
body[data-screen="landing"] .screen[data-screen="landing"],
body[data-screen="join"] .screen[data-screen="join"],
body[data-screen="room"] .screen[data-screen="room"] {
  display: flex;
  animation: screen-fade-in 0.18s ease-out;
}
.screen { display: none; }
@keyframes screen-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---- Landing & Join & Loading ---- */
.screen[data-screen="landing"],
.screen[data-screen="join"],
.screen[data-screen="loading"] {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---- Loading splash ---- */
.loading-card {
  align-items: center;
  text-align: center;
}
.brand-pulse {
  font-size: 38px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  animation: brand-pulse 2.6s ease-in-out infinite;
}
@keyframes brand-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 18px 0 10px;
}
.dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.18s; }
.dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40%          { opacity: 1;    transform: scale(1.05); }
}
.loading-status {
  margin-top: 2px;
  opacity: 0.7;
  font-size: 14px;
  min-height: 1.2em;
  transition: opacity 0.25s ease-out;
}
.card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card h1 {
  font-size: 38px;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 4px;
}
.tagline {
  color: var(--subtle);
  text-align: center;
  margin-bottom: 28px;
  font-size: 14px;
}
.btn-primary, .btn-secondary {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s, background 0.15s;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: #e8e8e8; }
.btn-primary.danger { background: var(--danger); color: #fff; }
.btn-primary.danger:hover { background: #b62828; }
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #222; }

#code-input {
  width: 100%;
  padding: 16px;
  font-size: 26px;
  text-align: center;
  letter-spacing: 6px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  text-transform: uppercase;
}
#code-input:focus {
  outline: none;
  border-color: #555;
}

/* ---- Room ---- */
.screen[data-screen="room"] {
  min-height: 100vh;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}
.room-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-right: 130px; /* profile-chip 영역 회피 */
}
.room-header > .participant-count { margin-right: auto; }
.code-pill {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 8px 14px;
  background: var(--card);
  border-radius: 10px;
  cursor: pointer;
  user-select: all;
}
.code-pill:hover { background: #222; }
.participant-count {
  color: var(--subtle);
  font-size: 14px;
}
.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--subtle);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tv-chip:hover { background: #222; }
.tv-chip[data-active="true"] {
  background: #2d5a2d;
  color: #fff;
  border-color: #46a046;
}
.tv-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.video-area {
  flex: 1;
  background: var(--card-2);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  position: relative;
}
.video-area video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.empty-state {
  text-align: center;
  color: var(--hint);
  padding: 28px;
}
.empty-state .icon {
  font-size: 48px;
  opacity: 0.5;
  margin-bottom: 8px;
}
.empty-state .sub {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
}
.room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Profile chip ---- */
.profile-chip {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 50;
  font-family: inherit;
}
.profile-chip:hover { background: #222; }

/* ---- Overlay sheet ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 16px 24px 24px;
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sheet-title {
  color: var(--subtle);
  font-size: 12px;
  margin-bottom: 8px;
}
.sheet .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sheet .big-name {
  flex: 1;
  font-size: 22px;
  font-weight: 600;
}
.sheet #profile-name {
  flex: 1;
  background: #222;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
}
.btn-link {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 8px;
}
.btn-link:hover { color: #fff; }
.btn-link.subtle { color: var(--hint); }
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.sheet-btn {
  width: 100%;
  background: #222;
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-bottom: 6px;
}
.sheet-btn:hover { background: #2a2a2a; }
.help {
  color: var(--hint);
  font-size: 11px;
  margin-top: 8px;
  line-height: 1.5;
}

/* ---- Admin link (landing) ---- */
.admin-link {
  text-align: center;
  margin-top: 6px;
  text-decoration: none;
  font-size: 13px;
  color: var(--subtle);
}
.admin-link:hover { color: var(--text); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
