/* General Styles & Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0d1117; /* GitHub Dark Dimmed inspired */
    color: #c9d1d9; /* Light gray text */
    font-family: 'Fira Code', 'Source Code Pro', 'Courier New', Courier, monospace;
    line-height: 1.7;
    overflow-x: hidden;
}

/* tsParticles Background Styling */
#tsparticles {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

/* Header & Navigation */
header {
    padding: 20px 40px;
    background-color: rgba(13, 17, 23, 0.88);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #30363d;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-header {
    color: #58a6ff;
    font-size: 1.1em;
    font-weight: bold;
}

nav a {
    color: #8b949e;
    text-decoration: none;
    margin-left: 18px; /* Disesuaikan agar muat */
    padding: 8px 10px; /* Disesuaikan */
    border-radius: 5px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.88em; /* Disesuaikan agar muat */
}

nav a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: #58a6ff;
    transition: width 0.3s ease;
}

nav a:hover {
    color: #58a6ff;
    background-color: rgba(88, 166, 255, 0.1);
}

nav a:hover::before {
    width: 80%;
}

/* Main Content & Sections */
main {
    padding: 40px;
    position: relative;
    z-index: 1;
}

section {
    margin-bottom: 60px;
    padding: 30px;
    background-color: rgba(22, 27, 34, 0.85);
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.section-title {
    color: #58a6ff;
    border-bottom: 2px solid #30363d;
    padding-bottom: 10px;
    margin-bottom: 25px;
    font-size: 1.8em;
    display: inline-block;
}

/* Intro Section Specifics */
.intro-section {
    text-align: center;
    padding: 60px 20px;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    box-shadow: none;
}

.intro-section h1 {
    font-size: clamp(1.8em, 4vw, 2.8em);
    color: #58a6ff;
    margin-bottom: 15px;
    min-height: 80px;
}

.intro-section .subtitle {
    font-size: clamp(1em, 2.5vw, 1.2em);
    color: #8b949e;
}

/* Typed.js Cursor */
.typed-cursor {
    color: #58a6ff;
    opacity: 1;
    animation: typedjsBlink 0.7s infinite;
}
@keyframes typedjsBlink {
    50% { opacity: 0.0; }
}

/* About Section with Profile Picture */
.about-content-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 30px;
}
.profile-picture-container {
    text-align: center;
    flex-shrink: 0;
}
.profile-picture {
    width: 150px; /* Ukuran foto */
    height: 150px; /* Ukuran foto */
    border-radius: 50%;
    border: 3px solid #58a6ff;
    object-fit: cover; /* Penting jika foto tidak persegi */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.profile-picture:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.4);
}
#about .about-content-wrapper pre {
    flex-grow: 1;
    min-width: 280px;
}


/* Code Block Styling */
pre {
    background-color: #010409;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid #30363d;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
code.code-block {
    font-family: 'Fira Code', 'Source Code Pro', monospace;
    font-size: 0.95em;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Repository Section */
.repository-list-container {
    margin-top: 20px;
}
.file-list {
    list-style: none;
    padding-left: 0;
}
.file-item {
    background-color: #010409;
    border: 1px solid #30363d;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.file-item:hover {
    background-color: #0d1a29;
    transform: translateY(-2px);
}
.file-icon {
    font-family: 'Courier New', Courier, monospace;
    color: #f0883e;
    margin-right: 15px;
    font-weight: bold;
    flex-shrink: 0;
}
.file-name {
    color: #c9d1d9;
    font-weight: 500;
    flex-grow: 1;
    margin-right: 15px;
    word-break: break-all;
}
.file-description {
    font-size: 0.85em;
    color: #8b949e;
    font-style: italic;
    flex-basis: 100%;
    margin-top: 5px;
    margin-left: 40px;
}
.download-link {
    background-color: #238636;
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    white-space: nowrap;
    margin-left: 10px;
    margin-top: 5px;
}
.download-link:hover {
    background-color: #2ea043;
    box-shadow: 0 2px 8px rgba(46, 160, 67, 0.4);
}

/* Interactive Coding Lab */
.lab-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 20px;
}
.game-canvas-area {
    flex: 1;
    min-width: 280px;
    padding: 15px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background-color: #0d1117;
}
.canvas-label {
    font-size: 0.9em;
    color: #8b949e;
    margin-bottom: 10px;
}
#game-canvas {
    width: 100%;
    height: 200px;
    background-color: #161b22;
    border: 1px dashed #484f58;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}
#sprite {
    width: 30px;
    height: 30px;
    background-color: #58a6ff;
    position: absolute;
    transition: all 0.2s linear;
    border: 1px solid #0d1117;
}
.terminal-simulation-area {
    flex: 1.5;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background-color: #010409;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 15px;
    height: 300px;
}
#terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.9em;
    color: #c9d1d9;
    margin-bottom: 10px;
    padding-right: 5px;
}
#terminal-output p {
    margin-bottom: 5px;
    word-break: break-all;
}
#terminal-output .user-input { color: #79c0ff; }
#terminal-output .system-response { color: #a371f7; }
#terminal-output .error-response { color: #f85149; }

.terminal-input-line {
    display: flex;
    align-items: center;
    border-top: 1px solid #30363d;
    padding-top: 10px;
}
.lab-prompt {
    color: #58a6ff;
    margin-right: 8px;
    font-weight: bold;
}
#terminal-input {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Source Code Pro', monospace;
    font-size: 0.95em;
    outline: none;
}
.command-help {
    margin-top: 25px;
    padding: 15px;
    background-color: rgba(22, 27, 34, 0.7);
    border: 1px solid #30363d;
    border-radius: 6px;
}
.command-help h4 {
    color: #58a6ff;
    margin-bottom: 10px;
}
.command-help ul {
    list-style: none;
    padding-left: 0;
    font-size: 0.85em;
}
.command-help li {
    margin-bottom: 5px;
    color: #8b949e;
}
.example-cmd {
    color: #f0883e;
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(139, 148, 158, 0.1);
    padding: 1px 3px;
    border-radius: 3px;
}

/* Existing Coding Game Section Styles (Reach the Target) */
.game-play-area {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 20px;
}

.game-canvas-main-container {
    flex: 1;
    min-width: 280px;
    padding: 15px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background-color: #0d1117;
    display: flex; /* Added for centering button */
    flex-direction: column; /* Added for centering button */
    align-items: center; /* Added for centering button */
}

#game-canvas-main {
    width: 100%;
    height: 250px; /* Increased height for game */
    background-color: #161b22;
    border: 1px dashed #484f58;
    position: relative;
    overflow: hidden;
}

#game-sprite {
    width: 25px;
    height: 25px;
    background-color: #58a6ff; /* Blue sprite */
    position: absolute;
    transition: all 0.2s linear;
    border: 1px solid #0d1117;
    border-radius: 4px;
}

#game-target {
    width: 30px;
    height: 30px;
    background-color: #f85149; /* Red target */
    position: absolute;
    border-radius: 50%; /* Circular target */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
}

#game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    display: none; /* Hidden by default */
    z-index: 10;
}

.game-terminal-area {
    flex: 1.5;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background-color: #010409;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 15px;
    height: 300px; /* Consistent height */
}

#game-terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.9em;
    color: #c9d1d9;
    margin-bottom: 10px;
    padding-right: 5px;
}
#game-terminal-output p {
    margin-bottom: 5px;
    word-break: break-all;
}
#game-terminal-output .user-input { color: #79c0ff; }
#game-terminal-output .system-response { color: #a371f7; }
#game-terminal-output .error-response { color: #f85149; }
#game-terminal-output .success-response { color: #238636; } /* New success color */

#game-terminal-input {
    flex-grow: 1;
    background-color: transparent;
    border: 1px solid #30363d; /* Added border for input */
    color: #c9d1d9;
    font-family: 'Fira Code', 'Source Code Pro', monospace;
    font-size: 0.95em;
    outline: none;
    padding: 8px 10px;
    border-radius: 5px;
    margin-right: 10px;
}
#game-terminal-input:focus { border-color: #58a6ff; }

/* New Platformer Game Specific Styles */
#platformer-game-canvas {
    width: 100%;
    height: 250px; /* Consistent height with other game */
    background-color: #161b22;
    border: 1px dashed #484f58;
    position: relative;
    overflow: hidden;
}

#player-sprite {
    width: 20px;
    height: 20px;
    background-color: #58a6ff; /* Blue player */
    position: absolute;
    bottom: 0; /* Start at bottom */
    left: 0;
    transition: background-color 0.1s ease; /* For visual feedback on jump */
}

.platform {
    position: absolute;
    background-color: #79c0ff; /* Light blue platforms */
    border: 1px solid #306090;
    border-radius: 3px;
}

#platformer-target {
    width: 25px;
    height: 25px;
    background-color: #238636; /* Green target */
    position: absolute;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
}

#platformer-game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    display: none; /* Hidden by default */
    z-index: 10;
}

#platformer-terminal-output { /* Reusing existing styles for terminal output */
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.9em;
    color: #c9d1d9;
    margin-bottom: 10px;
    padding-right: 5px;
}
#platformer-terminal-output p {
    margin-bottom: 5px;
    word-break: break-all;
}
#platformer-terminal-output .user-input { color: #79c0ff; }
#platformer-terminal-output .system-response { color: #a371f7; }
#platformer-terminal-output .error-response { color: #f85149; }
#platformer-terminal-output .success-response { color: #238636; }

#platformer-terminal-input { /* Reusing existing styles for terminal input */
    flex-grow: 1;
    background-color: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Source Code Pro', monospace;
    font-size: 0.95em;
    outline: none;
    padding: 8px 10px;
    border-radius: 5px;
    margin-right: 10px;
}
#platformer-terminal-input:focus { border-color: #58a6ff; }


/* AI Assistant Chat */
.ai-chat-container {
    max-width: 700px;
    margin: 0 auto;
    background-color: #010409;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 450px;
}
#ai-chat-log {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}
.user-message, .ai-message {
    margin-bottom: 12px;
    line-height: 1.5;
}
.user-message p, .ai-message p {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 85%;
    word-wrap: break-word;
}
.user-name, .ai-name {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
    font-size: 0.85em;
}
.user-message { text-align: right; }
.user-name { color: #79c0ff; text-align: right; }
.user-message p {
    background-color: #214162;
    color: #c9d1d9;
    border-bottom-right-radius: 0;
    text-align: left;
}
.ai-message { text-align: left; }
.ai-name { color: #a371f7; }
.ai-message p {
    background-color: #2a2e37;
    color: #c9d1d9;
    border-bottom-left-radius: 0;
}
.ai-message p a { color: #58a6ff; text-decoration: underline; }
.ai-message p a:hover { color: #79c0ff; }
.ai-chat-input-area {
    display: flex;
    align-items: center;
    border-top: 1px solid #30363d;
    padding-top: 15px;
}
.chat-prompt { color: #58a6ff; margin-right: 8px; font-weight: bold; }
#ai-chat-input {
    flex-grow: 1;
    background-color: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Source Code Pro', monospace;
    font-size: 0.95em;
    outline: none;
    padding: 8px 10px;
    border-radius: 5px;
    margin-right: 10px;
}
#ai-chat-input:focus { border-color: #58a6ff; }
#ai-chat-send-btn {
    background-color: #238636;
    color: #ffffff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
#ai-chat-send-btn:hover { background-color: #2ea043; }


/* Contact Section */
.contact-content p { margin-bottom: 15px; }
.contact-content ul { list-style: none; padding-left: 0; }
.contact-content li { margin-bottom: 10px; color: #8b949e; }
.contact-content a { color: #58a6ff; text-decoration: none; transition: color 0.3s ease; }
.contact-content a:hover { color: #79c0ff; text-decoration: underline; }
.prompt_char { color: #58a6ff; margin-right: 5px; }
.prompt { color: #58a6ff; font-weight: bold; }

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid #30363d;
    color: #8b949e;
    font-size: 0.9em;
    position: relative;
    z-index: 1;
    background-color: #0d1117;
}

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch-animation-subtle 5s infinite linear alternate-reverse;
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
    clip-path: inset(50% 50% 50% 50%);
}
.glitch::before {
    left: -1px;
    text-shadow: 1px 0 #ff00c1;
    animation: glitch-skew 3s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94) alternate-reverse;
}
.glitch::after {
    left: 1px;
    text-shadow: -1px 0 #00fff9;
    animation: glitch-skew 3s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse alternate-reverse;
}
@keyframes glitch-skew {
  0% { clip-path: inset(70% 0 10% 0); transform: skew(0.5deg); } 10% { clip-path: inset(10% 0 75% 0); } 20% { clip-path: inset(80% 0 5% 0); } 30% { clip-path: inset(20% 0 40% 0); transform: skew(-0.5deg); } 40% { clip-path: inset(5% 0 80% 0); } 50% { clip-path: inset(60% 0 30% 0); } 60% { clip-path: inset(30% 0 40% 0); transform: skew(0.2deg); } 70% { clip-path: inset(75% 0 5% 0); } 80% { clip-path: inset(10% 0 85% 0); } 90% { clip-path: inset(40% 0 20% 0); transform: skew(-0.2deg); } 100% { clip-path: inset(80% 0 10% 0); }
}
@keyframes glitch-animation-subtle {
    0%, 18%, 22%, 78%, 82%, 100% { transform: translate(0); } 20% { transform: translate(-0.5px, 0.5px); } 80% { transform: translate(0.5px, -0.5px); }
}

/* Responsive Adjustments */
@media (max-width: 1024px) { /* Penyesuaian untuk nav agar tidak terlalu sempit di tablet landscape */
    nav a {
        margin-left: 12px; /* Sedikit lebih banyak ruang */
        font-size: 0.85em;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 15px;
        align-items: center;
    }
    .terminal-header { margin-bottom: 10px; font-size: 1em;}
    nav { text-align: center; width: 100%; } /* Nav mengambil lebar penuh */
    nav a { margin: 5px 6px; font-size: 0.8em; } /* Margin lebih kecil agar muat */
    main { padding: 20px; }
    .about-content-wrapper { flex-direction: column; align-items: center; }
    .profile-picture-container { margin-bottom: 20px; }
    .intro-section h1 { min-height: 60px; }
    .section-title { font-size: 1.6em; }
    pre { padding: 15px; font-size: 0.9em; }
    .lab-container, .game-play-area { flex-direction: column; } /* Apply to new game section too */
    .terminal-simulation-area, .game-terminal-area { height: 250px; } /* Apply to new game section too */
    #game-canvas, #game-canvas-main, #platformer-game-canvas { height: 180px; } /* Apply to new game section too */
    .file-item { flex-direction: column; align-items: flex-start; }
    .file-description { margin-left: 0; margin-bottom: 10px; }
    .download-link { margin-left: 0; align-self: flex-start; }
}
@media (max-width: 480px) {
    nav a { display: block; margin: 8px auto; width: fit-content;}
    .intro-section h1 { font-size: clamp(1.5em, 5vw, 1.8em); }
    .section-title { font-size: 1.4em; }
    .file-name { font-size: 0.9em;}
    .download-link { padding: 6px 10px; font-size: 0.85em; }
    .ai-chat-container { height: 400px; } /* Kurangi tinggi chat di layar kecil */
    #ai-chat-input { font-size: 0.9em; }
    #ai-chat-send-btn { padding: 7px 12px; }
}
