/* ==========================================================================
   1. Foundation & Layout Reset (Zero-Scroll Viewport)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700;800;900&family=Nunito:wght@700;800;900&display=swap');

:root {
  --brand-purple: #7048e8;
  --brand-purple-dark: #5f3dc4;
  --brand-orange: #ff922b;
  --brand-orange-hover: #f76707;
  --accent-green: #20c997;
  --accent-cyan: #15aabf;
  --accent-yellow: #fcc419;
  --text-main: #212529;
  --text-muted: #868e96;
  --border-subtle: #e9ecef;
  --radius-card: 22px;
}

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

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  font-family: 'Fredoka', cursive, sans-serif;
  background-color: #f1f3f5;
  background-image: radial-gradient(#d0bfff 0.85px, transparent 0.85px);
  background-size: 16px 16px;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* No page scroll */
}

/* ==========================================================================
   2. Floating Doodles Engine
   ========================================================================== */
.bg-doodles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
  display: none;
}

.doodle {
  position: absolute;
  font-size: 1.8rem;
  opacity: 0.9;
  user-select: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
  animation: floatDrift linear infinite;
  bottom: -50px;
}

@keyframes floatDrift {
  0% { transform: translateY(0vh) rotate(0deg) scale(0.9); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { transform: translateY(-115vh) rotate(360deg) scale(1.1); opacity: 0; }
}

/* ==========================================================================
   3. Space Doodle Hook / Splash Screen
   ========================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(145deg, #f3f0ff 0%, #e5dbff 50%, #d0bfff 100%);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow: hidden;
}

.splash-deco-star {
  position: absolute;
  pointer-events: none;
  animation: starTwinkle 2s infinite ease-in-out alternate;
}

@keyframes starTwinkle {
  0% { transform: scale(0.8) rotate(0deg); opacity: 0.6; }
  100% { transform: scale(1.15) rotate(15deg); opacity: 1; }
}

.splash-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: splashPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
}

@keyframes splashPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.splash-rocket-wrap {
  width: 85px;
  height: 85px;
  filter: drop-shadow(0 12px 20px rgba(112, 72, 232, 0.3));
  animation: rocketBob 2.2s infinite ease-in-out alternate;
}

@keyframes rocketBob {
  0% { transform: translateY(0) rotate(-6deg); }
  100% { transform: translateY(-10px) rotate(4deg); }
}

.splash-title-brand {
  font-size: 3rem;
  font-weight: 900;
  color: var(--brand-purple);
  margin: 0;
  letter-spacing: -1px;
}

.splash-title-brand span {
  color: var(--brand-orange);
}

.splash-tagline-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: #495057;
  margin: 0;
}

.splash-loader-track {
  width: 180px;
  height: 7px;
  background: rgba(112, 72, 232, 0.15);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 6px;
}

.splash-loader-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-orange));
  border-radius: 20px;
  animation: splashFill 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes splashFill {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ==========================================================================
   4. App Screen Layout (Fits Screen Exactly Without Scrolling)
   ========================================================================== */
.app-screen {
  width: 100%;
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top, 8px) 12px env(safe-area-inset-bottom, 10px) 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  box-shadow: 0 0 35px rgba(112, 72, 232, 0.08);
  position: relative;
  z-index: 10;
  background-size: cover !important;
  background-position: center !important;
}

@media (min-width: 500px) {
  body { padding: 1rem 0; }
  .app-screen {
    height: 92vh;
    max-height: 840px;
    border-radius: 32px;
    border: 3.5px solid #ffffff;
    box-shadow: 0 20px 50px rgba(95, 61, 196, 0.18);
  }
}

/* ==========================================================================
   5. Clean Header Bar
   ========================================================================== */
.app-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 100; /* Stacks header components above banner */
}

.header-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 101;
}

.brand-logo-area {
  display: flex;
  align-items: center;
}

.brand-logo-text {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--brand-purple);
  letter-spacing: -0.5px;
}

.brand-logo-text span {
  color: var(--brand-orange);
}

.header-right-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Age Selector Pill Button */
.btn-age-pill {
  background: #f3f0ff;
  border: 1.5px solid #d0bfff;
  color: var(--brand-purple);
  border-radius: 50px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(112, 72, 232, 0.1);
  transition: transform 0.1s;
}

.btn-age-pill:active {
  transform: scale(0.96);
}

.online-pill {
  background: #f8f9fa;
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: liveDotBlink 1s infinite ease-in-out;
}

@keyframes liveDotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

.header-sub-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.name-input-appealing {
  flex: 1;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 800;
  border-radius: 50px;
  border: 1.5px solid var(--border-subtle);
  background: #f8f9fa;
  color: var(--text-main);
  outline: none;
}

.name-input-appealing:focus {
  border-color: var(--brand-purple);
  background: #ffffff;
}

.theme-menu-container {
  position: relative;
}

.nav-pill-btn {
  background: #f8f9fa;
  border: 1.5px solid var(--border-subtle);
  border-radius: 50px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  color: #495057;
}

.theme-list-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: 16px;
  padding: 8px 6px;
  display: none;
  flex-direction: column;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
  width: 190px;
  z-index: 1000;
}

.theme-list-dropdown.show { display: flex; }

.theme-list-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 10px;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
}

.theme-list-item:hover {
  background: #f3f0ff;
  color: var(--brand-purple);
}

.theme-list-divider {
  height: 1px;
  background: #f1f3f5;
  margin: 4px 0;
}

.doodle-menu-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #495057;
  cursor: pointer;
}

.doodle-menu-toggle-row input {
  accent-color: var(--brand-purple);
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   6. Ribbon Banner
   ========================================================================== */
.hero-purple-banner {
  background: linear-gradient(135deg, #7048e8 0%, #5f3dc4 60%, #4c28b5 100%);
  border-radius: 18px;
  padding: 10px 14px;
  text-align: center;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(112, 72, 232, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 18px;
  margin-bottom: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
  z-index: 1; /* Keeps banner safely below tooltips & menus */
}

.hero-purple-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
  pointer-events: none;
}

.hero-purple-banner h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.hero-purple-banner p {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffd43b;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   7. Central Dynamic Stage (No scrolling, compact & vivid)
   ========================================================================== */
.main-stage-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 0; /* Prevents flex overflow */
  padding-top: 8px;
}

.prompt-card-avatar-view {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1.5px solid #dee2e6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 14px 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.avatar-badge-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e7f5ff;
  border: 2.5px solid #74c0fc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.avatar-badge-wrap svg {
  width: 44px;
  height: 44px;
}

.avatar-check-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--accent-green);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

.prompt-text-bold {
  font-size: 1.35rem;
  font-weight: 900;
  color: #212529;
  margin: 2px 0 0;
  line-height: 1.28;
}

.prompt-helper-text {
  font-size: 0.8rem;
  color: #868e96;
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

.bonus-card {
  background: #f8f9fa;
  border: 1.5px dashed #ced4da;
  border-radius: 12px;
  padding: 6px 10px;
  width: 100%;
}

.bonus-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #868e96;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.bonus-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.chip {
  background: #e5dbff;
  color: var(--brand-purple);
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Action Buttons Row */
.action-buttons-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
}

.btn-random-topic-main {
  flex: 1.5;
  background: linear-gradient(135deg, #ff922b, #f76707);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(247, 103, 7, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s;
}

.btn-random-topic-main:active {
  transform: scale(0.97);
}

.btn-random-topic-main:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-quick-word-alt {
  flex: 1;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  color: #495057;
  border-radius: 50px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   8. Recording Dock & Mic Bar
   ========================================================================= */
.recording-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
  background: #fa5252;
  padding: 6px;
  border-radius: 12px;
}

.rec-pulse {
  width: 7px;
  height: 7px;
  background: #ffffff;
  border-radius: 50%;
  animation: liveBlink 0.7s infinite alternate;
}

@keyframes liveBlink {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.3; transform: scale(0.7); }
}

.timer-dock {
  background: #ffffff;
  border: 1.5px solid #dee2e6;
  border-radius: 18px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.duration-select {
  border: 1.5px solid #dee2e6;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 6px 8px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.8rem;
  outline: none;
}

.clock-display {
  font-family: 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: #212529;
}

.btn-record-start {
  background: linear-gradient(135deg, #20c997, #12b886);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(32, 201, 151, 0.35);
}

.btn-record-stop {
  background: #fa5252;
  color: #ffffff;
  border: none;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(250, 82, 82, 0.35);
}

/* ==========================================================================
   9. Age Selection Modal Popup
   ========================================================================== */
.age-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(33, 37, 41, 0.65);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 5000;
}

.age-modal-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 18px 16px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(112, 72, 232, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.age-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #212529;
}

.age-modal-header p {
  margin: 3px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.age-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.age-num-btn {
  background: #ffffff;
  border: 1.5px solid #dee2e6;
  border-radius: 14px;
  padding: 12px 0;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  color: #495057;
  cursor: pointer;
  transition: all 0.15s ease;
}

.age-num-btn:hover,
.age-num-btn.active {
  background: #f3f0ff;
  border-color: var(--brand-purple);
  color: var(--brand-purple);
  box-shadow: 0 4px 10px rgba(112, 72, 232, 0.2);
  transform: translateY(-1px);
}

.btn-confirm-age {
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 11px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(112, 72, 232, 0.35);
}

/* ==========================================================================
   10. Evaluation Modal Styles
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(33, 37, 41, 0.65);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 14px;
  z-index: 2000;
}

.modal-sheet {
  background: #ffffff;
  color: var(--text-main);
  padding: 16px 14px;
  border-radius: 26px;
  width: 100%;
  max-width: 400px;
  max-height: 94vh; /* Increased from 90vh */
  max-height: 94dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth iOS momentum scrolling */
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-sheet-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.stars-row {
  font-size: 2rem;
  letter-spacing: 2px;
  margin: 0;
}

.modal-topic-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #212529;
  margin: 0;
}

.modal-audio-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 50px;
  padding: 4px 8px;
}

.modal-audio-bar audio {
  flex: 1;
  height: 36px;
}

.modal-round-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #dee2e6;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.speech-summary-card {
  background: #ffffff;
  border: 1.5px solid #e9ecef;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.speech-summary-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.metric-bar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #495057;
}

.metric-bar-item span:first-child {
  width: 95px;
}

.metric-track {
  flex: 1;
  height: 7px;
  background: #f1f3f5;
  border-radius: 10px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 10px;
}

.summary-card-inner {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.8rem;
  color: #495057;
  max-height: none; /* Removed the 90px ceiling so highlights don't cut off */
  overflow: visible;
  line-height: 1.45;
  word-break: break-word;
}

.topic-feedback-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feedback-header-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 800;
  color: #868e96;
}

.feedback-reactions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.reaction-pill {
  background: #f8f9fa;
  border: 1.5px solid #e9ecef;
  border-radius: 10px;
  padding: 5px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
}

.reaction-emoji { font-size: 1.05rem; }
.reaction-text { font-size: 0.68rem; font-weight: 800; color: #495057; }

.btn-modal-close {
  background: linear-gradient(135deg, #ff922b, #f76707);
  color: #ffffff;
  border: none;
  width: 100%;
  padding: 11px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(247, 103, 7, 0.3);
  flex-shrink: 0; /* Prevents button compression on small viewports */
  margin-top: 2px;
}

.onboarding-guide-badge {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: #ffd43b;
  color: #212529;
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(255, 212, 59, 0.5);
  pointer-events: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   Interactive Avatar Trigger & Selection Modal
   ========================================================================== */
.avatar-badge-wrap {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.avatar-badge-wrap:hover {
  transform: scale(1.05);
}

.avatar-badge-wrap:active {
  transform: scale(0.95);
}

.avatar-edit-icon {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--brand-purple);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 10px;
}

/* Avatar Modal Overlay & Grid */
.avatar-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(33, 37, 41, 0.65);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 5500;
}

.avatar-modal-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 18px 16px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(112, 72, 232, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.avatar-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0;
}

.avatar-option-btn {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 18px;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.avatar-option-btn svg {
  width: 46px;
  height: 46px;
}

.avatar-option-btn span {
  font-size: 0.72rem;
  font-weight: 800;
  color: #495057;
}

.avatar-option-btn.selected,
.avatar-option-btn:hover {
  background: #f3f0ff;
  border-color: var(--brand-purple);
  box-shadow: 0 4px 12px rgba(112, 72, 232, 0.25);
  transform: translateY(-2px);
}

/* ==========================================================================
   Coins & Gamification Styling
   ========================================================================== */
.coin-pill {
  position: relative;
  background: #fff9db;
  border: 1.5px solid #ffe066;
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #d9480f;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 6px rgba(245, 159, 0, 0.18);
  transition: transform 0.15s ease;
}

.coin-pill:hover,
.coin-pill:focus {
  transform: scale(1.04);
}

.coin-icon {
  font-size: 0.95rem;
}

/* Tooltip on Top Coin Pill */
.coin-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 210px;
  background: #212529;
  color: #ffffff;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 9999; /* Floats above everything */
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(-4px);
  pointer-events: none;
}

.coin-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent #212529 transparent;
}

.coin-pill:hover .coin-tooltip,
.coin-pill:focus .coin-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Modal Coin Reward Banner */
.modal-coin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff3bf, #ffe066);
  border: 1.5px solid #fcc419;
  color: #e67700;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 900;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(252, 196, 25, 0.35);
}

.coin-vault-sub {
  font-size: 0.75rem;
  color: #7950f2;
}

.pulse-reward {
  animation: coinCelebrate 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes coinCelebrate {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.coin-bounce {
  display: inline-block;
  animation: miniBounce 1s infinite alternate ease-in-out;
}

@keyframes miniBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}
