/* --- Core Variables Layout --- */
body { 
    background: #111; 
    color: #ccc; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace; 
    padding: 0; 
    margin: 0; 
    overflow: hidden;
}
.wrapper { 
    display: flex; 
    height: 100vh; 
}
.sidebar { 
    width: 300px; 
    background: #161616; 
    padding: 24px; 
    border-right: 1px solid #262626; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 18px; 
    z-index: 10;
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
}
.main-panel { 
    flex: 1; 
    padding: 20px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    background: #0a0a0a; 
    position: relative; 
}
.tabs { 
    display: flex; 
    gap: 4px; 
    border-bottom: 2px solid #262626; 
    padding-bottom: 12px; 
}
.tab { 
    background: #222; 
    border: 1px solid #333; 
    color: #888; 
    padding: 6px 14px; 
    cursor: pointer; 
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}
.tab:hover { color: #fff; border-color: #555; }
.tab.active { background: #b35900; border-color: #b35900; color: #fff; }

/* Fixed Control Spacing Layout */
label { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 11px; 
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px; /* Clean vertical row separation gaps */
}
input[type=range] {
    -webkit-appearance: none;
    appearance: none; /* Cross-Platform CSS Warning Correction */
    width: 140px;
    background: #333;
    height: 4px;
    border-radius: 2px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #b35900;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}
select, input[type=text], input[type=number] { 
    width: 140px; 
    background: #1f1f1f; 
    color: #fff; 
    border: 1px solid #333; 
    padding: 5px; 
    font-family: monospace;
    font-size: 12px;
}
select:focus, input:focus { border-color: #b35900; outline: none; }

.canvas-container { 
    width: 100%; 
    max-width: 800px; 
    max-height: 85vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}
canvas { 
    width: 100%; 
    height: auto; 
    max-height: 85vh; 
    object-fit: contain; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    image-rendering: pixelated; 
    image-rendering: crisp-edges;
    background-color: #1a1a1a;
    background-image: linear-gradient(45deg, #222 25%, transparent 25%), linear-gradient(-45deg, #222 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #222 75%), linear-gradient(-45deg, transparent 75%, #222 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}
button, .file-label { 
    padding: 10px; 
    background: #2a2a2a; 
    color: #fff; 
    border: 1px solid #444; 
    cursor: pointer; 
    text-align: center; 
    font-size: 11px; 
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.2s ease;
}
button:hover, .file-label:hover { background: #3a3a3a; border-color: #666; }
.btn-group { display: flex; gap: 6px; }
.btn-group button { flex: 1; }
.hidden { display: none !important; }

.swatch { width: 25px; height: 25px; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: #fff !important; box-shadow: 0 0 8px rgba(255,255,255,0.5); }
hr { border: 0; border-top: 1px solid #262626; margin: 12px 0; }

#status-overlay { 
    position: absolute; 
    top: 20px; 
    left: 50%; 
    transform: translateX(-50%);
    background: #b35900; 
    color: #fff; 
    padding: 12px 24px; 
    font-size: 14px; 
    font-weight: bold; 
    letter-spacing: 2px; 
    display: none; 
    z-index: 2000; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    border-radius: 4px;
}

h2 { margin: 0 0 5px 0; color: #fff; font-size: 22px; letter-spacing: 2px; }
.url-box { display: flex; gap: 5px; margin-top: 5px; }
.url-box input { flex: 1; width: auto; }

/* --- Clean Light Mode Theme Overrides --- */
body.light-mode { background: #eaeaea; color: #222; }
body.light-mode .sidebar { background: #f5f5f5; border-right: 1px solid #d0d0d0; box-shadow: 5px 0 15px rgba(0,0,0,0.05); }
body.light-mode h2 { color: #111; }
body.light-mode label { color: #555; }
body.light-mode hr { border-top: 1px solid #d0d0d0; }
body.light-mode select, body.light-mode input[type=text], body.light-mode input[type=number] { background: #fff; color: #000; border: 1px solid #ccc; }
body.light-mode input[type=range] { background: #ccc; }
body.light-mode button, body.light-mode .file-label { background: #e0e0e0; color: #222; border: 1px solid #ccc; }
body.light-mode button:hover, body.light-mode .file-label:hover { background: #d4d4d4; }
body.light-mode .tab { background: #e0e0e0; border: 1px solid #ccc; color: #666; }
body.light-mode .tab.active { background: #b35900; color: #fff; border-color: #b35900; }
body.light-mode .main-panel { background: #f0f0f0; }
body.light-mode canvas { 
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); 
    background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
}

/* --- Info Sliding Panel --- */
.info-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background: #161616;
    border-left: 1px solid #333;
    box-shadow: -5px 0 20px rgba(0,0,0,0.7);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}
.info-panel.open {
    right: 0;
}
.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #262626;
}
.info-header h2 { margin: 0; font-size: 18px; color: #fff; }
.close-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    width: auto;
}
.close-btn:hover { color: #fff; background: transparent; border-color: transparent; }
.info-content {
    padding: 24px;
    overflow-y: auto;
    color: #bbb;
    font-size: 12px;
    line-height: 1.6;
}
.info-content h3 { color: #fff; margin: 0 0 10px 0; font-size: 14px; text-transform: uppercase; letter-spacing: 1px;}
.info-content ol { padding-left: 16px; margin-bottom: 20px; }
.info-content li { margin-bottom: 10px; }
.info-content strong { color: #b35900; }

/* Light mode overrides for Info Panel */
body.light-mode .info-panel { background: #f5f5f5; border-left: 1px solid #ccc; box-shadow: -5px 0 20px rgba(0,0,0,0.1); }
body.light-mode .info-header { border-bottom: 1px solid #d0d0d0; }
body.light-mode .info-header h2 { color: #111; }
body.light-mode .info-content { color: #444; }
body.light-mode .info-content h3 { color: #222; }
body.light-mode .close-btn { color: #666; }
body.light-mode .close-btn:hover { color: #000; }