/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-circuit-builder
 */
.cb-stage { font-family: 'Nunito', system-ui, sans-serif; }

.cb-prompt {
    font-weight: 700; font-size: 16px; color: #163a5f;
    background: #eef6ff; border: 1px solid #c7dcf2; border-radius: 10px;
    padding: 10px 14px; margin: 4px 0 14px;
}

/* ---- Breadboard grid ---------------------------------------------------- */
.cb-grid {
    width: min(460px, 100%);
    margin: 4px auto 14px;
    display: grid;
    background: #f3f6fb;
    border: 2px solid #d7e0ea;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 1px 4px rgba(15, 42, 80, .08);
}
.cb-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    touch-action: none;
    background:
        radial-gradient(circle at 50% 50%, #c3cdda 2px, transparent 2.6px);
    transition: background-color .12s ease, box-shadow .12s ease;
}
.cb-cell.cb-cell-over { box-shadow: inset 0 0 0 3px rgba(21, 101, 192, .45); background-color: rgba(21, 101, 192, .08); }

.cb-tile { position: absolute; inset: 0; }
.cb-tilesvg { width: 100%; height: 100%; display: block; overflow: visible; }

/* wires */
.cb-wire { stroke: #4b5563; stroke-width: 6; stroke-linecap: round; fill: none; }
.cb-tile.cb-energized .cb-wire {
    stroke: #f59e0b; stroke-dasharray: 7 5;
    filter: drop-shadow(0 0 2px rgba(252, 211, 77, .95));
    animation: cb-flow .7s linear infinite;
}
@keyframes cb-flow { to { stroke-dashoffset: -12; } }

/* battery */
.cb-batt { fill: #2bb673; stroke: #1d8a56; stroke-width: 2; }
.cb-batt-nub { fill: #1d8a56; }
.cb-pol { font: 800 13px 'Nunito', sans-serif; fill: #1f2a37; }

/* bulb */
.cb-bulb-glass { fill: #e2e8f0; stroke: #b8c2cf; stroke-width: 2; transition: fill .15s ease; }
.cb-filament { stroke: #b8c2cf; stroke-width: 2; }
.cb-bulb-base { fill: #9aa3ad; }
.cb-tile.cb-on .cb-bulb-glass { fill: #ffe27a; stroke: #f5c945; filter: drop-shadow(0 0 7px rgba(250, 204, 21, .9)); animation: cb-flicker 2.4s ease-in-out infinite; }
.cb-tile.cb-on .cb-filament { stroke: #d97706; }
@keyframes cb-flicker { 0%, 100% { opacity: 1; } 50% { opacity: .88; } }

/* fan */
.cb-fan-housing { fill: #dbe2ea; stroke: #94a3b8; stroke-width: 2; }
.cb-blade { fill: #93a0b0; }
.cb-fan-hub { fill: #5b6675; }
.cb-blades { transform-box: fill-box; transform-origin: center; }
.cb-tile.cb-on .cb-blades { animation: cb-spin .5s linear infinite; }
.cb-tile.cb-on .cb-blade { fill: #5b9bd5; }
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* motor */
.cb-motor-body { fill: #c3ccd8; stroke: #8b97a6; stroke-width: 2; }
.cb-motor-shaft { stroke: #5b6675; stroke-width: 3; stroke-linecap: round; }
.cb-motor-m { font: 800 9px 'Nunito', sans-serif; fill: #475569; text-anchor: middle; }

/* LED */
.cb-led-dome { fill: #e2e8f0; stroke: #b8c2cf; stroke-width: 2; transition: fill .15s ease; }
.cb-led-base { fill: #9aa3ad; }
.cb-led-rays { stroke: #ef4444; stroke-width: 2.5; stroke-linecap: round; opacity: 0; }
.cb-tile.cb-on .cb-led-dome { fill: #ef4444; stroke: #b91c1c; filter: drop-shadow(0 0 7px rgba(239, 68, 68, .85)); }
.cb-tile.cb-on .cb-led-rays { opacity: 1; animation: cb-flicker 1.8s ease-in-out infinite; }

/* bell */
.cb-bell-body { fill: #f4c430; stroke: #c79612; stroke-width: 2; }
.cb-bell-base { fill: #c79612; }
.cb-bell-clap { fill: #8a6a12; }

/* push button */
.cb-btn-base { fill: #94a3b8; stroke: #64748b; stroke-width: 1.5; }
.cb-btn-cap { fill: #ef4444; stroke: #b91c1c; stroke-width: 1.5; transition: none; }
.cb-tile.cb-energized .cb-btn-cap { fill: #f87171; }

/* buzzer */
.cb-buzz-body { fill: #334155; stroke: #1f2937; stroke-width: 2; }
.cb-buzz-dot { fill: #94a3b8; }
.cb-sound { stroke: #f59e0b; stroke-width: 2.5; fill: none; opacity: 0; }
.cb-tile.cb-on .cb-sound { opacity: 1; animation: cb-sound 1s ease-in-out infinite; }
@keyframes cb-sound { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* switch */
.cb-lever { stroke: #1f2a37; stroke-width: 6; stroke-linecap: round; transition: all .15s ease; }
.cb-term { fill: #4b5563; }
.cb-tile.cb-energized .cb-lever { stroke: #b45309; }

/* test material */
.cb-test { fill: #fef3c7; stroke: #d97706; stroke-width: 2; }

/* remove button — subtle by default, only reddens when you hover it directly */
.cb-remove {
    position: absolute; top: 2px; right: 2px; z-index: 4;
    width: 15px; height: 15px; padding: 0; line-height: 1;
    border: none; border-radius: 50%;
    background: rgba(100, 116, 139, .16); color: #94a3b8; font-size: 8px;
    cursor: pointer; opacity: .4;
    transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.cb-cell:hover .cb-remove { opacity: .8; }
.cb-remove:hover { background: rgba(220, 38, 38, .92); color: #fff; opacity: 1; }

/* ---- Result ------------------------------------------------------------- */
.cb-result { text-align: center; font-weight: 800; min-height: 24px; margin: 6px 0 12px; }
.cb-result.cb-on { color: #15803d; }
.cb-result.cb-off { color: #64748b; }

/* ---- Palette ------------------------------------------------------------ */
.cb-palette-wrap { margin-bottom: 8px; }
.cb-tray-label {
    font-weight: 800; font-size: 12px; color: #64748b; margin: 4px 0 8px;
    text-transform: uppercase; letter-spacing: .08em;
}
.cb-palette {
    display: flex; flex-wrap: wrap; gap: 10px; padding: 12px;
    background: linear-gradient(180deg, #f1f5f9, #e7eef6);
    border: 1px dashed #cbd5e1; border-radius: 14px;
}
.cb-pal-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 74px; padding: 8px 6px;
    background: #ffffff; border: 1.5px solid #cbd5e1; border-radius: 12px;
    cursor: grab; user-select: none; touch-action: none;
    box-shadow: 0 2px 6px rgba(15, 42, 80, .12);
    transition: transform .12s ease, box-shadow .12s ease;
}
.cb-pal-item:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -6px rgba(15, 42, 80, .35); }
.cb-pal-item:active { cursor: grabbing; }
.cb-pal-item.cb-dragging { opacity: .35; }
.cb-pal-item .cb-tile { position: static; width: 48px; height: 48px; }
.cb-pal-label { font-weight: 800; font-size: 11px; color: #475569; text-align: center; }

.cb-hint { font-size: 12px; color: #64748b; text-align: center; margin: 2px 0 8px; }

/* ---- Check -------------------------------------------------------------- */
.cb-target-panel { display: flex; align-items: center; gap: 14px; justify-content: center; }

/* ---- Display mode ------------------------------------------------------- */
.activity-container.display-mode .cb-cell { background: none; }
