/* Import typewriter fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Source+Code+Pro:wght@300;400;500;600;700&family=Fira+Code:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

/* Original styling with fullscreen */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    background: #2c3e50;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-transform: lowercase;
}

body.day-mode {
    background: #E8D5C4; /* Slightly darker warm beige/cream parchment color */
}

h1 {
    color: #ecf0f1;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    margin: 0;
    text-align: center;
    font-family: 'Manrope', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.8px;
    text-transform: lowercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

body.day-mode h1 {
    color: #2c3e50; /* Dark text for light background */
    background: rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.controls {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 10;
}

.controls button {
    background: rgba(67, 56, 202, 0.9); /* Slightly darker blue/purple */
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 3px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.3s;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls button:hover {
    background: rgba(99, 102, 241, 1); /* Brighter blue/purple on hover */
}

body.day-mode .controls button {
    background: rgba(67, 56, 202, 0.9); /* Slightly darker blue/purple for light mode */
    color: white;
}

body.day-mode .controls button:hover {
    background: rgba(99, 102, 241, 1); /* Brighter blue/purple on hover */
}

.toolbar {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.tool-btn {
    background: rgba(67, 56, 202, 0.9); /* Slightly darker blue/purple */
    color: white;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    min-width: 48px;
    height: 48px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tool-btn i {
    font-size: 16px;
    color: currentColor;
}

.tool-btn:hover {
    background: rgba(99, 102, 241, 1); /* Brighter blue/purple on hover */
    transform: translateY(-2px);
}

.tool-btn.active {
    background: rgba(59, 130, 246, 0.9); /* Brighter blue for active */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tool-btn.active:hover {
    background: rgba(37, 99, 235, 1); /* Brighter blue for active hover */
}

/* Tooltip styling */
.tool-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out forwards;
}

/* Welcome prompt styling */
#welcomePrompt {
    position: fixed;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

.welcome-prompt-content {
    background: rgba(55, 65, 81, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: welcomePromptFadeIn 0.5s ease-out;
}

.welcome-prompt-content h2 {
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 24px 0;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.welcome-prompt-input {
    display: flex;
    gap: 0;
    align-items: stretch;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.welcome-prompt-input:focus-within {
    border-color: rgba(67, 56, 202, 0.9);
    box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.2);
}

.welcome-prompt-input input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    color: #ffffff;
    outline: none;
    border-radius: 6px;
    text-transform: lowercase;
}

.welcome-prompt-input input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.welcome-prompt-input button {
    padding: 12px 16px;
    background: rgba(67, 56, 202, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: lowercase;
}

.welcome-prompt-input button:hover {
    background: rgba(99, 102, 241, 1);
}

.welcome-prompt-input button:active {
    background: rgba(59, 130, 246, 0.9);
}

/* Day mode welcome prompt */
body.day-mode .welcome-prompt-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.day-mode .welcome-prompt-content h2 {
    color: #0f172a;
}

body.day-mode .welcome-prompt-content p {
    color: #64748b;
}

body.day-mode .welcome-prompt-input {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body.day-mode .welcome-prompt-input:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

@keyframes welcomePromptFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tool-btn[title]:hover::before {
    content: '';
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out forwards;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

body.day-mode .tool-btn {
    background: rgba(67, 56, 202, 0.9); /* Slightly darker blue/purple for light mode */
    color: white;
}

body.day-mode .tool-btn:hover {
    background: rgba(99, 102, 241, 1); /* Brighter blue/purple on hover */
}

body.day-mode .tool-btn.active {
    background: rgba(59, 130, 246, 0.9); /* Brighter blue for active in light mode */
    color: white;
}

body.day-mode .tool-btn.active:hover {
    background: rgba(37, 99, 235, 1); /* Brighter blue for active hover in light mode */
}

body.day-mode .toolbar {
    background: rgba(255, 255, 255, 0.1);
}

.status {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7); /* Original dark background */
    color: #ecf0f1; /* Original light text */
    padding: 10px 15px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', 'Source Code Pro', 'Fira Code', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.3px;
    text-transform: none; /* Proper case for status messages */
    max-width: 300px;
    z-index: 10;
}

body.day-mode .status {
    background: rgba(44, 62, 80, 0.9); /* Original dark blue for light mode */
    color: #F5E6D3; /* Original light text */
}

/* Study Modal styles */
.study-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    font-family: 'JetBrains Mono', monospace;
}

.study-modal.show {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    max-width: 800px;
    width: 95%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-content.expanded {
    max-width: 800px;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
    background: #222;
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    text-transform: none;
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.modal-btn {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.modal-btn:hover {
    background: #444;
}

.modal-body {
    padding: 20px;
    color: #ccc;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
    text-transform: none;
    font-family: 'Roboto', 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

.modal-body p {
    margin: 0 0 12px 0;
    font-size: 16px;
    text-transform: none;
    font-family: inherit;
    line-height: 1.5;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

/* Quiz modal specific styling */
.quiz-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.quiz-question {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(67, 56, 202, 0.1);
    border-radius: 8px;
    border-left: 4px solid rgba(67, 56, 202, 0.8);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.quiz-option {
    padding: 12px 16px;
    background: rgba(67, 56, 202, 0.1);
    border: 2px solid rgba(67, 56, 202, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.quiz-option:hover {
    background: rgba(67, 56, 202, 0.2);
    border-color: rgba(67, 56, 202, 0.5);
    transform: translateY(-1px);
}

.quiz-option.selected {
    background: rgba(67, 56, 202, 0.3);
    border-color: rgba(67, 56, 202, 0.8);
}

.quiz-option.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.8);
    color: rgba(34, 197, 94, 1);
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.8);
    color: rgba(239, 68, 68, 1);
}

.quiz-result {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
}

.quiz-result.correct {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid rgba(34, 197, 94, 0.3);
    color: rgba(34, 197, 94, 1);
}

.quiz-result.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 1);
}

.quiz-score {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    padding: 15px;
    background: rgba(67, 56, 202, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(67, 56, 202, 0.3);
}
