Files
logic-gates/css/style.css
Jose Luis 53d600fcb0 fix: horizontal toolbar layout + fix component button placement
Redesign toolbar sections to use horizontal button rows instead of
vertical stacking. Fix component placement by attaching click handlers
directly to dynamically created buttons and passing correct gate object
shape to getComponentWidth/Height.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 03:06:23 +01:00

779 lines
15 KiB
CSS

* { margin: 0; padding: 0; box-sizing: border-box; }
/* ==================== Custom Scrollbar ==================== */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #2a2a3a;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #00e59966;
}
::-webkit-scrollbar-corner {
background: transparent;
}
/* Firefox */
* {
scrollbar-width: thin;
scrollbar-color: #2a2a3a transparent;
}
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: #0a0a0f;
color: #e0e0e0;
overflow: hidden;
height: 100vh;
}
/* ==================== Toolbar ==================== */
#toolbar {
position: fixed;
top: 0; left: 0; right: 0;
height: 56px;
background: #12121a;
border-bottom: 1px solid #2a2a3a;
display: flex;
align-items: center;
padding: 0 12px;
gap: 6px;
z-index: 100;
}
#toolbar .logo {
font-weight: 700;
font-size: 15px;
color: #00e599;
margin-right: 12px;
}
.gate-btn {
padding: 5px 12px;
background: #1a1a2e;
border: 1px solid #2a2a3a;
border-radius: 6px;
color: #ccc;
cursor: pointer;
font-size: 12px;
font-weight: 600;
transition: all 0.15s;
user-select: none;
}
.gate-btn:hover { background: #252540; border-color: #00e599; color: #fff; }
.gate-btn.input-btn { border-color: #3388ff; }
.gate-btn.input-btn:hover { border-color: #55aaff; }
.gate-btn.clock-btn { border-color: #ff44aa; }
.gate-btn.clock-btn:hover { border-color: #ff66cc; }
.gate-btn.output-btn { border-color: #ff8833; }
.gate-btn.output-btn:hover { border-color: #ffaa55; }
.separator { width: 1px; height: 32px; background: #2a2a3a; margin: 0 6px; }
.create-component-btn {
padding: 4px 10px;
background: #1a1a2e;
border: 1px solid #9900ff;
border-radius: 6px;
color: #9900ff;
cursor: pointer;
font-size: 11px;
font-weight: 600;
transition: all 0.15s;
user-select: none;
}
.create-component-btn:hover { background: #252540; border-color: #cc66ff; color: #cc66ff; }
.toolbar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.action-btn {
padding: 5px 10px;
background: transparent;
border: 1px solid #333;
border-radius: 6px;
color: #888;
cursor: pointer;
font-size: 11px;
transition: all 0.15s;
}
.action-btn:hover { border-color: #ff4444; color: #ff4444; }
.action-btn.help-btn:hover { border-color: #00e599; color: #00e599; }
.action-btn.sim-btn { border-color: #ff44aa; color: #ff44aa; }
.action-btn.sim-btn:hover { background: #ff44aa22; }
.action-btn.sim-btn.active { background: #ff44aa33; border-color: #ff66cc; color: #ff66cc; }
/* ==================== Toolbar Sections ==================== */
.toolbar-section {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 2px;
padding: 4px 0;
}
.section-label {
font-size: 8px;
color: #555;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 0 2px;
line-height: 1;
}
.section-buttons {
display: flex;
gap: 3px;
align-items: center;
flex-wrap: nowrap;
}
.toolbar-section .gate-btn {
padding: 4px 10px;
font-size: 11px;
}
.toolbar-section #saved-components {
display: flex;
gap: 3px;
align-items: center;
}
.toolbar-section .component-btn {
padding: 4px 10px;
font-size: 11px;
background: #1a1a2e;
border: 1px solid #2a2a3a;
border-radius: 6px;
color: #9900ff;
cursor: pointer;
font-weight: 600;
transition: all 0.15s;
}
.toolbar-section .component-btn:hover {
border-color: #9900ff;
color: #cc66ff;
background: #252540;
}
/* ==================== Canvas ==================== */
#canvas {
position: fixed;
top: 56px; left: 0; right: 0; bottom: 0;
cursor: default;
transition: left 0.2s ease;
}
/* ==================== Waveform Panel ==================== */
#waveform-panel {
display: none;
position: fixed;
left: 0; right: 0; bottom: 0;
height: 220px;
background: #0c0c14;
border-top: 2px solid #00e599;
z-index: 90;
flex-direction: column;
transition: left 0.2s ease;
}
#waveform-panel.visible { display: flex; }
#wave-toolbar {
display: flex;
align-items: center;
padding: 4px 12px;
gap: 8px;
background: #10101a;
border-bottom: 1px solid #1a1a2a;
height: 32px;
flex-shrink: 0;
}
#wave-toolbar span.wave-title {
font-size: 12px;
font-weight: 700;
color: #00e599;
margin-right: 8px;
}
.wave-btn {
padding: 3px 10px;
background: #1a1a2e;
border: 1px solid #2a2a3a;
border-radius: 4px;
color: #aaa;
cursor: pointer;
font-size: 11px;
font-weight: 600;
transition: all 0.15s;
}
.wave-btn:hover { border-color: #00e599; color: #fff; }
.wave-btn.active { background: #00e59933; border-color: #00e599; color: #00e599; }
.wave-btn.record { border-color: #ff4444; }
.wave-btn.record.active { background: #ff444433; border-color: #ff4444; color: #ff4444; }
.wave-info { margin-left: auto; font-size: 11px; color: #555; }
#wave-container { display: flex; flex: 1; overflow: hidden; }
#wave-labels {
width: 100px;
flex-shrink: 0;
overflow-y: auto;
background: #0e0e18;
border-right: 1px solid #1a1a2a;
}
.wave-label {
height: 30px;
display: flex;
align-items: center;
padding: 0 8px;
font-size: 11px;
font-weight: 600;
border-bottom: 1px solid #111;
color: #888;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.wave-label.input-label { color: #3388ff; }
.wave-label.output-label { color: #ff8833; }
.wave-label.gate-label { color: #00e599; }
#wave-canvas { flex: 1; cursor: crosshair; }
/* ==================== Help Modal ==================== */
#help-modal {
display: none;
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.7);
z-index: 200;
justify-content: center;
align-items: center;
}
#help-modal.visible { display: flex; }
#help-content {
background: #12121a;
border: 1px solid #2a2a3a;
border-radius: 12px;
padding: 24px;
max-width: 520px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
}
#help-content h2 { color: #00e599; margin-bottom: 12px; font-size: 18px; }
#help-content h3 { color: #ff44aa; margin: 12px 0 8px; font-size: 14px; }
#help-content p, #help-content li { color: #aaa; font-size: 13px; line-height: 1.5; margin-bottom: 6px; }
#help-content ul { padding-left: 20px; }
#help-content kbd {
background: #1a1a2e;
border: 1px solid #333;
border-radius: 4px;
padding: 1px 5px;
font-size: 11px;
color: #ddd;
}
#help-close {
margin-top: 12px;
padding: 6px 18px;
background: #00e599;
border: none;
border-radius: 6px;
color: #000;
font-weight: 600;
cursor: pointer;
}
/* ==================== Resize Handle ==================== */
#wave-resize {
position: absolute;
top: -4px; left: 0; right: 0;
height: 8px;
cursor: ns-resize;
z-index: 91;
}
/* ==================== Mode Toggle ==================== */
.mode-toggle {
display: flex;
gap: 0;
border-radius: 6px;
overflow: hidden;
}
.mode-btn {
padding: 5px 12px;
background: #1a1a2e;
border: 1px solid #2a2a3a;
color: #888;
cursor: pointer;
font-size: 12px;
font-weight: 600;
transition: all 0.15s;
border-radius: 0;
margin: 0 -1px;
}
.mode-btn:first-child { border-radius: 6px 0 0 6px; }
.mode-btn:last-child { border-radius: 0 6px 6px 0; }
.mode-btn:hover {
border-color: #00e599;
color: #fff;
}
.mode-btn.active {
background: #00e59922;
border-color: #00e599;
color: #00e599;
}
/* ==================== Component Editor Overlay ==================== */
#component-editor-overlay {
position: fixed;
top: 56px;
left: 0;
right: 0;
height: 44px;
background: #1a1a2e;
border-bottom: 2px solid #9900ff;
z-index: 105;
display: flex;
align-items: center;
padding: 0 12px;
gap: 12px;
}
#component-editor-bar {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
}
#component-editor-title {
color: #9900ff;
font-weight: 600;
font-size: 13px;
flex: 1;
}
#component-editor-save, #component-editor-cancel {
padding: 4px 12px;
border-radius: 4px;
border: none;
cursor: pointer;
font-size: 12px;
font-weight: 600;
transition: all 0.15s;
}
#component-editor-save {
background: #00e599;
color: #000;
}
#component-editor-save:hover {
background: #00ff99;
box-shadow: 0 0 10px #00e59944;
}
#component-editor-cancel {
background: transparent;
border: 1px solid #ff4444;
color: #ff4444;
}
#component-editor-cancel:hover {
background: #ff444422;
}
/* Shift canvas when editor is active */
#component-editor-overlay:not([style*="display: none"]) ~ #canvas {
top: calc(56px + 44px);
}
/* ==================== Puzzle Panels ==================== */
.puzzle-panel {
display: none;
position: fixed;
top: 56px;
left: 0;
width: 340px;
height: calc(100vh - 56px);
background: #12121a;
border-right: 1px solid #2a2a3a;
z-index: 95;
flex-direction: column;
overflow-y: auto;
}
.puzzle-panel.visible {
display: flex;
}
.puzzle-panel.puzzle-info {
top: 56px;
width: 340px;
}
/* When puzzle panel is visible, shift canvas and waveform */
.puzzle-panel.visible ~ #canvas,
body.puzzle-sidebar-open #canvas {
left: 340px;
}
body.puzzle-sidebar-open #waveform-panel {
left: 340px;
}
.puzzle-header {
padding: 16px;
background: #0a0a0f;
border-bottom: 1px solid #2a2a3a;
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-shrink: 0;
}
.puzzle-header h2 {
color: #00e599;
font-size: 18px;
margin: 0 0 8px 0;
}
.puzzle-header .close-btn {
background: none;
border: none;
color: #888;
font-size: 20px;
cursor: pointer;
padding: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.15s;
}
.puzzle-header .close-btn:hover {
color: #ff4444;
}
.close-btn {
background: none;
border: none;
color: #888;
font-size: 20px;
cursor: pointer;
padding: 0;
transition: color 0.15s;
}
.close-btn:hover {
color: #ff4444;
}
/* Level Panel */
.levels-container {
padding: 16px;
overflow-y: auto;
}
.level-category h3 {
color: #ff44aa;
font-size: 14px;
margin: 16px 0 8px 0;
padding: 8px 0;
border-bottom: 1px solid #2a2a3a;
}
.level-card {
background: #1a1a2e;
border: 1px solid #2a2a3a;
border-radius: 8px;
padding: 12px;
margin-bottom: 8px;
cursor: pointer;
transition: all 0.2s;
}
.level-card:hover:not(.locked) {
border-color: #00e599;
background: #1a1a3a;
}
.level-card.locked {
opacity: 0.5;
cursor: not-allowed;
}
.level-card.completed {
border-color: #00e599;
background: #00e59911;
}
.level-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.level-title {
color: #fff;
font-weight: 600;
font-size: 13px;
}
.level-difficulty {
color: #ff8833;
font-size: 11px;
letter-spacing: 2px;
}
.level-description {
color: #888;
font-size: 12px;
margin-bottom: 8px;
line-height: 1.4;
}
.level-status {
color: #00e599;
font-size: 11px;
font-weight: 600;
text-align: right;
}
.level-card.locked .level-status {
color: #ff8833;
}
/* Puzzle Content */
#puzzle-content {
padding: 16px;
overflow-y: auto;
flex: 1;
}
.puzzle-description {
color: #aaa;
font-size: 13px;
margin-bottom: 16px;
line-height: 1.5;
}
.truth-table-section h3,
.available-gates-section h3 {
color: #ff44aa;
font-size: 13px;
margin: 12px 0 8px 0;
font-weight: 600;
}
/* Truth Table */
.truth-table {
display: grid;
gap: 1px;
margin-bottom: 16px;
background: #0a0a0f;
padding: 8px;
border-radius: 6px;
}
.truth-table-row {
display: grid;
grid-auto-flow: column;
gap: 1px;
}
.truth-table-row.header {
background: #1a1a2e;
margin-bottom: 4px;
}
.truth-cell {
padding: 6px 8px;
font-size: 11px;
font-weight: 600;
background: #0e0e18;
text-align: center;
border-radius: 4px;
min-width: 30px;
}
.truth-table-row.header .truth-cell {
background: #1a1a2e;
color: #00e599;
}
.truth-cell.input-cell {
color: #3388ff;
}
.truth-cell.output-cell {
color: #ff8833;
}
/* Available Gates */
.available-gates-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 16px;
}
.available-gate-btn {
padding: 6px 10px;
background: #1a1a2e;
border: 1px solid #2a2a3a;
border-radius: 6px;
color: #aaa;
cursor: pointer;
font-size: 11px;
font-weight: 600;
transition: all 0.15s;
white-space: nowrap;
}
.available-gate-btn:hover {
border-color: #00e599;
color: #fff;
background: #1a1a3a;
}
.available-gate-btn:active {
background: #00e59922;
}
/* Puzzle Actions */
.puzzle-actions {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid #2a2a3a;
}
.action-btn.verify-btn {
background: #00e599;
border: none;
color: #000;
font-weight: 600;
padding: 8px 12px;
border-radius: 6px;
cursor: pointer;
transition: all 0.15s;
}
.action-btn.verify-btn:hover {
background: #00ff99;
box-shadow: 0 0 10px #00e59944;
}
.action-btn.hint-btn,
.action-btn.reset-btn {
background: transparent;
border: 1px solid #2a2a3a;
color: #888;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 12px;
transition: all 0.15s;
}
.action-btn.hint-btn:hover {
border-color: #ff44aa;
color: #ff44aa;
}
.action-btn.reset-btn:hover {
border-color: #ff8833;
color: #ff8833;
}
/* Verification Result */
.verification-result {
margin-top: 16px;
padding: 12px;
border-radius: 6px;
font-size: 12px;
}
.verification-result.success {
background: #00e59922;
border: 1px solid #00e599;
color: #00e599;
}
.verification-result.failure {
background: #ff444422;
border: 1px solid #ff4444;
color: #ff8888;
}
.result-message {
font-weight: 600;
margin-bottom: 8px;
}
.verification-result.success .result-message {
color: #00ff99;
}
.verification-result.failure .result-message {
color: #ff6666;
}
.failed-tests {
margin-top: 8px;
font-size: 11px;
max-height: 120px;
overflow-y: auto;
}
.failed-test {
margin-bottom: 6px;
padding: 6px;
background: rgba(0,0,0,0.3);
border-radius: 4px;
font-family: monospace;
color: #ccc;
}
#next-level-btn {
background: #00e599;
border: none;
color: #000;
font-weight: 600;
padding: 8px 12px;
border-radius: 6px;
cursor: pointer;
margin-top: 8px;
transition: all 0.15s;
}
#next-level-btn:hover {
background: #00ff99;
box-shadow: 0 0 10px #00e59944;
}