* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#hud {
    display: flex;
    justify-content: space-around;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid #333;
    position: relative;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
}

.stat .label {
    color: #888;
    font-size: 9px;
    margin-bottom: 2px;
}

.stat .value {
    color: #0f0;
    font-weight: bold;
}

.help-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.help-btn:active {
    background: #444;
    transform: translateY(-50%) scale(0.95);
}

#circuit-canvas {
    flex: 1;
    background: #111;
    cursor: crosshair;
}

#toolbox {
    display: flex;
    justify-content: space-around;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid #333;
    gap: 4px;
}

.tool-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
}

.tool-btn:active {
    background: #444;
    transform: scale(0.95);
}

.tool-btn.selected {
    background: #0a4;
    border-color: #0f0;
}

.tool-btn .icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.tool-btn .name {
    font-size: 9px;
    text-align: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    overflow-y: auto;
}

.modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    margin: auto;
}

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

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:active {
    background: #333;
}

.modal-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body section {
    margin-bottom: 20px;
}

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

.modal-body h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #0f0;
}

.modal-body p {
    font-size: 12px;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 8px;
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
}

.modal-body li {
    font-size: 12px;
    line-height: 1.8;
    color: #ccc;
    padding-left: 16px;
    position: relative;
}

.modal-body li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #0f0;
}

.modal-body strong {
    color: #fff;
}

