/* ================================================
   홈트리 — Moss & Stone Design System
   ================================================ */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--color-bg);
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Helvetica Neue', Arial, 'Noto Sans KR', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── CSS Custom Properties — Moss & Stone ── */
:root {
  --color-bg: #F5F3EF;
  --color-surface: #FFFFFF;
  --color-surface-2: #EDEAE5;
  --color-surface-3: #E0DDD7;
  --color-text: #2C3530;
  --color-text-muted: #8A9590;
  --color-text-light: #B0B8B4;
  --color-accent: #4A8B6E;
  --color-accent-dark: #3A7058;
  --color-accent-light: #E5F0EA;
  --color-border: rgba(74,139,110,0.12);
  --color-border-strong: rgba(74,139,110,0.20);
  --color-success: #52B788;
  --color-error: #E05252;
  --color-warning: #F0AD4E;
  --color-gold: #B8860B;
  --color-overlay: rgba(28, 35, 30, 0.55);

  /* Glass */
  --glass-bg: rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.4);
  --glass-blur: blur(20px);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.10);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --tabbar-height: 84px;
  --header-height: 56px;

  --transition-fast: all 0.15s ease;
  --transition: all 0.25s ease;
  --transition-slow: all 0.4s ease;
}

/* ── Dark Mode — Moss & Stone ── */
[data-theme="dark"] {
  --color-bg: #181D1A;
  --color-surface: #222A25;
  --color-surface-2: #2A332D;
  --color-surface-3: #343D37;
  --color-text: #E5EDE8;
  --color-text-muted: #8A9590;
  --color-text-light: #5A6560;
  --color-accent: #5EA882;
  --color-accent-dark: #7BC4A0;
  --color-accent-light: #1E3028;
  --color-border: rgba(94,168,130,0.15);
  --color-border-strong: rgba(94,168,130,0.25);
  --color-gold: #D4A028;
  --color-overlay: rgba(0, 0, 0, 0.70);

  --glass-bg: rgba(34,42,37,0.75);
  --glass-border: rgba(94,168,130,0.12);

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

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.35; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
p  { line-height: 1.7; }

/* ── Layout Containers ── */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  overflow-x: clip; /* clip은 fixed 자식에 영향 없음 */
}

.page-content {
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--space-4));
  min-height: 100dvh;
}

.section {
  padding: var(--space-5) var(--space-4);
}

.section + .section {
  padding-top: 0;
}

/* ── Page Header ── */
.page-header {
  background: transparent;
  border-bottom: none;
  padding: var(--space-4) var(--space-4) var(--space-3);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 16px; right: 16px;
  height: 1px;
  background: var(--color-border);
}
[data-theme="dark"] .page-header {
  background: transparent;
}
.page-header h1,
.page-header h2 {
  color: var(--color-text);
  font-size: 1.25rem;
  font-weight: 450;
  letter-spacing: 1.2px;
  flex: 1;
}
.page-header .header-icon {
  font-size: 1.4rem;
}

/* ── Card (Glass) ── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.card-body {
  padding: var(--space-4);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-full);
  padding: 14px var(--space-6);
  min-height: 48px;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { background: var(--color-accent-dark); }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.btn-secondary:hover { background: var(--color-surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  padding: 10px var(--space-4);
  min-height: 40px;
}
.btn-ghost:hover { background: var(--color-accent-light); }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 1.1rem;
}

.btn-danger {
  background: #FEE8E8;
  color: var(--color-error);
}
[data-theme="dark"] .btn-danger {
  background: #3A1818;
  color: #F08080;
}

.btn-full { width: 100%; }

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

/* ── Bottom Tab Bar (Glass) ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  -webkit-transform: translateX(-50%) translateZ(0);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-bg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: stretch;
  z-index: 500;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 6px var(--space-1);
  text-decoration: none;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  height: var(--tabbar-height);
}

.tab-item .tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  transition: var(--transition-fast);
}

.tab-item .tab-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-text-muted);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-item.active {
  color: var(--color-accent);
}

.tab-item.active .tab-icon svg {
  stroke: var(--color-accent);
}

/* Pill-shaped active indicator */
.tab-item.active::before {
  content: '';
  position: absolute;
  inset: 8px 4px;
  background: rgba(74,139,110,0.1);
  border-radius: 14px;
  z-index: -1;
}

[data-theme="dark"] .tab-item.active::before {
  background: rgba(94,168,130,0.12);
}

/* ── Background Blobs ── */
.bg-blobs {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}
.blob-1 {
  width: 280px; height: 280px;
  background: rgba(74,139,110,0.07);
  top: -60px; right: -80px;
}
.blob-2 {
  width: 220px; height: 220px;
  background: rgba(184,134,11,0.05);
  bottom: 140px; left: -100px;
}
.blob-3 {
  width: 200px; height: 200px;
  background: rgba(74,139,110,0.05);
  bottom: -50px; right: -50px;
}
[data-theme="dark"] .blob-1 { background: rgba(94,168,130,0.06); }
[data-theme="dark"] .blob-2 { background: rgba(212,160,40,0.04); }
[data-theme="dark"] .blob-3 { background: rgba(94,168,130,0.04); }

/* ── Member Card (Login Page) ── */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  background: var(--color-bg);
  position: relative;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-brand-label {
  font-size: 0.975rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.login-brand-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: var(--space-2);
  line-height: 1;
}

.login-logo p:not(.login-brand-label) {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.member-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-3);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 110px;
  box-shadow: var(--shadow-md);
}

.member-card:hover,
.member-card:focus-visible {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.member-card:active {
  transform: scale(0.96);
}

.member-card:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.member-card .member-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.member-card .member-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.member-card.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* Member card 5th item centered */
.member-grid .member-card:nth-child(4) {
  grid-column: 1;
}
.member-grid .member-card:nth-child(5) {
  grid-column: 2;
}

/* ── PIN Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6) var(--space-6) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.modal-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.modal-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.pin-selected-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--space-5);
  padding: 4px var(--space-3) 6px;
  background: var(--color-accent-light);
  border-radius: var(--radius-lg);
}

.pin-selected-member .member-emoji {
  font-size: 2rem;
  line-height: 0;
}
.pin-selected-member .member-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-accent-dark);
}

.pin-input-wrapper {
  position: relative;
  margin-bottom: var(--space-4);
}

.pin-input {
  width: 100%;
  height: 60px;
  font-family: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  caret-color: var(--color-accent);
  -webkit-text-security: disc;
  text-security: disc;
}

.pin-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.pin-input.error {
  border-color: var(--color-error);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-border-strong);
  transition: var(--transition-fast);
}

.pin-dot.filled {
  background: var(--color-accent);
  transform: scale(1.15);
}

/* ── Toast Notification (중앙 팝업) ── */
.toast-container {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  gap: var(--space-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: all;
  animation: toastCenterIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  max-width: 320px;
}

.toast.toast-success {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(74,139,110,0.08), var(--color-surface));
}
.toast.toast-error {
  border-color: var(--color-error);
  background: linear-gradient(135deg, rgba(224,82,82,0.08), var(--color-surface));
}
.toast.toast-info {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(74,139,110,0.05), var(--color-surface));
}

.toast.toast-out {
  animation: toastCenterOut 0.25s ease forwards;
}

@keyframes toastCenterIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes toastCenterOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.8); opacity: 0; }
}

/* ── Loading Spinner ── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 8888;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.spinner-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.inline-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.section-header .see-all {
  font-size: 0.82rem;
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* ── Photo Grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.photo-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-surface-2);
  position: relative;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-item:hover img { transform: scale(1.05); }

.photo-item .photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: var(--space-2);
}

.photo-item:hover .photo-overlay { opacity: 1; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox img {
  max-width: 100%;
  max-height: 80dvh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-caption {
  color: #fff;
  font-size: 0.9rem;
  margin-top: var(--space-3);
  text-align: center;
  padding: 0 var(--space-4);
  opacity: 0.85;
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ── Cheer Cards ── */
.cheer-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.cheer-card + .cheer-card { margin-top: var(--space-3); }

.cheer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.cheer-target {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.cheer-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.cheer-message {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-text);
}

/* ── Profile ── */
.profile-hero {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-5);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding-bottom: var(--space-5);
}

.profile-banner {
  width: 100%;
  height: 100px;
  background: linear-gradient(180deg,
    rgba(74,139,110,0.10) 0%,
    rgba(74,139,110,0.04) 60%,
    transparent 100%);
  position: relative;
  flex-shrink: 0;
}
[data-theme="dark"] .profile-banner {
  background: linear-gradient(180deg,
    rgba(94,168,130,0.12) 0%,
    rgba(94,168,130,0.04) 60%,
    transparent 100%);
}

.profile-avatar {
  width: 110px;
  height: 110px;
  min-width: 110px;
  min-height: 110px;
  margin-top: -55px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  overflow: hidden;
  position: relative;
}

.profile-avatar span {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-avatar img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  transform: scale(1.35);
}

.profile-name {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  margin-top: 8px;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.profile-bio {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.6;
}
.bio-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  width: 100%;
}
.bio-wrap .profile-bio {
  flex: 0 1 auto;
}
.bio-edit-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.5;
  transition: opacity 0.15s;
  color: var(--color-text-muted);
  position: absolute;
  right: 16px;
}
.bio-edit-btn:hover { opacity: 1; }
.bio-editor {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.bio-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.88rem;
  text-align: center;
  outline: none;
}
.bio-input:focus { border-color: var(--color-primary); }
.bio-editor-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.bio-save-btn, .bio-cancel-btn {
  padding: 5px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.bio-save-btn {
  background: var(--color-primary);
  color: #fff;
}
.bio-cancel-btn {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

/* ── Note Area ── */
.note-textarea {
  width: 100%;
  min-height: 120px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.note-textarea:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

/* ── Form Elements ── */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px var(--space-4);
  outline: none;
  transition: var(--transition);
  min-height: 48px;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239A958E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.char-count {
  font-size: 0.78rem;
  color: var(--color-text-light);
  text-align: right;
  margin-top: var(--space-1);
}

.char-count.near-limit { color: var(--color-warning); }
.char-count.at-limit { color: var(--color-error); }

/* ── Quick Cheer Buttons ── */
.quick-cheers {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.quick-cheer-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.quick-cheer-btn:hover,
.quick-cheer-btn:active {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  transform: scale(0.97);
}

/* ── Filter Chips ── */
.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: 0 var(--space-4) var(--space-3);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}

.chip.active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.chip:not(.active):hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ── Timeline Feed ── */
.timeline-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 2px;
}

.timeline-text {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: var(--space-1);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.timeline-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
  cursor: pointer;
}

/* ── Daily Quote ── */
.quote-card {
  background: linear-gradient(135deg, var(--color-accent), var(--color-gold, #B8860B));
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-5) var(--space-4);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.quote-card::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 10px;
  font-size: 8rem;
  font-weight: 900;
  opacity: 0.15;
  line-height: 1;
}

.quote-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: var(--space-4);
  position: relative;
}

.quote-refresh {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: var(--transition-fast);
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.quote-refresh:hover { background: rgba(255,255,255,0.3); }
.quote-refresh:active { transform: scale(0.95); }

/* ── Activity Badges ── */
.badge-row {
  display: flex;
  gap: var(--space-3);
}

.badge-item {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-2);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.badge-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-2);
}

.badge-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.badge-count {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
  font-feature-settings: 'tnum';
}

/* ── Tab Switcher (inside page) ── */
.tab-switcher {
  display: flex;
  gap: 0;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--space-5);
}

.tab-switch-btn {
  flex: 1;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px var(--space-2);
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}

.tab-switch-btn.active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: var(--shadow-xs);
}

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-label span:first-child {
  font-size: 0.95rem;
  font-weight: 600;
}

.toggle-label span:last-child {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.toggle {
  width: 52px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.toggle.on {
  background: var(--color-accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle.on::after {
  left: calc(100% - 27px);
}

/* ── Settings List ── */
.settings-section {
  margin-bottom: var(--space-5);
}

.settings-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--space-1) var(--space-2);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.settings-item:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.settings-item:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); margin-bottom: 0; }
.settings-item:only-child { border-radius: var(--radius-md); }
.settings-item + .settings-item { border-top: none; }

.settings-item:hover { background: var(--color-surface-2); }

a.settings-item {
  text-decoration: none;
  color: var(--color-text);
}

a.chip {
  text-decoration: none;
  color: inherit;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.settings-item-text {
  flex: 1;
}

.settings-item-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1px;
  color: var(--color-text);
}

.settings-item-text p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.settings-item-arrow {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--color-surface-2);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  -webkit-tap-highlight-color: transparent;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.upload-area .upload-icon { font-size: 2rem; }

.upload-area p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.upload-area span {
  color: var(--color-accent);
  font-weight: 600;
}

/* ── Undo Banner ── */
.undo-banner {
  position: fixed;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--space-3));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: var(--transition);
  z-index: 800;
  white-space: nowrap;
  pointer-events: none;
  max-width: calc(100% - var(--space-8));
}

.undo-banner.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

.undo-btn {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  min-height: 30px;
}

.undo-progress {
  width: 30px;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.undo-progress-bar {
  height: 100%;
  background: rgba(255,255,255,0.7);
  width: 100%;
  transform-origin: left;
  animation: undoCountdown 10s linear forwards;
}

@keyframes undoCountdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ── Session Info Card ── */
.session-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

.session-avatar {
  font-size: 2.5rem;
  line-height: 1;
}

.session-info h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.session-info p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--color-text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-3); }
.empty-state h3 { font-size: 1rem; font-weight: 700; margin-bottom: var(--space-2); color: var(--color-text); }
.empty-state p { font-size: 0.85rem; line-height: 1.6; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-2) 25%,
    var(--color-surface-3) 50%,
    var(--color-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 16px; width: 100%; margin-bottom: var(--space-2); }
.skeleton-text.sm { height: 12px; width: 60%; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card { height: 80px; border-radius: var(--radius-md); margin-bottom: var(--space-3); }
.skeleton-photo { aspect-ratio: 1; border-radius: var(--radius-xs); }

/* ── Misc Utilities ── */
.mt-auto { margin-top: auto; }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Rank Number Badge ── */
.stock-rank-medal.rank-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Settings SVG Icon ── */
.settings-item-icon svg {
  display: block;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-4) 0;
}

/* ── Home Brand Header ── */
.home-brand-header {
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
  position: relative;
  z-index: 1;
}
.home-settings-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}
.home-settings-btn:active { background: var(--color-surface-2); }
.home-brand-label {
  font-size: 1.024rem;
  font-weight: 700;
  letter-spacing: 3.15px;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.home-brand-icon {
  font-size: 3.15rem;
  margin-bottom: var(--space-2);
  line-height: 1;
}
.home-brand-greeting {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.4;
}
.home-brand-greeting strong {
  font-weight: 800;
}

/* ── Home greeting banner (legacy) ── */
.greeting-banner {
  padding: var(--space-5) var(--space-4) var(--space-3);
  position: relative;
  z-index: 1;
}
.greeting-banner .greeting-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.greeting-banner .greeting-main {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ── Scrollable photo strip ── */
.photo-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: 0 var(--space-4) var(--space-2);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.photo-strip::-webkit-scrollbar { display: none; }

.photo-strip-item {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--color-surface-2);
}
.photo-strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.photo-strip-item:hover img { transform: scale(1.06); }

/* ── Inline bio edit ── */
.bio-edit-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.bio-edit-row .form-textarea { flex: 1; min-height: 72px; }

/* ── Progress bar ── */
.progress-bar-wrap {
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  margin-top: var(--space-2);
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ── Responsive adjustments ── */
@media (min-width: 420px) {
  .member-grid {
    gap: var(--space-4);
  }
}

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