:root {
  --bg: #f8fafc; /* Slate 50 - 화사하고 세련된 초연한 그레이 */
  --surface: #ffffff;
  --panel: #ffffff;
  --primary: #0f172a; /* Slate 900 - 깊고 신뢰 가득한 네이비 블랙 */
  --primary-hover: #1e293b;
  --teal: #0f766e; /* Teal 700 - 고급스러운 청록색 브랜드 악센트 */
  --teal-light: #f0fdfa;
  --line: #e2e8f0; /* Slate 200 - 초미세 분할 경계선 */
  --muted: #64748b; /* Slate 500 - 보조 및 설명 텍스트 */
  --ink: #0f172a;
  --success: #10b981; /* Emerald 500 - 안정 및 보안 인증 성공 */
  --success-light: #ecfdf5;
  --danger: #ef4444; /* Red 500 - 에러, 끄기, 거절 */
  --danger-light: #fef2f2;
  --shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  background-color: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
}

main {
  position: relative;
  z-index: 1;
  width: min(100%, 780px); /* 채팅방 폭을 컴팩트하고 정갈하게 제한 */
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* 1. HSK CONNECT CONTAINER */
.hsk-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

/* 2. HEADER */
.hsk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  gap: 12px;
}

.hsk-header .header-logo {
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: -0.01em;
  color: var(--primary);
  cursor: pointer;
}

.hsk-header .logo-area {
  display: flex;
  align-items: center;
  font-weight: bold;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.95rem;
}

.hsk-header .back-arrow {
  margin-right: 6px;
}

.hsk-header .header-nav {
  display: flex;
  gap: 6px;
}

.nav-link {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: none;
}

.nav-link:hover, .nav-link.active {
  background: var(--teal-light);
  color: var(--teal);
}

.security-badge-clickable, .status-badge-clickable {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.security-badge-clickable {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.status-badge-clickable {
  background: var(--teal-light);
  color: var(--teal);
}

.status-dot {
  display: inline-block;
  margin-right: 4px;
  font-size: 0.75rem;
}

.status-dot.green {
  color: var(--success);
}

/* 3. CONNECT HOME CARD (첫 접속 바로연결) */
.connect-home-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 24px;
  text-align: center;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  background: var(--teal-light);
  color: var(--teal);
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(15, 118, 110, 0.15);
}

.connect-home-card h1 {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--primary);
  line-height: 1.1;
}

.subtitle-text {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.btn-create-room {
  background: var(--primary);
  color: var(--surface);
  font-size: 0.98rem;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.btn-create-room:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.or-divider {
  width: 100%;
  text-align: center;
  border-bottom: 1px solid var(--line);
  line-height: 0.1em;
  margin: 14px 0;
}

.or-divider span {
  background: var(--surface);
  padding: 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.join-box {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.join-box input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  text-align: center;
  font-weight: 700;
  background: var(--bg);
  color: var(--primary);
  letter-spacing: 1px;
}

.btn-join {
  background: var(--teal);
  color: var(--surface);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-join:hover {
  opacity: 0.95;
}

.bottom-bullets {
  font-size: 0.88rem;
  color: var(--primary);
  line-height: 1.4;
  font-weight: 600;
  margin-top: 12px;
}

.powered-by-text {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 16px;
}

/* 4. READY PANEL (방 생성 대기화면) */
.ready-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 20px;
  text-align: center;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ready-eyebrow {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

.room-code-display {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.invite-options {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 340px;
}

.btn-invite {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-invite:hover {
  background: var(--line);
}

.qr-container {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
  background: white;
  margin: 4px 0;
  animation: fadeIn 0.2s ease-out;
}

.qr-container img {
  width: 140px;
  height: 140px;
}

.qr-container p {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
}

.waiting-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--teal);
  font-weight: 700;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  background-color: var(--teal);
  border-radius: 50%;
  animation: beaconPulse 1.4s infinite ease-in-out;
}

.ready-footer-text {
  font-size: 0.78rem;
  color: var(--muted);
}

/* 5. LANDING TAB VIEW STYLE */
.landing-hero {
  text-align: center;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.landing-hero h2 {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.landing-hero .lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.5;
}

.features-grid, .tech-spec-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.feature-card, .tech-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.feature-card h3, .tech-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.feature-card p, .tech-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* PRICING TAB */
.pricing-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
}

.pricing-card.premium {
  border-color: #3b82f6;
  background: linear-gradient(to bottom, #ffffff, #f0f7ff);
}

.pricing-card.pro {
  border-color: var(--teal);
  background: linear-gradient(to bottom, #ffffff, var(--teal-light));
}

.pricing-card.current {
  border-width: 2px;
}

.plan-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 999px;
  color: var(--muted);
}

.plan-badge.plus {
  background: #eff6ff;
  color: #1d4ed8;
}

.plan-badge.pro {
  background: var(--teal-light);
  color: var(--teal);
}

.pricing-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.pricing-card .price {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--primary);
}

.pricing-card .price span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
}

.plan-desc {
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}

.plan-features {
  list-style: none;
  font-size: 0.8rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.plan-features li {
  color: var(--primary);
  text-align: left;
}

.current-plan-indicator {
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--success);
  margin-top: auto;
}

.btn-plan-select, .btn-checkout-plus, .btn-checkout-pro {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: auto;
}

.btn-plan-select {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--line);
}

.btn-checkout-plus {
  background: #2563eb;
  color: white;
}

.btn-checkout-pro {
  background: var(--teal);
  color: white;
}

/* 6. INTEGRATED CONVERSATION CHAT TIMELINE */
main.in-room {
  height: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.hsk-container.in-room {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.conversation-timeline {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  height: 520px;
  min-height: 380px;
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
  scroll-behavior: auto;
}

.empty-timeline {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
}

.empty-icon {
  font-size: 2.2rem;
  background: var(--teal-light);
  color: var(--teal);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 118, 110, 0.1);
}

.empty-timeline h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.empty-timeline p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Messages & File Bubbles inside Timeline */
.bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.bubble-wrapper.me {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble-wrapper.peer {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.bubble-body {
  background: var(--bg);
  color: var(--primary);
  padding: 10px 14px;
  font-size: 0.92rem;
  border-radius: 18px;
  line-height: 1.4;
  word-break: break-word;
}

.bubble-wrapper.me .bubble-body {
  background: var(--primary);
  color: var(--surface);
}

/* File Bubble Styles */
.file-bubble {
  width: 100%;
  max-width: 340px;
}

.file-card-body {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble-wrapper.me .file-card-body {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.file-info-header {
  display: flex;
  gap: 10px;
  align-items: center;
}

.file-icon {
  font-size: 1.5rem;
}

.file-name-size {
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.file-name-text {
  font-size: 0.85rem;
  color: var(--primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.file-size-text {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Progress bar inside file card */
.file-progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
  transition: width 0.1s ease-out;
}

.bubble-wrapper.me .progress-bar-fill {
  background: var(--primary);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
}

.file-complete-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.file-notice {
  font-size: 0.68rem;
  color: #059669;
  font-weight: 600;
  text-align: left;
  line-height: 1.2;
}

.download-location-hint {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.room-security-box {
  width: 100%;
  max-width: 440px;
  margin: 0 auto 18px;
  padding: 14px;
  border: 1px solid #ccfbf1;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 100%);
  text-align: left;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.08);
}

.room-security-title {
  color: #0f766e;
  font-size: 0.9rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.room-security-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.room-security-box label {
  color: #334155;
  font-size: 0.76rem;
  font-weight: 800;
}

.room-security-box input[type="text"] {
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.18em;
}

.room-security-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.room-security-box p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.room-security-live {
  max-width: 720px;
  margin: 8px auto 10px;
  padding: 10px 12px;
  border: 1px solid #ccfbf1;
  border-radius: 14px;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.08);
}

.room-security-live b {
  display: block;
  margin-bottom: 3px;
}

.room-security-live.waiting {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.room-security-live.alert {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.join-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(154, 52, 18, 0.18);
}

.join-request-row button {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: #0f766e;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}

.join-request-row button + button {
  background: #dc2626;
}

.btn-download-link {
  text-decoration: none;
}

.btn-download {
  background: var(--teal);
  color: white;
  border: none;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: none;
  white-space: nowrap;
}

/* 7. BOTTOM CHAT INPUT BAR */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: var(--shadow);
}

.btn-input-plus {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--line);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.1s;
}

.btn-input-plus:hover {
  background: var(--line);
}

#integratedMessageInput {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 4px;
  font-size: 0.95rem;
  color: var(--primary);
  outline: none;
}

.btn-input-mic {
  background: transparent;
  color: var(--muted);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.1s;
}

.btn-input-mic.active {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-input-mic:not(.active):hover {
  background: var(--bg);
}

.btn-input-send {
  background: var(--teal);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: bold;
  cursor: pointer;
}

.btn-input-send:hover {
  opacity: 0.95;
}

/* 8. VOICE CALL FLOATING BAR */
.call-floating-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  gap: 12px;
  animation: slideDown 0.25s ease-out;
}

.call-floating-bar.calling {
  border-color: #93c5fd;
  background: #f8fafc;
}

.call-floating-bar.ringing {
  border-color: #fca5a5;
  background: #fff5f5;
}

.call-floating-bar.connected {
  border-color: #86efac;
  background: #f0fdf4;
}

.call-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--primary);
}

.pulse-call-indicator {
  width: 8px;
  height: 8px;
  background-color: #3b82f6;
  border-radius: 50%;
  animation: beaconPulse 1.2s infinite ease-in-out;
}

.incoming-pulse {
  font-size: 1.1rem;
  animation: ringShake 0.6s infinite ease-in-out;
}

.status-dot.pulsing {
  color: var(--success);
  animation: beaconPulse 1s infinite ease-in-out;
}

.call-actions {
  display: flex;
  gap: 6px;
}

.btn-call-hangup, .btn-call-accept, .btn-call-reject, .btn-call-mute {
  border: none;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: none;
}

.btn-call-hangup {
  background: var(--danger);
  color: white;
}

.btn-call-accept {
  background: var(--success);
  color: white;
}

.btn-call-reject {
  background: var(--muted);
  color: white;
}

.btn-call-mute {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--line);
}

.btn-call-mute.muted {
  background: var(--danger-light);
  color: var(--danger);
}

/* 9. SECURITY / INTEGRITY DROPDOWNS & STATUS BAR */
.hsk-verification-status-panel {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: #166534;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  user-select: none;
}

.hsk-verification-status-panel:hover {
  background-color: #dcfce7;
}

.hsk-verif-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hsk-verif-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.hsk-verif-badge {
  font-weight: 800;
  font-size: 0.82rem;
  white-space: nowrap;
  color: #15803d;
}

.hsk-verif-text {
  font-size: 0.76rem;
  color: #166534;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsk-verif-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
  white-space: nowrap;
  flex-shrink: 0;
}

.hsk-verif-status-dot {
  color: #16a34a;
  font-size: 0.75rem;
}

.indicator-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  animation: fadeIn 0.15s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.modal-header strong {
  color: var(--primary);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  padding: 0 4px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
}

.integrity-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #166534;
  font-weight: 600;
}

.integrity-item .check {
  color: var(--success);
  font-weight: bold;
}

.session-id {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: monospace;
}

.details-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.details-row b {
  color: var(--primary);
}

.btn-tech {
  background: transparent;
  color: var(--teal);
  border: none;
  font-size: 0.75rem;
  text-decoration: underline;
  box-shadow: none;
  align-self: flex-start;
  padding: 4px 0;
  cursor: pointer;
}

/* 10. FILE DRAG OVERLAY */
.file-drag-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 16px;
}

.drag-box {
  border: 2px dashed var(--teal);
  background: var(--teal-light);
  border-radius: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--teal);
}

.drag-icon {
  font-size: 3rem;
}

.drag-box h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.drag-box p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* 11. ADVANCED SECTION (기존 디버깅 보존) */
.advanced-details {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.advanced-details summary {
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  background: #f8fafc;
  transition: background 0.15s ease;
}

.advanced-details summary:hover {
  background: #f1f5f9;
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.advanced-grid .card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  box-shadow: none;
}

.advanced-grid h2 {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 10px;
}

.feature-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.feature-row span {
  color: var(--muted);
}

.feature-row b {
  color: var(--primary);
}

/* ANIMATIONS */
@keyframes beaconPulse {
  0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4); }
  70% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 0 8px rgba(15, 118, 110, 0); }
  100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
}

@keyframes ringShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE & MOBILE CHAT STABILIZATION */
@media (max-width: 768px) {
  .features-grid, .tech-spec-section, .pricing-cards-container, .advanced-grid {
    grid-template-columns: 1fr;
  }
  main {
    padding: 8px;
  }
  main.in-room {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    padding-bottom: 8px;
  }
  .hsk-container.in-room {
    height: 100%;
    overflow: hidden;
  }
  .hsk-header {
    padding: 8px 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }
  .hsk-verification-status-panel {
    flex-shrink: 0;
    margin-bottom: 8px;
  }
  .conversation-timeline {
    max-height: none;
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    margin-bottom: 8px;
    padding: 12px;
    gap: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
  .chat-input-bar {
    padding: 4px 8px;
    flex-shrink: 0;
  }
  #integratedMessageInput, #messageInput {
    font-size: 16px; /* Prevents Android and iOS soft keyboard focus auto-zoom and layout jitter */
  }
  .hsk-container.in-room .hsk-footer {
    display: none;
  }
}

/* ADMIN DASHBOARD STYLES */
.admin-dashboard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.2s ease-out;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.admin-badge {
  background: var(--primary);
  color: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.btn-refresh-admin {
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid rgba(15, 118, 110, 0.2);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh-admin:hover {
  background: var(--teal);
  color: var(--surface);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.admin-stat-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.admin-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.admin-stat-value {
  font-size: 1.5rem;
  font-weight: 850;
  color: var(--primary);
}

.admin-stat-subtext {
  font-size: 0.72rem;
  color: var(--muted);
}

.admin-panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .admin-panel-row {
    grid-template-columns: 1fr;
  }
}

.admin-list-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-list-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.admin-list-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.admin-list-item {
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.admin-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
}

.admin-feedback-text {
  font-style: italic;
  color: var(--primary);
  line-height: 1.3;
}

/* Sub-navigation bar */
.admin-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.admin-nav-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-nav-btn:hover {
  background: var(--surface);
  color: var(--primary);
}

.admin-nav-btn.active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

/* Health status bar */
.admin-health-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 12px;
}

.health-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 6px;
  width: fit-content;
}

.health-healthy {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.health-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.health-critical {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Key cards grid */
.admin-key-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.highlight-card {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 1.5px solid var(--teal);
}

/* Admin Data Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.admin-table th {
  background: var(--bg);
  padding: 10px 12px;
  font-weight: 800;
  color: var(--muted);
  border-bottom: 1.5px solid var(--line);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--primary);
}

.admin-table tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Privacy notice banner */
.admin-privacy-banner {
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.25);
  color: var(--teal);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Visual bar indicator */
.admin-bar-container {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}

.admin-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

/* ADMIN PLANS & PRICING EDITOR STYLES */
.admin-plans-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-plan-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
  overflow-x: auto;
}

.admin-plan-tab-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.admin-plan-tab-btn:hover {
  background: var(--surface);
  color: var(--primary);
}

.admin-plan-tab-btn.active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.admin-feature-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-feature-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: border-color 0.2s ease;
}

.admin-feature-row:hover {
  border-color: var(--teal);
}

.admin-feature-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.84rem;
  color: var(--primary);
  font-weight: 500;
}

.admin-feature-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.admin-btn-move {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-btn-move:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.admin-btn-delete {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.76rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s ease;
}

.admin-btn-delete:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.admin-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.admin-btn-add {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: var(--teal);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.admin-btn-add:hover {
  opacity: 0.9;
}

/* ==========================================================================
   Checkout & Payment Modal Styles
   ========================================================================== */
.checkout-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.checkout-modal-card {
  background: #ffffff;
  border-radius: 18px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUpModal {
  from { transform: scale(0.95) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.checkout-modal-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
}

.checkout-modal-header.plus-theme {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 1px solid #bfdbfe;
}

.checkout-modal-header.pro-theme {
  background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
  border-bottom: 1px solid #99f6e4;
}

.checkout-close-btn {
  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.checkout-close-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

.checkout-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkout-plan-summary {
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkout-plan-summary.plus-box {
  background: #f8fafc;
  border: 1.5px solid #93c5fd;
}

.checkout-plan-summary.pro-box {
  background: #f8fafc;
  border: 1.5px solid #5eead4;
}

.checkout-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkout-input-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.checkout-input-field {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  font-size: 0.92rem;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.checkout-input-field:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-checkout-primary {
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn-checkout-primary.plus-btn {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-checkout-primary.plus-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-checkout-primary.pro-btn {
  background: var(--teal);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.btn-checkout-primary.pro-btn:hover {
  background: #0f766e;
  transform: translateY(-1px);
}

.btn-checkout-sandbox {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-checkout-sandbox:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* =========================================================
   10. MOBILE ROOM FULL-HEIGHT & VIEWPORT LOCKING
   ========================================================= */
@media (max-width: 768px) {
  body.in-room-body {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    position: fixed;
    width: 100%;
  }

  main.in-room {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .hsk-container.in-room {
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 !important;
    min-height: 0 !important;
  }

  .hsk-container.in-room .hsk-header {
    margin-bottom: 6px !important;
    padding: 8px 12px !important;
    flex-shrink: 0 !important;
  }

  .hsk-container.in-room .hsk-verification-status-panel {
    margin-bottom: 6px !important;
    padding: 6px 10px !important;
    flex-shrink: 0 !important;
  }

  .hsk-container.in-room .conversation-timeline {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 6px !important;
    padding: 10px 8px !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .hsk-container.in-room .chat-input-bar {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    margin-bottom: 2px !important;
    padding: 4px 6px !important;
  }

  .hsk-container.in-room .hsk-footer {
    display: none !important;
  }

  .hsk-container.in-room .advanced-details {
    display: block !important;
    flex: 0 0 auto !important;
    margin: 4px 0 0 0 !important;
    border-radius: 14px !important;
    max-height: 42dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .hsk-container.in-room .advanced-details summary {
    min-height: 38px !important;
    padding: 8px 12px !important;
    font-size: 0.86rem !important;
    border-radius: 12px !important;
    background: #ecfeff !important;
    color: #0f766e !important;
    border: 1px solid #99f6e4 !important;
  }

  .hsk-container.in-room .advanced-details[open] {
    background: #ffffff !important;
    border: 1px solid #ccfbf1 !important;
    box-shadow: 0 12px 30px rgba(15, 118, 110, 0.12) !important;
  }

  .hsk-container.in-room .advanced-details[open] .advanced-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 8px !important;
  }

  .hsk-container.in-room .logs-card {
    margin: 8px !important;
  }

  .hsk-container.in-room .status-badge-clickable,
  .hsk-container.in-room .security-badge-clickable {
    padding: 6px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap !important;
  }

  .room-security-row {
    grid-template-columns: 1fr !important;
  }

  .join-request-row {
    align-items: stretch;
    flex-direction: column;
  }
}




