/* ── App Shell ───────────────────────────────────────────────────── */
#app-shell {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--c-bg);
}

/* ── Header ──────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-h);
  background: rgba(15, 13, 11, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-3);
  z-index: 100;
}

.header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--c-text-muted);
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.header-back:hover { color: var(--c-text); background: var(--c-surface-2); }

.header-title {
  flex: 1;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title.brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--c-amber-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--c-text-muted);
  transition: color var(--t-fast), background var(--t-fast);
}
.header-btn:hover { color: var(--c-amber-light); background: var(--c-amber-pale); }

/* ── View Root ───────────────────────────────────────────────────── */
.view-root {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom));
  scroll-behavior: smooth;
}

.view-root.no-scroll { overflow: hidden; }

/* ── View Transitions ────────────────────────────────────────────── */
@keyframes slideInRight {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes slideInLeft {
  from { transform: translateX(-28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.view-root.enter-right { animation: slideInRight var(--t-mid) var(--ease) both; }
.view-root.enter-left  { animation: slideInLeft  var(--t-mid) var(--ease) both; }
.view-root.enter-fade  { animation: fadeIn       var(--t-mid) var(--ease) both; }
.view-root.enter-scale { animation: scaleIn      var(--t-mid) var(--ease) both; }

/* ── Bottom Navigation ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 13, 11, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.bottom-nav.hidden { transform: translateX(-50%) translateY(100%); transition: transform var(--t-mid) var(--ease); }

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--c-text-faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color var(--t-fast) var(--ease);
  position: relative;
}

.bnav-item .icon { transition: transform var(--t-fast) var(--ease-spring); }
.bnav-item:active .icon { transform: scale(0.88); }

.bnav-item.active { color: var(--c-amber-light); }
.bnav-item.active .icon { filter: drop-shadow(0 0 4px var(--c-amber-glow)); }

.bnav-item .badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-amber);
  border: 2px solid var(--c-bg);
}

/* ── Overlays ────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn var(--t-mid) var(--ease) both;
}

/* ── Bottom Sheet ────────────────────────────────────────────────── */
.bottom-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--c-surface);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  border: 1px solid var(--c-border);
  border-bottom: none;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  animation: sheetSlideUp var(--t-mid) var(--ease-out) both;
  padding-bottom: env(safe-area-inset-bottom);
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-surface-3);
  margin: var(--sp-3) auto var(--sp-2);
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-5) var(--sp-4);
  flex-shrink: 0;
}

.sheet-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--c-text);
}

.sheet-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--c-text-muted);
  background: var(--c-surface-2);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--sp-5) var(--sp-6);
  -webkit-overflow-scrolling: touch;
}

/* ── Confirm Dialog ──────────────────────────────────────────────── */
.confirm-dialog {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  width: calc(100% - 48px);
  max-width: 360px;
  margin: auto;
  animation: scaleIn var(--t-mid) var(--ease-spring) both;
}

.confirm-dialog h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.confirm-dialog p {
  color: var(--c-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-5);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* ── Splash ──────────────────────────────────────────────────────── */
.splash {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60dvh;
}

.splash-logo svg {
  width: 48px;
  height: 60px;
  animation: pulseAmber 2s ease-in-out infinite;
}

@keyframes pulseAmber {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ── Scrollbar styling ───────────────────────────────────────────── */
.view-root::-webkit-scrollbar { width: 0; }
