/* Base Styles */
:root {
    --primary-color: #4a6bff;
    --secondary-color: #ff6b6b;
    --tertiary-color: #6bff9e;
    --background-color: #f9f9ff;
    --text-color: #333;
    --light-gray: #f0f0f0;
    --medium-gray: #ddd;
    --dark-gray: #888;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Comic Neue', cursive;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

h1 {
    font-size: 2.5rem;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.3rem;
    color: var(--secondary-color);
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1, header h2 {
    color: white;
    margin: 0.5rem 0;
}

header h2 {
    font-size: 1.2rem;
    font-weight: normal;
}

nav {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    display: flex;
    list-style: none;
    overflow-x: auto;
    padding: 0.5rem;
    justify-content: center;
}

nav li {
    margin: 0 0.5rem;
    white-space: nowrap;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    display: block;
}

nav a.active, nav a:hover {
    background-color: var(--primary-color);
    color: white;
}

main {
    min-height: 80vh;
    padding: 2rem 0;
}

section {
    display: none;
    padding: 2rem 0;
    animation: fadeIn 0.5s ease;
}

section.active-section {
    display: block;
}

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Character and Speech Bubble */
.character-container {
    display: flex;
    align-items: flex-start;
    margin: 2rem 0;
}

.character {
    flex: 0 0 150px;
    margin-right: 1rem;
}

.character img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.speech-bubble {
    position: relative;
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    flex: 1;
}

.speech-bubble:before {
    content: '';
    position: absolute;
    left: -20px;
    top: 30px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent white transparent transparent;
}

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.nav-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.nav-button:hover {
    background-color: #3a5bef;
    transform: translateY(-2px);
}

/* Visual Tokens Section */
.token-demo {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.input-area {
    margin-bottom: 1.5rem;
}

.input-area label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.input-area input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.input-area button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.input-area button:hover {
    background-color: #ff5a5a;
}

.token-visualization {
    margin: 1.5rem 0;
}

#tokens-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.token {
    background-color: var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    display: inline-block;
    animation: popIn 0.3s ease;
    border: 2px solid var(--primary-color);
}

/* Sentence Builder Section */
.game-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

#sentence-display {
    background-color: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: bold;
}

.prediction-area {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.user-prediction, .ai-prediction {
    flex: 1;
    min-width: 250px;
}

.user-prediction label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.user-prediction input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.user-prediction button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.user-prediction button:hover {
    background-color: #ff5a5a;
}

.ai-prediction h3 {
    margin-bottom: 0.5rem;
}

.ai-prediction ol {
    padding-left: 1.5rem;
}

.ai-prediction li {
    margin-bottom: 0.3rem;
}

.result-feedback {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

#prediction-feedback {
    margin-bottom: 1rem;
}

#next-sentence {
    background-color: var(--tertiary-color);
    color: var(--text-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

#next-sentence:hover {
    background-color: #5aef8d;
}

/* Training vs Predicting Section */
.training-demo {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

/* Interactive Training */
.interactive-training {
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .interactive-training {
        grid-template-columns: 1fr 1fr;
    }
}

.training-phase, .prediction-phase {
    background-color: var(--light-gray);
    border-radius: 10px;
    padding: 1.5rem;
    min-height: 300px;
}

.training-data-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.training-data-item {
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    cursor: grab;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    user-select: none;
}

.training-data-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.training-data-item.dragging {
    opacity: 0.5;
}

.data-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.ai-brain-container {
    margin-top: 1.5rem;
}

#ai-brain {
    background-color: var(--primary-color);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

#ai-brain.highlight {
    background-color: #5d7bff;
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(74, 107, 255, 0.5);
}

.brain-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#training-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 15px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #4ecca3;
    transition: width 0.5s ease;
}

.prediction-controls {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

#prediction-topic {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    border: 2px solid #ddd;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
}

#generate-prediction {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generate-prediction:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.prediction-result {
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    min-height: 100px;
}

.training-explanation ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Model vs Human Section */
.quiz-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

#quiz-question {
    margin-bottom: 1.5rem;
}

#quiz-text {
    background-color: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
    font-style: italic;
}

.quiz-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-options button {
    flex: 1;
    background-color: white;
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.quiz-options button:hover {
    background-color: var(--light-gray);
}

#quiz-feedback {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    min-height: 80px;
}

#next-quiz {
    background-color: var(--tertiary-color);
    color: var(--text-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

#next-quiz:hover {
    background-color: #5aef8d;
}

/* Build-a-Bot Section */
.bot-builder {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.training-selection {
    margin-bottom: 1.5rem;
}

.training-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.training-option {
    background-color: var(--light-gray);
    color: var(--text-color);
    border: 2px solid var(--medium-gray);
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.training-option:hover {
    background-color: var(--medium-gray);
}

.training-option.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.bot-interaction {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bot-character {
    margin-bottom: 1.5rem;
}

.bot-character img {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.bot-prompt {
    width: 100%;
    margin-bottom: 1.5rem;
}

.bot-prompt label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.bot-prompt input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.bot-prompt button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.bot-prompt button:hover {
    background-color: #ff5a5a;
}

.bot-response {
    background-color: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    width: 100%;
    min-height: 100px;
}

/* Glossary Section */
.glossary-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.glossary-item {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .character-container {
        flex-direction: column;
        align-items: center;
    }
    
    .character {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .speech-bubble:before {
        left: 50%;
        top: -20px;
        transform: translateX(-50%);
        border-color: transparent transparent white transparent;
    }
    
    .prediction-area {
        flex-direction: column;
    }
    
    .glossary-list {
        grid-template-columns: 1fr;
    }
    
    nav ul {
        justify-content: flex-start;
    }
}

/* Accessibility Enhancements */
button:focus, a:focus, input:focus {
    outline: 3px solid var(--tertiary-color);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
