* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    background-color: #fffef5;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #404040;
    min-height: 100vh;
}


.header {
    text-align: center;
    margin-bottom: 20px;
}

.web-title {
    font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
    font-size: 46px;
    font-weight: 900;
    letter-spacing: 3px;
    margin: 0;
    padding: 15px 30px;
    display: inline-block;
    background-color: #fff3cc;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.title-main {
    color: #c0504d;
    text-shadow:
        2px 2px 0px #000000,
        3px 3px 0px #5a2020,
        -1px -1px 0px #ffffff;
    -webkit-text-stroke: 1px #5a2020;
    margin-right: 15px;
    vertical-align: baseline;
}

.title-playground {
    color: #d06060;
    font-size: 46px;
    text-shadow:
        2px 2px 0px #000000,
        3px 3px 0px #4a1818,
        -1px -1px 0px #ffffff;
    -webkit-text-stroke: 1px #4a1818;
    vertical-align: baseline;
}

@media (max-width: 768px) {
    .web-title {
        font-size: 32px;
    }
    
    .title-main {
        display: block;
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .title-playground {
        font-size: 26px;
        display: block;
    }
}

/* Main playground container */
.playground-widget {
    border: 2px solid #c0504d;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(192, 80, 77, 0.15);
    max-width: 95%;
    margin: 0 auto;
}

/*Editor Section*/

.editor-section {
    border-bottom: 2px solid #e0e0e0;
}

/* Toolbar */
.toolbar {
    background: #f5f5f5;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e0e0e0;
}

/* Buttons */
.toolbar button {
    background: #c0504d;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
}

.toolbar button:hover:not(:disabled) {
    background: #a0403d;
    transform: translateY(-1px);
}

.toolbar button:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar button:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Stop button state */
#run.stopping {
    background: #dc3545;
}

#run.stopping:hover {
    background: #c82333;
}

#share {
    background: #6c757d;
}

#share:hover {
    background: #5a6268;
}

#share-info {
    color: #c0504d;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

/* Config options */
.config-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.run-option {
    font-size: 13px;
    color: #404040;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: border-color 0.2s;
}

.run-option:hover {
    border-color: #c0504d;
}

.run-option input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
    accent-color: #c0504d;
}

.run-option select {
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.run-option select:focus {
    outline: none;
    border-color: #c0504d;
}

/* Editor container - Light yellow theme */
#editor {
    background: #fffef5;
}

#editor .cm-editor {
    height: 50vh;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #fffef5;
}

.cm-scroller {
    overflow: auto;
    background: #fffef5;
}

#editor .cm-content {
    color: #333333;
    background: transparent !important;
}

#editor .cm-line {
    color: #333333;
    background: transparent;
}

#editor .cm-gutters {
    background: #fff9e6;
    border-right: 1px solid #e0d8c0;
}

#editor .cm-lineNumbers .cm-gutterElement {
    color: #999977;
}

#editor .cm-activeLineGutter {
    background: #fff3cc;
}

#editor .cm-activeLine {
    background: rgba(192, 80, 77, 0.05);
}

/* Syntax highlighting - colors for light background */
.cm-keyword { color: #c0504d !important; font-weight: bold; }
.cm-atom { color: #8b4513 !important; }
.cm-number { color: #ae81ff !important; }
.cm-def { color: #006400 !important; }
.cm-variable { color: #333333 !important; }
.cm-variable-2 { color: #006666 !important; }
.cm-variable-3 { color: #0066aa !important; }
.cm-property { color: #333333 !important; }
.cm-operator { color: #c0504d !important; }
.cm-comment { color: #808080 !important; font-style: italic; }
.cm-string { color: #a31515 !important; }
.cm-string-2 { color: #c0504d !important; }
.cm-meta { color: #808080 !important; }
.cm-builtin { color: #0066aa !important; }
.cm-bracket { color: #333333 !important; }
.cm-tag { color: #c0504d !important; }
.cm-attribute { color: #006400 !important; }

/* CodeMirror 6 token classes for light theme */
.ͼ1 .ͼ5 { color: #333333 !important; }
.ͼ1 .ͼ7 { color: #808080 !important; font-style: italic; }
.ͼ1 .ͼb { color: #c0504d !important; font-weight: bold; }
.ͼ1 .ͼc { color: #a31515 !important; }
.ͼ1 .ͼd { color: #ae81ff !important; }
.ͼ1 .ͼe { color: #006400 !important; }

/* ========================================
   Output Section with Tabs
   ======================================== */

.output-section {
    background: #fafafa;
}

.output-header {
    display: flex;
    align-items: center;
    background: #e8e8e8;
    border-bottom: 1px solid #d0d0d0;
    padding-right: 10px;
}

.output-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-right: 1px solid #d0d0d0;
    transition: background 0.2s, color 0.2s;
    user-select: none;
    background: transparent;
    border-top: none;
    border-bottom: none;
    border-left: none;
}

.output-tab:hover {
    background: #f0f0f0;
    color: #404040;
}

.output-tab.active {
    background: #fafafa;
    color: #c0504d;
    font-weight: bold;
    border-bottom: 2px solid #c0504d;
    margin-bottom: -1px;
}

/* Copy button */
.copy-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #e8e8e8;
    color: #404040;
    border-color: #c0c0c0;
}

.copy-btn.copied {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.output-content {
    position: relative;
    min-height: 150px;
    height: 20vh;
}

.result-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 15px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: none;
    border: none;
}

.result-box.active {
    display: block;
}

.result-box:empty::before {
    content: "Output will appear here...";
    color: #666;
    font-style: italic;
}

#error:empty::before {
    content: "Errors will appear here...";
}

#svcode:empty::before {
    content: "Generated SystemVerilog code will appear here...";
}

#svcode {
    background: #fafafa;
    color: #333;
}

/* Footer */

.info-bar {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
}

.info-link {
    display: inline-block;
    margin: 0 12px;
    color: #c0504d;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s;
}

.info-link:hover {
    color: #CB9D06;
    text-decoration: underline;
}

.compiler-version {
    color: #808080;
    font-size: 12px;
}

.compiler-version a {
    color: #c0504d;
    text-decoration: none;
}

.compiler-version a:hover {
    color: #CB9D06;
    text-decoration: underline;
}

/* Small footer tweaks: match "Found a bug?" and copyright to theme */
.found-bug {
    color: #808080;
    font-size: 12px;
    margin-left: 12px;
    font-weight: 600;
}
.found-bug a {
    color: #c0504d;
    text-decoration: none;
}
.found-bug a:hover {
    color: #CB9D06;
    text-decoration: underline;
}

.info-bar.copyright {
    color: #808080;
    font-size: 12px;
    margin-top: 8px;
}

/* Device Adjust*/

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar button {
        width: 100%;
        margin-bottom: 8px;
    }

    .config-bar {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }

    .run-option {
        flex: 1;
        justify-content: center;
    }

    #editor .cm-editor {
        height: 40vh;
    }

    .output-content {
        height: 25vh;
    }
}

@media (min-width: 769px) {
    #editor .cm-editor {
        height: 60vh;
    }

    .output-content {
        height: 22vh;
    }
}
