/* public/assets/css/layout.css */

/* ── APP SHELL ──────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* ── TOP BAR ────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--page-pad);
  gap: var(--space-sm);
  flex-shrink: 0;
}
.topbar__logo {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--active);
  font-weight: 700;
}
.topbar__title {
  font-weight: var(--fw-extrabold);
  font-size: var(--text-md);
  flex: 1;
  text-align: center;
}
.topbar__back {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease);
}
.topbar__back:active { background: var(--bg-alt); }
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ── BOTTOM NAV ─────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  z-index: var(--z-nav);
  box-shadow: 0 -4px 16px rgba(28,25,23,0.06);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px var(--space-xs) 0;
  gap: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease);
  color: var(--muted);
  min-height: var(--nav-height);
  position: relative;
}
.nav-item.active { color: var(--active); }
.nav-item__icon  {
  font-size: 22px;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.nav-item.active .nav-item__icon { transform: scale(1.15); }
.nav-item__label {
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  line-height: 1;
}
.nav-item__dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 16px);
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* Center Play button */
.nav-item--play {
  margin-top: -12px;
}
.nav-item--play .nav-item__icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--active);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--active) 40%, transparent);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.nav-item--play:active .nav-item__icon-wrap {
  transform: scale(0.93);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--active) 30%, transparent);
}

/* ── MAIN CONTENT ───────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0) + var(--space-md));
  -webkit-overflow-scrolling: touch;
}

/* ── PAGES ──────────────────────────────────────── */
.page {
  padding: var(--space-md) var(--page-pad);
  min-height: 100%;
}
.page--full {
  padding: 0;
}
.page--no-topbar {
  padding-top: var(--space-md);
}

/* ── PAGE TRANSITIONS ───────────────────────────── */
.page-enter {
  animation: fadeUp var(--dur-slow) var(--ease) both;
}

/* ── SECTION ────────────────────────────────────── */
.section { margin-bottom: var(--space-xl); }
.section:last-child { margin-bottom: 0; }

/* ── PADDED SECTION ─────────────────────────────── */
.padded { padding: 0 var(--page-pad); }

/* ── FULLSCREEN PAGE (auth, onboarding, play) ───── */
.fullscreen {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-nav) + 1);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ── HEADER HERO ────────────────────────────────── */
.page-hero {
  padding: var(--space-xl) var(--page-pad) var(--space-lg);
  text-align: center;
}
.page-hero__emoji { font-size: 48px; margin-bottom: var(--space-md); }
.page-hero__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--ink);
  margin-bottom: var(--space-sm);
}
.page-hero__desc {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: var(--lh-base);
}

/* ── RESULT SCREEN ──────────────────────────────── */
.result-hero {
  text-align: center;
  padding: var(--space-xl) var(--page-pad);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}
.result-hero__score {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--active);
  line-height: 1;
}
.result-hero__stars { font-size: 28px; }

/* ── RESPONSIVE — keep max-width centered on desktop */
@media (min-width: 520px) {
  body { background: var(--bg-alt); }
  #app { box-shadow: var(--shadow-lg); }
  .bottom-nav { border-radius: 0; }
}
