/* === 字体 === */
@font-face {
    font-family: 'Unifont';
    src: url('../unifont-17.0.03.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* === CSS 变量 === */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --link-color: #0000ff;
    --font-size: 14px;
    --line-height: 20px;
    --font-family: 'Unifont', monospace;
}

/* === 全局样式 === */
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
    cursor: none;  /* 全局隐藏原生光标 */
}

/* === 网格容器 === */
#grid {
    position: relative;
    user-select: none;
    cursor: none;
}

#grid-canvas {
    display: block;
    cursor: none;
}

/* Cell styles removed — all rendering is now canvas-based */

/* === Media console DOM overlay (img/iframe inside console windows) === */
.console-media {
    position: absolute;
    z-index: 10;
    border: none;
    object-fit: contain;
    background: #0a0a0a;
    pointer-events: auto;
}

/* === 图片 Overlay === */
#image-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

#image-overlay.hidden {
    display: none;
}

#overlay-image {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
}

#overlay-hint {
    margin-top: 20px;
    color: #666;
    font-family: var(--font-family);
    font-size: 12px;
}

/* === 版权信息 === */
#copyright {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.6;
    user-select: none;
    pointer-events: none;
    z-index: 100;
}

/* === 圆形光标 === */
#cursor-circle {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 999;
    display: none;
    box-sizing: border-box;
    transition: border-color 0.1s ease, width 0.2s ease, height 0.2s ease;
    mix-blend-mode: difference;
}

#cursor-circle.active {
    display: block;
}

#cursor-circle.on-link {
    border-color: rgba(255, 255, 0, 0.8);
}

/* === 响应式设计 === */
@media (max-width: 768px) {
    :root {
        --font-size: 10px;
        --line-height: 14px;
    }
    
    /* 移动端恢复默认光标 */
    body {
        cursor: auto;
        font-size: var(--font-size);
    }
    
    #grid {
        cursor: auto;
        font-size: var(--font-size);
        line-height: var(--line-height);
    }
    
    #copyright {
        font-size: 10px;
        bottom: 5px;
    }
    
    /* 移动端圆形光标样式 */
    #cursor-circle.mobile {
        display: block !important;
        border-width: 2px;
        border-color: rgba(255, 255, 255, 0.8);
        background: transparent;
        /* 大小由 JS 动态控制，快速过渡 */
        transition: border-color 0.1s ease, width 0.1s ease, height 0.1s ease;
    }

    /* 移动端光标在链接上时 */
    #cursor-circle.mobile.on-link {
        border-color: rgba(255, 255, 0, 0.8);
    }
    
    /* 隐藏移动端光标（fallback 模式） */
    #cursor-circle.hidden {
        display: none !important;
    }
}

/* === 移动端陀螺仪启动按钮 === */
#gyro-start-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    padding: 20px 40px;
    font-family: var(--font-family);
    font-size: 16px;
    background: var(--link-color);
    color: white;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#gyro-start-btn.hidden {
    display: none;
}

#gyro-start-btn:active {
    opacity: 0.8;
}

/* Hidden input for keyboard capture */
#console-hidden-input {
    position: fixed;
    opacity: 0;
    width: 1px;
    height: 1px;
    top: -100px;
    left: -100px;
    pointer-events: none;
    font-size: 16px; /* Prevent iOS zoom */
}

/* Toggle button (visible when console is closed) */
#console-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    width: 40px;
    height: 40px;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #888;
    font-family: var(--font-family);
    font-size: 14px;
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
}

#console-toggle-btn.visible {
    display: flex;
}

#console-toggle-btn:hover {
    color: #e0e0e0;
    border-color: #666;
}

/* === Console 移动端适配 === */
@media (max-width: 768px) {
    #console-toggle-btn {
        bottom: 10px;
        right: 10px;
    }
}

