:root {
  /* Color Palette - Poster Theme (Pastel Blue & Pink) */
  --primary: #60a5fa;       /* Pastel Blue */
  --primary-hover: #3b82f6; /* Blue 500 */
  --primary-light: #eff6ff; /* Blue 50 */
  --secondary: #fb7185;     /* Soft Pink/Salmon */
  --success: #34d399;       /* Pastel Green */
  --success-hover: #10b981; 
  --warning: #fbbf24;       /* Pastel Yellow */
  --danger: #f87171;        
  --bg-main: #e0f2fe;       /* Light blue background base */
  --bg-card: rgba(255, 255, 255, 0.85); /* Glassmorphism card */
  --text-main: #1e3a8a;     /* Deep Blue for readability */
  --text-muted: #475569;    /* Slate 600 */
  --border: rgba(255, 255, 255, 0.6); /* Soft white borders */
  --border-focus: #bfdbfe;  /* Blue 200 */
  
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(96, 165, 250, 0.15), 0 2px 4px -2px rgba(96, 165, 250, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(96, 165, 250, 0.2), 0 4px 6px -4px rgba(96, 165, 250, 0.1);
  --shadow-glow: 0 0 15px rgba(251, 113, 133, 0.4);
  
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-full: 9999px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: linear-gradient(180deg, #dbeafe 0%, #fce7f3 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════
   Layout & Screens
══════════════════════════════════════════════════════════ */
.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
}
.screen.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

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

/* ══════════════════════════════════════════════════════════
   Login Screen
══════════════════════════════════════════════════════════ */
#screen-login {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
#screen-login.active {
  display: flex;
}

.login-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  z-index: -1;
  overflow: hidden;
}

.login-particles {
  position: absolute;
  width: 100%; height: 100%;
  background-image: radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.4) 0%, transparent 40%),
                    radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.4) 0%, transparent 40%);
  filter: blur(40px);
  animation: pulseBg 10s infinite alternate;
}

@keyframes pulseBg {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.login-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 1.5rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.camp-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.gradient-text {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.session-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
}

.session-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: blink 2s infinite;
}

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

.session-time {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.login-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.login-form {
  display: none;
}
.login-form.active {
  display: block;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.input-group {
  margin-bottom: 1.2rem;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-wrap input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: #f8fafc;
}

.input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px var(--border-focus);
}

.login-btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  margin-top: 1.5rem;
}

.login-btn.primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  box-shadow: var(--shadow-md);
}

.login-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.demo-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* ══════════════════════════════════════════════════════════
   Navigation
══════════════════════════════════════════════════════════ */
.top-nav {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.teacher-nav {
  background: rgba(236, 72, 153, 0.05);
  border-bottom-color: rgba(236, 72, 153, 0.2);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-back {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.nav-back:hover {
  background: var(--bg-main);
}

.nav-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.student-badge { background: var(--primary-light); color: var(--primary); }
.teacher-badge { background: #fce7f3; color: var(--secondary); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-session-chip {
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-session-chip::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.nav-icon-btn {
  background: var(--primary);
  color: white;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.nav-icon-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* 글자 크기 토글 버튼 */
.nav-font-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  cursor: pointer;
  min-width: 36px;
  transition: var(--transition);
  line-height: 1;
}
.nav-font-btn:hover { background: var(--primary-light); }
.nav-font-btn.size-lg  { font-size: 1.1rem; background: var(--primary-light); }
.nav-font-btn.size-xl  { font-size: 1.25rem; background: var(--primary); color: white; }

/* 바탕화면 추가 버튼 */
.nav-homescreen-btn {
  font-size: 1.2rem;
  background: var(--success);
}
.nav-homescreen-btn:hover { background: var(--success-hover); }

/* 사전신청 설문 버튼 (푸른 그라데이션 및 바운스 애니메이션) */
.nav-pre-survey-btn {
  font-family: 'Jua', sans-serif;
  font-weight: 400;
  font-size: 0.92rem;
  color: white;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.35);
  animation: bounce-gentle 2.2s infinite ease-in-out;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.nav-pre-survey-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 16px rgba(79, 172, 254, 0.5);
  background: linear-gradient(135deg, #2a9df4, #00c6fb);
}

.nav-pre-survey-btn:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: 0 2px 6px rgba(79, 172, 254, 0.3);
}

/* 만족도 조사 버튼 (귀여운 그라데이션 및 바운스 애니메이션) */
.nav-survey-btn {
  font-family: 'Jua', sans-serif;
  font-weight: 400;
  font-size: 0.92rem;
  color: white;
  background: linear-gradient(135deg, #ff6b8b, #ff8e53);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 4px 12px rgba(255, 107, 139, 0.35);
  animation: bounce-gentle 2.2s infinite ease-in-out;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.nav-survey-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 16px rgba(255, 107, 139, 0.5);
  background: linear-gradient(135deg, #ff477e, #ff7b39);
}

@keyframes bounce-gentle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.04); }
}

@media (max-width: 768px) {
  .nav-right {
    gap: 0.3rem;
  }
  .nav-survey-btn, .nav-pre-survey-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.05em;
  }
  .nav-pre-survey-btn {
    box-shadow: 0 3px 8px rgba(79, 172, 254, 0.25);
  }
  .nav-survey-btn {
    box-shadow: 0 3px 8px rgba(255, 107, 139, 0.25);
  }
  .nav-session-chip {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    letter-spacing: -0.05em;
  }
}

/* 글자 크기 클래스 (screen-student에 적용) */
#screen-student.font-lg  { font-size: 1.13em; }
#screen-student.font-xl  { font-size: 1.3em; }
#screen-student.font-lg .room-block,
#screen-student.font-xl .room-block { font-size: inherit; }

/* 바탕화면 추가 URL 박스 */
.homescreen-url-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════
   Main Content Layout
══════════════════════════════════════════════════════════ */
.main-content {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  margin-bottom: 3rem;
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: nowrap;        /* 탭이 아래로 줄바꿈되지 않도록 */
  gap: 0.5rem;
  overflow: hidden;
}

.section-title {
  font-family: 'Jua', sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

/* Session Tabs in content */
.session-tabs {
  display: flex;
  background: var(--bg-main);
  border-radius: var(--radius-full);
  padding: 0.25rem;
  flex-shrink: 0;           /* 줄바꿈 방지 */
  overflow-x: auto;         /* 탭이 많아도 가로 스크롤 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;    /* Firefox: 스크롤바 숨김 */
  white-space: nowrap;      /* 탭 텍스트 줄바꿈 금지 */
}
.session-tabs::-webkit-scrollbar { display: none; } /* Chrome: 스크롤바 숨김 */
.session-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;      /* 각 탭 텍스트 줄바꿈 금지 */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.session-time-label {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.75;
}
.session-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.session-banner {
  background: linear-gradient(to right, #eff6ff, #e0e7ff);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
  font-weight: 500;
  color: #1e3a8a;
}

/* ══════════════════════════════════════════════════════════
   Cards & Grids
══════════════════════════════════════════════════════════ */
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.program-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.program-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--primary);
  opacity: 0.8;
  transition: var(--transition);
}

.program-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-focus);
}

.program-card:hover::before {
  width: 6px;
  opacity: 1;
}

.program-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--bg-main);
  color: var(--text-muted);
}
.badge.floor { background: #fee2e2; color: #b91c1c; }
.badge.room { background: #dcfce7; color: #15803d; }

.program-title {
  font-family: 'Jua', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  line-height: 1.3;
}

.program-teacher {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Floor Map New Design */
.floor-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-main);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.floor-tabs::-webkit-scrollbar { display: none; }
.floor-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.floor-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* 배치도 스케일 래퍼: JS가 transform-origin top left로 scale 적용 */
.floor-map-scale-wrapper {
  transform-origin: top left;
  width: fit-content;
}

.floor-map-layout {
  display: grid;
  grid-template-columns: repeat(42, 1fr);
  grid-auto-rows: 40px;
  gap: 0.2rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  min-width: 1400px;
  width: 1400px;
}

/* 배치도 툴바 (힌트 + 초기화 버튼) */
.fm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.fm-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}
.fm-reset-btn {
  flex-shrink: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
}
.fm-reset-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.room-empty {
  background: transparent;
  border: none;
}
.room-empty-bordered {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.room-block {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-family: 'Jua', sans-serif;
  font-size: 0.85rem; /* JS가 개별 제어함 - 전역 클래스에 상속되지 않도록 명시적 rem으로 고정 */
  font-weight: 400;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  word-break: keep-all;
  line-height: 1.2;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
/* 글자크기 전역 클래스가 room-block에 상속되지 않도록 직접 차단 (JS가 인라인으로 개별 제어) */
#screen-student.font-lg .room-block,
#screen-student.font-xl .room-block {
  font-size: 0.85rem; /* 기본값 유지, JS가 체크 후 인라인으로만 확대 */
}
.room-block:hover:not(.room-static) {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.room-block.room-static {
  cursor: default;
  background: #f1f5f9;
  color: #64748b;
  box-shadow: none;
  font-weight: 600;
  padding: 0.2rem;
}
.room-block.has-program {
  background: #e0e7ff;
  border-color: var(--primary);
  color: var(--primary-hover);
}
.room-block.has-program::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: var(--secondary);
  border-radius: 50%;
  border: 2px solid white;
  animation: pulseBg 2s infinite;
}
/* 스탬프부스 강조 애니메이션 */
.stamp-booth-highlight {
  background: linear-gradient(135deg, #fef08a, #fde047) !important;
  color: #854d0e !important;
  font-weight: 800 !important;
  border: 2px dashed #eab308 !important;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
  animation: stampBounce 1.3s infinite ease-in-out;
  z-index: 2;
}
@keyframes stampBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7); border-color: var(--secondary); background: #fdf2f8; transform: scale(1); z-index: 10; }
  50% { box-shadow: 0 0 0 10px rgba(236, 72, 153, 0); border-color: var(--secondary); background: #fdf2f8; transform: scale(1.05); z-index: 10; }
  100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); border-color: var(--secondary); background: #fdf2f8; transform: scale(1); z-index: 10; }
}
.highlight-glow {
  animation: highlightPulse 1.5s infinite;
  border-width: 2px !important;
  color: var(--secondary) !important;
}

/* ══════════════════════════════════════════════════════════
   Teacher Screens
══════════════════════════════════════════════════════════ */
.program-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.teacher-program-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.teacher-program-card:hover {
  border-color: var(--secondary);
  background: #fdf2f8;
}
.teacher-program-card.selected {
  border-color: var(--secondary);
  background: var(--secondary);
  color: white;
}
.teacher-program-card.selected .program-teacher { color: rgba(255,255,255,0.8); }
.teacher-program-card.selected .badge { background: rgba(255,255,255,0.2); color: white; }

/* Attendance Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.attendance-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.attendance-table th,
.attendance-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.attendance-table th {
  background: var(--bg-main);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}

.attendance-table tbody tr:hover {
  background: #f8fafc;
}

.status-stamp {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}
.status-stamp.done { background: #dcfce7; color: #166534; }
.status-stamp.none { background: #f1f5f9; color: #64748b; }

.memo-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: inherit;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { border-color: var(--border); background: white; color: var(--text-main); }
.btn-outline:hover { background: var(--bg-main); border-color: var(--text-muted); }

.attendance-actions {
  display: flex;
  gap: 0.5rem;
}

.attendance-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-main);
  padding: 1rem;
  border-radius: var(--radius-md);
}
.stat-box {
  flex: 1;
  text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   Modals
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-close {
  background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* QR Modal Specific */
.qr-modal { max-width: 320px; text-align: center; }
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
#qrCodeDisplay {
  background: white; padding: 1rem; border-radius: var(--radius-md); border: 2px solid var(--border);
  display: inline-block;
}
.qr-info { margin-top: 0.5rem; }
.qr-name { font-size: 1.2rem; font-weight: 800; }
.qr-id { color: var(--text-muted); font-size: 0.9rem; }
.qr-hint {
  background: #fef2f2; color: #991b1b; padding: 0.5rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; width: 100%;
}

/* Memo Modal Specific */
textarea {
  width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md); font-family: inherit; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--border-focus); }

.student-info-card {
  background: var(--bg-main); padding: 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; border-left: 4px solid var(--primary);
}
.existing-memo {
  background: #fffbeb; padding: 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: 0.9rem; max-height: 150px; overflow-y: auto; border: 1px solid #fde68a;
  white-space: pre-wrap;
}

/* ══════════════════════════════════════════════════════════
   Utilities
══════════════════════════════════════════════════════════ */
.loading-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); gap: 1rem; grid-column: 1 / -1;
}
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.9); color: white; padding: 0.8rem 1.5rem; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.95rem; z-index: 9999; opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Settings */
.settings-bar {
  position: fixed; bottom: 0; left: 0; width: 100%; background: #1e293b; color: white; padding: 10px; display: none; gap: 10px; z-index: 9999;
}
.settings-bar input { flex: 1; padding: 5px; border-radius: 4px; border: none; }
.settings-bar button { padding: 5px 10px; background: var(--primary); border: none; color: white; border-radius: 4px; cursor: pointer; }
.settings-toggle {
  position: fixed; bottom: 20px; right: 20px; width: 45px; height: 45px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; opacity: 0.9; z-index: 9998; box-shadow: var(--shadow-md); font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.settings-toggle:hover { opacity: 1; transform: scale(1.1); box-shadow: var(--shadow-lg); }

/* Responsive */
@media (max-width: 768px) {
  /* 전체 레이아웃 */
  .top-nav { padding: 0 0.75rem; }
  .section { padding: 0.75rem; margin-bottom: 1.5rem; }
  .main-content { padding: 0.75rem; }
  .section-header { flex-wrap: wrap; }
  .section-title { font-size: 1.05rem; white-space: normal; overflow: visible; }
  .nav-name { font-size: 1.3rem !important; }

  /* 세션 탭: 폰트·패딩 축소 (긴 텍스트 잘림 방지) */
  .session-tab {
    padding: 0.3rem 0.25rem;
    font-size: 0.72rem;
    letter-spacing: -0.02em;
  }
  .session-time-label {
    font-size: 0.58rem;
    letter-spacing: -0.03em;
  }
  .floor-tab {
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
  }

  /* 프로그램 그리드: 1열 */
  .program-grid { grid-template-columns: 1fr; }

  /* 오전 프로그램 리스트: 폰트·패딩 최소화 */
  .morning-program-list { padding: 1rem !important; }
  .morning-program-list h3 { font-size: 1rem !important; }
  .morning-program-list li { font-size: 0.88rem !important; padding: 0.6rem !important; }

  /* 배치도: 모바일 전용 (PC는 기본값 40px / 0.85rem 그대로) */
  .floor-map-container {
    position: relative;
  }
  .floor-map-layout {
    grid-auto-rows: 32px;   /* 모바일 행 높이 */
    padding: 0.5rem;
    gap: 0.1rem;
    min-width: 840px;       /* 스크롤 범위 축소 */
  }
  .room-block {
    font-size: 0.72rem;     /* 모바일: 읽기 가능한 크기 (PC: 0.85rem 유지) */
    padding: 0.1rem 0.15rem;
    border-radius: 2px;
    word-break: break-all;
  }

  /* 출석부 */
  .attendance-actions { flex-direction: column; width: 100%; }
  .attendance-actions button { width: 100%; }
  .attendance-table.morning-mode {
    min-width: 0 !important;
    width: 100%;
  }
  .attendance-table.morning-mode th,
  .attendance-table.morning-mode td {
    padding: 0.5rem 0.4rem;
    font-size: 0.85rem;
  }
  .attendance-stats {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* 배치도 스크롤 힌트 (모바일) */
.floor-map-scroll-hint {
  display: none;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.3rem;
  margin-bottom: 0.5rem;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  animation: fadeInOut 3s ease-in-out forwards;
}
@keyframes fadeInOut {
  0% { opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; }
}
@media (max-width: 768px) {
  .floor-map-scroll-hint { display: block; }
}

