:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --surface-soft: #fff1e6;
  --ink: #2b2d42;
  --muted: #6c757d;
  --primary: #ef476f;
  --primary-dark: #d62851;
  --gold: #ffb703;
  --mint: #06d6a0;
  --blue: #118ab2;
  --border: #f1e3d3;
  --shadow: 0 8px 24px rgba(43, 45, 66, 0.08);
  --radius: 20px;
}

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

body {
  margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

h1, h2, h3, .brand-title {
  font-family: 'Fredoka', sans-serif;
  margin: 0;
}

.hidden {
  display: none !important;
}

/* --- LOGIN SCREEN --- */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top right, #ffe5ec, #fff8f0 55%, #fef3c7);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 28px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 3px solid var(--border);
}

.login-hero {
  text-align: center;
  margin-bottom: 18px;
}

.pokeball-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 4px solid var(--ink);
  background: linear-gradient(to bottom, var(--primary) 46%, var(--ink) 46%, var(--ink) 54%, #ffffff 54%);
  position: relative;
  animation: bob 2.4s ease-in-out infinite;
}

.pokeball-spinner::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffd166;
  border: 3px solid var(--ink);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.brand-title {
  font-size: 2rem;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.family-quick-pick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.quick-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--ink);
}

.quick-pick-btn:hover,
.quick-pick-btn.selected {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: #ffe5ec;
}

.login-form .field {
  margin-bottom: 14px;
}

.login-form label {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.login-form input,
.input-field {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  background: #fffdfb;
  color: var(--ink);
  outline: none;
}

.login-form input:focus,
.input-field:focus {
  border-color: var(--primary);
}

.login-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 14px 0 0;
}

.error-text {
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.88rem;
  margin: 0 0 10px;
}

/* --- BUTTONS --- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-full {
  width: 100%;
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-yes {
  background: var(--mint);
  color: #073b2c;
  box-shadow: 0 4px 0 #04a77c;
}

.btn-no {
  background: #ffd166;
  color: #5c3d00;
  box-shadow: 0 4px 0 #e0a800;
}

.btn-secondary {
  background: #e9ecef;
  color: var(--ink);
  box-shadow: 0 4px 0 #ced4da;
}

.icon-btn {
  background: var(--surface-soft);
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- APP SHELL --- */
.app-shell {
  max-width: 780px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 84px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 248, 240, 0.94);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-mini {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
}

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

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

.stat-chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
  border: 2px solid var(--border);
  background: var(--surface);
}

.berry-chip {
  background: #ffe5ec;
  border-color: #ffb3c6;
}

.streak-chip {
  background: #fef3c7;
  border-color: #fcd34d;
}

.notify-banner {
  margin: 12px 16px 0;
  padding: 12px 14px;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 0.88rem;
}

.main-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- CARDS --- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

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

.card-header h2 {
  font-size: 1.25rem;
}

.badge-pill {
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

/* --- DINNER PROMPT HERO --- */
.prompt-card {
  background: linear-gradient(135deg, #fff1e6 0%, #ffe5ec 100%);
  border: 3px solid #ffb3c6;
}

.prompt-card.urgent {
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 8px 24px rgba(239, 71, 111, 0.16); }
  50% { box-shadow: 0 8px 28px rgba(239, 71, 111, 0.35); }
}

.prompt-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.prompt-question {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.prompt-meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.answer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.answered-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.answered-pill.yes {
  background: #d1fae5;
  color: #065f46;
}

.answered-pill.no {
  background: #fef3c7;
  color: #92400e;
}

/* --- STREAK TRACKER --- */
.streak-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.streak-slot {
  background: var(--surface-soft);
  border: 2px dashed #e2cbb5;
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--muted);
}

.streak-slot.filled {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #92400e;
}

/* --- AH MAH DASHBOARD --- */
.headcount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.count-box {
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  border: 2px solid var(--border);
}

.count-box .num {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  line-height: 1.1;
}

.count-box .lbl {
  font-size: 0.78rem;
  font-weight: 800;
}

.count-yes { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.count-no { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.count-wait { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

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

.diner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
}

.diner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diner-info h3 {
  font-size: 1.05rem;
}

.diner-comment {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.status-tag {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  white-space: nowrap;
}

.status-yes { background: #06d6a0; color: #053b2b; }
.status-no { background: #ffd166; color: #5c3d00; }
.status-pending { background: #e9ecef; color: #495057; }

.adhoc-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adhoc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* --- CHAT --- */
.chat-card {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 180px);
  min-height: 420px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px;
  margin-bottom: 10px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-msg.mine {
  flex-direction: row-reverse;
}

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  font-size: 0.94rem;
  font-weight: 700;
}

.chat-msg.mine .chat-bubble {
  background: #ffe5ec;
  border-color: #ffb3c6;
}

.chat-msg.system {
  justify-content: center;
}

.chat-msg.system .chat-bubble {
  max-width: 94%;
  background: #fef3c7;
  border-color: #fcd34d;
  text-align: center;
  font-size: 0.85rem;
}

.chat-sender {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 800;
}

.chat-time {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

.sticker-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.sticker-btn {
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
}

/* --- REWARDS --- */
.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
  margin-bottom: 10px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.badge-item {
  padding: 12px;
  border-radius: 16px;
  border: 2px solid #fcd34d;
  background: #fffbeb;
  text-align: center;
}

.badge-item.locked {
  border-color: var(--border);
  background: #f8f9fa;
  opacity: 0.65;
}

/* --- BOTTOM NAV --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 780px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 2px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  padding: 6px;
  border-radius: 14px;
}

.nav-btn.active {
  color: var(--primary);
  background: #ffe5ec;
}

.nav-icon {
  font-size: 1.3rem;
}

.unread-dot {
  position: absolute;
  top: 6px;
  right: 28%;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* --- MODAL & TOAST & CONFETTI --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 45, 66, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 26px;
  padding: 26px 22px;
  text-align: center;
  border: 3px solid var(--gold);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.modal-pokemon {
  margin-bottom: 10px;
}

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 60;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 70;
}

.confetti-piece {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confettiFall 2.2s linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(105vh) rotate(540deg);
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .adhoc-actions {
    grid-template-columns: 1fr;
  }
}

/* --- AH MAH SUPER-CLEAR LARGE MANDARIN MODE --- */
.app-shell.ahmah-mode .card-header h2 {
  font-size: 1.65rem;
}

.app-shell.ahmah-mode .count-box {
  padding: 16px 8px;
  border-width: 3px;
}

.app-shell.ahmah-mode .count-box .num {
  font-size: 3rem;
  font-weight: 800;
}

.app-shell.ahmah-mode .count-box .lbl {
  font-size: 1.15rem;
  margin-top: 4px;
}

.app-shell.ahmah-mode .cook-total-banner {
  font-size: 1.35rem !important;
  padding: 14px 12px;
  background: #d1fae5;
  border: 2.5px solid #06d6a0;
  border-radius: 16px;
}

.app-shell.ahmah-mode .diner-row {
  padding: 16px 14px;
  border-width: 2.5px;
}

.app-shell.ahmah-mode .diner-info h3 {
  font-size: 1.4rem;
}

.app-shell.ahmah-mode .diner-comment {
  font-size: 1.08rem;
  color: #3d405b;
}

.app-shell.ahmah-mode .status-tag {
  font-size: 1.12rem;
  padding: 10px 16px;
}

.app-shell.ahmah-mode .adhoc-box .input-field {
  font-size: 1.15rem;
  padding: 14px 16px;
}

.app-shell.ahmah-mode .adhoc-actions .btn {
  font-size: 1.25rem;
  padding: 16px 18px;
}

.app-shell.ahmah-mode .nav-btn {
  font-size: 1.02rem;
}

.app-shell.ahmah-mode .nav-icon {
  font-size: 1.55rem;
}

.app-shell.ahmah-mode .user-name {
  font-size: 1.3rem;
}

.app-shell.ahmah-mode .user-sub {
  font-size: 0.95rem;
}

.lang-toggle-btn {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 6px 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #78350f;
  cursor: pointer;
}

.huge-date-banner {
  background: #fff3d6;
  border: 2.5px solid #ffb703;
  border-radius: 16px;
  padding: 10px 16px;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

.app-shell.ahmah-mode .huge-date-banner {
  font-size: 2rem;
  padding: 14px 16px;
  border-width: 3px;
}
