/* ============================================================
   TAG COCKPIT — MOBILE  /  mobile.css
   H/MIX Theater design vocabulary: deep night, gold, serif,
   dynamic --aura tint. Portrait, phone-first. Device shell on
   wide screens; full-bleed on narrow / touch.
   ============================================================ */
:root {
  --ink: #f3ecdd; --ink-soft: rgba(243, 236, 221, .6); --ink-dim: rgba(243, 236, 221, .32);
  --gold: #d8b46a; --gold-soft: rgba(216, 180, 106, .55);
  --bg: #050409;
  --line: rgba(243, 236, 221, .12);
  --aura: 216, 180, 106;
  --r-feel: #f6d296; --r-story: #cea8ec; --r-place: #bce0f6;
  --font-jp: 'Noto Serif JP', serif; --font-en: 'Cinzel', serif; --hud: 'Share Tech Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 30%, #15110c 0%, #07060b 46%, #030206 100%);
  color: var(--ink); font-family: var(--font-jp); -webkit-font-smoothing: antialiased;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: rgba(var(--aura), .3); }

/* ---- device shell ---- */
.device {
  position: relative; width: 402px; height: min(872px, 94vh); border-radius: 52px;
  background: #0a0a0e; padding: 13px;
  box-shadow: 0 0 0 2px #1c1c22, 0 0 0 11px #050507, 0 40px 120px -30px rgba(0, 0, 0, .9), inset 0 0 4px rgba(255, 255, 255, .06);
}
.device::after { /* notch */
  content: ''; position: absolute; top: 13px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 26px; background: #050507; border-radius: 0 0 16px 16px; z-index: 60; pointer-events: none;
}
.screen {
  position: relative; width: 100%; height: 100%; border-radius: 40px; overflow: hidden;
  background: var(--bg); isolation: isolate;
}
@media (max-width: 600px), (pointer: coarse) and (max-width: 900px) {
  body { display: block; }
  .device { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; }
  .device::after { display: none; }
  .screen { border-radius: 0; }
}

/* ---- shared canvas + atmosphere ---- */
#starCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(130% 95% at 50% 38%, transparent 44%, rgba(0, 0, 0, .62) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .45), transparent 18%, transparent 70%, rgba(0, 0, 0, .72)); }
.grain { position: absolute; inset: -40%; z-index: 1; pointer-events: none; opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---- screen views ---- */
.view { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none; transition: transform .6s var(--ease); }
body[data-screen="atlas"] #view-atlas,
body[data-screen="cockpit"] #view-cockpit,
body[data-screen="scenery"] #view-scenery { opacity: 1; visibility: visible; pointer-events: auto; }
#view-cockpit { transform: translateY(3%); }
body[data-screen="cockpit"] #view-cockpit { transform: none; }

/* status spacer for notch */
.statusbar { height: env(safe-area-inset-top, 0); min-height: 12px; flex: 0 0 auto; }

/* ============================================================ TOP BAR (shared) */
.topbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px 4px; gap: 8px; position: relative; z-index: 5; }
.tb-link { font-family: var(--hud); font-size: 10px; letter-spacing: .18em; color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: 5px; padding: 8px 4px; transition: color .3s var(--ease); }
.tb-link:active { color: var(--ink); }
.tb-mark { font-family: var(--font-en); font-size: 11px; letter-spacing: .34em; color: var(--gold-soft); text-indent: .34em; white-space: nowrap; }
.tb-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink-soft); transition: .3s var(--ease); }
.tb-icon:active { border-color: var(--gold-soft); color: var(--ink); }
.tb-icon svg { width: 17px; height: 17px; }

/* ============================================================ ATLAS */
#view-atlas { padding-bottom: 0; }
.atlas-head { flex: 0 0 auto; text-align: center; padding: 10px 24px 12px; }
.atlas-head .kicker { font-family: var(--font-en); font-size: 11px; letter-spacing: .5em; text-indent: .5em; color: var(--gold); opacity: .85; }
.atlas-head h1 { font-weight: 300; font-size: 24px; line-height: 1.32; margin: 10px 0 8px; letter-spacing: .02em; text-wrap: balance; }
.atlas-head h1 b { font-weight: 500; color: var(--gold-bright, #e8c478); }
.atlas-head .sub { font-family: var(--hud); font-size: 9px; letter-spacing: .34em; color: var(--ink-dim); }

/* mode segmented + search */
.atlas-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; }
.seg { display: flex; flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: rgba(255, 255, 255, .02); }
.seg button { flex: 1; font-size: 12px; font-family: var(--font-jp); padding: 7px 0; border-radius: 999px; color: var(--ink-dim); letter-spacing: .04em; transition: color .25s var(--ease); }
.seg button[aria-selected="true"] { color: #0b0c12; background: rgba(var(--aura), .92); font-weight: 500; }
.search-btn { flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: .3s var(--ease); }
.search-btn.on, .search-btn:active { border-color: var(--gold-soft); color: var(--gold); }
.search-btn svg { width: 16px; height: 16px; }

.search-wrap { flex: 0 0 auto; max-height: 0; overflow: hidden; transition: max-height .4s var(--ease); padding: 0 16px; }
.search-wrap.open { max-height: 60px; }
.search-wrap input { width: 100%; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font-family: var(--font-jp); font-size: 15px; padding: 11px 14px; margin-bottom: 10px; outline: none; }
.search-wrap input:focus { border-color: var(--gold-soft); }
.search-wrap input::placeholder { color: var(--ink-dim); }

/* atlas body modes */
.atlas-body { flex: 1 1 auto; position: relative; min-height: 0; }

/* LIST mode */
.atlas-list { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 120px; scrollbar-width: none; }
.atlas-list::-webkit-scrollbar { display: none; }
.tag-section { margin-bottom: 22px; }
.tag-section h2 { display: flex; align-items: center; gap: 8px; font-weight: 300; font-size: 13px; letter-spacing: .14em; color: var(--ink-soft); margin: 4px 2px 12px; }
.tag-section h2 i { width: 7px; height: 7px; border-radius: 50%; }
.tag-section h2 .en { font-family: var(--hud); font-size: 8px; letter-spacing: .24em; color: var(--ink-dim); margin-left: auto; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: baseline; gap: 7px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .015); transition: .25s var(--ease); }
.chip .jp { font-size: 15px; font-weight: 300; }
.chip .n { font-family: var(--hud); font-size: 9px; color: var(--ink-dim); }
.chip:active { transform: scale(.95); border-color: rgba(var(--chip), .6); background: rgba(var(--chip), .12); }
.chip.r0 { --chip: 246, 210, 150; } .chip.r1 { --chip: 206, 168, 236; } .chip.r2 { --chip: 188, 224, 246; }
.chip .jp { color: var(--ink); }

/* SKY (constellation) mode */
.atlas-sky { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-y; }
.atlas-sky::-webkit-scrollbar { display: none; }
.sky-field { position: relative; width: 100%; }
.skylbl { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-align: center; padding: 6px;
  transition: opacity .4s var(--ease); }
.skylbl .jp { display: block; font-weight: 300; letter-spacing: .04em; text-shadow: 0 1px 10px rgba(0, 0, 0, .85); line-height: 1; }
.skylbl .meta { display: block; font-family: var(--hud); font-size: 7.5px; letter-spacing: .12em; color: var(--ink-dim); margin-top: 5px; opacity: 0; transition: opacity .3s; }
.skylbl:active .meta { opacity: 1; }
.skylbl:active .jp { color: #fff; }
.skylbl.r0 .jp { color: var(--r-feel); } .skylbl.r1 .jp { color: var(--r-story); } .skylbl.r2 .jp { color: var(--r-place); }
.sky-hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 4;
  font-family: var(--hud); font-size: 9px; letter-spacing: .2em; color: var(--ink-dim); pointer-events: none;
  animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateX(-50%) translateY(0); opacity: .5; } 50% { transform: translateX(-50%) translateY(-5px); opacity: .9; } }

/* HYBRID: top sky band + bottom list */
body[data-atlasmode="hybrid"] .atlas-body { display: flex; flex-direction: column; }
body[data-atlasmode="hybrid"] .atlas-sky { position: relative; flex: 0 0 30%; overflow: hidden; touch-action: none; }
body[data-atlasmode="hybrid"] .atlas-list { position: relative; flex: 1 1 auto; inset: auto; }
/* SKY / LIST: show only the active panel */
body[data-atlasmode="sky"] .atlas-list { display: none; }
body[data-atlasmode="list"] .atlas-sky { display: none; }

/* legend */
.atlas-legend { flex: 0 0 auto; display: flex; justify-content: center; gap: 18px; padding: 10px 0 calc(14px + env(safe-area-inset-bottom, 0));
  font-size: 11px; color: var(--ink-soft); background: linear-gradient(0deg, rgba(5, 4, 9, .9), transparent); position: relative; z-index: 4; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.atlas-legend i { width: 7px; height: 7px; border-radius: 50%; }

/* mood: clear — lift readability over immersion */
body.mood-clear .vignette { background:
  radial-gradient(130% 95% at 50% 38%, transparent 52%, rgba(0, 0, 0, .42) 100%),
  linear-gradient(180deg, rgba(2, 4, 9, .72), transparent 22%, transparent 64%, rgba(2, 4, 9, .8)); }
body.mood-clear .atlas-head h1 { color: #fbf4e6; }
body.mood-clear .chip { background: rgba(255, 255, 255, .05); }
body.mood-clear .nowbar, body.mood-clear .sheet { background: linear-gradient(180deg, rgba(14, 16, 22, .9), rgba(8, 9, 14, .98)); }

/* empty state */
.empty { text-align: center; color: var(--ink-dim); font-size: 12px; line-height: 1.8; padding: 40px 30px; }
