/* CHIKARA shell layer (v1.6.0): Island, logo menu, About, tour, canonical splash, Gamazine accents,
   press feedback. Stacking follows the Canon 16.6 ladder:
   header 80 / bottom bar 90 / backdrop 120 / drawer+menu 130 / modal 150 / Island scrim 199 /
   Island 200 / Halo petals 249 / Halo 250 / toast 300 / tour 500 / splash 9999. */

/* ---------- Gamazine accents (Canon 3) - TEXT-FREE surfaces only (3.9) ---------- */
:root {
  --c-emerald: #00E676; --c-gold: #FFD600; --c-scarlet: #FF1744; --c-aqua: #00E5FF;
  --mesh-paint: linear-gradient(135deg, var(--c-emerald) 0%, var(--c-gold) 33%, var(--c-scarlet) 66%, var(--c-aqua) 100%);
}
.gamazine { background: var(--mesh-paint); filter: url(#gamazine-grain); }
.gamazine-bar { display: block; height: 4px; width: 120px; border-radius: 999px; background: var(--mesh-paint); background-size: 180% 100%; filter: url(#gamazine-grain); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Island (Canon 16.5 reference CSS) ---------- */
:root {
  --island-h: 40px; --island-gap: 8px;
  --island-top: max(10px, var(--safe-top));
  --island-strip: calc(var(--island-top) + var(--island-h) + var(--island-gap));
  --island-bg: #1A1208; --island-ink: #FBF5EA;
  --island-ok: #4ADE80; --island-warn: #FBBF24; --island-off: #F87171;
}
html.has-island body { padding-top: var(--island-strip); }
html.has-island::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--island-strip); background: var(--bg); z-index: 199; pointer-events: none; }
html.has-island .header { top: var(--island-strip); padding-top: 0; height: var(--header-h); }
html.has-island .update-banner { top: calc(var(--island-strip) + 4px); }
.island {
  box-sizing: border-box; position: fixed; top: var(--island-top); left: 50%; transform: translateX(-50%); z-index: 200;
  width: max-content; max-width: min(440px, calc(100vw - 2rem)); min-height: var(--island-h);
  background: var(--island-bg); color: var(--island-ink);
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
  transition: border-radius .35s cubic-bezier(.175,.885,.32,1.275), padding .35s ease;
}
.island[hidden] { display: none; }
.island.expanded { border-radius: 22px; }
.island-toggle { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: calc(var(--island-h) - 2px);
  padding: 8px 18px; background: none; border: 0; color: inherit; font-family: var(--font-ui); font-size: 13px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; }
.island-toggle::after { content: ''; position: absolute; inset: -2px 0; }
.island-toggle[aria-disabled="true"] { cursor: default; }
.island-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 999px; }
.island-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island.expanded .island-text { white-space: normal; }
.island-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; animation: island-pulse 2s ease-in-out infinite; }
.island-dot[data-state="ok"] { background: var(--island-ok); box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.island-dot[data-state="warn"] { background: var(--island-warn); box-shadow: 0 0 0 3px rgba(251,191,36,.25); }
.island-dot[data-state="off"] { background: var(--island-off); box-shadow: 0 0 0 3px rgba(248,113,113,.25); animation: none; }
.island-detail { padding: 0 18px 12px 37px; font-size: 12px; font-weight: 500; color: #C3BCB2; }
@keyframes island-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .island, .island-dot { animation: none !important; transition: none !important; } }

/* ---------- Universal press feedback (Canon 10.1): <150ms scale + accent glow ---------- */
.btn, .icon-btn, .choice, .bottom-nav button, .side-nav button, .lm-row, .halo-petal, .tile, .card.clickable {
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.btn:active, .icon-btn:active, .choice:active, .bottom-nav button:active, .side-nav button:active, .lm-row:active, .tile:active {
  transform: scale(0.97);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .btn:active, .icon-btn:active, .choice:active, .bottom-nav button:active, .side-nav button:active, .lm-row:active, .tile:active { box-shadow: none; }
}

/* ---------- Logo menu (Canon 17.3) ---------- */
.menu-scrim { position: fixed; inset: 0; z-index: 120; background: transparent; }
.menu-scrim[hidden] { display: none; }
.logo-menu {
  position: fixed; z-index: 130; left: max(0.75rem, var(--safe-left)); width: min(340px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - var(--menu-top, 70px) - var(--safe-bottom) - 12px); overflow-y: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(26,30,26,.22); padding: 0.4rem;
}
.logo-menu[hidden] { display: none; }
.lm-group { padding: 0.3rem 0; }
.lm-group + .lm-group { border-top: 1px solid var(--line); }
.lm-label { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); padding: 0.35rem 0.7rem 0.15rem; }
.lm-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; min-height: 44px; padding: 0.4rem 0.7rem;
  background: none; border: 0; border-radius: var(--radius-md); color: inherit; font-family: var(--font-ui); font-size: 0.9rem; text-align: left; cursor: pointer; }
.lm-row:hover { background: var(--bg-alt); }
.lm-row .lm-val { font-family: var(--font-mono); font-size: 0.75rem; color: var(--primary-ink); }
.lm-step { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; min-height: 44px; }
.lm-step .lm-step-label { flex: 1; font-size: 0.9rem; font-family: var(--font-ui); }
.lm-step button { position: relative; width: 28px; height: 28px; padding: 0; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg-alt);
  color: var(--primary-ink); font-family: var(--font-mono); font-size: 1rem; line-height: 1; cursor: pointer; }
.lm-step button::after { content: ''; position: absolute; inset: -8px; }            /* 28px look, 44px hit area (Canon 5.2.1) */
.lm-step .lm-step-val { font-family: var(--font-mono); font-size: 0.75rem; color: var(--primary-ink); min-width: 2.2rem; text-align: center; }
.lm-step .lm-reset { width: auto; padding: 0 0.6rem; font-size: 0.7rem; }

/* ---------- About dialog (Canon 17.4) and shared dialog chrome ---------- */
.dialog-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(12,16,14,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dialog-scrim[hidden] { display: none; }
.dialog { background: var(--surface); color: var(--ink); width: min(480px, 100%); max-height: min(86dvh, 720px); overflow-y: auto; border-radius: var(--radius-xl);
  border: 1px solid var(--line-strong); padding: 1.25rem 1.25rem 1rem; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.dialog h2 { margin: 0 0 0.25rem; font-family: var(--font-display); }
.dialog dl { margin: 0.75rem 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; font-size: 0.88rem; }
.dialog dt { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.72rem; padding-top: 0.12rem; }
.dialog dd { margin: 0; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; margin-top: 0.75rem; }
.dialog .notice { background: var(--bg-alt); border-radius: var(--radius-md); padding: 0.6rem 0.75rem; font-size: 0.85rem; margin-top: 0.5rem; }

/* ---------- Guided tour (Canon 6) ---------- */
.tour { position: fixed; inset: 0; z-index: 500; pointer-events: auto; }        /* blocks pass-through taps to Halo and nav */
.tour[hidden] { display: none; }
.tour-spot { position: fixed; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 3px var(--primary-ink), 0 0 0 9999px rgba(12,16,14,.62); transition: all 240ms var(--ease-out); }
.tour-card { position: fixed; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 1.5rem)); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 1rem 1rem 0.8rem; box-shadow: 0 18px 48px rgba(0,0,0,.3); }
.tour-card h3 { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 1.05rem; }
.tour-card p { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--ink-muted); }
.tour-card .tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tour-card .tour-count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

/* ---------- Canonical splash (Canon 17.1) ---------- */
.splash { z-index: 9999; }
.splash .splash-mark { position: relative; width: 104px; height: 104px; display: grid; place-items: center; }
.splash .splash-mark .ring { position: absolute; inset: 0; border-radius: 50%; }          /* text-free: bright spectrum is allowed here */
.splash .splash-mark .core { position: relative; width: 88px; height: 88px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 2rem; font-weight: 700; }
.splash .splash-mark img { position: relative; width: 88px; height: 88px; object-fit: contain; border-radius: 50%; }
.splash .tagline { color: var(--ink-muted); }
.splash .splash-load { width: min(260px, 70vw); text-align: center; }
.splash .splash-load .bar { height: 3px; border-radius: 999px; background: var(--line-strong); overflow: hidden; }
.splash .splash-load .bar i { display: block; height: 100%; width: 0; background: var(--primary); }
.splash .splash-load .status { display: block; margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-muted); min-height: 1em; }
.splash .credit { color: var(--ink-muted); font-size: 0.66rem; }
.splash.hide { transition: opacity 0.6s var(--ease-out); }

html[data-splash="full"] .splash .splash-mark { animation: sp-mark 1.8s var(--ease-out) both, sp-breathe 3.6s ease-in-out 1.8s infinite; }
html[data-splash="full"] .splash h1 { animation: sp-fade 0.5s ease 1.3s both; }
html[data-splash="full"] .splash .tagline { animation: sp-fade 0.5s ease 1.55s both; }
html[data-splash="full"] .splash .gamazine-bar { animation: sp-fade 0.5s ease 1.55s both; }
html[data-splash="full"] .splash .splash-load { animation: sp-fade 0.4s ease 1.7s both; }
html[data-splash="full"] .splash .splash-load .bar i { animation: sp-fill 2.3s linear 1.7s both; }
html[data-splash="full"] .splash .credit { animation: sp-fade 0.4s ease 0.2s both; }
@keyframes sp-mark { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes sp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sp-fill { from { width: 0; } to { width: 100%; } }
@keyframes sp-breathe { 0%,100% { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--primary) 30%, transparent)); } 50% { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--primary) 55%, transparent)); } }
@media (prefers-reduced-motion: reduce) {
  html[data-splash] .splash *, html[data-splash] .splash { animation: none !important; }
  html[data-splash] .splash .splash-load .bar i { width: 100%; }
}

/* ---------- Brand artwork (v1.8.0) ---------- */
.header .mark, .sidebar .side-brand .mark { overflow: hidden; }
.header .mark img, .sidebar .side-brand .mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chikara-halo .halo-core { overflow: hidden; }
.chikara-halo .halo-core img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; pointer-events: none; }
.splash .splash-mark.splash-art { width: min(90vw, 420px); height: auto; aspect-ratio: 1 / 1; border-radius: 22px; overflow: hidden; display: block;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28); }
.splash .splash-mark.splash-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; display: block; }
.about-logo { display: block; width: min(45%, 170px); height: auto; aspect-ratio: 1 / 1; margin: 0 auto 0.75rem; border-radius: 16px; object-fit: cover; }
