:root {
    /* Cyber-Dojo Palette */
    --bg-color: #0f172a;
    --panel-bg: #1e293b;
    --console-bg: #000000;
    --text-primary: #ffffff; /* Pure White for max contrast */
    --text-secondary: #94a3b8;
    
    --accent-color: #3b82f6; /* Blue for UI */
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --success-color: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.5);
    
    --error-color: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.5);
    
    --gold: #eab308;
    
    --header-height: 70px;
    
    /* UPDATED FONTS */
    --font-ui: 'Roboto Mono', monospace;       /* Technical/Terminal font */
    --font-code: 'Roboto Mono', monospace;     /* Code font */
    /*--font-display: 'Noto Serif JP', serif;    /* Traditional Dojo Style */
    /*--font-display: 'Roboto Mono', monospace;*/
    --font-display: 'Permanent Marker', cursive;
}

* { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    font-weight: 400; 
}

/* --- HUD HEADER --- */
.top-bar {
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 0 20px var(--accent-glow);
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.app-title {
    font-family: var(--font-display); 
    font-size: 1.6rem;
    color: var(--text-primary);
    text-shadow: 2px 2px 0px var(--accent-color);
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: 1px;
    font-weight: 900; /* Bolder for the title */
    font-style: italic; /* Slight slant for action feel */
}

/* Level Badge HUD */
.level-container {
    position: relative;
}

.level-badge {
    font-family: var(--font-display); 
    font-size: 1.2rem;
    background: linear-gradient(135deg, #334155, #1e293b);
    padding: 8px 25px;
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    color: var(--gold);
    min-width: 140px;
    text-align: center;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 1px;
    font-weight: 700;
}

/* Animation State: Level Up */
.level-badge.level-up {
    transform: scale(1.4);
    border-color: var(--gold);
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 30px var(--gold);
    z-index: 101;
}

.container {
    display: flex;
    height: calc(100vh - var(--header-height));
}

/* --- LEFT PANEL: DATA LOG --- */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #334155;
    background: var(--panel-bg);
    height: 100%;
    max-width: 45%;
    position: relative;
}

.left-panel::before {
    /* Scanline Overlay for decorative effect */
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.5;
}

#dojo-log {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding-bottom: 100px;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--panel-bg);
}

#dojo-log::-webkit-scrollbar { width: 8px; }
#dojo-log::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }

/* CARDS */
.log-entry {
    background: rgba(0, 0, 0, 0.25); /* Darker background for contrast */
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
    border-radius: 8px;
    position: relative;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.log-entry.past {
    opacity: 0.5;
    filter: grayscale(0.8);
    border-color: transparent;
}

.log-entry.active {
    border-left: 4px solid var(--accent-color);
    background: linear-gradient(90deg, rgba(0,0,0,0.3),rgba(59, 130, 246, 0.1));
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.log-entry.error-flash {
    animation: shake 0.4s ease-in-out;
    border-left-color: var(--error-color);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2), transparent);
}

.instructor-text {
    font-family: var(--font-display); 
    font-size: 1.4rem;  /* Slightly larger for legibility */
    line-height: 1.6;
    color: #ff5d5d;/*var(--text-primary);*/
    font-weight: 100; /* Beefy enough to read on dark bg */
    letter-spacing: 0.5px;
    white-space: pre-line; /* Respects \n for line breaks */
    /*text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); */
    font-style: normal;
    transform: scaleY(1.2);
}
.philosophy-text {
    font-family: var(--font-display); 
    font-size: 1.4rem;  /* Slightly larger for legibility */
    line-height: 1.6;
    color: #c3c3d0;/*var(--text-primary);*/
    font-weight: 100; /* Beefy enough to read on dark bg */
    letter-spacing: 0.5px;
    white-space: pre-line; /* Respects \n for line breaks */
    /*text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); */
    font-style: normal;
    transform: scaleY(1.2);
}
/* Container to align Label and Box horizontally */
.drill-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 25px; /* Spacing from instructions */
}

.drill-line {
    margin-top: 0; /* Reset margin so it aligns with flex container */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: rgba(0,0,0,0.4);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}

.drill-label {
    /* Explicitly matching instructor-text styles */
    font-family: var(--font-display); 
    font-size: 1.4rem;
    color: #fff;
    font-style: normal;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); 
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.code-target {
    font-family: var(--font-code);
    color: #90d2a7; 
    font-weight: 700;
    font-size: 1.2rem;
    /*text-shadow: 0 0 10px rgba(244, 114, 182, 0.3);*/
    white-space: pre-wrap; /* Allows newlines in instructions */
}

.philosophy-card {
    border-left: 4px solid var(--success-color);
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.15), rgba(0,0,0,0.3));
}

.philosophy-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--success-color);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

/* --- RIGHT PANEL: CONSOLE --- */
.right-panel {
    flex: 1;
    background-color: var(--console-bg);
    color: var(--console-text);
    padding: 30px;
    font-family: var(--font-code);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* CRT GLOW */
.right-panel::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: radial-gradient(circle, rgba(16, 255, 0, 0.02) 0%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
    z-index: 5;
}

.terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.5;
    color: #a7f3d0;
    text-shadow: 0 0 2px rgba(167, 243, 208, 0.3);
}

.input-area-container {
    display: flex;
    flex-direction: column;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 15px;
    position: relative;
    z-index: 10;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

.input-line {
    display: flex;
    align-items: flex-start;
}

.prompt { 
    color: var(--success-color); 
    margin-right: 15px; 
    font-weight: bold; 
    text-shadow: 0 0 5px var(--success-glow);
}

#code-input {
    background: transparent;
    border: none;
    color: var(--success-color);
    font-family: inherit;
    font-size: 1.1rem;
    flex-grow: 1;
    outline: none;
    resize: none;
    caret-color: var(--success-color);
}

.multiline-hint {
    font-size: 0.9rem;
    color: #555;
    margin-top: 5px;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}
.multiline-hint.visible { opacity: 1; }

/* CONTINUE HINT ANIMATION */
.continue-hint {
    margin-top: 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    border-top: 1px dashed rgba(255,255,255,0.1);
    padding-top: 15px;
    font-weight: 600;
}

/* LOADING SCREEN */
.loading {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    z-index: 200;
    flex-direction: column;
    color: var(--accent-color);
    font-family: var(--font-display);
}

/* --- ANIMATIONS & PARTICLES --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    pointer-events: none;
    z-index: 150;
}

.success-flash {
    position: absolute;
    top:0; left:0; width:100%; height:100%;
    background: var(--success-glow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 50;
}
.success-flash.active { opacity: 0.2; }
