:root {
    --bg: #0a0a0a;

    /* ConteX系の“オレンジ端末”を継承 */
    --color: #F6723A;
    --color-dim: rgba(246, 114, 58, 0.40);

    --panel: rgba(246, 114, 58, 0.02);
    --line: rgba(246, 114, 58, 0.85);
    --line-dim: rgba(246, 114, 58, 0.35);

    --good: #6cffb1;
}

/* ========================= BASE ========================= */
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--color);
    font-family: 'VT323', monospace;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
    text-transform: uppercase;

    text-shadow:
        0 0 4px var(--color-dim),
        0 0 15px var(--color-dim);

    font-size: 1.1rem;
}

.mono {
    letter-spacing: 1px;
}

.small {
    font-size: 0.95em;
    opacity: 0.85;
}

.good {
    color: var(--good);
}

/* CRT scanlines */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px);
    pointer-events: none;
    z-index: 99;
}

/* no selection */
html,
body,
body * {
    -webkit-user-select: none;
    user-select: none;
}

/* =========================
   LINK (orange terminal style)
========================= */
.panel a {
    color: var(--color);
    /* オレンジ */
    text-decoration: none;
    /* 下線消す */
    display: inline-block;
}

.panel a p {
    margin: 6px 0 0;
    /* pの余白整理 */
    color: inherit;
    /* aの色を継承 */
    letter-spacing: 2px;
    opacity: 0.95;
}

/* visitedでも紫にしない */
.panel a:visited {
    color: var(--color);
}

/* hoverで“光る” */
.panel a:hover {
    color: var(--color);
    text-shadow:
        0 0 6px rgba(246, 114, 58, .55),
        0 0 18px rgba(246, 114, 58, .25);
}

/* キーボード操作でもそれっぽく */
.panel a:focus-visible {
    outline: 2px solid var(--line);
    outline-offset: 3px;
    box-shadow: 0 0 10px rgba(246, 114, 58, .35);
}

/* ========================= SCREEN ========================= */
.screen {
    min-height: calc(100vh - 106px);
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

/* ========================= PANELS ========================= */
.panel {
    border: 1px dotted var(--color-dim);
    background: rgba(0, 0, 0, 0.10);
    padding: 12px;
}

.label {
    display: inline-block;
    margin-bottom: 6px;
    opacity: 0.85;
    letter-spacing: 2px;
}

.home-logo {
    width: 300px;
    height: 300px;
    border-radius: 18px;
    opacity: 0.95;
    filter:
        drop-shadow(0 0 6px rgba(246, 114, 58, 0.18)) drop-shadow(0 0 16px rgba(246, 114, 58, 0.10));
    transform-origin: 50% 60%;
    will-change: transform, filter;
}

/* =========================
   WORKS : BLOG STYLE TILES
========================= */
.works-tiles {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.work-tile {
    border: 1px dotted var(--color-dim);
    background: rgba(0, 0, 0, 0.22);
    overflow: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(246, 114, 58, 0.08);
    transition: box-shadow .2s ease, border-color .2s ease;
}

.work-tile:hover {
    border-color: var(--line);
    box-shadow:
        0 0 16px rgba(246, 114, 58, 0.35),
        inset 0 0 10px rgba(246, 114, 58, 0.15);
}

/* media */
.work-tile img,
.work-tile video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #000;
}

/* text area */
.work-meta {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.work-title {
    letter-spacing: 2px;
    font-size: 1.05rem;
}

.work-desc {
    opacity: .85;
    line-height: 1.3;
}

/* ========================= BOOT ========================= */
#boot {
    justify-content: center;
    align-items: center;
}

.boot-frame {
    width: min(980px, 100%);
    border: 2px solid var(--line);
    background: var(--panel);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.boot-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
}

.brand-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    opacity: 0.95;
    filter: drop-shadow(0 0 10px rgba(246, 114, 58, 0.18));
}

.brand-text {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.boot-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 10px 6px;
}

.hero-logo {
    width: 160px;
    height: 160px;
    border-radius: 18px;
    opacity: 0.95;
    filter:
        drop-shadow(0 0 6px rgba(246, 114, 58, 0.18)) drop-shadow(0 0 16px rgba(246, 114, 58, 0.10));
    transform-origin: 50% 60%;
    will-change: transform, filter;
}

/* jump flash (ConteX継承) */
.hero-logo.is-jumpflash {
    animation: ctxJumpFlash 260ms ease-out 1;
}

@keyframes ctxJumpFlash {
    0% {
        transform: translateY(0) scale(1);
        filter: brightness(1) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }

    35% {
        transform: translateY(-10px) scale(1.08);
        filter: brightness(1.5) drop-shadow(0 0 18px rgba(180, 255, 230, 0.55));
    }

    100% {
        transform: translateY(0) scale(1);
        filter: brightness(1) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
}

.details {
    opacity: 0.75;
    letter-spacing: 1px;
}

.boot-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.boot-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    opacity: 0.9;
}

.transfer {
    margin-top: 10px;
    letter-spacing: 0.12em;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.transfer.is-show {
    opacity: 1;
    transform: translateY(0);
}

/* ========================= BUTTON SYSTEM ========================= */
.btn,
.navbtn {
    background: transparent;
    border: 2px solid var(--line-dim);
    color: var(--color);
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.05rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-sizing: border-box;
    text-decoration: none;

    transition:
        color .15s linear,
        border-color .15s linear,
        box-shadow .15s linear,
        background .15s linear;
}

.btn:hover,
.navbtn:hover {
    border-color: var(--line);
    background: rgba(246, 114, 58, 0.06);
    box-shadow:
        0 0 6px rgba(246, 114, 58, 0.35),
        inset 0 0 4px rgba(246, 114, 58, 0.15);
}

.btn.primary {
    border-color: var(--line);
    background: rgba(246, 114, 58, 0.05);
}

.btn[aria-disabled="true"] {
    opacity: .45;
    pointer-events: none;
}

/* ========================= TERMINAL ========================= */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;

    border: 2px solid var(--line);
    background: var(--panel);

    padding: 10px;
    margin-bottom: 12px;
}

.terminal-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-title {
    letter-spacing: 2px;
    font-weight: bold;
}

.terminal-status {
    text-shadow:
        0 0 4px rgba(108, 255, 177, 0.8),
        0 0 10px rgba(108, 255, 177, 0.6),
        0 0 20px rgba(108, 255, 177, 0.35);
}

.terminal-right {
    display: flex;
    gap: 18px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.kv strong {
    letter-spacing: 2px;
}

/* layout */
.terminal-main {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 15px;
    height: calc(100vh - 120px);
}

.terminal-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 2px solid var(--line);
    background: var(--panel);
    padding: 10px;
}

.navbtn {
    width: 100%;
    text-align: left;
}

.navbtn.active {
    border-color: var(--line);
    background: rgba(246, 114, 58, 0.08);
    padding-left: 14px;
    border-left: 3px solid var(--line);
    box-shadow:
        0 0 12px rgba(246, 114, 58, 0.55),
        inset 0 0 6px rgba(246, 114, 58, 0.25);
}

.navsep {
    border: none;
    border-top: 1px dotted var(--color-dim);
    margin: 10px 0;
}

.terminal-view {
    border: 2px solid var(--line);
    background: var(--panel);
    padding: 12px;
    overflow: auto;
}

/* content helpers */
.grid-2 {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.work-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.work-card {
    border: 1px dotted var(--color-dim);
    background: rgba(0, 0, 0, 0.18);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.work-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.work-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* console log */
.console-log {
    padding: 10px;
    border: 1px dotted var(--color-dim);
    background: rgba(0, 0, 0, 0.35);
    line-height: 1.4;
    max-height: 240px;
    overflow: auto;
}

/* ========================= FOOTER NAV ========================= */
footer.footer-nav {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.78;
    pointer-events: none;
}

footer.footer-nav a {
    pointer-events: auto;
    color: var(--color-dim);
    text-decoration: none;
    letter-spacing: 2px;

    border: 2px solid var(--line);
    padding: 6px 12px;
    background: rgba(246, 114, 58, 0.04);

    box-shadow:
        0 0 6px rgba(246, 114, 58, 0.25),
        inset 0 0 4px rgba(246, 114, 58, 0.15);

    text-shadow:
        0 0 4px var(--color-dim),
        0 0 10px var(--color-dim);

    transition:
        color .15s linear,
        border-color .15s linear,
        box-shadow .15s linear,
        background .15s linear;
}

footer.footer-nav a:hover {
    border-color: var(--line);
    background: rgba(246, 114, 58, 0.08);
    box-shadow:
        0 0 12px rgba(246, 114, 58, 0.55),
        inset 0 0 6px rgba(246, 114, 58, 0.25);
    color: var(--color);
}

/* boot中は右側を隠しても良い（ConteX継承の演出） */
#boot:not(.hidden)~footer.footer-nav .footer-right {
    display: none;
}

/* =========================
   REMOVE LEFT FOOTER (RETURN)
========================= */
footer.footer-nav .footer-left {
    display: none !important;
}

/* ========================= LEAVE FX ========================= */
.leave-fx {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

.leave-fx::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.05) 0px,
            rgba(255, 255, 255, 0.05) 1px,
            transparent 1px,
            transparent 3px);
    opacity: 0;
}

@keyframes leaveFadeToBlack {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 0.08;
    }

    40% {
        opacity: 0.22;
    }

    60% {
        opacity: 0.45;
    }

    72% {
        opacity: 0.65;
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

@keyframes leaveScanIn {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 0.08;
    }

    60% {
        opacity: 0.15;
    }

    75% {
        opacity: 0.22;
    }

    100% {
        opacity: 0.22;
    }
}

.leave-fx.is-on {
    animation: leaveFadeToBlack 1200ms cubic-bezier(.12, .88, .08, 1) forwards;
}

.leave-fx.is-on::before {
    animation: leaveScanIn 1200ms cubic-bezier(.12, .88, .08, 1) forwards;
}

/* ========================= INITIAL BOOT FADE-IN ========================= */
.boot-fade {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 1;
    pointer-events: none;
    z-index: 1200;
}

.boot-fade.is-off {
    animation: bootFadeOut 1800ms cubic-bezier(.12, .88, .08, 1) forwards;
}

@keyframes bootFadeOut {
    0% {
        opacity: 1;
    }

    25% {
        opacity: 0.88;
    }

    60% {
        opacity: 0.35;
    }

    100% {
        opacity: 0;
    }
}

/* ========================= FX overlays ========================= */
.fx {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 900;
}

/* 画像素材が無い前提でも “それっぽく” するため、CSSのみのノイズ/グレインに寄せる */
.fx-crt {
    opacity: 0.06;
    mix-blend-mode: overlay;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.08) 0px, rgba(0, 0, 0, 0.08) 1px, transparent 1px, transparent 4px);
    animation: crtJitter 0.16s steps(2) infinite;
}

@keyframes crtJitter {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-0.6%, 0.4%, 0);
    }
}

.fx-glass {
    opacity: 0.05;
    mix-blend-mode: screen;
    background:
        radial-gradient(circle at 10% 15%, rgba(246, 114, 58, 0.08), transparent 35%),
        radial-gradient(circle at 80% 30%, rgba(246, 114, 58, 0.06), transparent 40%),
        radial-gradient(circle at 30% 85%, rgba(246, 114, 58, 0.05), transparent 45%);
}

/* vignette */
.fx-vignette {
    opacity: 0.95;
    mix-blend-mode: multiply;
    background: radial-gradient(ellipse at center,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.12) 55%,
            rgba(0, 0, 0, 0.28) 72%,
            rgba(0, 0, 0, 0.62) 88%,
            rgba(0, 0, 0, 0.95) 100%);
    border-radius: 18px;
    transform: scale(1.01);
}

/* ========================= RESPONSIVE ========================= */
@media (max-width: 900px) {

    /* ページ全体をスクロールできるように戻す */
    body {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        /* iOSの慣性スクロール */
    }

    /* 画面高さ固定を解除して、コンテンツ分だけ伸びるように */
    .terminal-main {
        height: auto;
        /* ← すでに書いてるけど念のため */
        min-height: 0;
    }

    /* 中身側の “中だけスクロール” をやめて、ページでスクロールさせる */
    .terminal-view {
        overflow: visible;
        max-height: none;
    }

    /* Boot画面も縦に長くなったらスクロールできるように */
    .screen {
        min-height: auto;
    }

    .terminal-main {
        grid-template-columns: 1fr;
        height: auto;
    }

    .work-grid {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* =========================
   GLOBAL SCROLLBAR (ORANGE)
========================= */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(246, 114, 58, 0.65) rgba(246, 114, 58, 0.08);
}

/* WebKit (Chrome / Edge / Safari) */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(246, 114, 58, 0.06);
    border: 1px dotted rgba(246, 114, 58, 0.22);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.55);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
            rgba(246, 114, 58, 0.75),
            rgba(246, 114, 58, 0.35));
    border: 1px solid rgba(246, 114, 58, 0.55);
    box-shadow:
        0 0 10px rgba(246, 114, 58, 0.25),
        inset 0 0 6px rgba(0, 0, 0, 0.35);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
            rgba(246, 114, 58, 0.95),
            rgba(246, 114, 58, 0.5));
    border-color: rgba(246, 114, 58, 0.85);
}

*::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.7);
}