﻿/* ── 리셋 & 변수 ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Light theme */
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --muted:     #475569;
  --accent:    #1d4ed8;
  --accent-h:  #1e40af;
  --accent-bg: #dbeafe;
  --green:     #15803d;
  --green-bg:  #dcfce7;
  --amber:     #b45309;
  --amber-bg:  #fef3c7;
  --red:       #b91c1c;
  --red-bg:    #fef2f2;
  --disabled:  #94a3b8;

  --header-h:  54px;
  --nav-h:     72px;
  --seat-sz:   46px;
  --seat-gap:  4px;
  --cluster-gap: 14px;
  --row-gap:   16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f172a;
    --surface:   #1e293b;
    --surface2:  #0f172a;
    --border:    #334155;
    --text:      #f1f5f9;
    --muted:     #a5b4c8;
    --accent:    #3b82f6;
    --accent-h:  #60a5fa;
    --accent-bg: rgba(59,130,246,.22);
    --green:     #22c55e;
    --green-bg:  rgba(34,197,94,.22);
    --amber:     #f59e0b;
    --amber-bg:  rgba(245,158,11,.22);
    --red:       #ef4444;
    --red-bg:    rgba(239,68,68,.12);
    --disabled:  #475569;
  }
}

:root[data-theme="light"] {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --muted:     #475569;
  --accent:    #1d4ed8;
  --accent-h:  #1e40af;
  --accent-bg: #dbeafe;
  --green:     #15803d;
  --green-bg:  #dcfce7;
  --amber:     #b45309;
  --amber-bg:  #fef3c7;
  --red:       #b91c1c;
  --red-bg:    #fef2f2;
  --disabled:  #94a3b8;
}

:root[data-theme="dark"] {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #0f172a;
  --border:    #334155;
  --text:      #f1f5f9;
  --muted:     #a5b4c8;
  --accent:    #3b82f6;
  --accent-h:  #60a5fa;
  --accent-bg: rgba(59,130,246,.22);
  --green:     #22c55e;
  --green-bg:  rgba(34,197,94,.22);
  --amber:     #f59e0b;
  --amber-bg:  rgba(245,158,11,.22);
  --red:       #ef4444;
  --red-bg:    rgba(239,68,68,.12);
  --disabled:  #475569;
}

/* ── 기본 타이포 ─────────────────────────────────────── */
html, body {
  height: 100%;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Apple SD Gothic Neo',
               'Noto Sans KR', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* ── 유틸 ───────────────────────────────────────────── */
.w-full  { width: 100%; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.muted-text { color: var(--muted); font-size: 12px; }

/* ── 공통 컴포넌트 ──────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: opacity 0.15s, background 0.15s;
  text-align: center;
}
.btn:active { opacity: 0.82; }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-danger   { background: var(--red-bg);  color: var(--red); border: 1.5px solid var(--red); }
.btn-sm       { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-primary.btn-sm { background: var(--accent); color: #fff; }
.btn-secondary.btn-sm { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--accent-bg); color: var(--accent); }

.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-group { margin-bottom: 16px; }

/* ── 온보딩 ────────────────────────────────────────── */
.onboarding-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 28px;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, var(--accent-bg), transparent 70%),
    var(--bg);
  position: relative;
}
.onboard-skip {
  position: absolute; top: 20px; right: 20px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 6px 10px; border-radius: 6px;
}
.onboard-skip:hover { background: var(--surface2); }
.onboard-slides { width: 100%; max-width: 340px; text-align: center; }
.onboard-slide { display: none; flex-direction: column; align-items: center; animation: onboardIn 0.35s ease; }
.onboard-slide.active { display: flex; }
@keyframes onboardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.onboard-icon {
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.onboard-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.onboard-desc { font-size: 14px; color: var(--muted); line-height: 1.6; }
.onboard-dots { display: flex; gap: 6px; margin: 32px 0 24px; }
.onboard-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: all 0.2s; }
.onboard-dot.active { width: 18px; background: var(--accent); }
.onboard-next { max-width: 340px; }

/* ── 인증 화면 ─────────────────────────────────────── */
.auth-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, var(--accent-bg), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px 28px;
  box-shadow: 0 8px 32px rgba(29,78,216,0.10), 0 1px 3px rgba(0,0,0,0.04);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.auth-logo-text { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.auth-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 26px; }

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 22px;
  gap: 3px;
}
.auth-tab {
  flex: 1; padding: 8px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tab.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .input { padding: 12px 14px; border-radius: 10px; }
.auth-form .btn { padding: 12px 16px; border-radius: 10px; margin-top: 4px; }
.auth-error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ── 앱 레이아웃 ───────────────────────────────────── */
.app-screen {
  height: 100dvh; overflow: hidden;
  display: flex; justify-content: center;
  background: var(--surface2);
}
.app-shell {
  display: flex; flex-direction: column;
  width: 100%; max-width: 480px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
@media (min-width: 700px) {
  .app-screen { padding: 20px 0; }
  .app-shell {
    height: calc(100dvh - 40px);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  }
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-title { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.header-right { display: flex; align-items: center; gap: 4px; }

.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--surface);
}

.app-main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── 탭 패널 ───────────────────────────────────────── */
.tab-pane { display: none; padding: 16px; padding-bottom: calc(var(--nav-h) + 24px); }
.tab-pane.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 700; }

/* ── 하단 네비 ─────────────────────────────────────── */
.bottom-nav {
  display: flex; align-items: stretch;
  min-height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.02em; transition: color 0.15s;
  padding: 10px 4px 8px;
  position: relative;
  min-height: 56px;
}
.nav-item svg { width: 24px; height: 24px; transition: stroke 0.15s; }
.nav-item.active { color: var(--accent); }
.nav-item.active svg { stroke: var(--accent); stroke-width: 2.5; }
.nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* ── 좌석 탭 ───────────────────────────────────────── */
.room-tabs-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.room-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 3px; gap: 3px;
  background: var(--surface);
}
.room-tab {
  padding: 6px 18px; border-radius: 6px;
  font-size: 13px; font-weight: 700;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.room-tab.active { background: var(--accent); color: #fff; }

.seat-map-wrap {
  overflow-x: auto; padding-bottom: 4px;
  display: flex; justify-content: center;
}
.seat-map {
  display: flex; flex-direction: column; gap: var(--row-gap);
  width: fit-content;
  margin: 0 auto;
}
.cluster-row { justify-content: center; }

/* 클러스터 행 */
.cluster-row {
  display: flex; gap: var(--cluster-gap);
  align-items: flex-start;
}

/* 클러스터 (테이블 그룹) */
.cluster {
  display: grid;
  gap: var(--seat-gap);
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* ── 좌석 셀 ───────────────────────────────────────── */
.seat-cell {
  width: var(--seat-sz); height: var(--seat-sz);
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px; cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.seat-cell:active { opacity: 0.75; }

/* 좌석 번호 */
.seat-num {
  font-size: 13px; font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* 예약 태그 */
.seat-user, .seat-tag {
  font-size: 10px; font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

/* 공부 시간 */
.seat-dur {
  font-size: 10px; font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* 관리자: 사용중인 사람 이름 */
.seat-occupant-name {
  font-size: 9px; font-weight: 700;
  color: var(--accent);
  line-height: 1;
  max-width: calc(var(--seat-sz) - 8px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 상태별 스타일 */
.seat-cell.occupied {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.seat-cell.reserved {
  border-color: var(--amber);
  background: var(--amber-bg);
}
.seat-cell.reserved .seat-user, .seat-cell.reserved .seat-tag { color: var(--amber); }
.seat-cell.reserved .seat-dur  { color: var(--amber); }

.seat-cell.mine {
  border-color: var(--green);
  background: var(--green-bg);
  box-shadow: 0 0 0 2px var(--green-bg), 0 0 0 3.5px var(--green);
}
.seat-cell.mine .seat-user, .seat-cell.mine .seat-tag { color: var(--green); }
.seat-cell.mine .seat-num  { color: var(--green); }
.seat-cell.mine .seat-dur  { color: var(--green); }
.seat-cell.mine .seat-occupant-name { color: var(--green); }

/* 비활성 좌석: 사선 표시 */
.seat-cell.disabled {
  border-color: var(--disabled);
  background: var(--surface2);
  cursor: not-allowed;
  opacity: 0.55;
  overflow: hidden;
}
.seat-cell.disabled .seat-num { color: var(--disabled); }
.seat-cell.disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    var(--disabled) 4px,
    var(--disabled) 5px
  );
  opacity: 0.5;
  pointer-events: none;
}

/* ── 범례 ──────────────────────────────────────────── */
.legend {
  display: flex; flex-wrap: wrap; gap: 12px 16px;
  margin-top: 12px;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.legend-dot {
  width: 14px; height: 14px; border-radius: 4px;
  border: 2px solid;
}
.legend-dot.empty    { border-color: var(--border); background: var(--surface2); }
.legend-dot.occupied { border-color: var(--accent); background: var(--accent-bg); }
.legend-dot.reserved { border-color: var(--amber);  background: var(--amber-bg); }
.legend-dot.mine     { border-color: var(--green);  background: var(--green-bg); }
.legend-dot.disabled { border-color: var(--disabled); background: var(--surface2); opacity: 0.55; }

/* ── 타이머 탭 ─────────────────────────────────────── */
.timer-card {
  text-align: center;
  padding: 28px 20px 24px;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  background-image: linear-gradient(180deg, var(--accent-bg), transparent 60%);
}
.timer-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  margin-bottom: 10px;
}
.timer-clock {
  font-size: 42px; font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.timer-subject-label {
  margin-top: 6px;
  font-size: 13px; color: var(--accent); font-weight: 700;
  min-height: 18px;
}

/* 과목 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip.selected { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.chip.delete { border-color: var(--red); color: var(--red); font-size: 10px; padding: 4px 8px; }

/* 과목 통계 */
.subject-stats { margin-top: 24px; }
.subject-stat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.subject-stat-item:last-child { border-bottom: none; }
.subject-stat-name { flex: 1; font-weight: 600; font-size: 14px; }
.subject-stat-time { font-size: 13px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.subject-bar-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.subject-bar-fill  { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s; }

/* ── 그룹 탭 ───────────────────────────────────────── */
.join-row { display: flex; gap: 8px; margin-bottom: 16px; }
.join-row .input { flex: 1; }

/* ── 랭킹 탭 ───────────────────────────────────────── */
.rank-tabs-bar {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 16px; gap: 0;
}
.rank-tab {
  flex: 1; padding: 10px; font-size: 13px; font-weight: 700;
  color: var(--muted); text-align: center;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: color 0.15s, border-color 0.15s;
}
.rank-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── 리스트 공통 ────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.list-item:hover { border-color: var(--accent); }
.list-item-rank {
  font-size: 16px; font-weight: 800;
  color: var(--muted); min-width: 28px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.list-item-rank.gold   { color: #ca8a04; }
.list-item-rank.silver { color: #64748b; }
.list-item-rank.bronze { color: #92400e; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-name { font-weight: 700; font-size: 15px; }
.list-item-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.list-item-right { text-align: right; }
.list-item-time { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.list-item-tier { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }

.rank-me { border-color: var(--accent); background: var(--accent-bg); }

/* ── 직급 배지 ─────────────────────────────────────── */
.tier-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  color: #fff;
  letter-spacing: 0.03em;
}

/* ── 푸시 알림 카드 ─────────────────────────────────── */
.push-row { display: flex; align-items: flex-start; gap: 12px; }
.push-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
}
.push-icon.on   { background: var(--green-bg); color: var(--green); }
.push-icon.off  { background: var(--surface2); color: var(--muted); border: 1.5px solid var(--border); }
.push-icon.warn { background: var(--amber-bg); color: var(--amber); }
.push-title { font-weight: 700; font-size: 13.5px; }
.push-desc  { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ── 프로필 탭 ─────────────────────────────────────── */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.profile-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
}
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.profile-name-block { flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 6px; }
.profile-name { font-size: 18px; font-weight: 800; }
.profile-dept { font-size: 13px; color: var(--muted); margin-top: 2px; }
.icon-btn-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn-sm:hover { background: var(--accent-bg); color: var(--accent); }
.icon-btn-sm.active { background: var(--accent-bg); color: var(--accent); }

.stats-row { display: flex; gap: 0; margin-bottom: 16px; }
.stat-box {
  flex: 1; padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  text-align: center;
}
.stat-box:first-child { border-radius: 8px 0 0 8px; }
.stat-box:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.stat-box:not(:first-child):not(:last-child) { border-left: none; }
.stat-val { font-size: 20px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.tier-progress {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.tier-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tier-name { font-size: 15px; font-weight: 800; }
.tier-next { font-size: 12px; color: var(--muted); }
.progress-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s; }

/* 알림 */
.notif-item {
  position: relative;
  padding: 12px 32px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
}
.notif-title { font-weight: 700; font-size: 13px; }
.notif-body  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.notif-time  { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-dismiss {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.notif-dismiss:hover { background: var(--red-bg); color: var(--red); }

/* ── 관리자 패널 ────────────────────────────────────── */
.admin-section { margin-bottom: 24px; }
.admin-section-title {
  font-size: 12px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.admin-seat-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.admin-seat-item {
  padding: 6px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s;
}
.admin-seat-item.inactive {
  color: var(--disabled);
  border-color: var(--disabled);
  text-decoration: line-through;
  opacity: 0.6;
}
.admin-seat-item.active:hover { border-color: var(--red); color: var(--red); }

.admin-room-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700; font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
}
.admin-room-toggle .chevron { transition: transform 0.15s; color: var(--muted); }
.admin-room-toggle.open .chevron { transform: rotate(90deg); }
.admin-room-body { margin-bottom: 10px; }
.admin-room-body.collapsed { display: none; }
.admin-add-seat-row { display: flex; gap: 6px; margin-top: 8px; }
.admin-add-seat-row .input { flex: 1; }

.member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}
.member-name { flex: 1; font-weight: 600; font-size: 13px; }
.member-meta { font-size: 12px; color: var(--muted); }
.member-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--accent-bg); color: var(--accent); }
.member-admin-badge { background: var(--amber-bg); color: var(--amber); }

/* ── 바텀시트 ───────────────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 40;
}
.seat-sheet {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  z-index: 50;
  max-height: 80dvh;
  overflow-y: auto;
  animation: sheetUp 0.25s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes sheetUp {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}
.sheet-content { padding: 16px 20px 32px; }
.sheet-seat-num { font-size: 28px; font-weight: 900; letter-spacing: -0.04em; margin-bottom: 4px; }
.sheet-status { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.sheet-info {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}
.sheet-info-label { color: var(--muted); min-width: 60px; font-weight: 600; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ── 등급표 시트 ───────────────────────────────────── */
.tier-info-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.tier-info-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.tier-info-row:last-child { border-bottom: none; }
.tier-info-row.mine { background: var(--accent-bg); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.tier-info-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.tier-info-name { flex: 1; font-weight: 700; font-size: 14px; }
.tier-info-hours { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── 서비스 소개 시트 ─────────────────────────────────── */
.service-info-text { font-size: 13.5px; color: var(--text); line-height: 1.7; margin-top: 16px; }
.service-info-footer {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); text-align: center;
}
.credit-link { color: inherit; text-decoration: none; }

/* ── 토스트 ────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  z-index: 100; white-space: nowrap;
  transition: opacity 0.3s;
}

/* ── 리저브 선택 UI ─────────────────────────────────── */
.hours-select { display: flex; gap: 6px; flex-wrap: wrap; }
.hours-btn {
  padding: 7px 14px; border-radius: 6px;
  border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.hours-btn.selected { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ── 그룹 카드 ─────────────────────────────────────── */
.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.group-card:hover { border-color: var(--accent); }
.group-name { font-weight: 700; font-size: 15px; }
.group-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.group-code { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; margin-top: 4px; }

/* ── 그룹 멤버 행 ───────────────────────────────────── */
.group-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.group-member-row:last-child { border-bottom: none; }
.group-member-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
}
.group-member-dot.active { background: var(--green); }
.group-member-name { flex: 1; font-weight: 600; font-size: 13px; }
.group-member-time { font-size: 12px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── 그룹 태그 ─────────────────────────────────────── */
.group-tag {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}
.group-tag.public  { background: var(--green-bg);  color: var(--green); }
.group-tag.private { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

/* ── 공부 금지 배너 ─────────────────────────────────── */
.ban-banner {
  padding: 10px 16px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px; font-weight: 700;
  text-align: center;
  border-bottom: 1px solid var(--red);
}

/* ── 예약 시작시간 피커 ─────────────────────────────── */
.reserve-picker .hours-select {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.reserve-picker .hours-btn {
  padding: 8px 12px; border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 13px; font-weight: 700;
  color: var(--text);
}
.reserve-picker .hours-btn.selected {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 반응형 ─────────────────────────────────────────── */
@media (max-width: 400px) {
  :root { --seat-sz: 42px; --seat-gap: 3px; --cluster-gap: 10px; --row-gap: 12px; }
  .tab-pane { padding: 12px; padding-bottom: calc(var(--nav-h) + 20px); }
  .timer-clock { font-size: 36px; }
}
@media (max-width: 340px) {
  :root { --seat-sz: 38px; }
  .seat-dur { font-size: 8px; }
}

/* ── 접근성 & 모션 ──────────────────────────────────── */
button, .seat-cell { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ AI 기능 ═══════════════════════════════════════════ */

/* AI 집중 모드 카드 */
.focus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}
.focus-head { display: flex; align-items: flex-start; gap: 12px; }
.focus-head > div:first-child { flex: 1; }
.focus-title { font-weight: 800; font-size: 14px; }
.focus-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.focus-toggle {
  width: 48px; height: 28px; border-radius: 14px;
  background: var(--border);
  position: relative; flex-shrink: 0;
  transition: background 0.2s;
}
.focus-toggle .focus-knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.focus-toggle.on { background: var(--accent); }
.focus-toggle.on .focus-knob { transform: translateX(20px); }
.focus-toggle.loading { opacity: 0.5; pointer-events: none; }

.focus-body { margin-top: 14px; }
.focus-status-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.focus-chip {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 12px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.focus-chip.good { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.focus-chip.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.focus-chip.bad  { border-color: var(--red); color: var(--red); background: var(--red-bg); }

/* AI 결과 박스 */
.ai-result {
  margin-top: 12px; padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px; line-height: 1.7;
}
.ai-h { font-weight: 800; font-size: 14px; color: var(--accent); margin: 10px 0 4px; }
.ai-h:first-child { margin-top: 0; }
.ai-li { padding-left: 4px; }

/* 퀴즈 */
.quiz-card { margin-bottom: 10px; }
.quiz-q { font-weight: 700; font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.quiz-options { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt {
  text-align: left;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  font-size: 13.5px;
  transition: border-color 0.15s;
}
.quiz-opt:not(:disabled):hover { border-color: var(--accent); }
.quiz-opt.correct { border-color: var(--green); background: var(--green-bg); color: var(--green); font-weight: 700; }
.quiz-opt.wrong   { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.quiz-opt.dim     { opacity: 0.5; }
.quiz-explain {
  margin-top: 10px; padding: 10px 12px;
  background: var(--accent-bg);
  border-radius: 8px;
  font-size: 12.5px; line-height: 1.6;
}

/* ═══ AI 집중 모드 플로팅 위젯 ═══════════════════════════ */
.focus-floating {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + 16px);
  width: 64px; height: 64px;
  border-radius: 50%;
  z-index: 60;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: transform 0.15s;
}
.focus-floating:active { transform: scale(0.94); }
.focus-floating-video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* 얼굴이 그대로 보이면 부담스러우니 블러 처리 — 인식 정확도에는 영향 없음 */
  filter: blur(14px) saturate(1.6) brightness(0.95);
}
.focus-floating-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 2px var(--surface), inset 0 0 14px rgba(0,0,0,0.25);
  animation: focusPulse 2s ease-in-out infinite;
}
.focus-floating-ring.good { border-color: var(--green); }
.focus-floating-ring.warn { border-color: var(--amber); }
.focus-floating-ring.bad  { border-color: var(--red); animation: focusPulseFast 0.6s ease-in-out infinite; }
@keyframes focusPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 0 rgba(29,78,216,0.35); }
  50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px rgba(29,78,216,0); }
}
@keyframes focusPulseFast {
  0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 0 rgba(239,68,68,0.5); }
  50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 8px rgba(239,68,68,0); }
}

/* ── 내 문제집 카드 ─────────────────────────────────── */
.my-quiz-item { cursor: pointer; }
.my-quiz-item .list-item-right { display: flex; align-items: center; gap: 6px; }
