* { box-sizing: border-box; }

/* ============ Design tokens (Apple / Linear / Notion / Toss mood) ============ */
:root,
:root[data-theme="light"],
:root[data-theme="character"] {
  color-scheme: light;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --bg-glow: #eef2ff;
  --card: #ffffff;
  --surface-2: #f1f5f9;
  --text: #111827;
  --subtext: #6b7280;
  --border: #e5e7eb;

  /* legacy aliases used by the detection/timer components */
  --accent: var(--primary);
  --accent-2: #3b82f6;
  --good: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --surface: var(--card);
  --text-dim: var(--subtext);

  /* categorical chart palette (validated: light-mode adjacent CVD/contrast pass) */
  --chart-1: #2a78d6; /* focus */
  --chart-2: #eb6834; /* drowsy */
  --chart-3: #1baf7a; /* sleep */
  --chart-4: #eda100; /* distraction */
  --chart-5: #e87ba4; /* away */

  /* cafe floor plan zone accents */
  --zone-group: #0d9488;
  --zone-lounge: #ec4899;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 1px rgba(17, 24, 39, 0.03);
  --shadow-md: 0 4px 16px rgba(17, 24, 39, 0.07);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, 0.10);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #3b82f6;
  --primary-dark: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --bg: #0b0d14;
  --bg-glow: #141a2e;
  --card: #12141f;
  --surface-2: #171a28;
  --text: #e8e9ee;
  --subtext: #9198ac;
  --border: #232739;

  --accent: var(--primary);
  --accent-2: #60a5fa;
  --good: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --surface: var(--card);
  --text-dim: var(--subtext);

  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --chart-4: #c98500;
  --chart-5: #d55181;

  --zone-group: #2dd4bf;
  --zone-lounge: #f472b6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

:root[data-theme="wood"] {
  color-scheme: light;
  --primary: #a5652f;
  --primary-dark: #874f22;
  --primary-soft: #f0e0c8;
  --success: #6f8f4d;
  --danger: #b5533f;
  --warning: #c98a2c;
  --bg: #f6efe1;
  --bg-glow: #eee0c4;
  --card: #fffbf3;
  --surface-2: #efe2c9;
  --text: #3c2c1e;
  --subtext: #8a7358;
  --border: #e3d3b4;

  --accent: var(--primary);
  --accent-2: #c17f3e;
  --good: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --surface: var(--card);
  --text-dim: var(--subtext);

  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;
  --chart-4: #eda100;
  --chart-5: #e87ba4;

  --zone-group: #4f8a72;
  --zone-lounge: #c1728f;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(60, 44, 30, 0.06);
  --shadow-md: 0 4px 16px rgba(60, 44, 30, 0.10);
  --shadow-lg: 0 16px 40px rgba(60, 44, 30, 0.16);
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/woff2/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 500px at 50% -12%, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
  margin: 0;
  padding: 0 0 60px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.hidden { display: none !important; }
a { color: inherit; }

.icon {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
  margin-right: 6px;
  opacity: 0.85;
}

/* ============ Topbar ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brandMark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.brandIcon { width: 24px; height: 24px; object-fit: contain; }
.brandName { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }

.navTabs { display: none; gap: 4px; margin-left: 8px; }
.navTabs.show { display: flex; }
.navTab {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--subtext);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.navTab:hover { color: var(--text); background: var(--surface-2); }
.navTab.active { color: var(--primary); background: var(--primary-soft); }

.topbarSpacer { flex: 1; }

.themeSelect {
  background: var(--surface-2);
  color: var(--subtext);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.themeSelect:hover { color: var(--text); border-color: var(--primary); }

#userInfo { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--subtext); }
.avatarChip {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* ============ Buttons ============ */
button {
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  transition: opacity 0.15s ease, transform 0.05s ease, box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.primaryBtn { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,0.28); }
.primaryBtn:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 8px 22px rgba(37,99,235,0.38); }
.secondaryBtn { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.secondaryBtn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.dangerBtn { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.dangerBtn:hover:not(:disabled) { background: rgba(239, 68, 68, 0.18); }
.ghostBtn { background: transparent; color: var(--subtext); border: 1px solid var(--border); }
.ghostBtn:hover { color: var(--text); border-color: var(--primary); }
.fullWidth { flex: 1 1 0%; }
.bigBtn { padding: 15px 28px; font-size: 15px; border-radius: 14px; }

/* ============ Layout / views ============ */
.viewRoot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 0;
}
.view { animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes pulseHard { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.75; transform: scale(1.015); } }
@keyframes bounceIn {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 4px 14px rgba(37,99,235,0.28); }
  50% { box-shadow: 0 4px 26px rgba(37,99,235,0.5); }
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
}

/* ============ Card ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card.hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cardHead { margin-bottom: 14px; }
.card h2 {
  font-size: 12px;
  font-weight: 800;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  display: flex;
  align-items: center;
}

/* ============ Hero (landing) ============ */
.hero {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  padding: 76px 32px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(147, 197, 253, 0.35), transparent 60%),
    radial-gradient(600px 320px at 85% 100%, rgba(37, 99, 235, 0.5), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 64px);
  z-index: -1;
}
.heroKicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.25);
  margin-bottom: 22px;
}
.heroTitle {
  font-size: clamp(32px, 5.4vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  line-height: 1.15;
}
.heroTitle .accentWord { color: #93c5fd; }
.heroSub {
  font-size: clamp(15px, 2vw, 18px);
  color: rgba(255,255,255,0.82);
  margin: 0 0 34px;
}
.heroActions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.heroActions .primaryBtn { padding: 15px 30px; font-size: 15.5px; }

.heroStats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: -46px 0 40px;
  position: relative;
  z-index: 2;
}
.heroStatCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.heroStatValue {
  font-size: 26px; font-weight: 800; color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.heroStatLabel { font-size: 12.5px; color: var(--subtext); margin-top: 4px; }

.sectionTitle { font-size: 20px; font-weight: 800; margin: 44px 0 18px; letter-spacing: -0.01em; }
.sectionSub { color: var(--subtext); font-size: 13.5px; margin: -12px 0 20px; }

/* ============ Ticket cards ============ */
.ticketGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.ticketCard {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ticketCard:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-md); border-color: var(--primary); }
.ticketCard.selected { border-color: var(--primary); background: var(--primary-soft); }
.ticketBadge {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.ticketLabel { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.ticketPrice { font-size: 15px; color: var(--subtext); font-weight: 600; }
.ticketPrice b { color: var(--text); font-weight: 800; }

/* ============ Payment ============ */
.paymentPanel { max-width: 460px; margin: 0 auto; }
.paymentSummary {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0 26px;
  display: flex; justify-content: space-between; align-items: center;
}
.paymentRow { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.paymentRow:last-child { border-bottom: none; }
.paymentTotal { font-size: 20px; font-weight: 800; }

.paySuccess { text-align: center; padding: 40px 10px; }
.paySuccessIcon {
  width: 84px; height: 84px; margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.paySuccessIcon svg { width: 42px; height: 42px; stroke: var(--success); }
.paySuccessTitle { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.paySuccessSub { color: var(--subtext); font-size: 14px; margin-bottom: 30px; }

#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ============ Dashboard ============ */
.greetingRow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.greetingDate { font-size: 13px; color: var(--subtext); margin-bottom: 4px; }
.greetingTitle { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }

.statCardGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
.statCard {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.statCardTop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.statCardIcon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.statCardIcon svg { width: 18px; height: 18px; }
.statCardValue { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.statCardLabel { font-size: 12.5px; color: var(--subtext); margin-top: 2px; }

/* ============ Seat grid ============ */
.seatLegend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; font-size: 12.5px; color: var(--subtext); }
.seatLegend span { display: inline-flex; align-items: center; gap: 6px; }
.legendDot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legendDot.empty { background: var(--surface-2); border: 1px solid var(--border); }
.legendDot.occupied { background: var(--primary); }
.legendDot.mine { background: var(--success); }


.cafeFloor {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  overflow-x: auto;
}

.floorTopRow { display: flex; gap: 14px; margin-bottom: 14px; min-width: 680px; }
.floorMainHall {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  min-width: 680px;
}
.floorBottomRow { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; min-width: 680px; }

.floorZone {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.zoneHeader {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 800; color: var(--subtext);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.zoneHeader .icon { width: 14px; height: 14px; opacity: 0.85; flex-shrink: 0; }

/* -- 출입구 -- */
.floorZoneEntrance {
  flex: 0 0 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-style: dashed;
  border-top-style: dashed;
  border-top-color: var(--primary);
}
.floorZoneEntrance .zoneHeader { margin: 8px 0 0; }
.doorGraphic { position: relative; width: 38px; height: 48px; display: flex; gap: 2px; }
.doorGraphic::before {
  content: ""; position: absolute; inset: -12px; border-radius: 16px; z-index: -1;
  background: radial-gradient(circle, var(--primary-soft), transparent 70%);
  animation: pulse 2.4s ease-in-out infinite;
}
.doorLeaf { flex: 1; background: var(--card); border: 1.5px solid var(--primary); border-radius: 3px; position: relative; }
.doorLeaf::after {
  content: ""; position: absolute; top: 50%; width: 2.5px; height: 2.5px; border-radius: 50%;
  background: var(--primary); transform: translateY(-50%);
}
.doorLeaf:first-child::after { right: 4px; }
.doorLeaf:last-child::after { left: 4px; }

/* -- 프리미엄석 -- */
.floorZonePremium {
  flex: 1 1 auto;
  border-top-color: var(--warning);
  background: linear-gradient(160deg, color-mix(in srgb, var(--warning) 7%, var(--card)), var(--card));
}
.floorZonePremium .zoneHeader { color: color-mix(in srgb, var(--warning) 65%, var(--subtext)); }
.seatRow { display: flex; gap: 8px; flex-wrap: wrap; }
.seat.zone-premium {
  background: linear-gradient(160deg, var(--primary-soft), var(--surface-2));
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 20%, transparent) inset;
}
.seat.zone-premium svg { color: color-mix(in srgb, var(--warning) 80%, var(--subtext)); }

/* Three separate premium rooms (A01-04 / A05-07 / A08-10), each its own
   3D scene - a thin wall divider between them instead of one flat row so
   the 2D floor plan matches the fact that they're different rooms. */
.premiumRooms { display: flex; align-items: stretch; gap: 10px; }
.premiumRoom { display: flex; align-items: center; }
.roomWall {
  width: 2px;
  align-self: stretch;
  background: repeating-linear-gradient(
    to bottom,
    color-mix(in srgb, var(--warning) 35%, var(--border)) 0 4px,
    transparent 4px 8px
  );
  opacity: 0.7;
}

.zoneHint { margin-left: auto; font-weight: 600; text-transform: none; letter-spacing: 0; opacity: 0.8; }
.clickableZone { cursor: pointer; transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease; }
.clickableZone:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.clickableZone:hover .zoneHeader { filter: brightness(1.2); }

/* -- 메인 홀 (창가석 / 일반석) -- */
.windowWall {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--bg-glow), transparent);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
}
.windowWallLabel {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 10.5px; font-weight: 800; color: var(--subtext);
  letter-spacing: 0.05em; opacity: 0.75;
}
.windowWallSeats { display: flex; flex-direction: column; gap: 8px; }
/* Six separate general-seating rooms (2 rows of 4 desks each, matching the
   3D GeneralRoomEnvironment) arranged as a 3x2 block of small rooms with a
   corridor gap between them, instead of one flat 48-seat grid. */
.generalHall {
  display: grid;
  grid-template-columns: repeat(2, auto);
  grid-template-rows: repeat(3, auto);
  gap: 22px 34px;
  align-content: start;
  justify-content: center;
}
.generalRoom {
  display: grid;
  grid-template-columns: repeat(4, 40px);
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.generalRoom .seat { width: 40px; height: 40px; }
.seat.zone-window { background: linear-gradient(180deg, var(--primary-soft), var(--surface-2)); }
.seat.zone-window svg { color: var(--primary); }

/* -- 단체 스터디룸 -- */
.floorZoneGroup {
  border-top-color: var(--zone-group);
  background: linear-gradient(160deg, color-mix(in srgb, var(--zone-group) 6%, var(--card)), var(--card));
}
.floorZoneGroup .zoneHeader { color: color-mix(in srgb, var(--zone-group) 65%, var(--subtext)); }
.groupRoomScene { position: relative; min-height: 220px; display: flex; align-items: center; justify-content: center; }
.groupTable {
  width: 112px; height: 72px; border-radius: 34px;
  background: color-mix(in srgb, var(--zone-group) 12%, var(--surface-2));
  border: 1.5px solid color-mix(in srgb, var(--zone-group) 35%, var(--border));
}
.groupSeatRing { position: absolute; inset: 0; }
.groupSeatRing .seat {
  position: absolute; width: 46px; height: 46px;
  border-color: color-mix(in srgb, var(--zone-group) 40%, var(--border));
  background: color-mix(in srgb, var(--zone-group) 10%, var(--surface-2));
}
.groupSeatRing .seat svg { color: var(--zone-group); }
.groupSeatRing .seat:nth-child(1) { top: 14px; left: 6%; }
.groupSeatRing .seat:nth-child(2) { top: 0; left: 50%; margin-left: -23px; }
.groupSeatRing .seat:nth-child(3) { top: 14px; right: 6%; }
.groupSeatRing .seat:nth-child(4) { bottom: 14px; left: 6%; }
.groupSeatRing .seat:nth-child(5) { bottom: 0; left: 50%; margin-left: -23px; }
.groupSeatRing .seat:nth-child(6) { bottom: 14px; right: 6%; }

/* -- 휴게실 -- */
.floorZoneLounge {
  border-top-color: var(--zone-lounge);
  background: linear-gradient(160deg, color-mix(in srgb, var(--zone-lounge) 6%, var(--card)), var(--card));
}
.floorZoneLounge .zoneHeader { color: color-mix(in srgb, var(--zone-lounge) 65%, var(--subtext)); }
.loungeScene { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0 4px; }
.loungeSofa {
  width: 100%; max-width: 180px; height: 42px; border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--zone-lounge) 16%, var(--surface-2)), var(--surface-2));
  border: 1.5px solid color-mix(in srgb, var(--zone-lounge) 35%, var(--border));
  position: relative;
}
.loungeSofa::before, .loungeSofa::after {
  content: ""; position: absolute; top: -10px; width: 26%; height: 20px; border-radius: 10px 10px 0 0;
  background: inherit; border: inherit; border-bottom: none;
}
.loungeSofa::before { left: 6%; }
.loungeSofa::after { right: 6%; }
.loungeCountLabel { font-size: 12.5px; font-weight: 700; color: var(--subtext); }

/* -- 좌석(책상) 기본 -- */
.seat {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--subtext);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
  width: 46px;
  height: 46px;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.seatRow .seat { width: 46px; flex: none; }
.seat:hover { transform: translateY(-2px) scale(1.08); box-shadow: var(--shadow-md); z-index: 3; }
.seat.occupied { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.seat.mine { background: var(--success); border-color: var(--success); color: #fff; animation: glow 2s ease infinite; }
.seat svg:not(.charSvg) { width: 13px; height: 13px; opacity: 0.55; }
.seat.occupied svg:not(.charSvg), .seat.mine svg:not(.charSvg) { opacity: 0.85; }

.seatMiniLabel {
  position: static;
  font-size: 12px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text); opacity: 0.92; pointer-events: none;
}
.seat.occupied .seatMiniLabel { color: var(--primary-dark); opacity: 0.9; }
.seat.mine .seatMiniLabel { color: #fff; opacity: 1; }
.seatAvatarInitial {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.charWrap { display: flex; align-items: center; justify-content: center; }
.seat .charSvg {
  position: static;
  width: 26px; height: 26px;
  top: auto; right: auto;
  opacity: 1;
  animation: charBob 2.4s ease-in-out infinite;
}
.walkingChar .charSvg {
  position: static;
  width: 30px; height: 30px;
  top: auto; right: auto;
  opacity: 1;
  animation: charBob 2.4s ease-in-out infinite;
}
@keyframes charBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

.walkingChar {
  position: absolute;
  width: 30px; height: 30px;
  z-index: 50;
  pointer-events: none;
  transition: left 0.9s cubic-bezier(0.4, 0, 0.2, 1), top 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.walkingChar .charSvg { animation: charWalk 0.35s ease-in-out infinite; }
@keyframes charWalk { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3px) rotate(3deg); } }

/* -- 좌석 실시간 미리보기 (hover) -- */
.seatPreview {
  position: fixed; z-index: 500; width: 210px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 12px 14px;
  pointer-events: none;
  animation: fadeIn 0.12s ease;
}
.seatPreview.hidden { display: none; }
.seatPreviewHead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.seatPreviewSeat { font-weight: 800; font-size: 14px; }
.seatPreviewZone { font-size: 11px; color: var(--subtext); font-weight: 600; }
.seatPreviewUser { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.seatPreviewRow { display: flex; justify-content: space-between; font-size: 12px; color: var(--subtext); padding: 3px 0; }
.seatPreviewRow span:last-child { color: var(--text); font-weight: 600; }

/* seat modal */
.modalOverlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(3px);
}
.modalCard {
  background: var(--card); border-radius: var(--radius-lg); padding: 28px;
  width: min(360px, 90vw);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modalTitle { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.modalSub { font-size: 13px; color: var(--subtext); margin-bottom: 18px; }
.modalInfoRow { display: flex; justify-content: space-between; font-size: 13.5px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.modalInfoRow:last-of-type { border-bottom: none; }
.modalActions { display: flex; gap: 10px; margin-top: 20px; }

/* auth modal */
.authModalCard { width: min(380px, 90vw); position: relative; }
.modalCloseBtn {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px;
  border: none; background: transparent; color: var(--subtext); font-size: 20px;
  cursor: pointer; line-height: 1; border-radius: 50%;
}
.modalCloseBtn:hover { background: var(--primary-soft); color: var(--text); }

.authTabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--primary-soft); border-radius: var(--radius-sm); padding: 4px; }
.authTab {
  flex: 1; padding: 9px 0; border: none; background: transparent; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; color: var(--subtext); cursor: pointer;
}
.authTab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

.authForm { display: flex; flex-direction: column; gap: 10px; }
.authInput {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px;
}
.authInput:focus { outline: none; border-color: var(--primary); }
.authError { color: #dc2626; font-size: 12.5px; margin: 0; }
.authSubmitBtn { width: 100%; margin-top: 4px; }

.authDivider { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; font-size: 12px; color: var(--subtext); }
.authDivider::before, .authDivider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.authSocialRow { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.authSocialRow > div { width: 100%; }
#googleSignInBtn {
  height: 40px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kakaoBtn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 0; border-radius: var(--radius-sm); border: none; cursor: pointer;
  background: #fee500; color: #391b1b; font-size: 14px; font-weight: 700;
}
.kakaoBtn:hover { background: #fada00; }

/* chat modal */
.chatModalCard { width: min(420px, 92vw); position: relative; display: flex; flex-direction: column; max-height: 80vh; }
.chatMessages {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 320px; min-height: 120px; overflow-y: auto;
  padding: 4px 2px; margin: 4px 0 12px;
}
.chatEmpty { font-size: 12.5px; color: var(--subtext); text-align: center; margin: 20px 0; }
.chatMsg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.chatMsg.mine { align-self: flex-end; align-items: flex-end; }
.chatMsgMeta { font-size: 11px; color: var(--subtext); margin-bottom: 3px; padding: 0 2px; }
.chatMsgBubble {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px 12px; font-size: 13.5px; line-height: 1.4;
  word-break: break-word; white-space: pre-wrap;
}
.chatMsg.mine .chatMsgBubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chatForm { display: flex; gap: 8px; }
.chatForm .authInput { flex: 1; margin: 0; padding: 11px 14px; }
.chatForm button { flex-shrink: 0; }

.loungeModalCard { --lounge-accent: var(--zone-lounge); }
.loungeMusicToggle {
  width: 100%; margin-bottom: 16px;
  background: color-mix(in srgb, var(--zone-lounge) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--zone-lounge) 35%, var(--border));
  color: color-mix(in srgb, var(--zone-lounge) 70%, var(--text));
}
.loungeMusicToggle:hover { border-color: var(--zone-lounge); }
.loungeMusicToggle.active {
  background: color-mix(in srgb, var(--zone-lounge) 22%, var(--surface-2));
  color: var(--zone-lounge);
}
.loungeMusicIcon { margin: 0; }
.loungeMusicToggle.active .loungeMusicIcon { animation: loungeMusicPulse 1.6s ease-in-out infinite; }
@keyframes loungeMusicPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

/* virtual space (3D study room) */
.room3dStage {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #2b241f;
}

.cameraOffRoom3D {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
}

.spaceRoomBackBtn { margin-bottom: 14px; }

.themeCardGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
}
.themeCard {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.themeCard.disabled { opacity: 0.55; }
.themeCardTitle { font-weight: 800; font-size: 16px; }
.themeCardOccupancy { color: var(--subtext); font-size: 13px; }
.themeCardEnterBtn { margin-top: 6px; }

/* study plan (시간표) */
.studyPlanNow {
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; font-size: 15px;
  text-align: center; transition: background 0.2s ease, color 0.2s ease;
}
.studyPlanNow.idle { background: var(--surface-2); color: var(--subtext); font-weight: 700; }
.studyPlanList { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.studyPlanItem {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card);
}
.studyPlanItem.active {
  border-color: var(--item-color, var(--primary));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--item-color, var(--primary)) 22%, transparent);
}
.studyPlanDot { width: 10px; height: 10px; border-radius: 50%; background: var(--item-color, var(--primary)); flex-shrink: 0; }
.studyPlanSubject { font-weight: 700; font-size: 13.5px; flex: 1; }
.studyPlanTime { font-size: 12.5px; color: var(--subtext); }
.studyPlanDeleteBtn {
  background: transparent; border: none; color: var(--subtext); font-size: 15px;
  line-height: 1; padding: 4px 6px; cursor: pointer; border-radius: 6px;
}
.studyPlanDeleteBtn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.studyPlanForm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.studyPlanForm .authInput { width: auto; flex: 1 1 120px; margin: 0; padding: 10px 12px; }
.studyPlanRangeSep { color: var(--subtext); font-size: 13px; }
.planColorInput {
  width: 40px; height: 40px; padding: 2px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; flex-shrink: 0;
}

.cameraToggleRow {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.cameraToggleRow input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.cameraToggleNote { font-size: 12px; color: var(--subtext); margin: 4px 0 0; }

/* ============ Study session ============ */
.studyGrid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; }

#videoWrap { position: relative; width: 100%; border-radius: var(--radius-sm); overflow: hidden; background: #05060a; aspect-ratio: 4 / 3; }
video, canvas#overlay { display: block; width: 100%; height: 100%; object-fit: cover; }
canvas#overlay { position: absolute; top: 0; left: 0; }

#calibrationOverlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(5,6,10,0.78);
  color: #fff;
}
.ringSvg { width: 88px; height: 88px; position: absolute; transform: rotate(-90deg); }
.ringTrack, .ringProgress { fill: none; stroke-width: 5; }
.ringTrack { stroke: rgba(255,255,255,0.12); }
.ringProgress {
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-dasharray: 276.5;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
#calibrationCount { font-size: 32px; font-weight: 800; }
#calibrationText { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 44px; }

#wakeImageOverlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  background: rgba(5,6,10,0.88);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
}
#wakeImageText {
  color: #f87171;
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 0 24px rgba(248,113,113,0.6);
  animation: pulseHard 0.6s infinite;
}
#wakeImage {
  max-width: min(90vw, 520px);
  max-height: 68vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  object-fit: contain;
}

#cameraOffPanel {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  background: #2b241f;
}
.cameraOffSoundBtn {
  /* Small icon+label pill tucked in a corner instead of a big button
     centered over the bottom of the 3D room - it used to cover a chunk of
     the scene right where desks/characters sit. */
  position: absolute;
  top: 10px;
  right: 10px;
  width: fit-content;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
  background: rgba(20,16,12,0.55);
  color: #f0e8dc;
  border-color: transparent;
  z-index: 1;
}
.cameraOffSoundBtn .icon { width: 14px; height: 14px; }

.status {
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.status.idle { background: var(--surface-2); color: var(--subtext); border-color: var(--border); }
.status.focused { background: rgba(34, 197, 94, 0.1); color: var(--success); border-color: rgba(34,197,94,0.28); }
.status.drowsy-warn { background: rgba(245, 158, 11, 0.12); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.status.asleep-alert { background: rgba(239, 68, 68, 0.16); color: var(--danger); border-color: rgba(239,68,68,0.4); animation: pulseHard 0.6s infinite; font-weight: 800; }
.status.away { background: var(--surface-2); color: var(--subtext); border-color: var(--border); }
.status.posture-ok { background: rgba(34, 197, 94, 0.1); color: var(--success); border-color: rgba(34,197,94,0.25); }
.status.posture-bad { background: rgba(245, 158, 11, 0.14); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.status.distraction-ok { background: rgba(34, 197, 94, 0.1); color: var(--success); border-color: rgba(34,197,94,0.25); }
.status.distraction-bad { background: rgba(239, 68, 68, 0.14); color: var(--danger); border-color: rgba(239,68,68,0.35); animation: pulse 1s infinite; }

.sectionDivider { height: 1px; background: var(--border); margin: 20px 0 16px; }

.detectOptionsLabel {
  display: block; font-size: 11px; font-weight: 800; color: var(--subtext);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.extraToggles { display: flex; gap: 8px; flex-wrap: wrap; }
.toggleBtn { background: var(--surface-2); color: var(--subtext); border: 1px solid var(--border); font-size: 13px; padding: 8px 14px; }
.toggleBtn .icon { width: 14px; height: 14px; margin-right: 6px; opacity: 0.9; }
.toggleBtn:hover { border-color: var(--primary); color: var(--text); }
.toggleBtn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.toggleBtn.active .icon { opacity: 1; }
.perfNote { font-size: 11.5px; color: var(--subtext); opacity: 0.85; margin: 10px 0 0; }

.privacyNote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid rgba(37,99,235,0.2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.privacyNote:hover { border-color: var(--primary); }
.privacyNote .icon { width: 14px; height: 14px; margin: 0; opacity: 1; flex-shrink: 0; }

#timerDisplay {
  font-size: 54px; font-weight: 800; text-align: center; margin: 6px 0 16px;
  letter-spacing: -1.5px; font-variant-numeric: tabular-nums; color: var(--text);
}
.timerSettings { display: flex; gap: 16px; margin-bottom: 4px; font-size: 13px; color: var(--subtext); }
.timerSettings input {
  width: 56px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px 6px; margin-left: 6px; font-family: inherit;
}
#timerControls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
#roundInfo { margin-top: 12px; font-size: 13px; color: var(--subtext); }
#roundInfo span { color: var(--text); font-weight: 700; }
#todayTotalInfo { margin-top: 6px; font-size: 13px; color: var(--subtext); }
#todayTotalInfo span { color: var(--primary); font-weight: 700; }

#goalProgress { margin-top: 14px; }
.goalProgressTop { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--subtext); margin-bottom: 6px; }
#goalRemainingText { color: var(--text); font-weight: 700; }
.goalProgressBar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
#goalProgressFill { height: 100%; width: 0%; border-radius: 999px; background: var(--success); transition: width 0.4s ease; }

#focusScoreBox { margin-bottom: 16px; }
.focusScoreTop { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.focusScoreLabel { font-size: 12px; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.06em; }
#focusScoreValue { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.focusScoreBar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
#focusScoreFill { height: 100%; width: 100%; border-radius: 999px; background: var(--success); transition: width 0.4s ease, background 0.4s ease; }

#liveStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.statTile { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 12px; }
.statLabel { font-size: 11.5px; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.05em; }
.statValue { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.statValue small { font-size: 12px; font-weight: 600; opacity: 0.6; margin-left: 2px; }
.statTile.focus .statValue { color: var(--success); }
.statTile.drowsy .statValue { color: var(--warning); }
.statTile.sleep .statValue { color: var(--danger); }
.statTile.away .statValue { color: var(--subtext); }
.statTile.distraction .statValue { color: var(--primary); }

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--subtext); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr:hover { background: var(--surface-2); }

.emptyState { text-align: center; color: var(--subtext); font-size: 13px; padding: 24px 0; }
#loginGate { text-align: center; color: var(--subtext); margin-top: 60px; font-size: 14px; }

/* ============ Attendance ============ */
.calendarHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendarHead h3 { font-size: 17px; font-weight: 800; margin: 0; }
.calendarGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendarDow { text-align: center; font-size: 11.5px; color: var(--subtext); font-weight: 700; padding-bottom: 6px; }
.calendarCell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--subtext); border: 1px solid transparent; gap: 2px;
}
.calendarCell.studied { background: var(--primary-soft); color: var(--primary); font-weight: 800; border-color: rgba(37,99,235,0.25); }
.calendarCell.today { border-color: var(--primary); }
.calendarDot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }

.badgeRow { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.badgePill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--subtext); font-size: 12.5px; font-weight: 700; border: 1px solid var(--border);
}
.badgePill.earned { background: linear-gradient(135deg, var(--primary-soft), #fff); color: var(--primary); border-color: rgba(37,99,235,0.3); }
.streakBox { text-align: center; padding: 18px; }
.streakValue { font-size: 40px; font-weight: 800; color: var(--primary); }
.streakLabel { color: var(--subtext); font-size: 13px; margin-top: 4px; }

/* ============ Stats / charts / leaderboard ============ */
.statsTabs { display: flex; gap: 8px; margin-bottom: 18px; }
.statsTab {
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer;
  background: var(--surface-2); color: var(--subtext); border: 1px solid var(--border);
}
.statsTab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chartWrap { position: relative; height: 260px; }
.chartLegend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; color: var(--subtext); }
.chartLegend span { display: inline-flex; align-items: center; gap: 6px; }
.legendSwatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.leaderRow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.leaderRow:last-child { border-bottom: none; }
.leaderRank { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--subtext); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.leaderRank.top1 { background: #fef3c7; color: #b45309; }
.leaderRank.top2 { background: #e5e7eb; color: #4b5563; }
.leaderRank.top3 { background: #fed7aa; color: #9a3412; }
.leaderName { flex: 1; font-weight: 600; font-size: 13.5px; }
.leaderValue { font-weight: 800; color: var(--primary); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ============ My page ============ */
.profileHead { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profileAvatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; }
.profileName { font-size: 20px; font-weight: 800; }
.profileMail { font-size: 13px; color: var(--subtext); }
.goalRow { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.goalRow input { width: 70px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: inherit; }
.miniStatGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.miniStat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.miniStatValue { font-size: 19px; font-weight: 800; }
.miniStatLabel { font-size: 11.5px; color: var(--subtext); margin-top: 4px; }

.yearlyHighlight {
  margin-top: 16px;
  text-align: center;
  background: linear-gradient(160deg, var(--primary-soft), var(--card) 65%);
  border-color: rgba(37,99,235,0.25);
}
.yearlyIcon {
  width: 48px; height: 48px; margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.yearlyIcon svg { width: 24px; height: 24px; }
.yearlyValue { font-size: 36px; font-weight: 800; color: var(--primary); letter-spacing: -0.01em; }
.yearlyLabel { font-size: 13px; color: var(--subtext); margin-top: 4px; font-weight: 600; }

/* ============ Toast ============ */
#toastHost { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--text); color: var(--card); padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
}

/* ============ Footer ============ */
.siteFooter {
  max-width: 1080px;
  margin: 60px auto 0;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--subtext);
  border-top: 1px solid var(--border);
}
.siteFooter a { color: var(--subtext); text-decoration: none; }
.siteFooter a:hover { color: var(--primary); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .studyGrid { grid-template-columns: 1fr; }
  .statCardGrid { grid-template-columns: repeat(2, 1fr); }
  .heroStats { grid-template-columns: repeat(2, 1fr); }
  .miniStatGrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; row-gap: 10px; }
  .brandName { white-space: nowrap; }
  .navTabs.show {
    flex-basis: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
  }
  .topbarSpacer { flex-basis: 100%; height: 0; }
  #userInfo { flex-wrap: wrap; row-gap: 6px; }
  .hero { padding: 56px 20px; }
  .heroActions .primaryBtn { width: 100%; }
  #liveStats { grid-template-columns: 1fr; }
  .profileHead { flex-direction: column; text-align: center; }
  .studyGrid, .statCardGrid { grid-template-columns: 1fr; }
}
