* { margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
body { background: #fff; }
canvas { display: block; background: transparent; }
#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
}
#bugSelect {
    padding: 8px 70px 8px 16px;
    font-size: 48px;
    font-family: inherit;
    border-radius: 6px;
    border: 2px solid #333;
    background-color: #fff;
    cursor: pointer;
    text-align: left;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 7'><path d='M1 1l5 5 5-5' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 44px 26px;
}
#bugGridOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
#bugGridOverlay.hidden { display: none; }
#bugGrid {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.bug-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, transform 0.15s;
}
.bug-card:hover { border-color: #333; transform: translateY(-2px); }
.bug-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}
.bug-card-name {
    font-size: 22px;
    font-weight: 500;
    text-align: center;
    color: #222;
}
.bug-card-placeholder {
    border-style: dashed;
    border-color: #aaa;
    color: #888;
    cursor: not-allowed;
    opacity: 0.7;
}
.bug-card-placeholder:hover { border-color: #aaa; transform: none; }
.bug-card-plus {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 96px;
    color: #bbb;
    font-weight: 200;
    line-height: 1;
}
.bug-card-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    font-size: 15px;
    color: #555;
    line-height: 1.3;
}
#spawnBtn {
    padding: 8px 24px;
    font-size: 48px;
    font-family: inherit;
    border-radius: 6px;
    border: 2px solid #333;
    background: #555;
    color: #fff;
    cursor: pointer;
}
#spawnBtn:hover { background: #444; }
#spawnBtn:active { background: #333; }
#resetBtn {
    padding: 8px 24px;
    font-size: 48px;
    font-family: inherit;
    border-radius: 6px;
    border: 2px solid #333;
    background: #fff;
    color: #000;
    cursor: pointer;
}
#resetBtn:hover { background: #f0f0f0; }
#resetBtn:active { background: #e0e0e0; }
#bugCount {
    font-size: 48px;
    font-family: inherit;
    color: #000;
    padding: 8px 24px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 6px;
}
#soundToggle {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    border: 2px solid #333;
    background: #fff;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#soundToggle:hover { background: #f0f0f0; }
#soundToggle .icon-sound-on { display: none; }
#soundToggle[aria-pressed="true"] .icon-sound-on { display: block; }
#soundToggle[aria-pressed="true"] .icon-sound-off { display: none; }
#soundToggle[aria-pressed="true"] { background: #d6f0c4; }
