:root {
    --bg-color: #2e3440;
    --text-color: #d8dee9;
    --prompt-color: #88c0d0;
    --accent-color: #81a1c1;
    --terminal-header: #3b4252;
    --cursor-color: #d8dee9;
}

body {
    background-color: #2e3440;
    margin: 0;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.terminal {
    background-color: var(--bg-color);
    width: 100%;
    max-width: 800px;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: height 0.4s ease, max-height 0.4s ease;
    box-sizing: border-box;
}

.terminal-header {
    background-color: var(--terminal-header);
    padding: 10px;
    display: flex;
    align-items: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
}

.red { background-color: #bf616a; }
.yellow { background-color: #ebcb8b; }
.green { background-color: #a3be8c; }

.terminal-title {
    margin-left: 20px;
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
}

.terminal-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
    flex-grow: 1;
}

.command-line {
    margin: 20px 0 10px;
    display: flex;
    align-items: center;
}

.prompt {
    color: var(--prompt-color);
    margin-right: 10px;
}

.output {
    margin-bottom: 20px;
    padding-left: 0;
    color: var(--text-color);
}

h1 {
    color: var(--accent-color);
    margin: 0;
    font-size: 24px;
}

.subtitle {
    color: var(--text-color);
    margin: 5px 0 20px;
    opacity: 0.8;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.links a {
    color: var(--accent-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.links a:hover {
    color: var(--accent-color);
}

footer {
    margin-top: 40px;
    color: var(--secondary-color);
    font-size: 0.9em;
    text-align: center;
}

/* Responsive design */
@media (max-width: 600px) {
    .content {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .links ul {
        flex-direction: column;
        gap: 10px;
    }
}

.nav-link {
    color: var(--accent-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-link i {
    font-size: 0.9em;
}

/* Base responsive adjustments */
@media (max-width: 768px) {
  body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1d21;
  }
  
  .container {
    margin: 10px;
    width: calc(100% - 20px);
    max-width: 100%;
  }
  
  .terminal {
    margin: auto;
    width: 100%;
    max-width: 95%;
    height: auto;
    max-height: 85vh;
    position: relative;
    top: 0;
  }
  
  .terminal-content {
    height: calc(100% - 30px); /* Account for header */
    overflow-y: auto;
  }
  
  h1 {
    font-size: 20px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .output p {
    font-size: 14px;
  }
  
  .command-line {
    margin-top: 15px;
  }
  
  .prompt {
    font-size: 14px;
  }
  
  .links a {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
  }
  
  pre.cowsay {
    font-size: 11px;
    white-space: pre-wrap;
    max-width: 100%;
    overflow-x: auto;
  }
  
  .mode-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
  }
  
  .toggle-button {
    background-color: #4a5568;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
  }
  
  .terminal.interactive {
    height: 85vh;
    max-height: 85vh;
  }
  
  .command-history {
    max-height: none; /* Let it grow naturally */
    overflow-y: auto;
  }
  
  /* Ensure content fills available space */
  .terminal-content, .command-history {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
  }
  
  /* Ensure command input stays at bottom */
  .command-input {
    margin-top: auto;
  }
  
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 100vh;
    height: 100%;
  }
}

/* Small phone adjustments */
@media (max-width: 480px) {
  .terminal-header {
    padding: 8px 10px;
  }
  
  .dot {
    width: 10px;
    height: 10px;
    margin-right: 4px;
  }
  
  .terminal-title {
    font-size: 13px;
  }
  
  .links {
    flex-direction: column;
    gap: 12px;
  }
  
  .links a {
    display: block;
    margin-bottom: 8px;
  }
  
  .output p {
    font-size: 13px;
  }
  
  .command-line {
    font-size: 13px;
  }
  
  .prompt {
    font-size: 13px;
  }
}

/* Fix for the cowsay ASCII art on mobile */
@media (max-width: 600px) {
  .cowsay {
    font-size: 13px;
    line-height: 1.2;
    overflow-x: auto;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
  }
}

/* Touch-friendly links */
@media (hover: none) {
  .links a {
    padding: 8px 0;
    display: block;
  }
  
  .links a:active {
    opacity: 0.7;
  }
}

/* Fix for viewport height issues on mobile browsers */
@media (max-width: 768px) {
    .terminal.interactive {
         min-height: 85vh;
         height: auto;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow-y: auto;
        align-items: flex-start;
        padding: 10px;
    }
    
    html {
        height: -webkit-fill-available;
    }
}

/* --- Additions for Interactive Mode --- */

/* Style the toggle button container */
.mode-toggle {
    position: fixed; /* Position relative to the viewport */
    top: 15px;       /* Distance from top */
    right: 20px;      /* Distance from right */
    z-index: 1000;    /* Ensure it's above other elements */
}

/* Style the new toggle button */
.toggle-button {
    background-color: var(--accent-color); /* Use accent color */
    color: var(--bg-color); /* Use background color for text */
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.15s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-weight: bold;
}

.toggle-button:hover {
    background-color: #81A1C1; /* Slightly lighter accent */
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.toggle-button:active {
    transform: scale(0.97); /* Simple press animation */
    background-color: #5E81AC; /* Darker accent */
}

/* Style for when interactive mode is ACTIVE */
.toggle-button.active {
    background-color: #be6870; /* Use a different color (e.g., red) for active state */
    color: var(--text-color);
}

.toggle-button.active:hover {
    background-color: #d08770; /* Lighter red/orange */
}

.toggle-button.active:active {
    background-color: #ae656c; /* Darker red */
}

/* Command Input Area Styling */
.command-input {
    display: none;
    align-items: center;
    padding-bottom: 5px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.command-input .prompt {
    color: var(--prompt-color);
    margin-right: 10px;
}

#command-input-field {
    flex-grow: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: inherit;
    caret-color: var(--cursor-color);
}

/* --- State Changes based on '.interactive' class --- */

/* When terminal IS interactive */
.terminal.interactive .static-content {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

.terminal.interactive .command-input {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Ensure command history (added by JS) is visible */
.terminal.interactive .command-history {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* When terminal IS NOT interactive (Default State) */
.terminal:not(.interactive) .static-content {
    opacity: 1;
    visibility: visible;
    position: static;
    pointer-events: auto;
}

.terminal:not(.interactive) .command-input {
    opacity: 0;
    visibility: hidden;
    display: none;
}

/* Hide command history container when not interactive */
.terminal:not(.interactive) .command-history {
    opacity: 0;
    visibility: hidden;
    display: none;
}

/* Add a slightly longer transition for content visibility */
.static-content, .command-input, .command-history {
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

/* Specific transitions for entering/leaving interactive mode */
.terminal.interactive .static-content {
    transition: opacity 0.4s ease, visibility 0s linear 0.4s, position 0s linear 0.4s;
}
.terminal:not(.interactive) .static-content {
     transition: opacity 0.4s ease 0.1s;
}

.terminal.interactive .command-input,
.terminal.interactive .command-history {
    transition: opacity 0.4s ease 0.1s;
}

.terminal:not(.interactive) .command-input,
.terminal:not(.interactive) .command-history {
     transition: opacity 0.4s ease, visibility 0s linear 0.4s, display 0s linear 0.4s;
}

/* Adjust padding/margins if needed for interactive mode */
.terminal.interactive .terminal-content {
    padding-bottom: 10px;
}

/* Style the command/response history added by JS */
.command-history .command {
    display: flex;
    margin-bottom: 5px;
}
.command-history .command .prompt {
    margin-right: 10px;
    color: var(--prompt-color);
}
.command-history .command .command-text {
    color: var(--text-color);
}
.command-history .response {
    margin-bottom: 15px;
    color: var(--text-color);
    line-height: 1.5;
}
.command-history .response a {
    color: var(--accent-color);
    text-decoration: underline;
}
.command-history .response a:hover {
    opacity: 0.8;
}
.command-history .response .cowsay {
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-color);
    white-space: pre;
    overflow-x: auto;
}

/* Ensure terminal content scrolls properly */
.terminal-content {
    position: relative;
}

/* Make terminal taller in interactive mode */
.terminal.interactive {
    height: 75vh;
    max-height: 90vh;
}

/* Ensure history container takes up necessary space */
.command-history {
    margin-bottom: 10px;
}

/* Ensure command input stays at the bottom */
.terminal.interactive .terminal-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Make sure history takes up available space but allows scrolling */
.command-history {
    overflow-y: auto;
    max-height: calc(100% - 30px); /* Adjust based on your command input height */
}

/* Replace the toggle switch styles with these simplified versions */

/* Toggle Switch Container */
.toggle-switch {
    position: relative;
    display: inline-block;
    margin-left: auto;
    width: 40px;
    height: 20px;
    cursor: pointer;
}

/* Hide default checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 34px;
}

/* The circle on the slider */
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #d8dee9;
    transition: .3s;
    border-radius: 50%;
}

/* Active/checked state - subtle red color */
.toggle-switch input:checked + .toggle-slider {
    background-color: #bf616a; /* Subtle Nord red */
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Remove the glow effect for a cleaner look */
.toggle-switch input:checked + .toggle-slider {
    box-shadow: none;
}

/* Hover effect */
.toggle-switch:hover .toggle-slider {
    background-color: rgba(255, 255, 255, 0.25);
}

.toggle-switch input:checked:hover + .toggle-slider {
    background-color: #d08770; /* Slightly lighter red/orange when hovered */
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .toggle-switch {
        width: 36px;
        height: 18px;
    }
    
    .toggle-slider:before {
        height: 14px;
        width: 14px;
        left: 2px;
        bottom: 2px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(18px);
    }
}

/* Add these styles for the blinking cursor */
.cursor-container {
    display: inline-block;
    cursor: pointer;
}

.blinking-cursor {
    display: inline-block;
    width: 10px;
    height: 18px;
    background-color: var(--text-color);
    animation: blink 1s infinite;
    margin-left: 5px;
    vertical-align: middle;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Only show cursor in normal mode, hide in interactive mode */
.terminal.interactive .cursor-container {
    display: none;
}

/* Make the entire last command line clickable */
.command-line.clickable {
    cursor: pointer;
    position: relative;
    padding: 5px 0;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.command-line.clickable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Add a subtle hint on hover */
.command-line.clickable:hover::after {
    content: "Click to enter interactive mode";
    position: absolute;
    right: 10px;
    font-size: 12px;
    opacity: 0.5;
    color: var(--prompt-color);
}

/* Keep the blinking cursor visible */
.terminal.interactive .cursor-container {
    display: none;
}
