:root {
    --bg-color: #020617;
    --panel-bg: #020617;
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.15);
    --accent-strong: rgba(34, 197, 94, 0.7);
    --danger: #f97373;
    --muted: #9ca3af;
    --border: #1f2937;
}

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

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 50%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.2), transparent 55%),
        #020617;
    background-attachment: fixed;
    color: #f9fafb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 16px;
}

.app {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    width: 100%;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 55%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.18), transparent 60%),
        var(--panel-bg);
    border-radius: 16px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.85),
        0 0 0 1px rgba(148, 163, 184, 0.3);
    position: relative;
    overflow: hidden;
}

.app::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(130deg, rgba(34,197,94,0.08), transparent 60%),
        radial-gradient(circle at 20% 10%, rgba(56,189,248,0.2), transparent 50%);
    opacity: 0.5;
    mix-blend-mode: soft-light;
}

.rows-container {
    position: relative;
    z-index: 1;
}

/* Header */

.header {
    padding: 12px 18px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.title-block h1 {
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f9fafb;
}

.title-block .subtitle {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 2px;
    letter-spacing: 0.08em;
}

/* Status chip */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid rgba(34,197,94,0.6);
    padding: 4px 10px;
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.25), transparent 60%),
        rgba(15,23,42,0.9);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #bbf7d0;
    box-shadow:
        0 0 0 1px rgba(30,64,175,0.3),
        0 0 16px rgba(34,197,94,0.6);
}

.chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow:
        0 0 0 3px rgba(34,197,94,0.5),
        0 0 14px rgba(22,163,74,0.9);
}

/* Layout */

.row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.row:last-child {
    margin-bottom: 0;
}

/* columns flex so cards can stretch */
.col-left,
.col-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Make left + right cards in first row equal height */
.row-top {
    align-items: stretch;
}

/* Generic card */

.card {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: radial-gradient(circle at top left, rgba(15,23,42,0.96), var(--panel-bg));
    padding: 10px 12px 11px 12px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(15,23,42,0.7), transparent 60%);
    mix-blend-mode: soft-light;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 6px;
}

.card-title {
    font-size: 0.86rem;
    letter-spacing: 0.08em;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title .icon {
    font-size: 1.05rem;
}

.card-subtitle {
    font-size: 0.76rem;
    color: #9ca3af;
    margin-top: 3px;
}

/* Status & badges */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #f9fafb;
    background: rgba(15, 23, 42, 0.9);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #f97373;
    box-shadow:
        0 0 0 2px rgba(248, 113, 113, 0.5),
        0 0 10px rgba(248, 113, 113, 0.7);
}

.status-pill.connected {
    border-color: rgba(34,197,94,0.9);
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.3), rgba(15,23,42,0.9));
}

.status-pill.connected .status-dot {
    background: #22c55e;
    box-shadow:
        0 0 0 2px rgba(34,197,94,0.55),
        0 0 10px rgba(22,163,74,0.9);
}

/* Generic badge */

.badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    color: #9ca3af;
}

.badge strong {
    color: #e5e7eb;
}

/* Connection layout */

.connection-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 10px;
}

@media (max-width: 900px) {
    .connection-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.connection-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 6px;
}

.button-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 8px;
}

/* Buttons */

button {
    border: none;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    border: 1px solid rgba(148,163,184,0.5);
    transition: all 0.15s ease;
}

button.primary {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    color: #052e16;
    border-color: rgba(34,197,94,0.9);
    box-shadow:
        0 12px 30px rgba(22,163,74,0.5),
        0 0 0 1px rgba(15,23,42,0.95);
}

button.secondary {
    background: rgba(15,23,42,0.9);
    border-color: rgba(148,163,184,0.6);
}

button.small {
    padding: 5px 9px;
    font-size: 0.72rem;
}

button .btn-icon {
    font-size: 1rem;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 12px 28px rgba(15,23,42,0.95),
        0 0 0 1px rgba(59,130,246,0.5);
}

button:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
}

/* Hint text */

.hint {
    font-size: 0.74rem;
    color: #9ca3af;
    margin-top: 3px;
}
.hint-title {
    font-weight: 500;
    margin-bottom: 2px;
}
.hint ol {
    margin: 0;
    padding-left: 16px;
}
.hint li {
    margin-bottom: 2px;
}

/* Mode pills */

.pill-group {
    display: inline-flex;
    gap: 6px;
    margin: 4px 0 8px;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(148,163,184,0.6);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    cursor: pointer;
}
.pill.big {
    padding: 5px 12px;
    font-size: 0.78rem;
}
.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(148,163,184,0.9);
}
.pill.active {
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.4), rgba(15,23,42,0.9));
    border-color: rgba(34,197,94,0.95);
    color: #bbf7d0;
    box-shadow:
        0 0 0 1px rgba(22,163,74,0.6),
        0 0 16px rgba(34,197,94,0.7);
}
.pill.active .pill-dot {
    background: #22c55e;
    box-shadow:
        0 0 0 2px rgba(74,222,128,0.6),
        0 0 10px rgba(22,163,74,0.9);
}

/* Device row */

.device-row {
    font-size: 0.74rem;
    color: #9ca3af;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.device-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.device-value {
    color: #e5e7eb;
    font-weight: 500;
}

/* Message log */

.log-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.log {
    flex: 1 1 auto;
    padding: 8px 10px;
    overflow-y: auto;
    min-height: 0;
    max-height: 260px; /* scrollbar appears when content taller than this */
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.78rem;
    line-height: 1.25;
    border-radius: 10px;
    border: 1px solid rgba(31,41,55,0.95);
    background: rgba(15,23,42,0.98);
}
.log-line {
    margin-bottom: 2px;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-line.info    { color: #9ca3af; }
.log-line.success { color: #bbf7d0; }
.log-line.error   { color: #f97373; }
.log-line.tx      { color: #a5b4fc; }
.log-line.rx      { color: #7dd3fc; }

.log-footer {
    padding-top: 5px;
    font-size: 0.7rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mode selector (tabs) */

.mode-selector-container {
    padding: 12px 18px 0;
}
.mode-selector {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 4px;
    margin-bottom: 8px;
}
.mode-btn {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.mode-btn .mode-icon {
    font-size: 1.1rem;
}
.mode-btn.active {
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.4), rgba(15,23,42,0.88));
    color: #bbf7d0;
    box-shadow:
        0 0 0 1px rgba(22,163,74,0.7),
        0 0 18px rgba(34,197,94,0.6);
}

/* Tab pages */

.tab-pages {
    padding: 0 18px 16px;
}
.tab-page { display: none; }
.tab-page.active { display: block; }

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Control sections */

.control-section {
    border-radius: 10px;
    border: 1px solid rgba(31,41,55,0.9);
    padding: 8px 10px;
    background: rgba(15,23,42,0.95);
}
.section-header { margin-bottom: 6px; }
.section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.section-icon { font-size: 1rem; }
.section-subtitle {
    font-size: 0.74rem;
    color: #9ca3af;
    margin-top: 2px;
}
.form-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* Inputs */

input[type="text"],
textarea {
    border-radius: 10px;
    border: 1px solid rgba(31,41,55,0.9);
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: inherit;
    flex: 1;
}
textarea {
    width: 100%;
    max-width: 100%;
    display: block;
}

input::placeholder,
textarea::placeholder {
    color: #6b7280;
}
input:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: rgba(59,130,246,0.9);
    box-shadow:
        0 0 0 1px rgba(59,130,246,0.7),
        0 0 14px rgba(59,130,246,0.5);
}

/* LED matrix */

.microbit-matrix-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.microbit-outline {
    border-radius: 14px;
    border: 1px solid rgba(31,41,55,0.95);
    padding: 8px 10px 10px;
    background:
        radial-gradient(circle at top left, rgba(30,64,175,0.2), transparent 60%),
        rgba(15,23,42,1);
}
.microbit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}
.microbit-chip {
    width: 34px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #020617, #111827);
    border: 1px solid rgba(148,163,184,0.5);
}
.microbit-ears {
    display: flex;
    gap: 4px;
}
.microbit-ear {
    width: 6px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(145deg, #4b5563, #9ca3af);
    border: 1px solid rgba(209,213,219,0.9);
}
.led-matrix {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: radial-gradient(circle at top left, #020617, #020617);
}
.led-cell {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(31,41,55,1);
    background: radial-gradient(circle at 30% 30%, #020617, #020617);
    box-shadow:
        0 2px 4px rgba(15,23,42,0.9),
        inset 0 0 0 1px rgba(15,23,42,1);
    cursor: pointer;
    transition: all 0.12s ease;
}
.led-cell.on {
    background: radial-gradient(circle at 30% 30%, #fef9c3, #facc15);
    border-color: rgba(250,204,21,1);
    box-shadow:
        0 0 8px rgba(250,204,21,0.9),
        0 0 16px rgba(250,204,21,0.8),
        0 2px 6px rgba(15,23,42,0.9);
}
.drawing-mode-hint {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 4px;
}
.matrix-controls { flex: 1; min-width: 0; }

/* Chip buttons */

.chip-btn {
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    padding: 5px 10px;
    font-size: 0.74rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.chip-btn:hover {
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.3), rgba(15,23,42,0.95));
    border-color: rgba(34,197,94,0.9);
}

/* --- SENSES GRID IMPROVED LAYOUT --- */

/* Full-width responsive grid */
.sensor-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    width: 100%;
    margin-top: 10px;
}

/* Each sensor block = container for value + chart */
.sensor-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(15,23,42,0.94);
    border: 1px solid rgba(31,41,55,0.85);
    border-radius: 10px;
    padding: 10px;
}

/* Sensor card */
.sensor-card {
    border-radius: 8px;
    border: 1px solid rgba(51,65,85,0.7);
    padding: 6px 8px;
    background:
        radial-gradient(circle at top left, rgba(30,64,175,0.2), transparent 60%),
        rgba(15,23,42,0.98);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sensor-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 2px;
}
.sensor-value {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.sensor-unit {
    font-size: 0.7rem;
    color: #6b7280;
}
.sensor-hint {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* Charts */

.chart-container {
    border-radius: 8px;
    border: 1px solid rgba(31,41,55,0.95);
    padding: 6px 8px;
    background: rgba(15,23,42,0.98);
}

.chart-container.small {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-container.small canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}
.chart-placeholder-text {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Beginner / expert visibility */

.beginner-only {
    display: block;
}
.app.beginner-mode .expert-only {
    display: none !important;
}
.app:not(.beginner-mode) .beginner-only {
    display: none !important;
}

/* Responsive tweaks */

@media (max-width: 700px) {
    body {
        padding: 8px;
    }
    .app {
        border-radius: 12px;
    }
    .header {
        padding: 10px 12px 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .tab-pages {
        padding: 0 12px 12px;
    }
}
/* ================================
   Kid-friendly visual upgrade 💫
   (CSS-only: no HTML/JS changes)
   ================================ */

/* Fun animations */
@keyframes float-soft {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes pulse-soft {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

@keyframes led-glow {
    0%   { box-shadow: 0 0 6px rgba(250,204,21,0.7); }
    100% { box-shadow: 0 0 16px rgba(250,204,21,1); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: translateY(-1px) scale(0.9); }
    40%      { opacity: 1; transform: translateY(0) scale(1); }
    60%      { opacity: 0; transform: translateY(-2px) scale(0.8); }
}

/* Title: more colorful + “logo” feeling */
.title-block h1 {
    font-size: 1.35rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: linear-gradient(120deg, #f97316, #22c55e, #38bdf8);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 18px rgba(56,189,248,0.4);
    animation: float-soft 4s ease-in-out infinite;
}

.title-block .subtitle {
    font-size: 0.82rem;
    color: #e5e7eb;
}

/* Status chip: floaty + twinkling sparkles */
.chip {
    position: relative;
    animation: float-soft 5s ease-in-out infinite;
}

.chip::after {
    content: "✨";
    position: absolute;
    right: -4px;
    top: -6px;
    font-size: 0.8rem;
    opacity: 0;
    animation: twinkle 2.8s ease-in-out infinite;
}

/* Primary action button: soft pulse to invite clicks */
button.primary {
    animation: pulse-soft 2.8s ease-out infinite;
}

/* All buttons a bit more playful on hover (but still clean) */
button:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.03);
    filter: brightness(1.05);
}

button:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

/* Mode tabs: clearer “selected” feeling */
.mode-btn {
    font-size: 0.8rem;
}

.mode-btn.active {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
        0 0 0 1px rgba(34,197,94,0.7),
        0 0 18px rgba(34,197,94,0.7);
}

/* Cards: slightly brighter and more “card game” feel */
.card {
    border-radius: 14px;
}

.card:hover {
    border-color: rgba(148,163,184,0.8);
    box-shadow:
        0 10px 30px rgba(15,23,42,0.9),
        0 0 18px rgba(34,197,94,0.25);
    transform: translateY(-1px);
    transition: all 0.18s ease;
}

/* Sensor cards: more colorful and fun */
.sensor-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sensor-card::before {
    content: "";
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.18), transparent 60%),
        radial-gradient(circle at bottom right, rgba(59,130,246,0.18), transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sensor-card:hover {
    transform: translateY(-1px);
    border-color: rgba(96,165,250,0.9);
    box-shadow: 0 8px 20px rgba(15,23,42,0.9);
}

.sensor-card:hover::before {
    opacity: 1;
}

.sensor-label {
    font-weight: 600;
    color: #e5e7eb;
}

.sensor-hint {
    font-size: 0.76rem;
    color: #a5b4fc;
}

/* LED drawing board: extra “glow toy” effect */
.led-cell {
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.led-cell:hover {
    transform: translateY(-1px) scale(1.08);
}

.led-cell.on {
    animation: led-glow 1.4s ease-in-out infinite alternate;
}

/* Small tweak to make the whole app feel softer */
.app {
    border-radius: 18px;
}
/* ============================================
   SUPER FUNNY MODE 🤪 (CSS only)
   - cartoon wobble
   - comic outlines
   - gentle rainbow colors
   - wiggles, bounces, sparkles
   ============================================ */

/* Funny animations */
@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes rainbowText {
  0% { color: #f97316; }
  25% { color: #eab308; }
  50% { color: #22c55e; }
  75% { color: #3b82f6; }
  100% { color: #a855f7; }
}

@keyframes sparkle {
  0% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(20deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
}

/* Funny header title (rainbow + wobble) */
.title-block h1 {
    animation: rainbowText 3s infinite linear,
               wobble 4s infinite ease-in-out;
    text-shadow: 0 0 12px rgba(255,255,255,0.4);
    font-weight: 900;
}

/* Subtitle more playful */
.title-block .subtitle {
    color: #fde68a !important;
    animation: wobble 6s infinite ease-in-out;
}

/* Chip = sticker badge */
.chip {
    border-radius: 18px;
    border: 2px dashed #22c55e;
    background: rgba(34,197,94,0.15);
    position: relative;
    animation: bounce 3s infinite ease-in-out;
}

.chip::after {
    content: "⭐";
    position: absolute;
    right: -10px;
    top: -10px;
    font-size: 1.2rem;
    animation: sparkle 2.5s infinite ease-in-out;
}

/* Buttons: cartoon bubbles */
button {
    border-radius: 12px !important;
    font-weight: 700;
    border: 2px solid #fff !important;
    background: linear-gradient(135deg, #f9a8d4, #93c5fd);
    color: #111 !important;
    text-shadow: none !important;
    transition: 0.15s ease;
}

button:hover:not(:disabled) {
    transform: scale(1.12) rotate(2deg);
    filter: brightness(1.15);
}

button:active:not(:disabled) {
    transform: scale(0.94);
}

/* Primary button = SUPER bubble */
button.primary {
    box-shadow: 0 0 14px 4px rgba(255,255,255,0.4);
    animation: bounce 2.5s infinite ease-in-out;
}

/* Tabs = bubble gum */
.mode-btn.active {
    background: linear-gradient(135deg, #34d399, #a7f3d0);
    transform: scale(1.15);
    border: 2px solid #6ee7b7;
    box-shadow: 0 0 12px rgba(34,197,94,0.8);
}

/* Cards = cartoon rectangles */
.card {
    border-radius: 16px;
    border: 3px solid #0f172a !important;
    background: #1e293b !important;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}

/* Random confetti in corners */
.card::before {
    content: "🎈";
    position: absolute;
    left: 6px;
    top: 6px;
    opacity: 0.7;
    animation: wobble 5s infinite ease-in-out;
}

.card::after {
    content: "🎉";
    position: absolute;
    right: 6px;
    bottom: 6px;
    opacity: 0.7;
    animation: wobble 4s infinite ease-in-out reverse;
}

/* Sensor cards: colorful gradients */
.sensor-card {
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(16,185,129,0.25));
    border: 2px solid #334155 !important;
    transition: 0.15s ease;
}

.sensor-card:hover {
    transform: scale(1.05) rotate(-1deg);
    border-color: #38bdf8 !important;
}

/* Sensor value BIG & FUN */
.sensor-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: #38bdf8;
    text-shadow: 0 0 8px rgba(59,130,246,0.6);
}

/* LED cells = glowing candies */
.led-cell {
    border-radius: 6px !important;
    transition: 0.12s ease;
}

.led-cell:hover {
    transform: scale(1.2);
}

.led-cell.on {
    background: #fde047 !important;
    box-shadow: 0 0 12px 4px rgba(250,204,21,0.9);
    animation: sparkle 1.2s infinite ease-in-out;
}

/* Sliders more colorful */
input[type="range"]::-webkit-slider-thumb {
    background: #f9a8d4 !important;
}

input[type="range"]::-webkit-slider-runnable-track {
    background: #93c5fd !important;
}

/* The whole app softer */
.app {
    border-radius: 22px;
}

button {
    color: #fff !important;
}

.servo-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.gauge-value {
    font-size: 0.9rem;
    margin-top: 4px;
    color: #e5e7eb;
}
/* ======================
   GamePad Button Styling
   ====================== */

.gp-btn {
    width: 110px;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 12px !important;
    padding: 8px 0;
}

/* Glow effect while keeping edges clean */
.gp-btn {
    box-shadow:
        0 0 10px rgba(34, 197, 94, 0.4),
        0 0 20px rgba(34, 197, 94, 0.2);
}

.gp-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}
/* ===========================
   GAMEPAD D-PAD LAYOUT
   =========================== */

.dpad-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.dpad-middle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* Center circle (non-interactive) */
.dpad-center {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(148,163,184,0.5);
    box-shadow:
        0 0 10px rgba(148,163,184,0.2),
        inset 0 0 6px rgba(148,163,184,0.3);
}

/* Buttons */
.dpad-btn {
    width: 60px;
    height: 48px;
    font-size: 1.25rem;
    text-align: center;
    justify-content: center;
    border-radius: 12px !important;
    font-weight: 700;
}

/* Fire button */
.fire-btn {
    margin-top: 4px;
    width: 110px;
    font-size: 1rem;
    padding: 10px 0;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #f87171, #fb923c) !important;
    color: #111 !important;
    box-shadow:
        0 0 10px rgba(252, 165, 165, 0.4),
        0 0 20px rgba(251, 146, 60, 0.4);
}

.fire-btn:hover {
    transform: scale(1.07);
}

/* Hover animations for D-Pad arrows */
.dpad-btn:hover {
    transform: scale(1.12);
    filter: brightness(1.1);
}
/* ==========================
   LED Drawing Board – groups
   ========================== */

.matrix-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.matrix-group {
    flex: 1 1 160px;
    border-radius: 10px;
    border: 1px solid rgba(31,41,55,0.8);
    background: rgba(15,23,42,0.9);
    padding: 6px 8px;
}

.matrix-group-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 4px;
}

.button-row.compact {
    gap: 6px;
    flex-wrap: wrap;
}

.button-row.compact .chip-btn.small {
    padding-inline: 8px;
    font-size: 0.72rem;
}

.title-block {
    display: flex;
    align-items: center; /* vertically center logo and text */
    gap: 12px;           /* space between logo and text */
}

.site-logo {
    width: 80px;   /* adjust size */
    height: auto;
	color: #ffffff; /* logo will take this color */
}

.animated-logo {
  width: 80px;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.animated-logo:hover {
  transform: rotate(15deg) scale(1.1);
  filter: drop-shadow(0 0 6px #ff6600);
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.animated-logo {
  width: 80px;
  animation: pulse 2s infinite;
}

/* Kids Mode Theme */
.app.kids-mode {
  --bg-color: #fff7ed;        /* soft cream background */
  --panel-bg: #fde68a;        /* pastel yellow panels */
  --accent: #fb923c;          /* cheerful orange */
  --accent-soft: rgba(251, 146, 60, 0.25);
  --accent-strong: rgba(251, 146, 60, 0.7);
  --danger: #f87171;          /* friendly red */
  --muted: #6b7280;           /* softer gray */
  --border: #fcd34d;          /* golden border */
  color: #3f3f46;             /* softer text color */
}

.app.kids-mode h1,
.app.kids-mode .card-title {
  color: #fb923c; /* warm orange titles */
}

.app.kids-mode button.primary {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #fff;
  border-color: #fb923c;
  box-shadow: 0 6px 18px rgba(251, 146, 60, 0.4);
}

/* Kids Mode – playful animations */
.app.kids-mode {
  animation: backgroundShift 12s infinite alternate ease-in-out;
}

/* Background gently shifts colors */
@keyframes backgroundShift {
  0%   { background-color: #fff7ed; }
  25%  { background-color: #fde68a; }
  50%  { background-color: #fbcfe8; }
  75%  { background-color: #93c5fd; }
  100% { background-color: #86efac; }
}

/* Buttons bounce like bubbles */
.app.kids-mode button {
  animation: bubbleBounce 3s infinite ease-in-out;
}

@keyframes bubbleBounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12) rotate(2deg); }
}

/* Titles rainbow shimmer */
.app.kids-mode h1 {
  animation: rainbowShimmer 5s infinite linear;
}

@keyframes rainbowShimmer {
  0%   { color: #f97316; }
  20%  { color: #facc15; }
  40%  { color: #22c55e; }
  60%  { color: #3b82f6; }
  80%  { color: #a855f7; }
  100% { color: #f97316; }
}

/* Chips sparkle */
.app.kids-mode .chip::after {
  content: "✨";
  position: absolute;
  right: -8px;
  top: -8px;
  font-size: 1rem;
  animation: sparklePop 2.5s infinite ease-in-out;
}

@keyframes sparklePop {
  0%   { opacity: 0; transform: scale(0.6) rotate(0deg); }
  50%  { opacity: 1; transform: scale(1.2) rotate(20deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
}

/* LED cells wiggle when on */
.app.kids-mode .led-cell.on {
  animation: candyGlow 1.5s infinite alternate ease-in-out;
}

@keyframes candyGlow {
  0%   { transform: scale(1); box-shadow: 0 0 8px #facc15; }
  100% { transform: scale(1.15); box-shadow: 0 0 16px #f97316; }
}

/* Bench tab custom style */
.tab-page[data-page="bench"] .card-title {
    color: #facc15; /* golden accent */
}

.tab-page[data-page="bench"] .section-title {
    color: #f97316; /* orange highlight */
}

.bench-response {
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid rgba(31,41,55,0.9);
  background: rgba(15,23,42,0.95);
  padding: 6px 10px;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: #e5e7eb;
}

/* =========================
   OTHERS TAB – compact grid
   ========================= */

.tab-page[data-page="others"] .tool-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Style the <details> containers */
.tab-page[data-page="others"] .tool-group {
    border-radius: 10px;
    border: 1px solid rgba(31,41,55,0.8);
    background: rgba(15,23,42,0.95);
    padding: 4px 6px 8px;
}

/* Make the summary look like a header row */
.tab-page[data-page="others"] .tool-group > summary {
    list-style: none;
    cursor: pointer;
    padding: 4px 2px 4px;
}

/* Hide default triangle */
.tab-page[data-page="others"] .tool-group > summary::-webkit-details-marker {
    display: none;
}

/* Add our own small indicator */
.tab-page[data-page="others"] .tool-group > summary::before {
    content: "▸";
    margin-right: 6px;
    font-size: 0.7rem;
    color: #9ca3af;
}
.tab-page[data-page="others"] .tool-group[open] > summary::before {
    content: "▾";
}

/* Turn controls-grid into a horizontal mini-card grid */
.tab-page[data-page="others"] .controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

/* Make each tool more compact */
.tab-page[data-page="others"] .control-section {
    padding: 6px 7px;
}

.tab-page[data-page="others"] .section-header {
    margin-bottom: 4px;
}

.tab-page[data-page="others"] .section-title {
    font-size: 0.74rem;
}

/* Slightly smaller form-row spacing in Others tab */
.tab-page[data-page="others"] .form-row {
    gap: 6px;
    margin-top: 3px;
}
/* ============================================
   OTHERS TAB — strict 1–2 items per row layout
   ============================================ */

.tab-page[data-page="others"] .controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 per row */
    gap: 8px;
}

/* On narrow screens → only 1 per row */
@media (max-width: 600px) {
    .tab-page[data-page="others"] .controls-grid {
        grid-template-columns: 1fr; /* 1 per row */
    }
}

/* Make cards compact */
.tab-page[data-page="others"] .control-section {
    padding: 8px 10px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
/* ====================================
   STRONGER CARD SEPARATION (bold look)
   ==================================== */

.tab-page[data-page="others"] .control-section {
    background: rgba(255,255,255,0.08); /* brighter block */
    border: 1.5px solid rgba(255,255,255,0.25); /* stronger border */
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0px 2px 6px rgba(0,0,0,0.7);
}

.tab-page[data-page="others"] .control-section:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.35);
    transform: translateY(-1px);
    transition: 0.15s ease;
}
/* ===========================================
   COLORED BORDER PER CATEGORY (clean + clear)
   =========================================== */

/* BASIC CONTROLS */
.tool-group:nth-child(1) .control-section {
    border-left: 4px solid #3b82f6; /* blue */
}

/* INDICATORS & OUTPUTS */
.tool-group:nth-child(2) .control-section {
    border-left: 4px solid #14b8a6; /* teal */
}

/* AUDIO, TIME & RANDOM */
.tool-group:nth-child(3) .control-section {
    border-left: 4px solid #a855f7; /* purple */
}

/* ADVANCED CONTROLS */
.tool-group:nth-child(4) .control-section {
    border-left: 4px solid #f59e0b; /* amber/orange */
}

/* SIMULATORS & HARDWARE */
.tool-group:nth-child(5) .control-section {
    border-left: 4px solid #ec4899; /* pink */
}
/* ============================================
   BIG / COLORFUL expand arrows for <details>
   ============================================ */

/* Make summary area larger + easier to click */
.tool-group > summary {
    padding: 10px 4px;              /* larger tap zone */
    font-size: 1rem;                /* slightly bigger text */
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Remove default marker */
.tool-group > summary::-webkit-details-marker {
    display: none;
}

/* Big arrow icon */
.tool-group > summary::before {
    content: "▸";                   /* closed arrow */
    font-size: 24px;                /* MUCH bigger arrow */
    font-weight: bold;
    margin-right: 10px;
    transition: transform 0.2s ease;
}

/* Rotate arrow when opened */
.tool-group[open] > summary::before {
    transform: rotate(90deg);
}

/* =============================
   Neon arrow color per category
   ============================= */

/* BASIC CONTROLS — neon blue */
.tool-group:nth-child(1) > summary::before {
    color: #00e5ff;
    text-shadow: 0 0 6px #00e5ff;
}

/* OUTPUTS — neon aqua */
.tool-group:nth-child(2) > summary::before {
    color: #00ffc8;
    text-shadow: 0 0 6px #00ffc8;
}

/* AUDIO/TIME — neon purple */
.tool-group:nth-child(3) > summary::before {
    color: #c77dff;
    text-shadow: 0 0 6px #c77dff;
}

/* ADVANCED — neon orange */
.tool-group:nth-child(4) > summary::before {
    color: #ff9d00;
    text-shadow: 0 0 6px #ff9d00;
}

/* SIMULATORS — neon pink */
.tool-group:nth-child(5) > summary::before {
    color: #ff00aa;
    text-shadow: 0 0 6px #ff00aa;
}
/* ==============================================
   NEON CIRCULAR EXPAND ICONS FOR <details> 
   ============================================== */

/* Bigger summary area */
.tool-group > summary {
    padding: 10px 6px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

/* Remove default triangle */
.tool-group > summary::-webkit-details-marker {
    display: none;
}

/* Create the circle */
.tool-group > summary::before {
    content: ""; /* content updated per category below */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: black;  /* arrow color */
    background: #fff; /* temporary, replaced below */
    box-shadow: 0 0 10px currentColor;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Rotate arrow when opened */
.tool-group[open] > summary::before {
    transform: rotate(90deg);
}

/* =============================
   Neon circle per category
   ============================= */

/* BASIC CONTROLS — Neon Blue */
.tool-group:nth-child(1) > summary::before {
    content: "▶";
    background: #00e5ff;
    color: #00151a;
    box-shadow: 0 0 12px #00e5ff, 0 0 22px #00e5ff80;
}

/* OUTPUTS — Neon Aqua */
.tool-group:nth-child(2) > summary::before {
    content: "▶";
    background: #00ffc8;
    color: #002018;
    box-shadow: 0 0 12px #00ffc8, 0 0 22px #00ffc880;
}

/* AUDIO/TIME — Neon Purple */
.tool-group:nth-child(3) > summary::before {
    content: "▶";
    background: #c77dff;
    color: #1a0030;
    box-shadow: 0 0 12px #c77dff, 0 0 22px #c77dff80;
}

/* ADVANCED — Neon Orange */
.tool-group:nth-child(4) > summary::before {
    content: "▶";
    background: #ff9d00;
    color: #301a00;
    box-shadow: 0 0 12px #ff9d00, 0 0 22px #ff9d0080;
}

/* SIMULATORS — Neon Pink */
.tool-group:nth-child(5) > summary::before {
    content: "▶";
    background: #ff00aa;
    color: #30001d;
    box-shadow: 0 0 12px #ff00aa, 0 0 22px #ff00aa80;
}

/* =============================
   Face Verify additions: Log styling
   ============================= */
.log {
  max-height: 420px;
  overflow-y: auto;
}

/* Base line */
.log-line{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 3px 6px;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.96;
}

/* Level colors */
.log-line.info    { color: #cbd5e1; }
.log-line.success { color: #22c55e; }
.log-line.error   { color: #f87171; }
.log-line.tx      { color: #22d3ee; }
.log-line.rx      { color: #fbbf24; }

/* Timestamp + module tags */
.log-line .ts { color: #64748b; margin-right: 6px; }
.log-line .mod { font-weight: 700; margin-right: 6px; }
.log-line .mod-CAM  { color: #38bdf8; }
.log-line .mod-FACE { color: #c084fc; }
.log-line .mod-BLE  { color: #4ade80; }
.log-line .mod-APP  { color: #e5e7eb; }

/* Slight highlight for errors */
.log-line.error { background: rgba(248,113,113,0.08); border-radius: 6px; }
.log-line.success { background: rgba(34,197,94,0.06); border-radius: 6px; }
.log-line.tx { background: rgba(34,211,238,0.05); border-radius: 6px; }
.log-line.rx { background: rgba(251,191,36,0.05); border-radius: 6px; }

/* =========================
   Robot Face (add-on styles)
   ========================= */

.robot-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 8px;
  min-height: 260px;
}

.robot-head {
  width: 320px;
  height: 320px;
  border-radius: 26px;
  position: relative;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.10), transparent 55%),
    linear-gradient(180deg, rgba(34,197,94,0.12), rgba(2,6,23,0.85)),
    rgba(15,23,42,0.92);
  border: 1px solid rgba(148,163,184,0.28);
  box-shadow:
    0 18px 45px rgba(0,0,0,0.55),
    inset 0 0 0 1px rgba(15,23,42,0.85);
  overflow: hidden;
}

/* A little top panel line like a robot */
.robot-head::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 98px;
  height: 1px;
  background: rgba(148,163,184,0.22);
}

/* Eyes */
.eyes {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 44px;
}

.eye {
  width: 76px;
  height: 54px;
  border-radius: 18px;
  background: rgba(2,6,23,0.72);
  border: 1px solid rgba(148,163,184,0.22);
  position: relative;
  overflow: hidden;
}

.eye::before {
  content: "";
  position: absolute;
  inset: -18px;
  background: radial-gradient(circle at 40% 35%, rgba(34,197,94,0.35), transparent 60%);
  filter: blur(4px);
  opacity: 0.85;
}

.pupil {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), rgba(34,197,94,0.95));
  box-shadow: 0 0 16px rgba(34,197,94,0.45);
}

/* Mouth */
.mouth-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 68px;
  width: 220px;
  height: 92px;
  border-radius: 22px;
  background: rgba(2,6,23,0.55);
  border: 1px solid rgba(148,163,184,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mouth {
  width: 160px;
  height: 18px;           /* JS animates this */
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(148,163,184,0.22);
  box-shadow: inset 0 0 20px rgba(34,197,94,0.10);
  transition: height 80ms linear, transform 80ms linear;
}

/* Little chin pill */
.robot-chin {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 22px;
  width: 150px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(148,163,184,0.18);
}



/* --- Layout tweak: robot + log on right, controls on left --- */
@media (min-width: 901px){
  .col-right .log { max-height: 420px; }
}

.robot-wrap {
  display: flex;
  align-items: center;      /* vertical center */
  justify-content: center;  /* horizontal center */
  width: 100%;
  height: 100%;
  min-height: 320px;        /* ensures vertical centering */
}




/* ==========================
   Geeky Robot Emotions (add-on)
   ========================== */

.robot-wrap{
  display:flex;
  flex-direction: column;
  align-items:center;
  gap: 10px;
}

.emotion-bar{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:center;
  margin-top: 8px;
}

.emotion-bar .emo.active{
  border-color: rgba(34,197,94,0.95) !important;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.6), 0 0 16px rgba(34,197,94,0.35);
}

/* Antenna */
.antenna{
  position:absolute;
  left:50%;
  top:-18px;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:5px;
  z-index:3;
}
.antenna-stick{
  width:6px;height:28px;border-radius:999px;
  background: linear-gradient(180deg, #94a3b8, #334155);
  border:1px solid rgba(255,255,255,0.22);
}
.antenna-bulb{
  width:18px;height:18px;border-radius:999px;
  background: radial-gradient(circle at 30% 30%, #fff, #fb7185 35%, #be123c 80%);
  box-shadow:0 0 18px rgba(251,113,133,0.65);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

/* Brows */
.brows{
  position:absolute;
  top:24px;
  left:50%;
  transform:translateX(-50%);
  width: 260px;
  display:flex;
  justify-content:space-between;
  pointer-events:none;
  z-index:2;
}
.brow{
  width: 96px;
  height: 10px;
  border-radius:999px;
  background: rgba(148,163,184,0.75);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25));
  transition: transform 180ms ease, height 180ms ease, opacity 180ms ease;
}

/* Glasses */
.glasses{
  position:absolute;
  top:44px;
  left:50%;
  transform:translateX(-50%);
  width: 280px;
  display:none;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  z-index:2;
  pointer-events:none;
  opacity:0.95;
}
.lens{
  flex:1;
  height:54px;
  border-radius:14px;
  border:2px solid rgba(226,232,240,0.85);
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.22), transparent 55%),
              rgba(2,6,23,0.25);
  box-shadow:0 0 0 1px rgba(56,189,248,0.22), 0 10px 20px rgba(0,0,0,0.22);
  position:relative;
  overflow:hidden;
}
.lens::after{
  content:"";
  position:absolute;
  inset:-20%;
  background: linear-gradient(120deg, transparent 40%, rgba(56,189,248,0.22), transparent 60%);
  transform: rotate(12deg);
  opacity:0.8;
}
.bridge{
  width:22px;
  height:10px;
  border-radius:999px;
  background: rgba(226,232,240,0.75);
  box-shadow:0 2px 8px rgba(0,0,0,0.25);
}

/* Cheeks */
.cheeks{
  position:absolute;
  top:150px;
  left:50%;
  transform:translateX(-50%);
  width: 300px;
  display:flex;
  justify-content:space-between;
  z-index:1;
  pointer-events:none;
  opacity:0;
  transition: opacity 180ms ease;
}
.cheek{
  width:64px;height:24px;border-radius:999px;
  background: radial-gradient(circle at 30% 40%, rgba(251,113,133,0.55), transparent 60%);
}

/* Tears */
.tears{
  position:absolute;
  top:118px;
  left:50%;
  transform:translateX(-50%);
  width: 250px;
  display:flex;
  justify-content:space-between;
  z-index:3;
  pointer-events:none;
  opacity:0;
  transition: opacity 180ms ease;
}
.tear{
  width:14px;height:28px;border-radius:999px;
  background: linear-gradient(180deg, rgba(125,211,252,0.95), rgba(56,189,248,0.25));
  box-shadow:0 8px 18px rgba(56,189,248,0.18);
  animation: drip 1.1s ease-in-out infinite;
}
.tear:nth-child(2){animation-delay:0.2s}
@keyframes drip{
  0%,100%{ transform: translateY(0); opacity:0.7; }
  50%{ transform: translateY(10px); opacity:1; }
}

/* Tooth + tongue */
.tooth{
  position:absolute;
  width:28px;height:14px;
  background: rgba(226,232,240,0.9);
  border-radius: 0 0 8px 8px;
  top:50%;
  transform: translateY(-50%);
  left:50%;
  margin-left:-14px;
  opacity:0;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow:0 3px 10px rgba(0,0,0,0.25);
}
.tongue{
  position:absolute;
  width:42px;height:26px;
  border-radius: 14px 14px 16px 16px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), transparent 55%),
              linear-gradient(180deg, #fb7185, #be123c);
  bottom:10px;
  left:50%;
  transform: translateX(-50%) translateY(10px);
  opacity:0;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow:0 10px 20px rgba(190,18,60,0.22);
}

/* ======================
   Emotion states
   ====================== */

.robot-head.emo-neutral .mouth{
  height:16px;
  border-radius:999px;
}

.robot-head.emo-happy .mouth{
  height:56px;
  border-radius: 0 0 999px 999px;
  background: rgba(255,255,255,0.08);
}
.robot-head.emo-happy .tooth{ opacity:1; transform: translateY(-50%) translateY(-3px); }
.robot-head.emo-happy .cheeks{ opacity:1; }
.robot-head.emo-happy .tongue{ opacity:1; transform: translateX(-50%) translateY(0); }

.robot-head.emo-sad .mouth{
  height:52px;
  border-radius: 999px 999px 0 0;
  transform: translateY(10px);
}
.robot-head.emo-sad .tears{ opacity:1; }
.robot-head.emo-sad .brow:first-child{ transform: rotate(18deg) translateY(6px); }
.robot-head.emo-sad .brow:last-child{ transform: rotate(-18deg) translateY(6px); }

.robot-head.emo-angry .brow:first-child{ transform: rotate(-18deg) translateY(4px); height:12px; }
.robot-head.emo-angry .brow:last-child{ transform: rotate(18deg) translateY(4px); height:12px; }
.robot-head.emo-angry .mouth{
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(251,113,133,0.18);
}
.robot-head.emo-angry .antenna-bulb{
  box-shadow:0 0 22px rgba(251,113,133,0.85);
  transform: scale(1.05);
}

.robot-head.emo-surprised .mouth{
  width:100px;
  height:56px;
  border-radius: 999px;
}
.robot-head.emo-surprised .pupil{
  width:14px;height:14px;
}

.robot-head.emo-nerdy .glasses{ display:flex; }
.robot-head.emo-nerdy .cheeks{ opacity:0.6; }
.robot-head.emo-nerdy .tongue{ opacity:1; transform: translateX(-50%) translateY(0); }

.robot-head.emo-sleepy .eye{
  height:34px;
  transform: translateY(12px);
  border-radius: 999px;
}
.robot-head.emo-sleepy .pupil{ opacity:0; }
.robot-head.emo-sleepy .mouth{ opacity:0.85; }

/* ======================
   Extra kid emotions (add-on)
   ====================== */

@keyframes emo-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

@keyframes emo-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  92%, 98%      { transform: scaleY(0.12); }
}

@keyframes emo-laugh {
  from { transform: translateX(-50%) translateY(0) scaleX(1); }
  to   { transform: translateX(-50%) translateY(-2px) scaleX(1.05); }
}

@keyframes emo-sparkle {
  0% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  45% { opacity: 1; transform: scale(1.1) rotate(15deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
}

/* 😜 Silly: uneven eyes + tongue out */
.robot-head.emo-silly .eye:first-child{ transform: scale(1.18) rotate(-2deg); }
.robot-head.emo-silly .eye:last-child{ transform: scale(0.82) rotate(2deg); }
.robot-head.emo-silly .tongue{ opacity:1; transform: translateX(-50%) translateY(0); }
.robot-head.emo-silly .mouth{
  height:42px;
  border-radius: 0 0 18px 18px;
}

/* 😱 Scared: huge eyes + open mouth + shake */
.robot-head.emo-scared{ animation: emo-shake 0.35s infinite; }
.robot-head.emo-scared .eye{ transform: scale(1.22); }
.robot-head.emo-scared .pupil{ width:14px; height:14px; box-shadow: 0 0 22px rgba(56,189,248,0.6); }
.robot-head.emo-scared .mouth{
  width:120px;
  height:64px;
  border-radius: 999px;
}

/* 😂 Laugh: squinty eyes + bouncy mouth */
.robot-head.emo-laugh .eye{
  height:18px;
  border-radius: 999px;
}
.robot-head.emo-laugh .pupil{ opacity:0; }
.robot-head.emo-laugh .mouth{
  height:52px;
  border-radius: 0 0 999px 999px;
  animation: emo-laugh 0.22s infinite alternate;
}
.robot-head.emo-laugh .tooth{ opacity:1; transform: translateY(-50%) translateY(-3px); }

/* 🥳 Party: blinking eyes + confetti sparkles */
.robot-head.emo-party .pupil{ animation: emo-blink 1.2s infinite; transform-origin:center; }
.robot-head.emo-party .antenna-bulb{
  box-shadow: 0 0 26px rgba(251,191,36,0.85);
  transform: scale(1.06);
}
.robot-head.emo-party::after{
  content:"🎉✨";
  position:absolute;
  right: 10px;
  top: 10px;
  font-size: 1.4rem;
  opacity: 0;
  animation: emo-sparkle 2.2s infinite ease-in-out;
  pointer-events:none;
}

/* 🤖 Robot: square mouth + blue eyes (mechanical) */
.robot-head.emo-robot .mouth{
  border-radius: 6px;
  background: rgba(56,189,248,0.12);
  box-shadow: inset 0 0 20px rgba(56,189,248,0.18);
}
.robot-head.emo-robot .pupil{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4), rgba(56,189,248,0.95));
  box-shadow: 0 0 18px rgba(56,189,248,0.55);
}
.robot-head.emo-robot .cheeks{ opacity:0; }
.robot-head.emo-robot .tongue{ opacity:0; }

/* 🤬 Angry+: red glow + sharper mouth + hot antenna */
.robot-head.emo-angryplus .brow:first-child{ transform: rotate(-24deg) translateY(4px); height:12px; }
.robot-head.emo-angryplus .brow:last-child{ transform: rotate(24deg) translateY(4px); height:12px; }
.robot-head.emo-angryplus .mouth{
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(248,113,113,0.28);
}
.robot-head.emo-angryplus{
  box-shadow:
    0 18px 45px rgba(0,0,0,0.55),
    0 0 26px rgba(248,113,113,0.22),
    inset 0 0 0 1px rgba(15,23,42,0.85);
}
.robot-head.emo-angryplus .antenna-bulb{
  box-shadow:0 0 28px rgba(248,113,113,0.9);
  transform: scale(1.08);
}


/* Right column must stretch fully */
.col-right {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Make log card take remaining space */
.log-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Let log fill the card */
.log {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none; /* 🔥 remove the limit */
}

/* Robot container */
.robot-wrap {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Robot head bigger */
.robot-head {
    width: 260px;
    height: 300px; /* 🔥 more height */
}

/* More breathing room for face elements */
.robot-head .eyes {
    margin-top: 20px;
}

.mouth-zone {
    margin-top: 18px;
    min-height: 60px;
}
/* Make the main top row fill available height */
.rows-container {
    height: 100%;
}

.row-top {
    min-height: calc(100vh - 140px); /* header offset */
    align-items: stretch;
}

/* Right column must stretch fully */
.col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Log card fills remaining space */
.log-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Log content scrolls */
.log {
    flex: 1;
    min-height: 0;
    max-height: none;
}
.col-left {
    overflow-y: auto;
    padding-right: 4px;
}
.log-card {
    margin-top: auto; /* ⬅ pushes LOG card to the bottom */
}




/* ======================
   Foldable cards (Voice/Options)
   ====================== */

details.card {
  padding: 0;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
}

details.card > summary::-webkit-details-marker {
  display: none;
}

/* Keep original header spacing */
details.card > summary.card-header {
  padding: 10px 12px 11px 12px;
}

/* Content spacing inside foldable cards */
details.card > .controls-grid {
  padding: 0 12px 12px 12px;
}

/* Arrow animation */
.fold-icon {
  font-size: 1rem;
  transition: transform 0.25s ease;
}

details[open] .fold-icon {
  transform: rotate(180deg);
}

/* Hover feedback */
summary.foldable:hover {
  background: rgba(34, 197, 94, 0.08);
  border-radius: 12px;
}


/* ==========================
   KID FRIENDLY FOLDABLE UI
   ========================== */

summary.kid-fold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

summary.kid-fold .fold-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

summary.kid-fold .fold-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #111827;
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.65);
  user-select: none;
}

summary.kid-fold .fold-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

/* Show OPEN vs CLOSE labels/icons */
details.card:not([open]) .fold-close,
details.card:not([open]) .fold-emoji-close {
  display: none;
}
details.card[open] .fold-open,
details.card[open] .fold-emoji-open {
  display: none;
}

details.card[open] summary.kid-fold .fold-right {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.65);
}

/* Big tap target + feedback */
summary.kid-fold {
  -webkit-tap-highlight-color: transparent;
}
summary.kid-fold:hover {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
}

/* Mobile: make it even clearer */
@media (max-width: 700px) {
  summary.kid-fold .fold-right {
    font-size: 0.9rem;
    padding: 7px 12px;
  }
  summary.kid-fold .fold-emoji {
    font-size: 1.25rem;
  }
}

input[type="text"] {
    border-radius: 999px; /* pill */
}

textarea {
    border-radius: 10px;  /* box */
}

textarea {
    resize: vertical;
    min-height: 120px;
}

