
/* ── Container — wraps canvas + overlay ──────────────────────────── */
#container {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 12px;
    /* Shadow lives here — overflow:hidden on a child would clip it */
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.2),
        0 0 50px rgba(99, 102, 241, 0.18),
        0 24px 64px rgba(0, 0, 0, 0.6);
    /* HTMLMenu will set width/height to match canvas via coverCanvas=true */
    margin: 20px auto;
}

/* ── Panel — absolute overlay on top of the canvas ───────────────── */
#rumblePanel {
    position: absolute;
    top: 0;
    left: 0;
    /* HTMLMenu sets width/height via coverCanvas=true */
    background: transparent;
    padding: 14px 20px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #e2e8f0;
    text-align: left;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ── Status bar ───────────────────────────────────────────────────── */
#statusBar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #94a3b8;
    background: rgba(17, 24, 39, 0.72);
    border-radius: 8px;
    padding: 6px 12px;
    backdrop-filter: blur(4px);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f87171;
    box-shadow: 0 0 6px #f87171;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.dot.connected {
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}

/* ── Section labels ───────────────────────────────────────────────── */
.section-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* ── Preset grid ──────────────────────────────────────────────────── */
#presetGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.preset-btn {
    background: rgba(31, 41, 55, 0.80);
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    display: grid;
    grid-template-areas:
        "key  params"
        "name name"
        "hint hint";
    grid-template-columns: auto 1fr;
    row-gap: 1px;
    backdrop-filter: blur(4px);
}

/* Coloured left-edge accent bar */
.preset-btn::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent);
    border-radius: 10px 0 0 10px;
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.preset-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.preset-btn.active {
    background: var(--accent);
}

.preset-tap    { --accent: #4ade80; }
.preset-impact { --accent: #f87171; }
.preset-engine { --accent: #fbbf24; }
.preset-buzz   { --accent: #c084fc; }

.key-label {
    grid-area: key;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Consolas', monospace;
}

.preset-params {
    grid-area: params;
    font-size: 11px;
    color: #64748b;
    text-align: right;
    font-family: 'Consolas', monospace;
    align-self: center;
}

.preset-name {
    grid-area: name;
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin-top: 5px;
}

.preset-hint {
    grid-area: hint;
    font-size: 12px;
    color: #64748b;
}

/* Flip all text dark when the card is active (flashed) */
.preset-btn.active .key-label,
.preset-btn.active .preset-params,
.preset-btn.active .preset-name,
.preset-btn.active .preset-hint {
    color: #111827;
}

/* ── Custom section ───────────────────────────────────────────────── */
#customSection {
    background: rgba(17, 24, 39, 0.72);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    backdrop-filter: blur(4px);
}

.motor-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.motor-label {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    width: 142px;
    flex-shrink: 0;
    font-family: 'Consolas', monospace;
}

.bar-bg {
    flex: 1;
    height: 22px;
    background: rgba(31, 41, 55, 0.75);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    width: 0%;
    transition: width 0.05s linear;
}

.bar-strong { background: #fbbf24; }
.bar-weak   { background: #c084fc; }

.motor-value {
    font-size: 12px;
    color: #94a3b8;
    font-family: 'Consolas', monospace;
    width: 46px;
    text-align: right;
}

#customFooter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

#fireHint {
    font-size: 13px;
    color: #6366f1;
}

#fireBtn {
    background: #1e1b4b;
    border: 1px solid #4338ca;
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 18px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

#fireBtn:hover {
    background: #312e81;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

#fireBtn:active {
    background: #1e1b4b;
    box-shadow: none;
}

/* ── Divider ──────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: rgba(31, 41, 55, 0.6);
    margin: 10px 0;
}

.wave-strip {
    flex-grow: 1;
}

/* Push the divider (and everything below it) to the bottom of the
   usable panel area, leaving a transparent wave strip below. */
#rumblePanel > .divider {
    margin-top: auto;
}

/* ── Last call section ────────────────────────────────────────────── */
#lastCallArea {
    background: rgba(17, 24, 39, 0.72);
    border-radius: 10px;
    padding: 10px 12px;
    backdrop-filter: blur(4px);
}
#lastCallAnnotation {
    font-size: 11px;
    font-family: 'Consolas', monospace;
    color: #334155;
    margin-bottom: 6px;
}

#lastCallSnippet {
    font-size: 15px;
    font-weight: 700;
    font-family: 'Consolas', monospace;
    color: #6366f1;
    min-height: 22px;
}

#lastCallSnippet.placeholder {
    font-weight: 400;
    font-size: 14px;
    color: #334155;
}

/* ── Title Rumble Animation ───────────────────────────────────────── */
@keyframes title-rumble {
    0%, 85%, 100% { transform: translate(0, 0) rotate(0deg); }
    87%, 91%, 95%, 99% { transform: translate(-2px, 1px) rotate(-1deg); }
    89%, 93%, 97% { transform: translate(2px, -1px) rotate(1deg); }
}

header h1 > .rumble {
    display: inline-block;  /* required: transform has no effect on inline elements */
    background: linear-gradient(130deg, #7470da 0%, #bc9a79 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: title-rumble 2s infinite;
}
