/* =========================================
   滾動條與全域選取風格
   ========================================= */
::-webkit-scrollbar {
    width: 6px;
    background: #050505;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
    background: #00ffff;
    box-shadow: 0 0 12px #006868, 0 0 20px #006868;
}

::-webkit-scrollbar-track {
    background: #050505;
}

::selection {
    background-color: #00bdbd;
    color: #050505;
    text-shadow: none;
}

::-moz-selection {
    background-color: #00ffff;
    color: #050505;
    text-shadow: none;
}

/* 基礎重設與變數 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background: #050505;
    color: white;
    font-family: 'Courier New', Arial, sans-serif;
    overflow-x: hidden;
    position: relative;
}

body.system-loading {
    overflow: hidden;
    pointer-events: none;
    cursor: wait;
}

body:not(.system-loading) #bootText {
    color: #39ff14;
    text-shadow: 0 0 10px #39ff14;
}

body.menu-open {
    overflow: hidden !important;
    height: 100vh;
}

#bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* =========================================
   導覽列 (桌機預設)
   ========================================= */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 9999;
    position: relative;
}

.menu-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: #00ffff;
    box-shadow: 0 0 8px #00ffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 100px);
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    z-index: 100;
    background: rgba(51, 51, 51, 0.5);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 0, 100% 0, 98% 100%, 2% 100%);
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 255, 255, 0.1);
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
    box-shadow: 0 0 10px #00ffff;
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 5px 10px;
}

.navbar .logo-text {
    color: #00ffff;
    font-weight: bold;
    font-size: 1.3rem;
    letter-spacing: 3px;
    text-shadow: 0 0 10px #00ffff, 0 0 20px rgba(0, 255, 255, 0.5);
}

.navbar .logo::before {
    content: '0101';
    position: absolute;
    top: -5px;
    right: -10px;
    font-size: 0.6rem;
    color: rgba(0, 255, 255, 0.4);
    opacity: 0.6;
    animation: cyber-digits-scan 2s steps(2) infinite;
}

@keyframes cyber-digits-scan {
    0%, 100% { content: '1010'; }
    50% { content: '0101'; }
}

.navbar .nav-links {
    display: flex;
    gap: 15px;
}

.navbar .nav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1px;
    position: relative;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
}

.navbar .nav-links a::before {
    content: attr(data-no);
    position: absolute;
    top: 1px;
    left: 8px;
    font-size: 0.65rem;
    color: rgba(0, 255, 255, 0.4);
    transition: 0.3s ease;
}

.navbar .nav-links a span {
    margin-top: 10px;
}

.navbar .nav-links a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: #00ffff;
    box-shadow: 0 0 8px #00ffff, 0 0 15px #00ffff;
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.navbar .nav-links a:hover {
    color: #00ffff;
    background: rgba(0, 255, 255, 0.05);
    clip-path: polygon(0% 0, 90% 0, 100% 100%, 10% 100%);
}

.navbar .nav-links a:hover::before {
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
    animation: cyber-digits-spin 0.2s steps(2) infinite alternate;
}

.navbar .nav-links a:hover::after {
    width: 100%;
    left: 0;
}

@keyframes cyber-digits-spin {
    0% { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(0); opacity: 0.6; }
}

.mobile-menu-overlay {
    display: none;
}

/* =========================================
   Hero 首頁區塊
   ========================================= */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

#bootText {
    color: #00ffff;
    letter-spacing: 4px;
    margin-bottom: 30px;
    font-size: 14px;
}

#name {
    font-size: clamp(3rem, 10vw, 7rem);
    opacity: 0;
    text-shadow: 0 0 10px #00ffff, 0 0 30px #00ffff, 0 0 60px #00ffff;
}

#heroTitle {
    opacity: 0;
    margin-top: 20px;
    font-size: clamp(1rem, 3vw, 1.2rem);
    letter-spacing: 2px;
    color: #888;
}

#exploreBtn {
    opacity: 0;
    display: inline-block;
    margin-top: 40px;
    padding: 15px 40px;
    border: 1px solid #00ffff;
    color: #00ffff;
    text-decoration: none;
    letter-spacing: 2px;
    transition: 0.3s ease;
}

#exploreBtn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* =========================================
   主體內容排版 (Container, Section)
   ========================================= */
.container {
    max-width: 1050px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 100px 0;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-title {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    color: #00ffff;
    margin-bottom: 40px;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    border-left: 4px solid #00ffff;
    padding-left: 15px;
}

.sub-panel-title {
    color: #00ffff;
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 25px;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.3);
    padding-bottom: 8px;
}

/* =========================================
   關於我與經歷 (Profile & Timeline)
   ========================================= */
.profile-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 50px;
    align-items: start;
}

.profile-photo-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    border: 1px solid #00ffff;
    background: rgba(0, 255, 255, 0.02);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-photo-frame::before,
.profile-photo-frame::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    z-index: 5;
}

.profile-photo-frame::before {
    top: 0; left: 0;
    border-top: 3px solid #00ffff; border-left: 3px solid #00ffff;
}

.profile-photo-frame::after {
    bottom: 0; right: 0;
    border-bottom: 3px solid #00ffff; border-right: 3px solid #00ffff;
}

.profile-img {
    position: absolute;
    top: 10px; left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    object-fit: cover;
    border: 1px solid rgba(0, 255, 255, 0.2);
    z-index: 1;
}

.scanline {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(to bottom, transparent, #00ffff, transparent);
    opacity: 0.6;
    animation: scan 4s linear infinite;
    pointer-events: none;
    z-index: 3;
}

@keyframes scan {
    0% { top: 0%; }
    100% { top: 100%; }
}

.frame-glitch-text {
    position: absolute;
    bottom: 15px; left: 20px;
    font-size: 0.75rem;
    color: #00ffff;
    letter-spacing: 2px;
    background: rgba(5, 5, 5, 0.8);
    padding: 2px 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
}

.profile-info-panel .bio-intro h3 {
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.profile-info-panel .bio-intro p {
    color: #ccc;
    line-height: 1.7;
    margin-top: 50px;
    margin-bottom: 70px;
}

.profile-info-panel .bio-intro p.cyber-tagline {
    color: #888888f1;
    font-style: italic;
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    border-left: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 25px;
    margin-bottom: 15px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px; top: 5px;
    width: 9px; height: 9px;
    background: #00ffff;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ffff;
}

.timeline-date {
    font-size: 0.8rem;
    color: #00ffff;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.timeline-month {
    font-size: 1.15rem;
    color: #00ffff;
    font-weight: bold;
    margin-left: 1px;
}

.timeline-content h5 {
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 5px;
}

.timeline-content p {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.5;
}

/* =========================================
   開發專案區塊 (Projects Grid)
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.project-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.project-card:hover {
    border-color: #00ffff;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.15);
}

.project-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.p-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.9) contrast(110%);
    transition: transform 0.5s ease, filter 0.5s ease;
}

.project-card:hover .p-media {
    transform: scale(1.06);
    filter: brightness(1.1) contrast(115%);
}

.project-info {
    padding: 25px;
    flex-grow: 1;
}

.project-info h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.project-info p {
    color: #aaa;
    font-size: 0.9rem;
    text-align: justify;
    margin-bottom: 20px;
    letter-spacing: 0.9px;
    line-height: 1.7;
}

/* =========================================
   專業技能區塊 (Skills Showcase)
   ========================================= */
.skills-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.skills-bars-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
}

.skill-bar-wrapper {
    margin-bottom: 22px;
}

.skill-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.skill-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.6), #00ffff);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    width: 0%;
    transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.skills-grid-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skill-group-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(0, 255, 255, 0.1);
    border-left: 3px solid #00ffff;
    padding: 25px;
    border-radius: 0 4px 4px 0;
}

.skill-group-card h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.skill-group-card p {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* =========================================
   通用按鈕、通訊面板、頁尾
   ========================================= */
.tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 10px;
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    border: 1px solid rgba(0, 255, 255, 0.3);
    margin-top: 15px;
    margin-right: 5px;
    border-radius: 2px;
}

.cyber-btn {
    display: inline-block;
    padding: 15px 30px;
    border: 1px solid #00ffff;
    color: #00ffff;
    text-decoration: none;
    letter-spacing: 2px;
    transition: 0.3s;
    background: transparent;
}

.cyber-btn:hover {
    background: #00ffff;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px #00ffff;
}

.panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 40px;
    border-radius: 4px;
    line-height: 1.8;
    color: #ccc;
}

.panel p { margin-bottom: 15px; }

#about {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.cyber-btn-more {
    display: inline-flex;
    margin-top: 40px;
    margin-left: auto;
}

.cyber-btn-more .cyber-btn {
    padding: 12px 28px;
    font-size: 0.9rem;
    cursor: pointer;
}

.text-center { text-align: center; }
.margin-bottom { margin-bottom: 25px; }

.footer {
    text-align: center;
    padding: 40px;
    font-size: 0.8rem;
    color: #bbbbbb;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   【RWD 響應式佈局】優化精簡版（移除沒必要的重複覆蓋與 !important）
   ========================================================================== */

@media (max-width: 1024px) {
    .navbar { padding: 20px 30px; }
    .profile-grid { grid-template-columns: 280px 1fr; gap: 35px; }
}

@media (max-width: 900px) {
    .section { padding: 60px 0; }
    .profile-grid { grid-template-columns: 1fr; gap: 40px; }
    .profile-photo-frame { max-width: 300px; margin: 0 auto; }
    .skills-showcase { grid-template-columns: 1fr; gap: 30px; }
    .cyber-btn-more { margin-left: auto; margin-right: auto; margin-top: 30px; }
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    
    .navbar {
        width: calc(100% - 30px);
        top: 15px;
        padding: 10px 20px;
        clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
    }

    .navbar .desktop-only { display: none; }

    .mobile-menu-overlay {
        position: fixed;
        top: 0; right: 0;
        width: 100vw; height: 100vh;
        background: rgba(5, 5, 5, 0.3);
    
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 9998;
        
        transform: translateX(100%);
        clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
        transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                    clip-path 0.9s cubic-bezier(0.16, 1, 0.3, 1);
        
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 2px solid #00ffff;
    }

    .mobile-menu-overlay.active {
        transform: translateX(0);
        clip-path: polygon(0 0, 100% 0, 100% 100%, 15% 100%);
        box-shadow: -10px 0 30px rgba(0, 255, 255, 0.15);
    }

    .mobile-links {
        display: flex;
        flex-direction: column;
        gap: 35px;
        width: 75%;
        text-align: right;
        padding-right: 10%;
    }

    .mobile-links a {
        color: #ffffff;
        font-size: 1.6rem;
        font-weight: bold;
        text-decoration: none;
        letter-spacing: 3px;
        padding: 12px 0;
        border-bottom: 1px dashed rgba(0, 255, 255, 0.1);
        display: block;
        position: relative;
        
        opacity: 0;
        transform: translateY(20px);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                    opacity 0.4s ease, 
                    color 0.2s ease;
    }

    .mobile-menu-overlay.active .mobile-links a {
        opacity: 1;
        transform: translateY(0);
    }

    .mobile-links a::after {
        content: '';
        position: absolute;
        bottom: -1px; right: 0;
        width: 0; height: 1px;
        background: #00ffff;
        box-shadow: 0 0 10px #00ffff;
        transition: width 0.3s ease;
    }

    .mobile-links a:hover::after,
    .mobile-links a:active::after {
        width: 100%;
    }

    .mobile-links a .num {
        color: #00ffff;
        font-family: monospace;
        font-size: 1rem;
        margin-right: 15px;
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    }

    .mobile-links a:hover, .mobile-links a:active {
        color: #00ffff;
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
        border-bottom: 1px solid #00ffff;
    }

    /* 漢堡鈕點擊變紅 X */
    .menu-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); background-color: #ff0055; box-shadow: 0 0 8px #ff0055; }
    .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); background-color: #ff0055; box-shadow: 0 0 8px #ff0055; }

    /* 區塊內容針對手機之微調 */
    .panel { padding: 30px 20px; }
    .skill-bars-container { padding: 20px; }
    /* 修正類別名稱，並限制手機版照片的最大寬度與置中 */
    .profile-photo-frame { 
        max-width: 260px; 
        width: 100%;
        margin: 0 auto; 
        aspect-ratio: 4 / 5;
    }
    .profile-info-panel .bio-intro h3,
    .profile-info-panel .bio-intro p.cyber-tagline { text-align: center; }
    .profile-info-panel .bio-intro h3 { font-size: 1.5rem; }
    .profile-info-panel .bio-intro p.cyber-tagline { font-size: 0.85rem; }
    
    .profile-info-panel .bio-intro p {
        margin-top: 20px;
        margin-bottom: 30px;
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .timeline-item {
        padding-left: 20px;
        padding-bottom: 20px;
        margin-bottom: 10px;
        display: flex;
        flex-direction: column;
    }
    .timeline-item::before { top: 6px; }
    .timeline-date { display: inline-block; margin-bottom: 4px; font-size: 0.75rem; }
    .timeline-content h5 { font-size: 1rem; line-height: 1.4; }
    .timeline-content p { font-size: 0.85rem; margin-top: 4px; }
}

@media (max-width: 480px) {
    .container { padding: 0 15px; }
    .section { padding: 45px 0; }
    .profile-info-panel .bio-intro h3 { font-size: 1.4rem; }
    .timeline-item { padding-left: 20px; margin-bottom: 20px; }
    .skill-group-card, .project-info { padding: 20px 15px; }
    .cyber-btn-more .cyber-btn { width: auto; padding: 12px 24px; font-size: 0.85rem; }
}