/* ===== Terminal Portfolio - 優化配色版 ===== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    background: #0a0a0a;
    color: #e6e6e6;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Terminal Container */
.terminal-container {
    max-width: 1400px;
    margin: 2rem auto;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(100, 150, 255, 0.3);
    overflow: hidden;
    min-height: calc(100vh - 4rem);
}

/* Terminal Header */
.terminal-header {
    background: #0d0d0d;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(100, 150, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.terminal-buttons {
    display: flex;
    gap: 0.5rem;
}

.terminal-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.btn-close {
    background: #ff5f56;
}

.btn-minimize {
    background: #ffbd2e;
}

.btn-maximize {
    background: #27c93f;
}

.terminal-title {
    font-size: 0.875rem;
    color: #666;
    flex: 1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.terminal-title:hover {
    color: #7a9cff;
}

.terminal-menu {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.menu-link {
    color: #7a9cff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.menu-link:hover {
    color: #a8c0ff;
    text-decoration: underline;
}

.github-icon {
    color: #7a9cff;
    display: inline-flex;
    align-items: center;
    margin-left: 1rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.github-icon:hover {
    color: #a8c0ff;
    transform: scale(1.1);
}

.github-icon svg {
    display: block;
}

/* Terminal Body */
.terminal-body {
    padding: 2rem;
    font-size: 1rem;
    line-height: 1.8;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

/* Custom Scrollbar */
.terminal-body::-webkit-scrollbar {
    width: 10px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #0d0d0d;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #7a9cff;
    border-radius: 5px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #a8c0ff;
}

/* CMD Lines - 指令要小且不顯眼,初始隱藏等待動畫 */
.cmd-line {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #666;
    opacity: 0;
}

.cmd-line.blank {
    height: 1rem;
}

.prompt {
    color: #666;
    font-weight: 400;
    user-select: none;
}

.command {
    color: #888;
    font-weight: 400;
}

.typing-cursor {
    color: #666;
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* CMD Output - 重點內容要大,初始隱藏等待動畫 */
.cmd-output {
    margin-left: 1.75rem;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.output-line {
    margin-bottom: 0.4rem;
    color: #e6e6e6;
    opacity: 0;
}

.output-line.blank {
    height: 0.75rem;
}

/* JSON Output */
.json-output {
    font-family: 'Fira Code', monospace;
    line-height: 1.8;
    color: #e6e6e6;
    margin: 0;
    white-space: pre;
    font-size: 1.15rem;
}

.key {
    color: #7a9cff;
    font-weight: 500;
}

.value {
    color: #fff;
    font-weight: 500;
}

/* Motto 標語樣式 - 手機版優先 (Mobile First) */
.motto {
    font-size: 1.5rem;
    /* 手機版縮小字體以確保單行 */
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 2px;
    margin: 1.5rem 0;
    text-shadow: 0 0 20px rgba(122, 156, 255, 0.5);
}

/* 平板版 (Tablet) */
@media (min-width: 481px) {
    .motto {
        font-size: 2rem;
        margin: 1.75rem 0;
    }
}

/* 中大型螢幕 (1080p / Laptop) */
@media (min-width: 769px) {
    .motto {
        font-size: 2.5rem;
        margin: 2rem 0;
    }
}

/* Text Styling - 增加配色 */
.highlight {
    color: #7a9cff;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.5px;
}

.subtitle {
    color: #a8c0ff;
    font-weight: 600;
    font-size: 1.2rem;
}

.period {
    color: #aaa;
    font-weight: 600;
}

.role {
    color: #fff;
    font-weight: 600;
}

.success {
    color: #a8c0ff;
    font-weight: 600;
}

.tech-label {
    color: #7a9cff;
    font-weight: 600;
}

.link {
    color: #7a9cff;
    text-decoration: underline;
}

.link:hover {
    color: #a8c0ff;
}

.info {
    color: #888;
    font-style: italic;
}

/* File Listing Styles */
.dir {
    color: #a8c0ff;
    font-weight: 600;
}

.file {
    color: #ccc;
}

.file-main {
    color: #fff;
    font-weight: 600;
}

/* Project Styles */
.project-badge {
    background: rgba(122, 156, 255, 0.2);
    color: #a8c0ff;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(122, 156, 255, 0.3);
}

.project-name {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Skills 多欄排列 */
.skills-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 1rem;
}

.skills-columns .output-line {
    margin-bottom: 0.3rem;
}

/* Section Spacing */
.cmd-section {
    margin-bottom: 3rem;
    scroll-margin-top: 5rem;
}

/* Selection */
::selection {
    background: #7a9cff;
    color: #fff;
}

::-moz-selection {
    background: #7a9cff;
    color: #fff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .skills-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .terminal-container {
        margin: 1.5rem 1.25rem;
        border-radius: 10px;
        min-height: calc(100vh - 3rem);
        background: rgba(26, 26, 26, 0.88);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }

    .terminal-body {
        padding: 1rem;
        font-size: 0.9rem;
        max-height: calc(100vh - 7rem);
    }

    .terminal-menu {
        display: flex;
        /* 確保選單容器顯示 */
        gap: 0.5rem;
    }

    .menu-link {
        display: none;
        /* 手機版隱藏文字連結，節省空間 */
    }

    .github-icon {
        margin-left: 0;
        /* 手機版取消左邊距 */
    }

    .terminal-title {
        font-size: 0.75rem;
    }

    .json-output {
        font-size: 0.95rem;
    }

    .highlight {
        font-size: 1.5rem;
    }

    .skills-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .terminal-body {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .cmd-output {
        margin-left: 1rem;
    }

    .terminal-buttons span {
        width: 10px;
        height: 10px;
    }

    .json-output {
        font-size: 0.85rem;
    }

    .highlight {
        font-size: 1.3rem;
    }
}

/* Smooth Scroll */
html {
    scroll-padding-top: 5rem;
}

/* Stats Section */
.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
}

.stat-card {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #1a1a1a;
}

.stat-card-large {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: #1a1a1a;
}

@media (max-width: 768px) {
    .stats-container {
        flex-direction: column;
    }

    .stat-card {
        width: 100%;
    }
}

.stat-card-full {
    max-width: 100%;
    width: 100%;
    height: auto;
}

.stat-card-medium {
    max-width: 500px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: #1a1a1a;
}

.stats-container-left {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: flex-start;
}

.stat-card-large {
    max-width: 700px;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 桌面版字體放大 */
@media (min-width: 1200px) {
    html {
        font-size: 20px;
        /* 從 18px 提升到 20px */
    }

    .motto {
        font-size: 3rem;
        /* 維持桌面版大氣視覺效果 */
    }

    .highlight {
        font-size: 2.2rem;
        /* 從 2rem 提升 */
    }

    .subtitle {
        font-size: 1.3rem;
        /* 從 1.2rem 提升 */
    }

    .cmd-output {
        font-size: 1.1rem;
        /* 從 1.05rem 提升 */
    }

    .json-output {
        font-size: 1.2rem;
        /* 從 1.15rem 提升 */
    }
}

/* Code Window Inside Terminal */
.code-window {
    background: #0d0d0d;
    border: 1px solid rgba(122, 156, 255, 0.3);
    border-radius: 6px;
    margin: 1.5rem 0;
    max-width: 650px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    font-family: 'Fira Code', monospace;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.code-window.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Three.js Background Canvas */
#three-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    /* 進一步提升透明度，確保駭客風格雨滴清晰可見 */
}

/* Achievement Accordion */
.section-label {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(122, 156, 255, 0.25);
}

.achievement-item {
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: border-left 0.3s ease, background 0.3s ease;
}

.achievement-item:hover {
    background: rgba(122, 156, 255, 0.05);
    border-left-color: rgba(122, 156, 255, 0.3);
}

.achievement-item summary {
    list-style: none;
    /* 移除預設箭頭 */
    outline: none;
}

.achievement-item summary::-webkit-details-marker {
    display: none;
}

.achievement-item[open] summary {
    color: #fff;
}

.achievement-item[open] .toggle-hint {
    opacity: 0.5;
}

.toggle-hint {
    font-size: 0.7rem;
    color: #666;
    margin-left: 0.5rem;
    font-style: italic;
}

.achievement-detail {
    padding-left: 1rem;
    border-left: 1px dashed rgba(122, 156, 255, 0.2);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

.indent {
    padding-left: 1.5rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.code-window-header {
    background: rgba(122, 156, 255, 0.1);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(122, 156, 255, 0.1);
}

.code-window-buttons {
    display: flex;
    gap: 0.4rem;
}

.code-window-buttons span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}

.cw-close {
    background: #ff5f56;
}

.cw-min {
    background: #ffbd2e;
}

.cw-max {
    background: #27c93f;
}

.code-window-title {
    font-size: 0.7rem;
    color: #666;
    flex: 1;
}

.code-window-body {
    padding: 1rem;
}

.code-window-body .output-line {
    opacity: 1 !important;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .code-window {
        max-width: 100%;
    }
}

/* ===== 桌面開場動畫 ===== */

/* 全螢幕桌面覆蓋層 */
#desktop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a0f1a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#desktop-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 桌面圖示 */
.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
    width: 80px;
}

.desktop-icon:hover {
    background: rgba(122, 156, 255, 0.1);
    border-color: rgba(122, 156, 255, 0.3);
}

.desktop-icon.selected {
    background: rgba(122, 156, 255, 0.2);
    border-color: rgba(122, 156, 255, 0.5);
}

.desktop-icon-img {
    width: 52px;
    height: 52px;
    background: #0d0d0d;
    border: 1px solid rgba(122, 156, 255, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fira Code', monospace;
    font-size: 0.65rem;
    line-height: 1.3;
    color: #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.15);
    flex-direction: column;
    text-align: center;
    padding: 4px;
}

.icon-c {
    color: #7a9cff;
    font-weight: 700;
}

.icon-cursor {
    color: #00ff41;
    animation: blink 1s infinite;
}

.desktop-icon-label {
    font-size: 0.7rem;
    color: #e6e6e6;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    font-family: 'Fira Code', monospace;
}

/* 桌面提示文字 */
#desktop-overlay::after {
    content: '雙擊圖示開啟終端機';
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: rgba(122, 156, 255, 0.5);
    letter-spacing: 2px;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.9;
    }
}

/* 迷你 CMD 視窗 */
#mini-cmd-window {
    position: fixed;
    z-index: 10000;
    width: 360px;
    background: #1a1a1a;
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 6px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(100, 150, 255, 0.3);
    font-family: 'Fira Code', monospace;
    display: none;
    transform-origin: top left;
    /* 廣況 position / 尺寸 transition */
    transition:
        left 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        border-radius 0.65s ease;
}

#mini-cmd-window.appear {
    display: block;
    animation: miniWindowAppear 0.35s cubic-bezier(0.34, 1.25, 0.64, 1) forwards;
}

/* 展開到全螢幕 */
#mini-cmd-window.expanded {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none;
}

@keyframes miniWindowAppear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mini-window-header {
    background: #0d0d0d;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 6px 6px 0 0;
}

.mini-window-buttons {
    display: flex;
    gap: 0.5rem;
}

.mini-window-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.mw-close {
    background: #ff5f56;
}

.mw-min {
    background: #ffbd2e;
}

.mw-max {
    background: #27c93f;
}

.mini-window-title {
    font-size: 0.875rem;
    color: #666;
    flex: 1;
    text-align: center;
}

.mini-window-body {
    padding: 2rem;
    min-height: 80px;
    background: #1a1a1a;
}

.mw-line {
    font-size: 0.75rem;
    line-height: 1.8;
}

.mw-prompt {
    color: #00ff41;
}

.mw-blink {
    color: #00ff41;
    animation: blink 1s infinite;
}

.mw-output {
    color: #a8c0ff;
    padding-left: 0.5rem;
}

#mw-motto-text {
    margin-top: 0.75rem;
    padding-left: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.05em;
}

/* 工作列 */
.desktop-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(10, 15, 26, 0.92);
    border-top: 1px solid rgba(122, 156, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 10001;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.taskbar-start {
    display: flex;
    align-items: center;
}

.taskbar-win-icon {
    font-size: 1.1rem;
    color: #7a9cff;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.taskbar-win-icon:hover {
    opacity: 1;
}

.taskbar-right {
    display: flex;
    align-items: center;
}

.taskbar-time {
    font-family: 'Fira Code', monospace;
    font-size: 0.72rem;
    color: #e6e6e6;
    opacity: 0.85;
}

/* 手機版調整 */
@media (max-width: 768px) {
    #mini-cmd-window {
        width: 90vw;
    }

    #desktop-overlay::after {
        font-size: 0.65rem;
        bottom: 3.5rem;
    }
}

/* ===== 假游標 ===== */
#fake-cursor {
    position: fixed;
    z-index: 10002;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition:
        left 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        top 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.3s ease;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

#fake-cursor svg {
    display: block;
    transition: transform 0.1s ease;
}

#fake-cursor.clicking svg {
    transform: scale(0.75);
}

/* 點擊漣漪 */
#fake-cursor::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(122, 156, 255, 0.35);
    transform: translate(-50%, -50%) scale(0);
    transition: none;
}

#fake-cursor.clicking::after {
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%) scale(1);
    transition: width 0.2s ease, height 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}