/* ══════════════════════════════════════════════════
   Edge Impulse · Motion Gesture Recognition
   Dark glassmorphism theme
══════════════════════════════════════════════════ */

:root {
    --bg:          #070b14;
    --bg2:         #0d1321;
    --card-bg:     rgba(255,255,255,0.04);
    --card-border: rgba(255,255,255,0.08);
    --accent:      #6c63ff;
    --accent2:     #38bdf8;
    --success:     #22d3a5;
    --warn:        #fb923c;
    --danger:      #f43f5e;
    --text:        #f1f5f9;
    --muted:       #64748b;
    --muted2:      #94a3b8;
    --font:        'Inter', sans-serif;
    --mono:        'JetBrains Mono', monospace;
    --radius:      20px;
    --radius-sm:   10px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 15% 15%, rgba(108,99,255,0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 85%, rgba(56,189,248,0.09) 0%, transparent 55%);
}

/* ── Topbar ──────────────────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 24px;
    background: rgba(7,11,20,0.8);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3px;
}
.brand-icon { font-size: 18px; }

/* WASM pill */
.wasm-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 100px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.4s;
}
.wasm-pill.wasm-ready {
    background: rgba(34,211,165,0.08);
    border-color: rgba(34,211,165,0.25);
}
.wasm-pill.wasm-model-ready {
    background: rgba(108,99,255,0.12);
    border-color: rgba(108,99,255,0.3);
}
.wasm-pill.wasm-error {
    background: rgba(244,63,94,0.1);
    border-color: rgba(244,63,94,0.3);
}

.wasm-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--warn);
    animation: blink 1s ease-in-out infinite;
    flex-shrink: 0;
}
.wasm-dot.dot-ready     { background: var(--success); animation: none; box-shadow: 0 0 6px var(--success); }
.wasm-dot.dot-model-ready { background: var(--accent); animation: pulse-glow 2s ease-in-out infinite; }
.wasm-dot.dot-error     { background: var(--danger); animation: none; }

.wasm-label { color: var(--muted2); }
.wasm-pill.wasm-ready        .wasm-label { color: var(--success); }
.wasm-pill.wasm-model-ready  .wasm-label { color: #a78bfa; }
.wasm-pill.wasm-error        .wasm-label { color: var(--danger); }

/* ── Container ───────────────────────────────────── */
.container {
    max-width: 580px;
    margin: 0 auto;
    padding: 28px 16px 72px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Hero ────────────────────────────────────────── */
.hero { text-align: center; padding: 10px 0 4px; }
.hero h1 {
    font-size: clamp(22px, 5vw, 30px);
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 8px;
}
.subtitle {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

/* ── Cards ───────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 16px;
}
.card-icon { font-size: 17px; }
.card-header h2 {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}
.card-unit {
    font-size: 11px;
    color: var(--muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 100px;
    border: 1px solid var(--card-border);
    font-family: var(--mono);
}

/* ── Status badge ────────────────────────────────── */
.badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid var(--card-border);
    letter-spacing: 0.3px;
}
.badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}
.badge-dot.dot-online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-glow 1.8s ease-in-out infinite;
}

/* ── Button ──────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: white;
    border: none;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(108,99,255,0.25);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(108,99,255,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-icon { font-size: 15px; }

/* ── Axis bars ───────────────────────────────────── */
.axis-grid {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-bottom: 20px;
}
.axis-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.axis-lbl {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.x-color { color: #f87171; }
.y-color { color: #4ade80; }
.z-color { color: #818cf8; }

.axis-track {
    flex: 1;
    height: 7px;
    background: rgba(255,255,255,0.06);
    border-radius: 100px;
    overflow: hidden;
}
.axis-fill {
    height: 100%;
    border-radius: 100px;
    width: 0%;
    transition: width 0.1s linear;
}
.x-fill { background: linear-gradient(90deg, #f43f5e, #fb923c); }
.y-fill { background: linear-gradient(90deg, #22d3a5, #4ade80); }
.z-fill { background: linear-gradient(90deg, #6c63ff, #818cf8); }

.axis-val {
    font-size: 12px;
    width: 54px;
    text-align: right;
    color: var(--text);
    flex-shrink: 0;
}

/* ── Sample progress ─────────────────────────────── */
.sample-section {
    border-top: 1px solid var(--card-border);
    padding-top: 13px;
}
.sample-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.sample-title { font-size: 12px; color: var(--muted); }
.sample-count  { font-size: 11px; color: var(--muted2); }

.progress-track {
    height: 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 100px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    width: 0%;
    transition: width 0.12s linear;
}

/* ── Prediction card ─────────────────────────────── */
.prediction-card {}

/* Inferring badge */
.infer-badge {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent2);
    background: rgba(56,189,248,0.1);
    padding: 4px 11px;
    border-radius: 100px;
    border: 1px solid rgba(56,189,248,0.22);
    margin-left: auto;
    animation: fade-in 0.25s ease;
}
.infer-badge.visible { display: flex; }
.infer-ring {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent2);
    animation: pulse-glow 0.8s ease-in-out infinite;
    flex-shrink: 0;
}

/* Gesture display */
.gesture-display {
    text-align: center;
    padding: 12px 0 10px;
}
.gesture-icon {
    font-size: 68px;
    display: block;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 22px rgba(108,99,255,0.5));
    animation: float 3.5s ease-in-out infinite;
    line-height: 1;
}
.gesture-label {
    font-size: clamp(28px, 8vw, 40px);
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #a78bfa 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}
.gesture-conf {
    font-size: 13px;
    color: var(--muted);
}

/* ── Probability bars ────────────────────────────── */
.prob-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.prob-item {
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    transition: background 0.3s, border-color 0.3s;
}
.prob-item.active {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
}
.prob-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.prob-icon { font-size: 16px; flex-shrink: 0; }
.prob-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted2);
    transition: color 0.3s;
}
.prob-item.active .prob-name { color: var(--text); font-weight: 700; }
.prob-pct {
    font-size: 12px;
    color: var(--muted);
    transition: color 0.3s;
    min-width: 36px;
    text-align: right;
}
.prob-item.active .prob-pct { color: var(--text); font-weight: 600; }

.prob-track {
    height: 7px;
    background: rgba(255,255,255,0.05);
    border-radius: 100px;
    overflow: hidden;
}
.prob-bar {
    height: 100%;
    border-radius: 100px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}
.circle-bar { background: linear-gradient(90deg, #f43f5e, #fb923c); }
.wave-bar   { background: linear-gradient(90deg, #22d3a5, #38bdf8); }
.idle-bar   { background: linear-gradient(90deg, #6c63ff, #818cf8); }

/* ── Utility ─────────────────────────────────────── */
.mono { font-family: var(--mono); }

/* ── Keyframes ───────────────────────────────────── */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.15; }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(108,99,255,0.6); }
    50%       { box-shadow: 0 0 0 5px rgba(108,99,255,0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-7px); }
}
@keyframes fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
    .topbar { padding: 11px 14px; }
    .container { padding: 20px 12px 60px; }
}