/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Assamese', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    padding: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    gap: 30px;
}

/* Editor Section */
.editor-section, .output-section, .examples-section, .docs-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.editor-header, .output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.editor-header h2, .output-header h2, .examples-section h2, .docs-section h2 {
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Noto Sans Assamese', sans-serif;
    font-weight: 600;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.run-btn {
    background: #48bb78;
    color: white;
}

.run-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.clear-btn {
    background: #e53e3e;
    color: white;
}

.clear-btn:hover {
    background: #c53030;
    transform: translateY(-2px);
}

.example-btn {
    background: #4299e1;
    color: white;
}

.example-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.clear-output-btn {
    background: #a0aec0;
    color: white;
    padding: 8px 15px;
    font-size: 0.9em;
}

.clear-output-btn:hover {
    background: #718096;
}

/* Code Editor */
.code-editor {
    display: flex;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #1a202c;
}

.line-numbers {
    background: #2d3748;
    color: #a0aec0;
    padding: 15px 10px;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    user-select: none;
}

.line-numbers div {
    height: 22px;
    line-height: 22px;
}

#codeInput {
    flex: 1;
    padding: 15px;
    border: none;
    background: #1a202c;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    line-height: 1.5;
    resize: vertical;
    min-height: 300px;
    outline: none;
    tab-size: 4;
}

#codeInput:focus {
    outline: none;
}

/* Output Console */
.output-console {
    background: #1a202c;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    line-height: 1.6;
}

.welcome-message {
    color: #a0aec0;
    text-align: center;
    padding: 20px;
}

.welcome-message p {
    margin-bottom: 10px;
}

/* Examples Section */
.example-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.example-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #4299e1;
}

.example-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.example-card pre {
    background: #1a202c;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9em;
}

/* Documentation */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.doc-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
}

.doc-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.doc-card ul {
    list-style: none;
}

.doc-card li {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.doc-card li:last-child {
    border-bottom: none;
}

.doc-card code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #2d3748;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9em;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #718096;
}

.close:hover {
    color: #2d3748;
}

.modal-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.modal-example {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-example:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
}

.modal-example h4 {
    color: #2d3748;
    margin-bottom: 15px;
}

.sample-modal-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.sample-modal-heading h3 {
    margin-top: 5px;
    color: var(--ink);
}

.sample-controls {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.sample-controls input,
.sample-controls select {
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8faf7;
    color: var(--ink);
    font: inherit;
}

.sample-controls input { flex: 1; }
.sample-controls select { min-width: 170px; }
.sample-controls input:focus,
.sample-controls select:focus { outline: 2px solid rgba(15, 118, 110, .2); border-color: var(--teal); }
.modal-examples .modal-example { min-height: 0; padding: 14px; }
.modal-examples .modal-example h4 { margin-bottom: 9px; font-size: .85rem; }
.modal-examples .modal-example pre { max-height: 130px; margin: 0; padding: 10px; overflow: auto; font-size: .7rem; white-space: pre-wrap; }

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
        flex-direction: column;
        gap: 10px;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .editor-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .example-cards, .docs-grid {
        grid-template-columns: 1fr;
    }
    
    .code-editor {
        flex-direction: column;
    }
    
    .line-numbers {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    
    .line-numbers div {
        margin-right: 20px;
        min-width: 20px;
    }

    .sample-modal-heading,
    .sample-controls { align-items: stretch; flex-direction: column; }

    .sample-controls select { width: 100%; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Syntax Highlighting in Output */
.output-console .error {
    color: #fc8181;
    font-weight: bold;
}

.output-console .success {
    color: #68d391;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dashboard layer */
:root {
    --ink: #17212b;
    --muted: #687681;
    --paper: #f4f6f2;
    --panel: #ffffff;
    --line: #dce4df;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --coral: #e76f51;
    --code: #14232a;
    --code-soft: #1b3239;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Noto Sans Assamese', 'Trebuchet MS', sans-serif;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(15, 118, 110, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 118, 110, .035) 1px, transparent 1px);
    background-size: 32px 32px;
}

.container {
    max-width: 1320px;
    padding: 28px 32px 42px;
    position: relative;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 24px 28px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 16px;
    background: #17343a;
    box-shadow: 0 16px 36px rgba(28, 52, 55, .16);
    color: #f7fbf8;
    text-align: left;
}

.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: #e4f0e7; color: var(--teal-dark); font-size: 20px; }
.app-header h1 { margin: 2px 0 3px; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: 0; justify-content: flex-start; }
.subtitle { margin: 0; color: #b8cec8; font-size: .95rem; }
.eyebrow { margin: 0; color: #8fc9ba; font: 700 .68rem/1.2 'Trebuchet MS', sans-serif; letter-spacing: .12em; }
.eyebrow span { color: var(--coral); }
.developer-credit { margin: 6px 0 0; color: #d2e9df; font-size: .76rem; }
.header-status, .shortcut-note, .section-count { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.header-status { padding: 9px 12px; border: 1px solid rgba(202, 235, 218, .2); border-radius: 999px; color: #d2e9df; background: rgba(255, 255, 255, .06); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #74d69e; box-shadow: 0 0 0 4px rgba(116, 214, 158, .14); }

.workspace-intro { display: flex; align-items: end; justify-content: space-between; margin: 12px 4px 18px; }
.workspace-intro h2 { margin: 5px 0 0; font: 700 clamp(1.3rem, 2.5vw, 1.8rem)/1.2 'Trebuchet MS', sans-serif; letter-spacing: 0; }
.shortcut-note { color: var(--teal-dark); font-size: .78rem; }

.main-content { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.editor-section, .output-section, .examples-section, .docs-section { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .92); box-shadow: 0 10px 24px rgba(36, 61, 58, .06); }
.editor-section { grid-column: 1; }
.output-section { grid-column: 2; }
.examples-section, .docs-section { grid-column: 1 / -1; }
.editor-header, .output-header { align-items: flex-start; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: flex-start; gap: 11px; }
.panel-title h2, .examples-section h2, .docs-section h2 { color: var(--ink); font-size: 1.05rem; }
.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.panel-kicker { color: var(--coral); font: 700 .72rem/1 'Trebuchet MS', sans-serif; }
.editor-buttons { display: flex; gap: 7px; }
.btn { padding: 9px 12px; border-radius: 8px; font-size: .82rem; box-shadow: none; }
.run-btn { background: var(--teal); }
.run-btn:hover { background: var(--teal-dark); transform: none; }
.clear-btn { background: #f8e7e2; color: #b34f3c; }
.clear-btn:hover { background: #f4d8d0; transform: none; }
.example-btn { background: #e5f1ec; color: var(--teal-dark); }
.example-btn:hover { background: #d3e8df; transform: none; }
.clear-output-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.clear-output-btn:hover { background: var(--paper); }

.code-editor { min-height: 388px; border: 1px solid #25434a; border-radius: 10px; background: var(--code); }
.line-numbers { min-width: 42px; padding: 16px 10px; background: var(--code-soft); color: #769099; font-size: .8rem; }
#codeInput { min-height: 388px; padding: 16px; color: #d9eee5; background: var(--code); font-size: .92rem; line-height: 1.65; }
.output-console { min-height: 388px; max-height: none; padding: 18px; border-radius: 10px; background: var(--code); color: #d9eee5; font-size: .9rem; }
.welcome-message { padding: 50px 20px; color: #8da6a0; }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 17px; }
.section-heading h2 { margin-top: 5px; }
.section-count { padding: 6px 10px; border-radius: 999px; color: var(--teal-dark); background: #e5f1ec; font-size: .72rem; }
.text-action { border: 0; background: transparent; color: var(--teal-dark); cursor: pointer; font: 700 .78rem 'Noto Sans Assamese', sans-serif; }
.text-action i { margin-left: 4px; font-size: .7rem; }
.example-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.example-card { min-height: 150px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf7; }
.example-card:hover { transform: translateY(-3px); border-color: #8bbcae; box-shadow: 0 10px 20px rgba(36, 61, 58, .08); }
.example-card h3 { margin-bottom: 11px; color: var(--ink); font-size: .98rem; }
.example-card pre { padding: 12px; border-radius: 7px; background: var(--code); color: #b9d9cd; font-size: .72rem; }
.docs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.doc-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf7; }
.doc-card h3 { margin-bottom: 9px; color: var(--ink); font-size: .93rem; }
.doc-card li { padding: 6px 0; border-bottom-color: var(--line); color: var(--muted); font-size: .8rem; }
.doc-card code { color: var(--teal-dark); background: #e7f0eb; }
footer { margin-top: 28px; padding: 8px; color: var(--muted); font-size: .78rem; }
.footer-links a { color: var(--teal-dark); }

@media (max-width: 900px) {
    .main-content { grid-template-columns: 1fr; }
    .editor-section, .output-section, .examples-section, .docs-section { grid-column: 1; }
    .example-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .container { padding: 14px 12px 28px; }
    .app-header { align-items: flex-start; flex-direction: column; gap: 18px; padding: 20px; }
    .header-status { align-self: flex-start; }
    .workspace-intro { align-items: flex-start; flex-direction: column; gap: 10px; }
    .editor-header, .output-header { flex-direction: column; gap: 12px; }
    .editor-buttons { width: 100%; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-buttons .btn { flex: 1; min-width: 0; justify-content: center; overflow-wrap: anywhere; }
    .example-cards, .docs-grid { grid-template-columns: 1fr; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .code-editor { width: 100%; min-width: 0; flex-direction: row; }
    .line-numbers { display: block; flex: 0 0 40px; width: 40px; min-width: 40px; overflow: hidden; padding: 15px 7px; }
    .line-numbers div { margin-right: 0; min-width: 0; }
    #codeInput { width: auto; min-width: 0; flex: 1; }
}

.typing-btn {
    background: #edf0f8;
    color: #43527a;
}

.typing-btn:hover {
    background: #e0e5f3;
    transform: none;
}

.typing-panel {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8faf7;
}

.typing-panel[hidden] { display: none; }

.typing-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.typing-panel-header h3 {
    margin-top: 4px;
    color: var(--ink);
    font-size: .95rem;
}

.typing-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: white;
    color: var(--muted);
    cursor: pointer;
}

.typing-group { margin-top: 9px; }
.typing-group-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.typing-row { display: flex; flex-wrap: wrap; gap: 5px; }
.typing-key {
    min-width: 34px;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid #cbd9d2;
    border-radius: 6px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    font: 600 .84rem 'Noto Sans Assamese', sans-serif;
}
.typing-key:hover { border-color: var(--teal); background: #e7f2ed; color: var(--teal-dark); }
.typing-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.typing-control { min-width: 86px; color: var(--teal-dark); }

@media (max-width: 600px) {
    .typing-row { gap: 4px; }
    .typing-key { min-width: 30px; padding: 3px 6px; }
}
/* v2.0 compiler output */
.output-console pre { margin: 8px 0 0; white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: .82rem; line-height: 1.55; }
.output-console pre.c-code { max-height: 420px; overflow: auto; padding: 12px; border-radius: 8px; background: rgba(255,255,255,.04); color: #cfe7de; }
.output-console pre.expected { padding: 10px 12px; border-left: 3px solid #68d391; background: rgba(104,211,145,.08); color: #e6f6ee; }
.output-console pre.diag { color: #fbb6b6; }
.output-console pre.diag.warn { color: #f6e05e; }
.output-console .output-label { margin-top: 14px; color: #8da6a0; font-size: .8rem; }
.output-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.small-btn { padding: 6px 12px; font-size: .78rem; background: #25434a; color: #d9eee5; }
.small-btn:hover { background: #2f5860; }

/* v2.1 — running programs in the browser */
.code-btn { background: #e5f1ec; color: var(--teal-dark); }
.code-btn:hover { background: #d3e8df; transform: none; }
.run-btn[disabled] { opacity: .65; cursor: progress; }
.output-buttons { display: flex; gap: 7px; }
.stop-btn { background: #f8e7e2; color: #b34f3c; }
.stop-btn[hidden] { display: none; }
.stdin-box { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf7; }
.stdin-box summary { padding: 9px 12px; cursor: pointer; color: var(--teal-dark); font-size: .8rem; font-weight: 700; }
.stdin-box summary span { color: var(--coral); font-weight: 600; }
.stdin-box textarea { display: block; width: calc(100% - 24px); margin: 0 12px 12px; padding: 9px 10px; border: 1px solid #cbd9d2; border-radius: 7px; background: white; color: var(--ink); font: .86rem/1.5 'Noto Sans Assamese', 'Courier New', monospace; resize: vertical; }
.output-console pre.program-output { min-height: 2.5em; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.04); color: #eef8f3; font-family: 'Noto Sans Assamese', 'Courier New', monospace; font-size: .9rem; }
.output-console pre.program-output .stderr { color: #fbb6b6; }
.output-console .run-status { margin-top: 10px; color: #8da6a0; font-size: .78rem; }
.output-console .run-status.ok { color: #68d391; }
.output-console .run-status.bad { color: #fbb6b6; }
.output-console .match { display: inline-block; margin-top: 8px; padding: 3px 9px; border-radius: 999px; background: rgba(104,211,145,.15); color: #9ae6b4; font-size: .76rem; }
.output-console .match.miss { background: rgba(246,224,94,.12); color: #f6e05e; }
