/* =========================================================
   teleport.qus.moe — terminal stylesheet
   保留：纸张 + 终端双栏、黑白主调、等宽字体、网点背景
   增强：geek 元素 — prompt 符号、scanline、闪烁光标、状态角标
   ========================================================= */

:root {
    --bg-color: #e6e6e6;
    --paper-color: #ffffff;
    --terminal-bg: #f3f3f3;
    --ink-color: #0a0a0a;
    --ink-soft: #2a2a2a;
    --muted: #6a6a6a;
    --accent: #00b86b;          /* 终端绿 — 仅做点缀 */
    --warn: #ff5b3a;
    --grid: #cfcfcf;

    --font-main: 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
                 'SFMono-Regular', 'Consolas', 'Courier New', Courier, monospace;
    --font-cn: 'JetBrains Mono', 'Cascadia Code',
               'PingFang SC', 'Microsoft YaHei', 'Courier New', monospace;

    --header-height: 50px;
    --border-w: 2px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    background-color: var(--bg-color);
    color: var(--ink-color);
    font-family: var(--font-cn);
    font-size: 14px;
    line-height: 1.45;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    /* 网点 + 极淡的扫描线，复合背景 */
    background-image:
        radial-gradient(var(--grid) 1px, transparent 1px),
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,0.018) 3px 4px);
    background-size: 20px 20px, 100% 4px;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* =================== 顶部导航 =================== */
.top-nav {
    height: var(--header-height);
    background: var(--paper-color);
    border-bottom: var(--border-w) solid var(--ink-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    flex-shrink: 0;
    z-index: 10;
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 1px;
    font-family: var(--font-main);
}

.brand .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    animation: pulse 1.6s ease-in-out infinite;
}

.brand .name::before { content: "[ "; color: var(--muted); font-weight: 400; }
.brand .name::after  { content: " ]"; color: var(--muted); font-weight: 400; }

.brand .cursor {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    background: var(--ink-color);
    margin-left: -2px;
    animation: blink 1.05s steps(1) infinite;
    transform: translateY(2px);
}

.quick-links {
    display: flex;
    gap: 14px;
    align-items: center;
}

.icon-link {
    color: var(--ink-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: transform 0.15s ease;
}

.icon-link .iconify {
    width: 22px;
    height: 22px;
    color: var(--ink-color);
}

.icon-link:hover { transform: translateY(-2px); }
.icon-link:active { transform: translateY(0); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.85); }
}
@keyframes blink {
    50% { background: transparent; }
}

/* =================== 主体分屏 =================== */
.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ---- 左侧控制面板（纸张） ---- */
.left-panel {
    width: 40%;
    min-width: 320px;
    background-color: var(--paper-color);
    border-right: var(--border-w) solid var(--ink-color);
    padding: 1.4rem 1.6rem 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.04);
}

.panel-tag {
    display: block;
    font-size: 0.76rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
    letter-spacing: 1px;
    font-family: var(--font-main);
}
.panel-tag::before { content: "$ "; color: var(--accent); }

.panel-title {
    font-size: 1.7rem;
    font-weight: 900;
    margin-bottom: 0.7rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
}
.panel-title::before {
    content: "// ";
    color: var(--accent);
    font-weight: 700;
}

.intro-text {
    margin-bottom: 1.6rem;
    line-height: 1.6;
    border-left: 3px solid var(--ink-color);
    padding: 0.45rem 0.85rem;
    background: rgba(0,0,0,0.025);
    font-size: 0.88rem;
}
.intro-text p { margin: 0.1rem 0; }
.intro-text p::before {
    content: "> ";
    color: var(--accent);
    font-weight: 700;
}

.section-divider {
    margin: 1.6rem 0 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 0.82rem;
    letter-spacing: 2px;
    font-family: var(--font-main);
}
.section-divider::before {
    content: "##";
    color: var(--accent);
}
.section-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px dashed var(--ink-color);
    margin-left: 6px;
    opacity: 0.6;
}

.data-row {
    display: flex;
    margin-bottom: 0.55rem;
    font-size: 0.93rem;
    align-items: baseline;
    gap: 0.6rem;
}

.key {
    font-weight: 700;
    min-width: 84px;
    color: var(--muted);
    font-family: var(--font-main);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.key::before { content: "▸ "; color: var(--accent); }

.value {
    flex: 1;
    min-width: 0;
}

.value a, .copy-btn {
    color: var(--ink-color);
    text-decoration: none;
    border-bottom: 1px solid var(--ink-color);
    transition: background 0.12s ease, color 0.12s ease;
    cursor: pointer;
    word-break: break-all;
    padding: 0 1px;
    display: inline-block;
}
.value a:hover, .copy-btn:hover {
    background: var(--ink-color);
    color: var(--paper-color);
}
.value a:active, .copy-btn:active {
    background: var(--accent);
    color: var(--ink-color);
}
.copy-btn::after {
    content: " ⌘";
    font-size: 0.75em;
    opacity: 0.5;
    margin-left: 2px;
}

/* ---- 右侧 ASCII 终端 ---- */
.right-panel {
    flex: 1;
    background-color: var(--terminal-bg);
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.07);
    min-width: 0;
}

/* 扫描线叠层 */
.right-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent 0 2px,
        rgba(0,0,0,0.03) 2px 3px
    );
    z-index: 1;
}
/* 内框 */
.right-panel::after {
    content: "";
    position: absolute;
    inset: 8px;
    pointer-events: none;
    border: 1px dashed rgba(0,0,0,0.22);
    z-index: 2;
}

canvas { display: block; position: relative; z-index: 0; }

/* 角标 */
.corner {
    position: absolute;
    font-family: var(--font-main);
    font-size: 0.7rem;
    color: var(--ink-soft);
    opacity: 0.55;
    pointer-events: none;
    letter-spacing: 1px;
    z-index: 5;
    white-space: nowrap;
}
.corner.tl { top: 14px; left: 18px; }
.corner.tr { top: 14px; right: 18px; }
.corner.bl { bottom: 14px; left: 18px; }
.corner.br { bottom: 14px; right: 18px; }

.corner .blink {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 4px;
    vertical-align: middle;
    animation: pulse 1.4s ease-in-out infinite;
}

.terminal-status {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    opacity: 0.65;
    pointer-events: none;
    text-align: center;
    width: 92%;
    z-index: 5;
    font-family: var(--font-main);
}

/* toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: var(--ink-color);
    color: var(--paper-color);
    padding: 0.65rem 1.1rem;
    font-size: 0.85rem;
    font-family: var(--font-main);
    border: 2px solid var(--ink-color);
    box-shadow: 4px 4px 0 0 var(--accent);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast::before { content: "> "; color: var(--accent); }

/* =================== 移动端适配 =================== */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: auto;
        font-size: 13px;
    }

    .top-nav {
        padding: 0 14px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
    .brand { font-size: 0.9rem; gap: 6px; letter-spacing: 0.5px; }
    .brand .dot { width: 7px; height: 7px; }
    .quick-links { gap: 12px; }
    .icon-link .iconify { width: 20px; height: 20px; }

    .main-container {
        flex-direction: column;
        height: auto;
    }

    /* ASCII 移到顶部当作 hero 区，更有冲击 */
    .right-panel {
        order: -1;
        width: 100%;
        height: 42vh;
        height: 42dvh;
        min-height: 260px;
        max-height: 440px;
        border-bottom: var(--border-w) solid var(--ink-color);
        border-right: none;
    }

    .left-panel {
        width: 100%;
        min-width: 0;
        border-right: none;
        padding: 1.1rem 1.1rem 2.2rem;
        padding-left: max(1.1rem, env(safe-area-inset-left));
        padding-right: max(1.1rem, env(safe-area-inset-right));
        padding-bottom: max(2.2rem, env(safe-area-inset-bottom));
        box-shadow: none;
        overflow-y: visible;
    }

    .panel-title { font-size: 1.45rem; }
    .panel-tag   { font-size: 0.72rem; }
    .intro-text  { font-size: 0.85rem; }
    .data-row    { font-size: 0.9rem; margin-bottom: 0.65rem; }
    .key         { min-width: 72px; font-size: 0.78rem; }
    .corner      { font-size: 0.65rem; }
    .corner.tl, .corner.tr { top: 10px; }
    .corner.bl, .corner.br { bottom: 10px; }
    .corner.tl, .corner.bl { left: 12px; }
    .corner.tr, .corner.br { right: 12px; }
    .terminal-status { bottom: 30px; font-size: 0.72rem; }
}

/* 极窄屏 */
@media (max-width: 380px) {
    .data-row {
        flex-wrap: wrap;
        gap: 0.2rem;
    }
    .key { min-width: 0; flex: 0 0 100%; }
    .quick-links { gap: 10px; }
    .icon-link .iconify { width: 18px; height: 18px; }
}

/* 触摸设备：去掉 crosshair 光标 */
@media (hover: none) and (pointer: coarse) {
    .right-panel { cursor: default; }
    .icon-link:hover { transform: none; }
    .value a:hover, .copy-btn:hover {
        background: transparent;
        color: var(--ink-color);
    }
}

/* 用户偏好降低动画 */
@media (prefers-reduced-motion: reduce) {
    .brand .dot,
    .brand .cursor,
    .corner .blink {
        animation: none;
    }
}
