/* ============================================================
   ORBIT DOSSIER — mobile first
   ============================================================ */

:root {
    --bg: #07040a;
    --bg-2: #12060f;
    --panel: rgba(10, 4, 12, 0.94);
    --panel-2: rgba(18, 8, 16, 0.88);
    --text: #f3eef4;
    --muted: rgba(243, 238, 244, 0.62);
    --accent: #e50081;
    --accent-2: #7af0ff;
    --accent-dim: rgba(229, 0, 129, 0.22);
    --border: rgba(229, 0, 129, 0.38);
    --glow: rgba(229, 0, 129, 0.45);
    --ok: #6dffb0;
    --warn: #ffc857;
    --danger: #ff5d6c;
    --radius: 16px;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace;
    --sans: "Segoe UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    --pad: clamp(12px, 4.2vw, 28px);
    --max: 760px;
}

[data-theme="boruto"] {
    --accent: #5ce1ff;
    --accent-2: #e50081;
    --glow: rgba(92, 225, 255, 0.4);
    --border: rgba(92, 225, 255, 0.34);
    --bg: #05080e;
    --bg-2: #0b1220;
}
[data-theme="kawaki"] {
    --accent: #ff5a3d;
    --accent-2: #c9c3bf;
    --glow: rgba(255, 90, 61, 0.42);
    --border: rgba(255, 90, 61, 0.36);
    --bg: #0c0706;
    --bg-2: #1a0c0a;
}
[data-theme="sarada"] {
    --accent: #ff3b4e;
    --accent-2: #ffd0d4;
    --glow: rgba(255, 59, 78, 0.42);
    --border: rgba(255, 59, 78, 0.36);
    --bg: #0c0508;
    --bg-2: #1a0810;
}
[data-theme="mitsuki"] {
    --accent: #4dffc2;
    --accent-2: #b8ffe8;
    --glow: rgba(77, 255, 194, 0.38);
    --border: rgba(77, 255, 194, 0.34);
    --bg: #04100c;
    --bg-2: #072018;
}
[data-theme="naruto"] {
    --accent: #ff9a2e;
    --accent-2: #ffe08a;
    --glow: rgba(255, 154, 46, 0.42);
    --border: rgba(255, 154, 46, 0.36);
    --bg: #100a04;
    --bg-2: #1c1206;
}
[data-theme="sasuke"] {
    --accent: #8b7cff;
    --accent-2: #d4ccff;
    --glow: rgba(139, 124, 255, 0.42);
    --border: rgba(139, 124, 255, 0.36);
    --bg: #07060f;
    --bg-2: #100e1c;
}
[data-theme="himawari"] {
    --accent: #ffd45c;
    --accent-2: #c9b7ff;
    --glow: rgba(255, 212, 92, 0.4);
    --border: rgba(255, 212, 92, 0.36);
    --bg: #0d0a04;
    --bg-2: #1a1408;
}
[data-theme="code"] {
    --accent: #f2f2f2;
    --accent-2: #ff2d4a;
    --glow: rgba(255, 45, 74, 0.38);
    --border: rgba(242, 242, 242, 0.28);
    --bg: #080808;
    --bg-2: #141010;
}
[data-theme="otsutsuki"] {
    --accent: #e8d6ff;
    --accent-2: #9d7bff;
    --glow: rgba(157, 123, 255, 0.42);
    --border: rgba(232, 214, 255, 0.3);
    --bg: #06040c;
    --bg-2: #10081a;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

[id] { scroll-margin-top: 72px; }

a { -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--sans);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 50% -10%, var(--glow), transparent 55%),
        radial-gradient(900px 500px at 110% 110%, var(--accent-dim), transparent 50%),
        linear-gradient(180deg, var(--bg), var(--bg-2) 40%, #000 140%);
    line-height: 1.75;
    letter-spacing: 0.01em;
    padding:
        max(10px, env(safe-area-inset-top))
        max(var(--pad), env(safe-area-inset-right))
        max(28px, env(safe-area-inset-bottom))
        max(var(--pad), env(safe-area-inset-left));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 40;
    opacity: 0.07;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.18) 0,
        rgba(255, 255, 255, 0.18) 1px,
        transparent 1px,
        transparent 4px
    );
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 41;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

.dossier {
    width: min(var(--max), 100%);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ---------- HUD ---------- */
.hud {
    position: sticky;
    top: max(0px, env(safe-area-inset-top));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 auto 12px;
    width: min(var(--max), 100%);
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(8, 5, 12, 0.82);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.hud-rec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--danger);
}

.hud-rec::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    animation: rec 1.4s ease-in-out infinite;
}

@keyframes rec {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.hud time { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- WINDOWS ---------- */
.window {
    position: relative;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 18px 50px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: 280px;
}

.window::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid var(--accent-dim);
    border-radius: calc(var(--radius) - 6px);
    pointer-events: none;
    opacity: 0.45;
}

.window-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.dots {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
    background: var(--accent);
    opacity: 0.35;
}

.dots i:nth-child(1) { opacity: 0.9; background: var(--accent); }
.dots i:nth-child(2) { opacity: 0.55; background: var(--accent-2); }
.dots i:nth-child(3) { opacity: 0.3; }

.window-bar b {
    color: var(--text);
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.window-bar em {
    font-style: normal;
    color: var(--accent);
    opacity: 0.85;
}

/* ---------- HERO ---------- */
.hero {
    display: grid;
    justify-items: center;
    text-align: center;
    padding: 22px 16px 20px;
    gap: 14px;
}

.avatar-wrap {
    position: relative;
    width: min(42vw, 148px);
    aspect-ratio: 1;
}

.avatar-wrap::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: conic-gradient(from 200deg, var(--accent), transparent 40%, var(--accent-2), transparent 75%, var(--accent));
    opacity: 0.55;
    animation: spin 12s linear infinite;
    filter: blur(0.2px);
}

.avatar-wrap::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1px dashed var(--border);
    animation: spin 22s linear infinite reverse;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.avatar {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent);
    background: #111;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stamp {
    position: absolute;
    right: -6%;
    bottom: 6%;
    z-index: 2;
    padding: 4px 8px;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    transform: rotate(-12deg);
    background: rgba(0, 0, 0, 0.55);
    animation: stampPulse 3.2s ease-in-out infinite;
}

@keyframes stampPulse {
    0%, 100% { opacity: 0.72; }
    50% { opacity: 1; }
}

.hero h1 {
    margin: 4px 0 0;
    font-size: clamp(1.45rem, 7vw, 2.35rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.15;
}

.kana {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 0.38em;
    color: var(--accent);
    font-weight: 500;
}

.subtitle {
    margin: 0;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    max-width: 36ch;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 92px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--mono);
    text-align: left;
}

.chip span {
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.chip strong {
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--accent-2);
    font-weight: 700;
}

/* ---------- TOC ---------- */
.toc {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 0 14px;
    padding: 2px 2px 8px;
}

.toc::-webkit-scrollbar { display: none; }

.toc a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: var(--panel-2);
}

.toc a:hover,
.toc a:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

/* ---------- TELEMETRY ---------- */
.meters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 14px 16px;
}

.meter label {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.meter b { color: var(--text); font-weight: 600; }

.bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.bar > i {
    display: block;
    height: 100%;
    width: var(--v, 50%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform-origin: left;
    animation: fill 1.1s ease-out both;
}

@keyframes fill {
    from { transform: scaleX(0); }
}

/* ---------- ARTICLE ---------- */
.article {
    padding: 16px 16px 18px;
}

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.article h2 {
    margin: 0 0 10px;
    font-size: clamp(1.05rem, 4.4vw, 1.35rem);
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.article p {
    margin: 0 0 12px;
    font-size: clamp(0.95rem, 3.7vw, 1.05rem);
    color: rgba(243, 238, 244, 0.9);
    max-width: 62ch;
}

.article p:last-child { margin-bottom: 0; }

.pull {
    margin: 14px 0 4px;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    background: var(--accent-dim);
    font-size: 0.95rem;
    color: var(--text);
    font-style: italic;
}

/* ---------- FOOT / BACK ---------- */
.back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px auto 0;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: var(--panel);
}

.back:hover,
.back:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.foot {
    margin-top: 16px;
    text-align: center;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- REVEAL ---------- */
.reveal {
    animation: rise 0.7s ease both;
}

.reveal:nth-of-type(2) { animation-delay: 0.05s; }
.reveal:nth-of-type(3) { animation-delay: 0.1s; }
.reveal:nth-of-type(4) { animation-delay: 0.15s; }
.reveal:nth-of-type(5) { animation-delay: 0.2s; }
.reveal:nth-of-type(6) { animation-delay: 0.25s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* ---------- DESKTOP ---------- */
@media (min-width: 720px) {
    body { padding-top: 22px; }

    .hero {
        grid-template-columns: 168px 1fr;
        justify-items: start;
        text-align: left;
        align-items: center;
        padding: 28px 28px 24px;
        gap: 28px;
    }

    .avatar-wrap { width: 168px; }

    .chips { justify-content: flex-start; }

    .meters {
        grid-template-columns: 1fr 1fr;
        padding: 20px 22px 22px;
        gap: 16px 22px;
    }

    .article { padding: 22px 24px 24px; }

    .window { margin-bottom: 18px; }
}

@media (hover: hover) and (min-width: 720px) {
    .window {
        transition: transform 0.25s ease, border-color 0.25s ease;
    }
    .window:hover {
        transform: translateY(-2px);
        border-color: var(--accent);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    html { scroll-behavior: auto; }
}
