/* ==================================================================
   LAYOUT — the structural skeleton: app shell, header (with the
   inline search box), screens, tab bar, and the login screen frame.
   No colors are defined here beyond referencing tokens.
   ================================================================== */

#app{
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.app-loading{ min-height: 100vh; display:flex; align-items:center; justify-content:center; color: var(--ink-soft); }
.tab-loading{ position: fixed; inset: 0; z-index: 60; background: var(--bg); }

/* ---------- Header (a marquee that stays lit, day or night) ---------- */
.masthead{
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--marquee-top) 0%, var(--marquee-bottom) 100%);
  padding: 16px 18px 14px;
  border-bottom: 2px solid var(--gold-bright);
  box-shadow: var(--shadow);
}
.masthead-row{ display:flex; align-items:center; gap: 10px; }
.wordmark{ font-size: 20px; margin:0; color: var(--marquee-ink); letter-spacing: 0.01em; white-space:nowrap; flex: 0 0 auto; }
.wordmark em{ color: var(--gold-bright); font-style: italic; }

/* Inline search — sits between the wordmark and the avatar */
.header-search{
  flex: 1; min-width: 0; display:flex; align-items:center; gap:6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(243,233,218,0.25);
  border-radius: 12px; padding: 8px 11px;
}
.header-search input{
  flex:1; min-width:0; background:none; border:none; outline:none;
  color: var(--marquee-ink); font-size: 14px;
}
.header-search input::placeholder{ color: rgba(243,233,218,0.5); }
.header-search .search-ico{ color: var(--gold); font-size: 13px; flex: 0 0 auto; }

.subnav{ display:flex; gap:8px; margin-top:14px; }
.subnav button{
  flex:1; background: rgba(255,255,255,0.08); border:1px solid rgba(243,233,218,0.25);
  color: var(--marquee-ink); border-radius: 12px; padding:9px 6px; font-size:12.5px; font-weight:700; cursor:pointer;
  font-family:'IBM Plex Mono',monospace; letter-spacing:.02em; transition: background .15s ease, color .15s ease;
}
.subnav button.active{ background: var(--gold-bright); color:#2a1610; border-color:var(--gold-bright); }

/* ---------- Content area ---------- */
main{ flex: 1; padding: 16px 16px 100px; }
.screen{ display:none; }
.screen.active{ display:block; animation: fade-in .18s ease; }
@keyframes fade-in{ from{ opacity:0; transform: translateY(4px);} to{ opacity:1; transform:none;} }

.section-label{
  display:flex; align-items:center; gap:10px; margin: 20px 0 12px;
  color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
}
.section-label::after{ content:""; flex:1; height:1px; background: var(--divider); }

/* ---------- Floating pill tab bar ---------- */
.tabbar{
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px;
  width: calc(100% - 32px); max-width: 448px; display:flex; gap:4px;
  background: var(--bg-elevated); border: 1px solid var(--divider);
  border-radius: 20px; padding: 6px; box-shadow: var(--shadow); z-index: 30;
}
.tab-btn{
  flex:1; background:none; border:none; cursor:pointer; border-radius: 14px;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  color: var(--ink-soft); padding: 8px 2px; font-size: 10.5px; font-weight:600;
  transition: background .15s ease, color .15s ease;
}
.tab-btn .tab-ico{ font-size: 18px; }
.tab-btn.active{ color: var(--ink); background: var(--bg); }
.tab-btn.active .tab-ico{ filter: drop-shadow(0 0 4px var(--gold-bright)); }

/* ---------- Login screen (outer frame) ---------- */
.login-screen{
  min-height: 100vh; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding: 30px; text-align:center;
  background: linear-gradient(180deg, var(--marquee-top) 0%, var(--marquee-bottom) 55%, var(--bg) 55%);
}

/* ---------- Loading / sync states ---------- */
.loading-row{ display:flex; align-items:center; justify-content:center; padding: 40px 0; color: var(--ink-soft); font-size:13px; gap:8px; }
.spinner{
  width:16px; height:16px; border-radius:50%;
  border: 2px solid var(--divider); border-top-color: var(--gold-bright);
  animation: spin .7s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
