/* ============================================================
   Lemi · Create — Hub  (warm palette, 2-col grid, no hero art)
   ============================================================ */

:root {
  /* Warm cozy palette pulled carefully from Lemi reference */
  --bg:         #F6EDD6;   /* main stage background — warm cream */
  --bg-deep:    #F1E3BF;   /* gradient stop toward top */
  --surface:    #FFFFFF;   /* white card art holder, continue bg */
  --text:       #2D2820;   /* deep warm black */
  --text-soft:  #8A7A5E;   /* muted warm brown-gray */
  --sage:       #8FA573;
  --sage-deep:  #6E8A56;
  --dark:       #2D2820;
  --star:       #F5C842;
  --flame:      #F58A4E;
  --xp-track:   #E6D8B3;
  --xp-fill-1:  #A8C288;
  --xp-fill-2:  #7FA062;

  /* Card tints — five warm pastels, one per family */
  --tint-tactile: #F9D9BC;  /* peach */
  --tint-garden:  #E0E4B8;  /* warm sage moss */
  --tint-sky:     #FAE6BE;  /* honey */
  --tint-puzzle:  #F6CEC5;  /* warm rose */
  --tint-breath:  #EDDEBE;  /* sand */

  /* Family dot colors (deeper variants) */
  --dot-tactile: #E89E6A;
  --dot-garden:  #8FA573;
  --dot-sky:     #E8B86D;
  --dot-puzzle:  #D48484;
  --dot-breath:  #C8A878;

  /* Shadows */
  --sh-card:   0 2px 6px rgba(90, 60, 20, .05);
  --sh-lift:   0 8px 22px rgba(90, 60, 20, .10);
  --sh-inset:  inset 0 1px 3px rgba(90, 60, 20, .14);

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --stage-max: 480px;
  --tabbar-h:  72px;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  color: var(--text);
  background:
    radial-gradient(ellipse at top, #3a2d20 0%, #1a130d 60%, #0e0806 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

button, .hud-menu, .hud-streak, .hud-star,
.tab, .xp-gallery, .continue-pill, .card {
  -webkit-user-select: none;
  user-select: none;
}

/* ================= STAGE ================= */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.stage {
  position: relative;
  width: 100%;
  max-width: var(--stage-max);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 260px, var(--bg) 100%);
  box-shadow: 0 0 80px rgba(0, 0, 0, .4);
  overflow: hidden;
}

@media (min-width: 640px) {
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 20px;
  }
  .app { min-height: auto; }
  .stage {
    min-height: auto;
    border-radius: 32px;
    overflow: hidden;
  }
}
@media (min-width: 900px) {
  body { padding: 32px; }
  .stage {
    box-shadow:
      0 30px 80px rgba(0, 0, 0, .55),
      0 10px 30px rgba(0, 0, 0, .4);
  }
}

/* ================= TOP BAR ================= */
.top {
  position: relative;
  padding: calc(16px + var(--safe-top)) 20px 6px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: start;
}
.hud-menu {
  grid-column: 1;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--dark);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(60, 40, 10, .15);
  align-self: center;
}
.hud-menu span {
  display: block;
  width: 18px; height: 2px;
  background: #fff;
  border-radius: 1px;
  position: relative;
}
.hud-menu span::before,
.hud-menu span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px; height: 2px;
  background: #fff;
  border-radius: 1px;
}
.hud-menu span::before { top: -6px; }
.hud-menu span::after  { top: 6px; }

.hud-star {
  grid-column: 3;
  border: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: var(--dark);
  border-radius: 22px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(60, 40, 10, .15);
  font-family: inherit;
  align-self: center;
}

.top-title {
  grid-column: 1 / -1;
  padding: 10px 4px 0;
  text-align: left;
}
.title-small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-soft);
  text-transform: uppercase;
}
.title-big {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
  margin-top: 4px;
}
.title-sub {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  font-style: italic;
  color: var(--text-soft);
  line-height: 1.4;
  max-width: 320px;
}

/* ================= FAMILY SECTIONS ================= */
.family { margin-top: 24px; }
.family:first-of-type { margin-top: 22px; }

.family-head {
  margin: 0 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.family-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .1px;
}
.family-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .6);
}
.family-dot.tactile { background: var(--dot-tactile); }
.family-dot.garden  { background: var(--dot-garden); }
.family-dot.sky     { background: var(--dot-sky); }
.family-dot.puzzle  { background: var(--dot-puzzle); }
.family-dot.breath  { background: var(--dot-breath); }

.family-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-soft);
}

/* Cards — 2 column grid */
.cards {
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ================= CARD ================= */
.card {
  position: relative;
  aspect-ratio: 1 / 1.08;
  padding: 10px 10px 12px;
  border-radius: 22px;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--sh-card);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s;
  text-align: left;
}
.card:hover  { box-shadow: var(--sh-lift); }
.card:active {
  transform: scale(.97);
  box-shadow: var(--sh-card);
}

.card-art {
  width: 100%;
  flex: 1;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-art svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px 0 4px;
}
.card-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-xp {
  font-size: 11px;
  font-weight: 800;
  color: var(--sage-deep);
  background: rgba(255, 255, 255, .55);
  padding: 3px 7px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  letter-spacing: .2px;
}

/* Per-family tints */
.card.tactile { background: var(--tint-tactile); }
.card.garden  { background: var(--tint-garden); }
.card.sky     { background: var(--tint-sky); }
.card.puzzle  { background: var(--tint-puzzle); }
.card.breath  { background: var(--tint-breath); }

.foot-space { height: 20px; }

/* ================= TAB BAR ================= */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 250, 240, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(90, 60, 20, .08);
  display: flex;
  justify-content: space-around;
  align-items: center;
}

@media (min-width: 640px) {
  .tabbar {
    position: sticky;
    bottom: 0;
    margin-top: 24px;
    border-radius: 0 0 32px 32px;
  }
  .stage { padding-bottom: 0; }
}

.tab {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: color .2s, transform .15s;
}
.tab:active { transform: scale(.96); }
.tab-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.tab-icon svg { width: 100%; height: 100%; }
.tab-label { font-size: 11px; font-weight: 700; }
.tab.is-active { color: var(--sage-deep); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
