/* ==========================================================================
   App Styles — Offmind POC
   Mobile app shell, screen-specific styles, responsive phone frame.
   ========================================================================== */

/* ── App Container ─────────────────────────────────────────────────────── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* ── App Header ────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-base) var(--space-base);
  background: var(--bg);
  min-height: 56px;
}

.app-header__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--text);
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.token-display {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-small);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* ── App Content ───────────────────────────────────────────────────────── */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-base) var(--space-base);
  padding-bottom: 96px;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom Navigation ─────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  z-index: 200;
}

.bottom-nav.hidden {
  display: none !important;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-tiny);
  font-weight: var(--fw-medium);
  transition: color var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
}

.nav-tab__icon {
  font-size: 22px;
  line-height: 1;
}

.nav-tab__label {
  font-size: 10px;
  font-weight: var(--fw-medium);
}

.nav-tab.active {
  color: var(--primary);
}

.nav-tab:active {
  transform: scale(0.92);
}

/* ── Screen Base ───────────────────────────────────────────────────────── */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn var(--transition-base) ease;
}

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 400px;
  width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  animation: toastIn 300ms ease, toastOut 300ms ease 2700ms forwards;
  pointer-events: auto;
}

.toast--success {
  background: var(--success);
}

.toast--error {
  background: var(--error);
}

.toast--info {
  background: var(--primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: var(--space-base);
  animation: modalOverlayIn 200ms ease;
}

.modal-overlay--fullscreen {
  align-items: stretch;
  padding: 0;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalContentIn 300ms var(--transition-spring);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content--fullscreen {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-base);
  text-align: center;
}

.modal-body {
  font-size: var(--fs-body);
  color: var(--text);
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.modal-actions > * {
  flex: 1;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  gap: var(--space-sm);
  width: 100%;
}

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

.btn--primary:hover {
  background: var(--primary-dark);
}

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

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

.btn--accent:hover {
  opacity: 0.9;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--surface-hover);
}

.btn--dark {
  background: #000;
  color: #fff;
  border-radius: var(--radius-md);
}

.btn--dark:hover {
  background: #222;
}

.btn--sm {
  padding: 8px 16px;
  font-size: var(--fs-small);
}

.btn--lg {
  padding: 16px 32px;
  font-size: var(--fs-h3);
}

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

/* ── Onboarding ────────────────────────────────────────────────────────── */
.onboarding {
  position: relative;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.onboarding__slides {
  display: flex;
  height: 100%;
  transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding__slide {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  gap: var(--space-xl);
}

.onboarding__illustration {
  font-size: 80px;
  margin-bottom: var(--space-base);
}

.onboarding__title {
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  color: var(--text);
  line-height: var(--lh-tight);
}

.onboarding__subtitle {
  font-size: var(--fs-body);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  max-width: 300px;
}

.onboarding__dots {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-sm);
  z-index: 10;
}

.onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition-base);
}

.onboarding__dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

.onboarding__cta {
  position: absolute;
  bottom: 40px;
  left: var(--space-xl);
  right: var(--space-xl);
  z-index: 10;
}

/* Onboarding steps */
.onboarding__steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  width: 100%;
  max-width: 300px;
}

.onboarding__step {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  text-align: left;
}

.onboarding__step-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.onboarding__step-text {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--text);
}

/* Sign-in slide */
.signin__divider {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  width: 100%;
  max-width: 300px;
  color: var(--text-muted);
  font-size: var(--fs-small);
}

.signin__divider::before,
.signin__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.signin__email-link {
  color: var(--primary);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.signin__email-link:hover {
  text-decoration: underline;
}

/* Profile form */
.profile-form {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: var(--space-base);
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.form-input {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  background: var(--surface);
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.form-input.error {
  border-color: var(--error);
}

.form-error {
  font-size: var(--fs-tiny);
  color: var(--error);
  min-height: 16px;
}

.form-hint {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

/* Avatar picker */
.avatar-picker {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-option {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--surface);
}

.avatar-option:hover {
  border-color: var(--primary-light);
}

.avatar-option.selected {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* Permission slide */
.permission-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.permission-card__icon {
  font-size: 48px;
  margin-bottom: var(--space-base);
}

.permission-card__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-sm);
}

.permission-card__text {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  line-height: var(--lh-relaxed);
}

.permission-card__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.permission-help {
  margin-top: var(--space-base);
  font-size: var(--fs-small);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.permission-help a {
  color: var(--primary);
  font-weight: var(--fw-medium);
}

/* ── Home Screen ───────────────────────────────────────────────────────── */
.greeting {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
}

.greeting__name {
  color: var(--primary);
}

/* Screen Time Card */
.screen-time-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  margin-top: var(--space-base);
}

.screen-time-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-base);
}

.screen-time-card__label {
  font-size: var(--fs-small);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.screen-time-card__time {
  font-size: 42px;
  font-weight: var(--fw-extrabold);
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.screen-time-card__change {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.screen-time-card__change--down {
  color: var(--success);
  background: var(--success-light);
}

.screen-time-card__change--up {
  color: var(--error);
  background: var(--error-light);
}

.screen-time-card__breakdown {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* Mini Bar Chart */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
  margin-top: var(--space-base);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.mini-chart__bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--primary-light);
  min-height: 4px;
  transition: height var(--transition-base);
  position: relative;
}

.mini-chart__bar--today {
  background: var(--primary);
}

.mini-chart__bar-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

/* Demo Slider */
.demo-slider {
  margin-top: var(--space-base);
  padding: var(--space-md);
  background: var(--warning-light);
  border-radius: var(--radius-md);
  border: 1px dashed var(--warning);
}

.demo-slider__label {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.demo-slider input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.demo-slider__value {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text);
  text-align: center;
  margin-top: var(--space-xs);
}

/* Tier Harvest Zone */
.harvest-zone {
  margin-top: var(--space-xl);
}

.harvest-zone__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-md);
}

.tier-boxes {
  display: flex;
  gap: var(--space-sm);
}

.tier-box {
  flex: 1;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: all var(--transition-base);
}

.tier-box--unlocked {
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  animation: tierUnlock 500ms ease;
}

.tier-box--t1.tier-box--unlocked { background: var(--tier1); }
.tier-box--t2.tier-box--unlocked { background: var(--tier2); color: #fff; }
.tier-box--t3.tier-box--unlocked { background: var(--tier3); color: #fff; }
.tier-box--t4.tier-box--unlocked { background: var(--tier4); color: #fff; }
.tier-box--t5.tier-box--unlocked { background: var(--tier5); }

.tier-box--locked {
  opacity: 0.45;
}

@keyframes tierUnlock {
  0% { transform: scale(0.85); opacity: 0.5; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.tier-box__tokens {
  font-size: var(--fs-h3);
  font-weight: var(--fw-extrabold);
  line-height: 1;
}

.tier-box__label {
  font-size: 9px;
  font-weight: var(--fw-medium);
  opacity: 0.7;
}

.harvest-btn {
  margin-top: var(--space-md);
}

.harvest-btn .btn {
  box-shadow: var(--shadow-harvest);
}

.harvest-countdown {
  text-align: center;
  margin-top: var(--space-md);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* Streak */
.streak-section {
  margin-top: var(--space-xl);
}

.streak-section__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-md);
}

.streak-days {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs);
}

.streak-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.streak-day__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-tiny);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  background: var(--surface);
}

.streak-day__circle--completed {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.streak-day__circle--today {
  border-color: var(--primary);
  color: var(--primary);
}

.streak-day__label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.streak-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  font-size: var(--fs-small);
  color: var(--primary);
  font-weight: var(--fw-semibold);
}

/* Challenges */
.challenges-section {
  margin-top: var(--space-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.section-header__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
}

.section-header__link {
  font-size: var(--fs-small);
  color: var(--primary);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.challenge-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-base);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-md);
}

.challenge-card__top {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.challenge-card__icon {
  font-size: 28px;
  flex-shrink: 0;
}

.challenge-card__info {
  flex: 1;
}

.challenge-card__title {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
}

.challenge-card__reward {
  font-size: var(--fs-tiny);
  color: var(--primary);
  font-weight: var(--fw-medium);
}

.challenge-card__progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.challenge-card__progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width var(--transition-base);
}

.challenge-card__progress-text {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

/* ── Rewards Screen ────────────────────────────────────────────────────── */
.category-filters {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: var(--space-base);
}

.category-filters::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.category-pill:hover {
  border-color: var(--primary-light);
}

.category-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.offer-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.offer-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

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

.offer-card__image {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.offer-card__image--sport { background: linear-gradient(135deg, #a8e6cf, #88d8a8); }
.offer-card__image--culture { background: linear-gradient(135deg, #dda0dd, #c471ed); }
.offer-card__image--bien-etre { background: linear-gradient(135deg, #89CFF0, #74b9ff); }
.offer-card__image--loisir { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); }
.offer-card__image--nature { background: linear-gradient(135deg, #55efc4, #00b894); }
.offer-card__image--jeux { background: linear-gradient(135deg, #fd79a8, #e84393); }
.offer-card__image--restaurants { background: linear-gradient(135deg, #fab1a0, #e17055); }

.offer-card__body {
  padding: var(--space-md);
}

.offer-card__category {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  margin-bottom: 4px;
}

.offer-card__title {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  margin-bottom: 4px;
}

.offer-card__partner {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.offer-card__cost {
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--primary);
}

/* Exchange Modal */
.exchange-modal__offer {
  margin-bottom: var(--space-base);
}

.exchange-modal__balance {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

.exchange-modal__cost {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--primary);
  margin: var(--space-base) 0;
}

/* ── QR Display ────────────────────────────────────────────────────────── */
.qr-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  text-align: center;
  padding: var(--space-2xl);
}

.qr-modal__code {
  background: #fff;
  padding: var(--space-base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.qr-modal__code img,
.qr-modal__code canvas {
  display: block;
}

.qr-modal__offer-name {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
}

.qr-modal__partner {
  font-size: var(--fs-body);
  color: var(--text-muted);
}

.qr-modal__instructions {
  font-size: var(--fs-small);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.qr-modal__id {
  font-size: var(--fs-tiny);
  color: var(--text-light);
  font-family: monospace;
}

.qr-modal__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 280px;
}

/* ── Leaderboard ───────────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  margin-bottom: var(--space-base);
  border: 1px solid var(--border);
}

.tab-group__tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
}

.tab-group__tab.active {
  background: var(--primary);
  color: #fff;
}

.sort-selector {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.sort-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-tiny);
  font-weight: var(--fw-medium);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sort-pill.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary-light);
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding: 0 var(--space-base);
}

.podium__place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.podium__place--1 {
  order: 2;
}

.podium__place--2 {
  order: 1;
}

.podium__place--3 {
  order: 3;
}

.podium__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--surface);
  border: 2px solid var(--border);
}

.podium__place--1 .podium__avatar {
  width: 64px;
  height: 64px;
  font-size: 32px;
  border-color: var(--warning);
  box-shadow: 0 0 12px rgba(253, 203, 110, 0.4);
}

.podium__crown {
  font-size: 20px;
  margin-bottom: -8px;
}

.podium__name {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  text-align: center;
}

.podium__stat {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.podium__rank {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
}

.podium__pedestal {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-h2);
  font-weight: var(--fw-extrabold);
  color: #fff;
}

.podium__place--1 .podium__pedestal {
  background: var(--warning);
  height: 80px;
}

.podium__place--2 .podium__pedestal {
  background: var(--text-light);
  height: 60px;
}

.podium__place--3 .podium__pedestal {
  background: #CD7F32;
  height: 45px;
}

/* Ranked List */
.ranked-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.ranked-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.ranked-row--user {
  background: rgba(108, 92, 231, 0.08);
  border: 1.5px solid var(--primary-light);
}

.ranked-row__rank {
  width: 28px;
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.ranked-row__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--surface-hover);
  flex-shrink: 0;
}

.ranked-row__name {
  flex: 1;
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
}

.ranked-row__stat {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.ranked-row__change {
  font-size: var(--fs-tiny);
  width: 24px;
  text-align: center;
}

.ranked-row__change--up { color: var(--success); }
.ranked-row__change--down { color: var(--error); }
.ranked-row__change--same { color: var(--text-light); }

/* User sticky position */
.user-position {
  position: sticky;
  bottom: 80px;
  padding: var(--space-sm) 0;
  background: var(--bg);
}

/* ── Profile Screen ────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast);
}

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

.profile-avatar__edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.profile-name {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  text-align: center;
}

.profile-username {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* Level bar */
.level-bar {
  width: 100%;
  max-width: 280px;
}

.level-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  margin-bottom: 4px;
}

.level-bar__track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.level-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width var(--transition-base);
}

/* Stats cards */
.stats-cards {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  scrollbar-width: none;
}

.stats-cards::-webkit-scrollbar {
  display: none;
}

.stat-card {
  flex-shrink: 0;
  width: 140px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-base);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-card__value {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--primary);
}

.stat-card__label {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Badge gallery */
.badge-gallery {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  scrollbar-width: none;
}

.badge-gallery::-webkit-scrollbar {
  display: none;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.badge-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.badge-circle--unlocked {
  background: var(--primary-light);
}

.badge-circle--locked {
  background: var(--border);
  color: var(--text-light);
  font-size: 16px;
}

.badge-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  max-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Token history */
.history-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.history-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.history-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--surface-hover);
  flex-shrink: 0;
}

.history-item__details {
  flex: 1;
}

.history-item__desc {
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
}

.history-item__date {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.history-item__amount {
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
}

.history-item__amount--positive {
  color: var(--success);
}

.history-item__amount--negative {
  color: var(--error);
}

/* Coupons */
.coupon-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.coupon-item:hover {
  box-shadow: var(--shadow-sm);
}

.coupon-item__info {
  flex: 1;
}

.coupon-item__name {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
}

.coupon-item__date {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.coupon-status {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-tiny);
  font-weight: var(--fw-semibold);
}

.coupon-status--active {
  background: var(--success-light);
  color: var(--success);
}

.coupon-status--used {
  background: var(--border);
  color: var(--text-muted);
}

.coupon-status--expired {
  background: var(--error-light);
  color: var(--error);
}

/* Settings */
.settings-section {
  margin-top: var(--space-xl);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

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

.settings-item__label {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
}

.settings-item__value {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--primary);
}

.toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.toggle.active .toggle__knob {
  transform: translateX(20px);
}

.settings-footer {
  margin-top: var(--space-xl);
  text-align: center;
  padding: var(--space-xl) 0;
}

.settings-footer__version {
  font-size: var(--fs-tiny);
  color: var(--text-light);
  margin-bottom: var(--space-md);
}

.settings-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.settings-footer__links a {
  color: var(--primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.empty-state__text {
  font-size: var(--fs-body);
}

/* ── Responsive: Desktop phone frame ───────────────────────────────────── */
@media (min-width: 768px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--space-2xl);
  }

  .app-container {
    width: 390px;
    max-width: 390px;
    min-height: 844px;
    max-height: 844px;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 8px #1a1a2e,
                0 0 0 10px #333;
    position: relative;
  }

  .app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 28px;
    background: #1a1a2e;
    border-radius: 0 0 20px 20px;
    z-index: 300;
  }

  .app-header {
    padding-top: 36px;
  }

  .app-content {
    max-height: calc(844px - 56px - 64px);
    overflow-y: auto;
  }

  .bottom-nav {
    position: absolute;
    border-radius: 0 0 40px 40px;
    padding-bottom: var(--space-base);
  }

  .onboarding {
    height: calc(844px - 56px);
  }
}
