/* ============================================================
   LiveApp — Lagom Design System
   Calm, balanced, "just right" palette
   ============================================================ */

:root {
  --c-primary:      #6B9E8F;   /* sage teal */
  --c-primary-dark: #4D7E71;
  --c-primary-light:#A8C5BB;
  --c-accent:       #D4A87C;   /* warm sand */
  --c-accent-light: #EDD9BA;
  --c-bg:           #F5F0E8;   /* warm cream */
  --c-surface:      #FFFFFF;
  --c-surface-2:    #FAF7F2;
  --c-text:         #2C3E35;
  --c-text-muted:   #7A8A84;
  --c-border:       #E4DDD2;
  --c-success:      #6BAE8A;
  --c-danger:       #C97878;
  --c-warning:      #D4A87C;
  --c-info:         #7BA8C4;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 4px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.10);

  --font-body:  'Inter', system-ui, sans-serif;
  --font-title: 'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 99px; }

/* ── Typography ──────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-title); font-weight: 600; color: var(--c-text); }
h5,h6 { font-weight: 600; color: var(--c-text); }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-dark); }

/* ── Layout ──────────────────────────── */
.la-main { padding-top: 4.5rem; min-height: 100vh; }
.la-main--auth { min-height: 100vh; }

/* ── Navbar ──────────────────────────── */
.la-navbar {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  padding: .6rem 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
}
.la-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.brand-icon { font-size: 1.4rem; }
.brand-name { font-family: var(--font-title); font-size: 1.2rem; font-weight: 600; color: var(--c-primary); }
.la-navbar .nav-link {
  color: var(--c-text-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.la-navbar .nav-link:hover, .la-navbar .nav-link.active {
  color: var(--c-primary);
  background: var(--c-primary-light)22;
}
.la-dropdown {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .4rem;
}
.la-dropdown .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
}
.la-dropdown .dropdown-item:hover { background: var(--c-bg); }

/* ── Cards ──────────────────────────── */
.la-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ──────────────────────────── */
.la-btn-primary {
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: .875rem;
  padding: .5rem 1.25rem;
  transition: all .15s;
}
.la-btn-primary:hover { background: var(--c-primary-dark); color: #fff; transform: translateY(-1px); }
.la-btn-primary:active { transform: translateY(0); }

.la-btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: .875rem;
  padding: .5rem 1.25rem;
  transition: all .15s;
}
.la-btn-outline:hover { background: var(--c-primary)15; color: var(--c-primary); }

.la-btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: .875rem;
  padding: .5rem 1.25rem;
  transition: all .15s;
}
.la-btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }

/* ── Forms ──────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .9rem;
  padding: .6rem .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary)22;
  outline: none;
}
.form-label { font-size: .875rem; font-weight: 500; color: var(--c-text); margin-bottom: .4rem; }
.form-text { font-size: .78rem; color: var(--c-text-muted); }

/* ── Auth Pages ──────────────────────── */
.auth-page { background: linear-gradient(135deg, #f0ebe0 0%, #e8f0ed 100%); }
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-card--wide { max-width: 640px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-icon { font-size: 3rem; }
.auth-title { font-family: var(--font-title); font-size: 1.75rem; color: var(--c-text); margin-bottom: .25rem; }
.auth-subtitle { color: var(--c-text-muted); font-size: .9rem; }
.la-link { color: var(--c-primary); font-weight: 500; text-decoration: none; }
.la-link:hover { color: var(--c-primary-dark); text-decoration: underline; }

/* ── Hero Card ──────────────────────── */
.la-hero-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.la-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--c-primary)08 0%, var(--c-accent)10 100%);
  pointer-events: none;
}
.la-level-badge {
  background: var(--c-primary)20;
  color: var(--c-primary);
  border: 1px solid var(--c-primary)40;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .6rem;
}
.la-motto { color: var(--c-text-muted); font-style: italic; font-size: .9rem; }
.xp-bar-wrap { background: var(--c-border); border-radius: 99px; height: 8px; overflow: hidden; }
.xp-bar { height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-accent)); border-radius: 99px; transition: width .4s ease; }
.streak-display { text-align: center; }
.streak-fire { font-size: 2rem; }
.streak-count { font-size: 1.75rem; font-weight: 700; color: var(--c-primary); display: block; }

/* ── Avatars ──────────────────────────── */
.avatar-badge, .avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem; color: #fff;
  flex-shrink: 0;
  background: var(--c-primary);
}
.avatar-sm { cursor: pointer; }
.character-avatar-lg {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  flex-shrink: 0;
}
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.profile-avatar-placeholder {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--c-primary);
  color: #fff; font-size: 2.5rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

/* ── Stats ──────────────────────────── */
.stat-card {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all .15s;
}
.stat-card--focus {
  border-color: var(--c-primary)60;
  background: var(--c-primary)06;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-icon { font-size: 1.1rem; }
.stat-name { font-size: .875rem; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--c-primary); }
.stat-progress-wrap { background: var(--c-border); border-radius: 99px; height: 5px; overflow: hidden; }
.stat-progress { height: 100%; border-radius: 99px; transition: width .4s ease; }
.focus-badge { font-size: .65rem; color: var(--c-accent); }
.stat-delta {
  font-size: .72rem; font-weight: 600;
  padding: .15rem .45rem;
  border-radius: 99px;
  white-space: nowrap;
}
.stat-delta--pos { background: var(--c-success)20; color: var(--c-success); }
.stat-delta--neg { background: var(--c-danger)20; color: var(--c-danger); }

.stat-icon-lg {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-setup-card {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.stat-input-card {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: .75rem;
}
.delta-btn {
  width: 32px; height: 32px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.delta-input::-webkit-outer-spin-button,
.delta-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Timeline ──────────────────────── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .7rem;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--c-border);
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: 1.1rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--c-primary);
  border: 2px solid var(--c-surface);
  box-shadow: 0 0 0 2px var(--c-primary)40;
}
.timeline-card { margin-left: .25rem; }

/* ── Posts ──────────────────────────── */
.la-post-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.la-post-input {
  resize: none;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-bg);
}
.la-post-input:focus { border-color: var(--c-primary); }
.post-content { font-size: .95rem; line-height: 1.6; }
.post-photo { width: 100%; border-radius: var(--radius-md); max-height: 400px; object-fit: cover; }
.event-link-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--c-primary)12;
  color: var(--c-primary);
  font-size: .75rem; font-weight: 500;
  padding: .2rem .6rem;
  border-radius: 99px;
  border: 1px solid var(--c-primary)30;
}
.like-btn {
  background: none; border: none; padding: 0;
  display: flex; align-items: center; gap: .4rem;
  color: var(--c-text-muted); font-size: .875rem; cursor: pointer;
  transition: color .15s;
}
.like-btn:hover { color: var(--c-danger); }
.like-btn.liked { color: var(--c-danger); }
.comment-btn {
  display: flex; align-items: center; gap: .4rem;
  color: var(--c-text-muted); font-size: .875rem; text-decoration: none;
  transition: color .15s;
}
.comment-btn:hover { color: var(--c-primary); }

/* ── Chat ──────────────────────────── */
.chat-messages { background: var(--c-bg); }
.chat-bubble {
  margin-bottom: .75rem;
  display: flex;
  flex-direction: column;
  max-width: 70%;
}
.chat-bubble--mine {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-bubble--theirs {
  align-self: flex-start;
  align-items: flex-start;
}
.bubble-text {
  padding: .6rem 1rem;
  border-radius: var(--radius-md);
  font-size: .9rem;
  line-height: 1.5;
}
.chat-bubble--mine .bubble-text {
  background: var(--c-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble--theirs .bubble-text {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-bottom-left-radius: 4px;
}
.bubble-time { font-size: .7rem; color: var(--c-text-muted); margin-top: .2rem; }

/* ── Achievements ──────────────────── */
.achievement-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.achievement-icon--common    { background: #e8e8e8; }
.achievement-icon--uncommon  { background: #d4edda; }
.achievement-icon--rare      { background: #cce5ff; }
.achievement-icon--epic      { background: #e2d4f0; }
.achievement-icon--legendary { background: linear-gradient(135deg, #ffeaa730, #fdcb6e40); }
.achievement-icon--locked    { filter: grayscale(1) opacity(.4); }
.achievement-badge {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; cursor: default;
}
.achievement-card { transition: transform .15s; }
.achievement-card:hover { transform: translateY(-2px); }
.achievement-card--locked { opacity: .6; }
.la-rarity-badge {
  font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px;
}
.la-rarity-badge--common    { background: #e8e8e8; color: #666; }
.la-rarity-badge--uncommon  { background: #d4edda; color: #28a745; }
.la-rarity-badge--rare      { background: #cce5ff; color: #004085; }
.la-rarity-badge--epic      { background: #e2d4f0; color: #6f42c1; }
.la-rarity-badge--legendary { background: #fef9e7; color: #d4a017; }

/* ── Challenges ──────────────────────── */
.la-challenge-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all .15s;
  height: 100%;
  box-shadow: var(--shadow-sm);
}
.la-challenge-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--c-primary)50; }
.challenge-emoji-lg { font-size: 2.5rem; }
.challenge-emoji { font-size: 1.5rem; }
.rank-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  background: var(--c-bg);
  color: var(--c-text-muted);
  flex-shrink: 0;
}
.rank-badge--1 { background: #fef9e7; color: #d4a017; }
.rank-badge--2 { background: #f5f5f5; color: #666; }
.rank-badge--3 { background: #fdebd0; color: #a0522d; }

/* ── Misc Components ──────────────────── */
.la-info-box {
  background: var(--c-primary)10;
  border: 1px solid var(--c-primary)30;
  border-radius: var(--radius-md);
  padding: .85rem 1rem;
  font-size: .875rem;
  color: var(--c-primary-dark);
  display: flex; align-items: flex-start; gap: .5rem;
}
.la-tip-card {
  background: linear-gradient(135deg, var(--c-accent-light), var(--c-primary)15);
  border: 1px solid var(--c-accent-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.la-tip-label { font-size: .75rem; font-weight: 600; color: var(--c-accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .25rem; }
.section-label { font-size: .75rem; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .08em; }
.la-list-item {
  border-radius: var(--radius-sm);
  transition: background .12s;
  cursor: pointer;
}
.la-list-item:hover { background: var(--c-bg); }
.la-list-item--unread { background: var(--c-primary)08; }
.la-badge { background: var(--c-primary); color: #fff; border-radius: 99px; padding: .15rem .55rem; font-size: .75rem; }
.la-badge-soft { background: var(--c-primary)15; color: var(--c-primary); border-radius: 99px; padding: .1rem .5rem; font-size: .7rem; }
.la-badge-btn {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  color: var(--c-text);
  border-radius: 99px;
  font-size: .8rem;
  padding: .35rem .85rem;
  transition: all .12s;
}
.la-badge-btn:hover { background: var(--c-primary)15; border-color: var(--c-primary)50; color: var(--c-primary); }
.la-friend-card {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  transition: all .15s;
}
.la-friend-card:hover { border-color: var(--c-primary)50; }
.notif-icon { font-size: 1.4rem; flex-shrink: 0; }
.badge-dot {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--c-danger);
  color: #fff;
  font-size: .6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.event-thumb {
  max-height: 180px; width: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

/* ── Toast Messages ──────────────────── */
.messages-container {
  position: fixed;
  top: 5rem; right: 1.5rem;
  z-index: 2000;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: 360px;
}
.la-toast {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .85rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: .875rem;
  animation: slideInRight .25s ease;
}
.la-toast--success { border-left: 4px solid var(--c-success); }
.la-toast--error   { border-left: 4px solid var(--c-danger); }
.la-toast--warning { border-left: 4px solid var(--c-warning); }
.toast-close { background: none; border: none; cursor: pointer; color: var(--c-text-muted); font-size: 1.1rem; }
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Avatar Style Selector ──────────────── */
.avatar-style-option { cursor: pointer; display: block; }
.avatar-style-option input[type="radio"] { display: none; }
.avatar-style-card {
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: .75rem .5rem;
  text-align: center;
  font-size: 1.5rem;
  transition: all .15s;
  background: var(--c-surface-2);
}
.avatar-style-option input:checked + .avatar-style-card {
  border-color: var(--c-primary);
  background: var(--c-primary)10;
}
.avatar-style-card:hover { border-color: var(--c-primary)60; }

/* ── Responsive ──────────────────────── */
@media (max-width: 575px) {
  .la-hero-card { padding: 1.25rem; }
  .character-avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .la-main { padding-top: 4rem; }
}
