/* 더 래버린스 — 공통 스타일 (모바일 우선) */

:root {
  --lab-bg: #f6f3ec;          /* 크림 배경 */
  --lab-fg: #2a2a28;          /* 진한 텍스트 */
  --lab-muted: #6b6960;
  --lab-accent: #7a8450;      /* 올리브 */
  --lab-accent-soft: #c8cea8;
  --lab-purple: #9b6bb0;
  --lab-mom: #e89055;
  --lab-bot: #7070a0;
  --lab-stone: #8a8579;       /* 돌문 회색 */
  --lab-mist: rgba(180, 180, 200, 0.25);
  --lab-success: #5a9d6f;
  --lab-error: #c97373;
  --lab-r: 18px;
  --lab-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --lab-shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.18);
  --lab-trans: all 0.3s ease;
}

[data-theme="dark"] {
  --lab-bg: #1a1c1f;
  --lab-fg: #e8e6df;
  --lab-muted: #9a988f;
  --lab-accent: #a3ad7a;
  --lab-accent-soft: #4a5238;
  --lab-stone: #5a5650;
  --lab-mist: rgba(80, 80, 100, 0.35);
  --lab-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --lab-shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ===== 베이스 ===== */
.lab-page {
  margin: 0;
  padding: 0;
  background: var(--lab-bg);
  color: var(--lab-fg);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  overflow-x: hidden;
}

.lab-page * { box-sizing: border-box; }

.lab-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 20px 100px;
  position: relative;
}

/* ===== 헤더 ===== */
.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
  font-size: 14px;
  color: var(--lab-muted);
}

.lab-header a {
  color: var(--lab-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: var(--lab-trans);
  user-select: none;
}

.lab-header a:active { background: var(--lab-mist); }

.lab-room-num {
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--lab-accent);
}

.lab-theme-toggle {
  background: none;
  border: 1px solid var(--lab-mist);
  color: var(--lab-fg);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.lab-me-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--lab-accent);
  color: white;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.lab-me-badge.offline {
  background: var(--lab-error);
  color: white;
  font-size: 11px;
}

/* ===== 방 카드 ===== */
.lab-room {
  background: var(--lab-bg);
  padding: 8px 0;
}

.lab-title {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 6px;
  color: var(--lab-fg);
  letter-spacing: -0.01em;
}

.lab-subtitle {
  font-size: 14px;
  color: var(--lab-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.lab-recommended {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--lab-accent-soft);
  color: var(--lab-fg);
  border-radius: 999px;
  margin-bottom: 16px;
}

.lab-gate-card {
  background: rgba(201, 115, 115, 0.12);
  border: 1px solid rgba(201, 115, 115, 0.3);
  padding: 16px;
  border-radius: var(--lab-r);
  margin: 16px 0;
  text-align: center;
}
.lab-gate-msg { font-size: 15px; line-height: 1.6; color: var(--lab-fg); }
.lab-gate-msg small { color: var(--lab-muted); font-size: 12px; }

[data-theme="dark"] .lab-recommended {
  background: var(--lab-accent-soft);
  color: var(--lab-bg);
}

/* ===== 후추봇 말풍선 ===== */
.lab-narrator {
  position: relative;
  background: var(--lab-bot);
  color: white;
  padding: 14px 16px;
  border-radius: 18px;
  margin: 16px 0;
  font-size: 15px;
  line-height: 1.55;
  box-shadow: var(--lab-shadow);
  animation: labFadeUp 0.4s ease;
}

.lab-narrator::before {
  content: '🦎';
  position: absolute;
  left: -8px;
  top: -10px;
  background: var(--lab-bg);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--lab-shadow);
  font-size: 16px;
}

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

/* ===== 입력/버튼 ===== */
.lab-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--lab-mist);
  border-radius: 12px;
  background: var(--lab-bg);
  color: var(--lab-fg);
  outline: none;
  transition: var(--lab-trans);
  font-family: inherit;
  -webkit-user-select: text;
  user-select: text;
}

.lab-input:focus { border-color: var(--lab-accent); }

.lab-btn {
  display: inline-block;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  background: var(--lab-accent);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--lab-trans);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.lab-btn:active { transform: scale(0.96); }

.lab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lab-btn-ghost {
  background: transparent;
  color: var(--lab-fg);
  border: 1px solid var(--lab-mist);
}

.lab-btn-row {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

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

/* ===== 진행도 바 ===== */
.lab-progress {
  display: flex;
  gap: 6px;
  margin: 16px 0;
}

.lab-progress-dot {
  flex: 1;
  height: 6px;
  background: var(--lab-mist);
  border-radius: 999px;
  transition: var(--lab-trans);
}

.lab-progress-dot.solved { background: var(--lab-accent); }
.lab-progress-dot.current { background: var(--lab-purple); }

/* ===== 토스트 ===== */
.lab-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--lab-fg);
  color: var(--lab-bg);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 9999;
  animation: labToastIn 0.3s ease, labToastOut 0.3s ease 2.5s forwards;
  box-shadow: var(--lab-shadow-deep);
  max-width: 90%;
  text-align: center;
}

@keyframes labToastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes labToastOut {
  to { opacity: 0; transform: translate(-50%, -10px); }
}

.lab-toast.success { background: var(--lab-success); color: white; }
.lab-toast.error   { background: var(--lab-error); color: white; }

/* ===== 모달 (방 넘기기) ===== */
.lab-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: labFadeIn 0.2s ease;
}

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

.lab-modal {
  background: var(--lab-bg);
  color: var(--lab-fg);
  border-radius: var(--lab-r);
  padding: 24px 20px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--lab-shadow-deep);
}

.lab-modal h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.lab-member-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lab-member-btn {
  flex: 1;
  padding: 14px 8px;
  font-size: 15px;
  background: var(--lab-mist);
  color: var(--lab-fg);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--lab-trans);
  font-family: inherit;
}

.lab-member-btn:active { transform: scale(0.95); }
.lab-member-btn:hover  { background: var(--lab-accent-soft); }

/* ===== 통과 애니메이션 ===== */
.lab-clear-overlay {
  position: fixed;
  inset: 0;
  background: var(--lab-bg);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  padding: 40px;
  text-align: center;
  animation: labFadeIn 0.5s ease;
}

.lab-clear-icon {
  font-size: 64px;
  animation: labClearPulse 1.2s ease infinite;
}

@keyframes labClearPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.lab-clear-msg {
  font-size: 18px;
  line-height: 1.6;
  max-width: 360px;
  color: var(--lab-fg);
}

/* ===== 잠금 화면 ===== */
.lab-locked {
  text-align: center;
  padding: 60px 20px;
  color: var(--lab-muted);
}

.lab-locked-icon { font-size: 48px; margin-bottom: 16px; }

/* ===== 유틸 ===== */
.lab-hidden { display: none !important; }
.lab-center { text-align: center; }
.lab-mt { margin-top: 16px; }
.lab-mt-lg { margin-top: 32px; }

/* ===== 모바일 안전 영역 ===== */
@supports (padding: max(0px)) {
  .lab-container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(100px, env(safe-area-inset-bottom));
  }
}
