:root {
  --bg-stoneware: #F7F2EC;
  --bg-oatmeal: #EDE5DC;
  --surface-glaze: #FFFDF9;
  --surface-tint: #FBF7F2;
  --clay-accent: #D9CFC4;
  --clay-deep: #C3B6A7;
  --ink: #2B303A;
  --ink-soft: #5A554E;
  --taupe: #7A7269;

  --confetti-terracotta: #C8645E;
  --confetti-sky: #8EC5E8;
  --confetti-pink: #EAB8C2;
  --confetti-butter: #F2E48C;
  --confetti-honey: #EBB765;
  --confetti-sage: #AED6A0;

  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 30px;
  --radius-pill: 999px;

  --shadow-ceramic:
    0 10px 26px rgba(74, 58, 43, 0.08),
    0 2px 6px rgba(74, 58, 43, 0.05),
    inset 0 2px 0 rgba(255, 255, 255, 0.85);
  --shadow-card:
    0 6px 18px rgba(74, 58, 43, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-press:
    0 3px 8px rgba(74, 58, 43, 0.08),
    inset 0 2px 4px rgba(74, 58, 43, 0.08);

  --font-display: 'Fredoka', 'Nunito', system-ui, -apple-system, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-stoneware);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  overflow-x: hidden;
}

/* Subtle hand-painted ceramic speckles across the canvas */
.ceramic-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg-stoneware);
  background-image:
    radial-gradient(circle at 12% 16%, rgba(234, 184, 194, 0.34) 0 5px, transparent 6px),
    radial-gradient(circle at 84% 10%, rgba(142, 197, 232, 0.32) 0 6px, transparent 7px),
    radial-gradient(circle at 72% 38%, rgba(242, 228, 140, 0.34) 0 5px, transparent 6px),
    radial-gradient(circle at 20% 56%, rgba(174, 214, 160, 0.32) 0 6px, transparent 7px),
    radial-gradient(circle at 88% 72%, rgba(200, 100, 94, 0.22) 0 5px, transparent 6px),
    radial-gradient(circle at 34% 88%, rgba(235, 183, 101, 0.28) 0 6px, transparent 7px),
    radial-gradient(circle at 52% 24%, rgba(217, 207, 196, 0.35) 0 3px, transparent 4px),
    radial-gradient(circle at 60% 80%, rgba(142, 197, 232, 0.26) 0 4px, transparent 5px);
  background-size: 320px 320px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.app-shell.is-welcome {
  padding-bottom: 32px;
}

.boot-loader {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--taupe);
  font-weight: 700;
}

.boot-logo {
  width: 112px;
  height: auto;
  animation: gentle-bob 1.8s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(74, 58, 43, 0.14));
}

@keyframes gentle-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}

/* Top Header Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(247, 242, 236, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(217, 207, 196, 0.55);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.topbar-titles {
  min-width: 0;
}

.topbar-app-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--taupe);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 207, 196, 0.85);
  background: var(--surface-glaze);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.icon-btn:active {
  transform: scale(0.93);
  box-shadow: var(--shadow-press);
}

.icon-btn.is-active {
  background: var(--confetti-butter);
  border-color: var(--confetti-honey);
}

.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px 0 6px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(217, 207, 196, 0.9);
  background: var(--surface-glaze);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--ink);
  max-width: 132px;
}

.user-chip-btn span.chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Avatars */
.avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 6px rgba(43, 48, 58, 0.14);
  line-height: 1;
  user-select: none;
}

.avatar-xs { width: 28px; height: 28px; font-size: 0.92rem; }
.avatar-sm { width: 38px; height: 38px; font-size: 1.15rem; }
.avatar-md { width: 46px; height: 46px; font-size: 1.45rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 2rem; }

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-enter {
  animation: fade-slide-up 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes fade-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ceramic Cards & Surfaces */
.card {
  background: var(--surface-glaze);
  border: 1.5px solid rgba(217, 207, 196, 0.72);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-ceramic);
  position: relative;
}

.card-oatmeal {
  background: var(--bg-oatmeal);
  border: 1.5px solid rgba(203, 191, 177, 0.7);
  border-radius: var(--radius-md);
  padding: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}

.muted-text {
  color: var(--taupe);
  font-size: 0.9rem;
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #D5746E 0%, #C8645E 100%);
  color: #FFFDF9;
  box-shadow: 0 5px 0 #9D4A45, 0 8px 18px rgba(200, 100, 94, 0.25);
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 0 #9D4A45, 0 4px 10px rgba(200, 100, 94, 0.2);
}

.btn-secondary {
  background: var(--surface-glaze);
  color: var(--ink);
  border-color: var(--clay-accent);
  box-shadow: 0 4px 0 var(--clay-accent), 0 6px 14px rgba(74, 58, 43, 0.06);
}

.btn-sky {
  background: linear-gradient(180deg, #9DD0EF 0%, #82BDE2 100%);
  color: var(--ink);
  box-shadow: 0 4px 0 #5E98BD;
}

.btn-sage {
  background: linear-gradient(180deg, #BCE0AF 0%, #9ECA8F 100%);
  color: var(--ink);
  box-shadow: 0 4px 0 #7AA86B;
}

.btn-danger {
  background: #FCEAE9;
  color: #A63C36;
  border-color: #EBB5B1;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.86rem;
}

.btn-block {
  width: 100%;
}

/* Welcome View */
.welcome-hero {
  text-align: center;
  padding: 20px 14px 8px;
}

.welcome-logo-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.welcome-logo {
  width: 146px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(74, 58, 43, 0.16));
  animation: gentle-bob 3.2s ease-in-out infinite;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.confetti-dots-divider {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.confetti-dots-divider span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 1.5px 1.5px 0 rgba(255, 255, 255, 0.7);
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-item-btn {
  width: 100%;
  text-align: left;
  background: var(--surface-glaze);
  border: 1.5px solid rgba(217, 207, 196, 0.85);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.14s ease;
  font-family: var(--font-body);
  color: var(--ink);
}

.group-item-btn:hover {
  border-color: var(--confetti-terracotta);
}

.group-item-btn:active {
  transform: scale(0.985);
}

.group-item-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.group-item-meta {
  font-size: 0.82rem;
  color: var(--taupe);
  font-weight: 700;
}

.group-lock-pill {
  background: var(--bg-oatmeal);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Forms & Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--clay-accent);
  background: var(--surface-glaze);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--confetti-terracotta);
  box-shadow: 0 0 0 4px rgba(200, 100, 94, 0.14);
}

.textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

/* 4-digit PIN Input */
.pin-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: 0.55em;
  padding-left: 0.9em;
}

/* Emoji & Color Pickers */
.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #FFFDF9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.color-swatch.is-selected {
  transform: scale(1.16);
  outline: 3px solid var(--ink);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.emoji-option {
  height: 42px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--clay-accent);
  background: var(--surface-glaze);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.emoji-option.is-selected {
  background: var(--confetti-butter);
  border-color: var(--ink);
  transform: scale(1.06);
}

/* Member selection list after PIN */
.member-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.member-pick-card {
  background: var(--surface-glaze);
  border: 2px solid var(--clay-accent);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.member-pick-card:hover {
  border-color: var(--confetti-terracotta);
}

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

/* HOME VIEW — Big Tactile Heart CTA */
.home-hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 18px 26px;
  background: radial-gradient(circle at 50% 35%, #FFFDF9 0%, #FBF5EE 70%, #F2E8DC 100%);
}

.greeting-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--bg-oatmeal);
  color: var(--ink-soft);
  border: 1px solid rgba(203, 191, 177, 0.7);
}

.pill-badge.is-butter { background: #FAF1B8; border-color: #E7D572; color: #5D4E10; }
.pill-badge.is-pink { background: #F8DCE2; border-color: #E5A7B4; color: #6E2D3B; }
.pill-badge.is-sky { background: #DFF0FA; border-color: #8EC5E8; color: #204F6D; }
.pill-badge.is-sage { background: #E3F3DD; border-color: #AED6A0; color: #2B5420; }

.heart-cta-wrap {
  position: relative;
  margin: 12px 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.heart-halo {
  position: absolute;
  width: 248px;
  height: 248px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(234, 184, 194, 0.36) 0%,
    rgba(242, 228, 140, 0.25) 45%,
    rgba(142, 197, 232, 0.0) 72%
  );
  animation: pulse-halo 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-halo {
  0%, 100% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}

.heart-cta-btn {
  position: relative;
  z-index: 2;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 4px solid #FFFDF9;
  background: radial-gradient(circle at 32% 28%, #FFFDF9 0%, #F5ECE2 68%, #E5D9CC 100%);
  box-shadow:
    0 14px 0 #CBBDAE,
    0 22px 38px rgba(74, 58, 43, 0.2),
    inset 0 4px 10px rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: transform 0.12s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.12s ease;
}

.heart-cta-btn:hover {
  transform: translateY(-2px) scale(1.015);
}

.heart-cta-btn:active,
.heart-cta-btn.is-pressed {
  transform: translateY(10px) scale(0.94);
  box-shadow:
    0 4px 0 #CBBDAE,
    0 10px 18px rgba(74, 58, 43, 0.18),
    inset 0 3px 8px rgba(74, 58, 43, 0.12);
}

.heart-cta-btn.is-pop {
  animation: ceramic-pop 0.52s cubic-bezier(0.22, 1.6, 0.4, 1);
}

@keyframes ceramic-pop {
  0% { transform: translateY(10px) scale(0.9); }
  45% { transform: translateY(-8px) scale(1.08); }
  75% { transform: translateY(2px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

.heart-cta-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(74, 58, 43, 0.16));
}

.cta-label-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink);
}

.cta-subtitle-text {
  color: var(--taupe);
  font-weight: 700;
  font-size: 0.94rem;
  margin: 0 0 16px;
}

.mini-stats-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-stat-box {
  background: var(--bg-oatmeal);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  border: 1px solid rgba(203, 191, 177, 0.6);
}

.mini-stat-val {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.1;
}

.mini-stat-lbl {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--taupe);
}

/* Segmented Filter Pills */
.segmented-pills {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--bg-oatmeal);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(203, 191, 177, 0.7);
  overflow-x: auto;
}

.seg-pill {
  flex: 1;
  min-width: fit-content;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--taupe);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg-pill.is-active {
  background: var(--surface-glaze);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(74, 58, 43, 0.1);
}

/* Leaderboard Podium */
.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  align-items: end;
  gap: 10px;
  padding: 14px 6px 6px;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.podium-crown {
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: -4px;
}

.podium-name {
  font-weight: 800;
  font-size: 0.84rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-pedestal {
  width: 100%;
  border-radius: 16px 16px 10px 10px;
  padding: 10px 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.podium-1 .podium-pedestal {
  min-height: 92px;
  background: linear-gradient(180deg, #F6EB9F 0%, #EBB765 100%);
}

.podium-2 .podium-pedestal {
  min-height: 72px;
  background: linear-gradient(180deg, #B6DDF4 0%, #8EC5E8 100%);
}

.podium-3 .podium-pedestal {
  min-height: 58px;
  background: linear-gradient(180deg, #F4CFD7 0%, #EAB8C2 100%);
}

.podium-rank {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.podium-score {
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.88;
}

/* Ranked Leaderboard Rows */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-row {
  background: var(--surface-glaze);
  border: 1.5px solid rgba(217, 207, 196, 0.75);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-row.is-me {
  border-color: var(--confetti-terracotta);
  background: linear-gradient(180deg, #FFFDF9 0%, #FDF2F0 100%);
  box-shadow: 0 6px 18px rgba(200, 100, 94, 0.14);
}

.rank-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-pos {
  width: 28px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--taupe);
  text-align: center;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rank-name {
  font-weight: 800;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-sub {
  font-size: 0.78rem;
  color: var(--taupe);
  font-weight: 700;
}

.rank-score-col {
  text-align: right;
  flex-shrink: 0;
}

.rank-score-num {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.rank-score-unit {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--taupe);
}

.rank-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-oatmeal);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* Quick Shortcuts Banner */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.shortcut-card {
  background: var(--surface-glaze);
  border: 1.5px solid rgba(217, 207, 196, 0.8);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  font-family: var(--font-body);
  color: var(--ink);
  transition: transform 0.14s ease;
}

.shortcut-card:active {
  transform: scale(0.97);
}

.shortcut-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 4px 0 2px;
}

.shortcut-card span {
  font-size: 0.8rem;
  color: var(--taupe);
  font-weight: 700;
}

/* KPI Grids & Awards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.kpi-card {
  background: var(--surface-glaze);
  border: 1.5px solid rgba(217, 207, 196, 0.75);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--taupe);
  margin-bottom: 4px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 3px;
}

.awards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.award-card {
  background: var(--surface-tint);
  border: 1.5px solid rgba(217, 207, 196, 0.8);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.award-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.award-winner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.award-winner-name {
  font-weight: 800;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.award-detail {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--taupe);
}

/* Charts & Heatmap */
.chart-box {
  width: 100%;
  overflow-x: auto;
}

.svg-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-tooltip {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-oatmeal);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-month-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-transform: capitalize;
}

.cal-weekdays,
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--taupe);
  padding-bottom: 4px;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: var(--bg-oatmeal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  position: relative;
  color: var(--ink);
  padding: 0;
}

.cal-cell.is-empty {
  background: transparent;
  cursor: default;
}

.cal-cell.lvl-1 { background: #E3F3DD; border-color: #AED6A0; }
.cal-cell.lvl-2 { background: #FAF1B8; border-color: #EBB765; }
.cal-cell.lvl-3 { background: #F5C6CE; border-color: #C8645E; }

.cal-cell.is-today {
  outline: 2px solid var(--confetti-sky);
}

.cal-cell.is-selected {
  outline: 2.5px solid var(--ink);
}

.cal-dot-count {
  font-size: 0.64rem;
  line-height: 1;
  color: var(--ink-soft);
}

/* Activity Feed & History */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
  border: 1px solid rgba(217, 207, 196, 0.7);
}

.feed-body {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
}

.feed-time {
  font-size: 0.75rem;
  color: var(--taupe);
  font-weight: 700;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1.5px solid rgba(217, 207, 196, 0.85);
  box-shadow: 0 -6px 22px rgba(74, 58, 43, 0.08);
}

.nav-item {
  border: none;
  background: transparent;
  border-radius: 16px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--taupe);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.72rem;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.nav-item .nav-ico {
  font-size: 1.28rem;
  line-height: 1.1;
}

.nav-item.is-active {
  background: var(--bg-oatmeal);
  color: var(--ink);
}

.nav-item:active {
  transform: scale(0.94);
}

/* Confetti Canvas & Celebration Overlay */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 80;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 48, 58, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease;
}

.celebration-layer.hidden,
.modal-root.hidden,
.hidden {
  display: none !important;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.celebration-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface-glaze);
  border: 3px solid #FFFDF9;
  border-radius: 32px;
  padding: 24px 20px 20px;
  text-align: center;
  box-shadow: 0 24px 50px rgba(43, 48, 58, 0.25);
  animation: card-bounce-in 0.42s cubic-bezier(0.2, 1.55, 0.4, 1);
}

@keyframes card-bounce-in {
  0% { opacity: 0; transform: scale(0.74) translateY(22px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.celebration-heart {
  width: 112px;
  height: auto;
  animation: wiggle-celebrate 0.75s ease-in-out infinite alternate;
  filter: drop-shadow(0 8px 16px rgba(74, 58, 43, 0.18));
}

@keyframes wiggle-celebrate {
  from { transform: rotate(-6deg) scale(0.98); }
  to { transform: rotate(6deg) scale(1.06); }
}

.celebration-plus {
  display: inline-block;
  margin: 8px 0 6px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: var(--confetti-butter);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--confetti-honey);
}

.celebration-phrase {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 8px 0 14px;
}

.celebration-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-oatmeal);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 14px;
}

.celebration-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--confetti-pink), var(--confetti-butter), var(--confetti-sky), var(--confetti-sage));
  width: 100%;
  transform-origin: left;
  animation: shrink-bar linear forwards;
}

@keyframes shrink-bar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(43, 48, 58, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

@media (min-width: 520px) {
  .modal-root {
    align-items: center;
  }
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface-glaze);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(43, 48, 58, 0.28);
  animation: fade-slide-up 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

/* Toast / Undo Snackbar */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 480px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--ink);
  color: #FFFDF9;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 26px rgba(43, 48, 58, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  animation: fade-slide-up 0.2s ease;
}

.toast.is-error {
  background: #A63C36;
}

.toast-action {
  background: var(--confetti-butter);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* Admin Panel Helpers */
.admin-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-tint);
  border: 1px solid rgba(217, 207, 196, 0.8);
  border-radius: var(--radius-sm);
}

.error-inline {
  background: #FCEAE9;
  color: #9A332D;
  border: 1.5px solid #EBB5B1;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-weight: 800;
  font-size: 0.86rem;
  margin-bottom: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-oatmeal);
  margin-bottom: 12px;
}

.switch-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--confetti-terracotta);
  cursor: pointer;
}

/* Expandable Emoji FAB Drawer */
.emoji-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.emoji-selected-pill {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-oatmeal);
  color: var(--ink);
  border: 1px solid rgba(203, 191, 177, 0.8);
}

.emoji-more-btn {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--bg-oatmeal);
  border-style: dashed;
}

.emoji-more-tag {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  color: var(--confetti-terracotta);
}

.emoji-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(43, 48, 58, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
  animation: fade-in 0.16s ease;
}

@media (min-width: 520px) {
  .emoji-drawer-backdrop {
    align-items: center;
  }
}

.emoji-drawer-sheet {
  width: 100%;
  max-width: 440px;
  max-height: 76dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-glaze);
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 26px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(43, 48, 58, 0.32);
  animation: fade-slide-up 0.2s ease;
}

.emoji-drawer-scroll {
  overflow-y: auto;
  padding-right: 4px;
}

.emoji-drawer-cat {
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--taupe);
  margin: 12px 0 6px;
}

.emoji-drawer-cat:first-child {
  margin-top: 2px;
}

.emoji-drawer-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
