/* ═══════════════════════════════════════════
   Electrical Simulator — Main Stylesheet
   Extracted from electrical-simulator-pro.html
   ═══════════════════════════════════════════ */

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

body {
    font-family: 'Arial', sans-serif;
    background: #f0f0f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ── Header ── */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 15px; }
.header-title { font-size: 1.5em; font-weight: bold; }
.exercise-label { background: rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 20px; font-size: 0.9em; }
.header-right { display: flex; align-items: center; gap: 20px; }
.score-display { background: rgba(255,255,255,0.2); padding: 8px 20px; border-radius: 8px; font-size: 1.1em; font-weight: bold; }
.score-display.passed { background: #51cf66; animation: scoreGlow 1s ease-in-out; }
@keyframes scoreGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(81, 207, 102, 0.5); }
    50% { box-shadow: 0 0 20px rgba(81, 207, 102, 0.8); }
}

/* ── Layout ── */
.main-container { display: flex; flex: 1; min-height: 0; }

/* ── Right Sidebar ── */
.right-sidebar {
    width: 0; min-width: 0; background: white; border-left: 2px solid #ddd;
    overflow: hidden; transition: width 0.35s ease, min-width 0.35s ease;
    flex-shrink: 0; display: flex; flex-direction: column;
}
.right-sidebar.open { width: 340px; min-width: 340px; }

/* ── Left Sidebar ── */
.sidebar {
    width: 320px; background: white; border-right: 2px solid #ddd;
    overflow-y: auto; box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: relative; flex-shrink: 0;
    transition: width 0.28s cubic-bezier(0.4,0,0.2,1), min-width 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.collapsed { width: 0 !important; min-width: 0 !important; overflow: hidden; }

/* ── Sidebar collapse tab ── */
.sidebar-toggle-btn {
    position: absolute; right: -18px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 52px; z-index: 200;
    background: #2a5298; border: none; border-radius: 0 8px 8px 0;
    color: white; font-size: 11px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 3px 0 8px rgba(0,0,0,0.18);
    transition: background 0.15s, right 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-toggle-btn:hover { background: #1a3a78; }
.sidebar.collapsed .sidebar-toggle-btn { right: -24px; width: 24px; border-radius: 0 10px 10px 0; }

.sidebar-section { padding: 16px 14px; border-bottom: 2px solid #f0f0f0; }
.sidebar-section h3 {
    color: #2a5298; margin-bottom: 12px; font-size: 1em;
    border-bottom: 2px solid #2a5298; padding-bottom: 6px;
}

/* ── Component grid — 2 columns, proportional preview boxes ── */
.component-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.component-card {
    background: #f9f9f9; border: 2px solid #e0e0e0; border-radius: 10px;
    padding: 10px 8px 8px; cursor: move; transition: all 0.22s;
    text-align: center; display: flex; flex-direction: column; align-items: center;
    position: relative;
}
.component-card:hover {
    transform: translateY(-2px); box-shadow: 0 6px 18px rgba(42,82,152,0.18);
    border-color: #2a5298; background: #f0f4ff;
}

/* ── Proportional preview box: fixed 80px tall, SVG scales to fit ── */
.card-preview {
    width: 100%; height: 80px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 6px;
}
.card-preview svg {
    /* SVG scales proportionally to fit within the 80px tall container */
    width: 100%; height: 100%;
    display: block;
}
.component-name { font-size: 0.8em; font-weight: 600; color: #444; line-height: 1.2; }

/* ── Tooltip popup ── */
.comp-tooltip {
    position: fixed; z-index: 9000; pointer-events: none;
    max-width: 240px; padding: 10px 13px;
    background: #1a2744; color: #e8eef8;
    border-radius: 10px; border: 1px solid #2a5298;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    font-family: Arial, sans-serif; font-size: 12px; line-height: 1.5;
    opacity: 0; transition: opacity 0.15s;
}
.comp-tooltip.visible { opacity: 1; }
.comp-tooltip-title {
    font-weight: 700; color: #74c0fc; margin-bottom: 4px; font-size: 12.5px;
}
.comp-tooltip-body { color: #c8d8f0; font-size: 11.5px; }

/* ── Canvas ── */
.canvas-container { flex: 1; background: white; position: relative; overflow: hidden; }
.canvas-area {
    min-width: 3000px; min-height: 3000px; position: relative; background: white;
    transform-origin: 0 0;
    will-change: transform;
}
.canvas-container.is-panning { cursor: grabbing !important; }
.canvas-container.space-pan { cursor: grab; }
.canvas-container.space-pan .placed-component { cursor: grab; }
.canvas-container.space-pan .placed-component * { pointer-events: none; }
.grid-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: linear-gradient(rgba(200,200,200,0.3) 1px, transparent 1px), linear-gradient(90deg, rgba(200,200,200,0.3) 1px, transparent 1px);
    background-size: 30px 30px; pointer-events: none;
}

/* ── Zoom Controls — Laci Kaca Pembesar ── */
/* position:fixed agar konsisten di semua device tanpa bergantung pada positioned ancestor.
   DOM order: .zoom-panel (pertama) → .zoom-drawer-toggle (terakhir).
   flex-direction: column → panel muncul DI ATAS trigger karena panel ada di DOM pertama. */
.zoom-controls {
    position: fixed;
    left: 14px;
    bottom: 22px;
    z-index: 1000;
    display: flex;
    flex-direction: column;   /* column normal — panel (DOM-first) muncul di atas trigger */
    align-items: flex-start;
    gap: 5px;
}

/* Trigger pill: always visible, shows current zoom level */
.zoom-drawer-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 13px;
    background: white;
    border: 1.5px solid #d0d0d0;
    border-radius: 20px;
    font-size: 13px; font-weight: 700;
    color: #444;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
}
.zoom-drawer-toggle:hover { background: #f0f8ff; border-color: #74c0fc; color: #1971c2; }
.zoom-controls.open .zoom-drawer-toggle {
    background: #e7f5ff; border-color: #1971c2; color: #1971c2;
}

/* Expandable panel with +/↺/− buttons — slides out above the trigger */
.zoom-panel {
    display: none; /* toggled by JS */
    flex-direction: column;
    background: white;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.17);
    animation: zoomPanelIn 0.16s cubic-bezier(0.22,1,0.36,1);
}
.zoom-controls.open .zoom-panel { display: flex; }

@keyframes zoomPanelIn {
    /* Panel tumbuh dari bawah ke atas → transform-origin: bottom */
    from { opacity: 0; transform: scaleY(0.72) translateY(6px); transform-origin: bottom center; }
    to   { opacity: 1; transform: scaleY(1)    translateY(0);   transform-origin: bottom center; }
}

.zoom-btn {
    width: 42px; height: 42px;
    border: none; background: white;
    font-size: 20px; font-weight: bold;
    color: #333; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.zoom-btn:hover { background: #f0f0f0; }
.zoom-btn:active { background: #e0e0e0; }

/* Reset button style — smaller icon, middle position */
.zoom-btn-reset { font-size: 15px; color: #888; height: 36px; }
.zoom-btn-reset:hover { color: #1971c2; background: #e7f5ff; }

.zoom-panel-divider {
    height: 1px; background: #eee; margin: 0 8px;
}

/* ── Components ── */
.placed-component { position: absolute; cursor: move; user-select: none; transition: filter 0.3s; }
.placed-component.selected { filter: drop-shadow(0 0 10px rgba(42, 82, 152, 0.8)); }
.placed-component.powered { filter: drop-shadow(0 0 15px rgba(81, 207, 102, 0.8)); }
.delete-btn {
    position: absolute; top: -12px; right: -12px; width: 28px; height: 28px;
    background: #ff6b6b; color: white; border: 2px solid white; border-radius: 50%;
    cursor: pointer; font-size: 16px; font-weight: bold; display: none; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); line-height: 24px; text-align: center;
}
.placed-component:hover .delete-btn { display: block; }

/* ── Terminals ── */
/*
 * Ukuran terminal dikecilkan dari 16px → 10px.
 * Alasan: hitbox 44px lama menyebabkan overlap 12px pada terminal
 * yang berjarak 32px (contactor), sehingga terminal salah terseleksi.
 * Hitbox baru 24px: gap aman ≥ 8px untuk jarak terminal terdekat.
 * Kompensasi visibilitas: white halo ring + scale(2.2) saat hover/wiring.
 */
.terminal {
    width: 10px; height: 10px; background: #ff6b6b; border: 2px solid #c92a2a;
    border-radius: 50%; position: absolute; cursor: crosshair; z-index: 10;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 1px 3px rgba(0,0,0,0.22);
}
/* Hitbox tak kasatmata — 24px: tidak overlap untuk jarak terminal ≥ 32px */
.terminal::after {
    content: ''; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 24px; height: 24px; border-radius: 50%;
}
.terminal:hover {
    background: #ffd43b; border-color: #f59f00; transform: scale(2.2);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.95), 0 0 14px rgba(255,212,59,0.85);
    z-index: 1000;
}
.terminal.connected {
    background: #51cf66; border-color: #2f9e44;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 0 7px rgba(81,207,102,0.6);
}
.terminal.connected:hover { background: #69db7c; border-color: #37b24d; }

/* ── Cable SVG ── */
.cable-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: visible; }
.cable-group { pointer-events: all; }
.cable-delete-btn { pointer-events: all; }
.cable-path { fill: none; stroke: #cc0000; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3)); }
/* .cable-path.powered tidak lagi dipakai — animasi dikontrol 100% via JS inline style */
.cable-outline { fill: none; stroke: #990000; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; opacity: 0.5; }
@keyframes cableFlow { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -40; } }
@keyframes cableFaultBlink {
  0%, 100% { opacity: 1; }
  40%       { opacity: 0.15; }
}

/* ── Explosion / Arc Flash Effects ── */

/* Kilatan putih layar penuh sesaat */
.exp-flash {
    position: fixed; inset: 0; z-index: 9998; pointer-events: none;
    background: rgba(255,255,255,0.92);
    animation: expFlash 0.32s ease-out forwards;
}
@keyframes expFlash {
    0%   { opacity: 1; }
    30%  { opacity: 0.7; }
    100% { opacity: 0; }
}

/* Ikon ledakan di titik pusat */
.exp-origin {
    position: fixed; z-index: 9999; pointer-events: none;
    font-size: 3.5em; line-height: 1;
    transform: translate(-50%, -50%);
    animation: expOrigin 0.65s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}
@keyframes expOrigin {
    0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    40%  { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.8); opacity: 0; }
}

/* Percikan partikel — posisi awal di (left,top) = titik ledakan */
.exp-spark {
    position: fixed; z-index: 9999; pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: expSpark 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes expSpark {
    0%   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
    60%  { opacity: 0.8; }
    100% { transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) scale(0.2); opacity: 0; }
}

/* ── Right dock (cable panel + analysis panel stacked) ── */
.right-dock {
    position: absolute; right: 12px; top: 12px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px;
    width: 248px;
    max-height: calc(100% - 24px);
    pointer-events: none; /* transparent on gaps between panels */
    overflow-y: auto; overflow-x: visible;
}
.right-dock::-webkit-scrollbar { display: none; }
.right-dock > * { pointer-events: all; }

/* ── Cable Panel ── */
.cable-panel {
    background: #fff; border: 1px solid #e0e0e0;
    border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    width: 100%;
    font-family: Arial, sans-serif; font-size: 12px;
    user-select: none;
}
.cp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px 7px; border-bottom: 1px solid #f0f0f0;
    background: #f8f8f8; border-radius: 12px 12px 0 0;
}
.cp-title { font-weight: bold; color: #333; font-size: 12px; }
.cp-collapse {
    display: flex; align-items: center; gap: 4px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10.5px; font-weight: 700;
    color: #666;
    padding: 3px 8px 3px 6px;
    line-height: 1.4;
    white-space: nowrap;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.cp-collapse:hover { background: #e7f5ff; color: #1971c2; border-color: #74c0fc; }
.cp-collapse-icon { font-size: 9px; }

/* Collapsed state — header only (body hidden), blue accent strip to hint panel */
.cable-panel.cp-collapsed .cp-header {
    border-radius: 12px;          /* all corners rounded without body below */
    border-bottom-color: transparent;
    background: linear-gradient(135deg, #e7f5ff 0%, #f8f8f8 100%);
}
.cable-panel.cp-collapsed .cp-title { color: #1971c2; }
.cable-panel.cp-collapsed .cp-collapse {
    background: #1971c2; color: white; border-color: #1971c2;
}
.cable-panel.cp-collapsed .cp-collapse:hover { background: #1864ab; }
.cp-body { padding: 10px 12px 12px; }
.cp-section-label {
    font-size: 10px; font-weight: bold; text-transform: uppercase;
    letter-spacing: 0.8px; color: #aaa; margin-bottom: 6px;
}
.cp-mode-row { display: flex; gap: 4px; margin-bottom: 8px; }
.cp-mode-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 4px; border: 1.5px solid #ddd; border-radius: 8px;
    background: #fff; cursor: pointer; transition: all 0.16s; font-family: inherit;
}
.cp-mode-btn:hover { border-color: #74c0fc; background: #f0f8ff; }
.cp-mode-btn.active {
    border-color: #1971c2; background: #e7f5ff;
    box-shadow: 0 0 0 2px rgba(25,113,194,0.18);
}
.cp-mode-icon { font-size: 15px; line-height: 1; }
.cp-mode-lbl { font-size: 9px; font-weight: 700; color: #555; text-align: center; }
.cp-mode-btn.active .cp-mode-lbl { color: #1971c2; }
.cp-action-row { display: flex; gap: 6px; margin-bottom: 6px; }
.cp-act-btn {
    flex: 1; padding: 5px 6px; border: 1px solid #ddd; border-radius: 7px;
    background: #f8f8f8; cursor: pointer; font-size: 11px; font-family: inherit;
    color: #444; transition: background 0.14s;
}
.cp-act-btn:hover { background: #e9ecef; border-color: #bbb; }
.cp-puil-grid { display: flex; flex-direction: column; gap: 4px; }
.cp-puil-row { display: flex; align-items: center; gap: 7px; }
.cp-puil-swatch {
    width: 20px; height: 14px; border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.14); flex-shrink: 0; display: inline-block;
}
.cp-puil-label { font-size: 11px; color: #333; font-weight: 500; flex: 1; }
.cp-puil-sub { font-size: 10px; color: #999; white-space: nowrap; }
.cp-hint { font-size: 10px; color: #bbb; text-align: center; margin-top: 8px; font-style: italic; }

/* Segmented type / cross-section row */
.cp-seg-row { display: flex; gap: 3px; margin-bottom: 2px; }
.cp-seg-btn {
    flex: 1; padding: 4px 2px; border: 1px solid #ddd; border-radius: 6px;
    background: #f8f9fa; font-size: 10px; font-weight: 700; cursor: pointer;
    color: #555; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.cp-seg-btn:hover { border-color: #74c0fc; background: #f0f8ff; }
.cp-seg-btn.active { border-color: #1971c2; background: #e7f5ff; color: #1971c2; }
.cp-cs-unit { font-size: 9px; color: #aaa; text-align: right; margin-top: -1px; margin-bottom: 2px; }

/* Stroke-width slider row */
.cp-stroke-row { display: flex; align-items: center; gap: 8px; }
.cp-stroke-row input[type=range] {
    flex: 1; height: 4px; accent-color: #1971c2; cursor: pointer;
}
#cpStrokeVal { font-size: 10px; font-weight: 700; color: #555; min-width: 30px; text-align: right; }

/* ── Cable right-click color menu ── */
.cable-color-menu {
    background: #fff; border: 1px solid #e0e0e0;
    border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    padding: 4px; min-width: 210px; z-index: 9999;
    font-family: Arial, sans-serif; font-size: 12px; user-select: none;
}
.ccm-title {
    padding: 7px 10px 5px; font-size: 10px; font-weight: bold;
    color: #aaa; text-transform: uppercase; letter-spacing: 0.7px;
    border-bottom: 1px solid #f0f0f0; margin-bottom: 3px;
}
.ccm-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 6px; cursor: pointer; transition: background 0.12s;
}
.ccm-item:hover { background: #f0f7ff; }
.ccm-item.active { background: #e7f5ff; }
.ccm-swatch {
    width: 24px; height: 15px; border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.12); flex-shrink: 0;
}
.ccm-label { flex: 1; color: #333; font-weight: 500; }
.ccm-sub { color: #aaa; font-weight: 400; font-size: 10px; }
.ccm-check { color: #1971c2; font-weight: bold; font-size: 13px; }

/* ── Toolbar ── */
.toolbar {
    background: linear-gradient(180deg, #e9ecef 0%, #dee2e6 100%);
    border-top: 2px solid #adb5bd; padding: 12px 20px;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); flex-shrink: 0;
}
.tool-btn {
    width: 62px; height: 62px; border: 2px solid #6c757d; border-radius: 12px;
    background: white; cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: relative;
}
.tool-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); border-color: #2a5298; }
.tool-btn:active { transform: translateY(0); }
.tool-btn.active { background: #2a5298; color: white; border-color: #1e3c72; }
.tool-btn.danger { background: #ff6b6b; color: white; border-color: #c92a2a; }
.tool-btn.success { background: #51cf66; color: white; border-color: #2f9e44; }
.tool-icon { font-size: 22px; }
.tool-label { font-size: 9px; font-weight: 600; text-transform: uppercase; }
.badge-pro { position: absolute; top: -5px; right: -5px; background: #ff6b6b; color: white; font-size: 8px; padding: 2px 5px; border-radius: 10px; font-weight: bold; }

/* ── Status Bar ── */
.status-bar {
    position: fixed; top: 10px; right: 10px; background: white;
    padding: 15px 20px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000; min-width: 250px;
}
.status-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.status-item:last-child { margin-bottom: 0; }
.status-indicator { width: 12px; height: 12px; border-radius: 50%; background: #ccc; }
.status-indicator.active { background: #51cf66; box-shadow: 0 0 10px rgba(81, 207, 102, 0.6); animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Animations ── */
@keyframes slideDown { from { transform: translateX(-50%) translateY(-20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(400px); opacity: 0; } }
/* Animasi notif mobile — dari atas masuk/keluar */
@keyframes slideInFromTop  { from { opacity:0; transform:translateY(-14px); } to { opacity:1; transform:translateY(0);     } }
@keyframes slideOutToTop   { from { opacity:1; transform:translateY(0);     } to { opacity:0; transform:translateY(-12px); } }
/* Animasi toast card mobile — dari bawah */
@keyframes toastSlideInMob  { from { opacity:0; transform:translateY(14px);  } to { opacity:1; transform:translateY(0);    } }
@keyframes toastSlideOutMob { from { opacity:1; transform:translateY(0);     } to { opacity:0; transform:translateY(10px); } }
@keyframes canvasShake {
  0%        { transform: translate(0,0) rotate(0deg); }
  8%        { transform: translate(-7px,-3px) rotate(-0.4deg); }
  16%       { transform: translate(7px,3px) rotate(0.4deg); }
  24%       { transform: translate(-6px,4px) rotate(-0.3deg); }
  32%       { transform: translate(6px,-4px) rotate(0.3deg); }
  40%       { transform: translate(-5px,2px) rotate(-0.2deg); }
  48%       { transform: translate(5px,-2px) rotate(0.2deg); }
  56%       { transform: translate(-3px,2px) rotate(-0.15deg); }
  64%       { transform: translate(3px,-1px) rotate(0.1deg); }
  80%       { transform: translate(-2px,1px) rotate(0deg); }
  100%      { transform: translate(0,0) rotate(0deg); }
}
.canvas-container.canvas-shake { animation: canvasShake 0.65s cubic-bezier(0.36,0.07,0.19,0.97) both; }
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,42,42,0.0); }
  50%       { box-shadow: 0 0 0 6px rgba(201,42,42,0.35); }
}
.canvas-container.fault-active { animation: dangerPulse 1.2s ease-in-out infinite; border: 2px solid #c92a2a; }

/* ── Motor 3F Animations ── */
@keyframes motorSpinCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes motorSpinCCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}
@keyframes motorFinShimmer {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.95; }
}
@keyframes motorFaultFlash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.42; }
}
@keyframes motorShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-3px); }
  40%      { transform: translateX(3px); }
  60%      { transform: translateX(-2px); }
  80%      { transform: translateX(2px); }
}

/* ── Modal ── */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 2000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 15px; max-width: 500px; width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.3); text-align: center; }
.modal-content h2 { color: #2a5298; margin-bottom: 20px; }
.modal-content .score-big { font-size: 4em; font-weight: bold; color: #51cf66; margin: 20px 0; }
.modal-btn { padding: 12px 30px; border: none; border-radius: 8px; font-size: 1.1em; font-weight: 600; cursor: pointer; margin: 5px; transition: all 0.3s; }
.modal-btn.primary { background: #2a5298; color: white; }
.modal-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }

/* ── Exercise Info ── */
.exercise-info { background: #e7f5ff; border-left: 4px solid #2a5298; padding: 15px; margin-bottom: 15px; border-radius: 5px; }
.exercise-info h4 { color: #2a5298; margin-bottom: 8px; }
.requirement-list { list-style: none; padding: 0; }
.requirement-list li { padding: 5px 0; position: relative; padding-left: 25px; }
.requirement-list li:before { content: "○"; position: absolute; left: 5px; color: #ff6b6b; font-weight: bold; }
.requirement-list li.checked:before { content: "✓"; color: #51cf66; }

/* ── Mobile Drawer Toggle Button ── */
.mobile-drawer-toggle { display: none; }

/* ── Analysis Panel ── */
.analysis-panel {
    display: none; width: 100%; max-height: 70vh;
    background: #fff; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden; border: 2px solid #4dabf7; font-size: 0.82em;
}
.analysis-panel.open { display: flex; flex-direction: column; }
.analysis-header {
    background: linear-gradient(135deg, #0d47a1, #1565c0); color: white;
    padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
    font-weight: bold; font-size: 1.05em;
}
.analysis-header button { background: none; border: none; color: white; font-size: 18px; cursor: pointer; }
.analysis-body { padding: 10px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.analysis-section { margin-bottom: 12px; border: 1px solid #e9ecef; border-radius: 10px; overflow: hidden; }
.analysis-section-header {
    background: #f1f3f5; padding: 8px 12px; font-weight: bold; color: #333;
    display: flex; align-items: center; gap: 8px; font-size: 0.95em;
}
.analysis-section-body { padding: 8px 12px; }
.analysis-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f1f3f5; }
.analysis-item:last-child { border-bottom: none; }
.analysis-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }
.badge-ok { background: #d3f9d8; color: #2f9e44; }
.badge-warn { background: #fff3bf; color: #e67700; }
.badge-danger { background: #ffe3e3; color: #c92a2a; }
.badge-info { background: #d0ebff; color: #1864ab; }
.fuzzy-bar { height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; flex: 1; }
.fuzzy-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.lamp-brightness { transition: filter 0.5s ease, opacity 0.5s ease; }

/* ── Fault Severity Groups ── */
.fault-group { margin-bottom: 10px; border-radius: 8px; overflow: hidden; border: 1px solid #e9ecef; }
.fault-group:last-child { margin-bottom: 0; }
.fault-group-header {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    font-weight: 700; font-size: 0.9em; letter-spacing: 0.3px;
}
.fault-group-count {
    margin-left: auto; padding: 1px 8px; border-radius: 10px;
    font-size: 0.8em; font-weight: 700;
}
.fault-group.danger { border-left: 4px solid #c92a2a; }
.fault-group.danger .fault-group-header { background: #fff5f5; color: #c92a2a; }
.fault-group.danger .fault-group-count { background: #ffe3e3; color: #c92a2a; }
.fault-group.warning { border-left: 4px solid #e67700; }
.fault-group.warning .fault-group-header { background: #fff9db; color: #e67700; }
.fault-group.warning .fault-group-count { background: #fff3bf; color: #e67700; }
.fault-group.info { border-left: 4px solid #1864ab; }
.fault-group.info .fault-group-header { background: #e7f5ff; color: #1864ab; }
.fault-group.info .fault-group-count { background: #d0ebff; color: #1864ab; }
.fault-group-body { padding: 4px 8px; }
.fault-item {
    padding: 6px 10px; margin: 4px 0; border-radius: 6px;
    border: 1px solid transparent; transition: background 0.2s;
}
.fault-item:hover { filter: brightness(0.97); }
.fault-item.danger { background: #fff5f5; border-color: #ffc9c9; }
.fault-item.warning { background: #fff9db; border-color: #ffe066; }
.fault-item.info { background: #e7f5ff; border-color: #a5d8ff; }
.fault-item-header { display: flex; align-items: flex-start; gap: 6px; }
.fault-item-icon { flex-shrink: 0; font-size: 1em; line-height: 1.4; }
.fault-item-desc { font-weight: 600; font-size: 0.92em; line-height: 1.4; }
.fault-item-reco {
    font-size: 0.82em; color: #666; padding: 3px 0 0 22px;
    line-height: 1.45; border-top: 1px dashed #e9ecef; margin-top: 4px; padding-top: 4px;
}

/* ── Gamifi Bar ── */
.gamifi-bar {
    display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.12);
    padding: 4px 12px; border-radius: 20px; font-size: 0.8em; cursor: pointer; transition: background 0.3s;
}
.gamifi-bar:hover { background: rgba(255,255,255,0.22); }
.gamifi-level-badge {
    background: linear-gradient(135deg, #ffd700, #ffaa00); color: #5a3e00;
    font-weight: 800; padding: 2px 10px; border-radius: 12px; font-size: 0.85em;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4); white-space: nowrap;
}
.gamifi-xp-wrap { display: flex; align-items: center; gap: 6px; }
.gamifi-xp-bar { width: 80px; height: 8px; background: rgba(255,255,255,0.2); border-radius: 4px; overflow: hidden; }
.gamifi-xp-fill { height: 100%; background: linear-gradient(90deg, #ffd700, #ffaa00); border-radius: 4px; transition: width 0.8s ease; }
.gamifi-xp-text { font-size: 0.75em; opacity: 0.85; white-space: nowrap; }

/* ── Header action buttons (Bantuan, Reset) ── */
.hdr-btn {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.28);
    color: white; border-radius: 8px; padding: 5px 13px;
    cursor: pointer; transition: background 0.18s, transform 0.15s; line-height: 1;
    font-family: inherit;
}
.hdr-btn:hover  { background: rgba(255,255,255,0.26); transform: translateY(-1px); }
.hdr-btn:active { background: rgba(255,255,255,0.18); transform: translateY(0); }
.hdr-btn-icon   { font-size: 1.05em; font-weight: 700; }
.hdr-btn-label  { font-size: 0.6em; opacity: 0.88; letter-spacing: 0.3px; }

/* ── User Avatar (menggantikan gamifi-bar di header) ── */
.user-avatar-btn {
    position: relative; background: none; border: none; cursor: pointer;
    padding: 0; display: flex; align-items: center; flex-shrink: 0;
    transition: transform 0.2s;
}
.user-avatar-btn:hover { transform: scale(1.1); }
.user-avatar-ring {
    width: 38px; height: 38px; border-radius: 50%;
    /* conic-gradient sebagai ring progress XP */
    background: conic-gradient(#ffd700 var(--xp-pct, 0%), rgba(255,255,255,0.22) 0%);
    padding: 3px;
}
.user-avatar-inner {
    width: 100%; height: 100%; border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.55); overflow: hidden;
}
.user-avatar-initials { font-size: 1.1em; color: white; user-select: none; line-height: 1; }
.user-avatar-lvl {
    position: absolute; bottom: -3px; right: -4px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #5a3e00; font-size: 0.52em; font-weight: 800;
    padding: 1px 4px; border-radius: 8px; border: 1.5px solid white;
    white-space: nowrap; pointer-events: none;
}

/* ── Tombol Tentang (header-left) ── */
.hdr-about-btn {
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.28);
    color: rgba(255,255,255,0.85); border-radius: 50%;
    width: 26px; height: 26px; font-size: 0.9em; font-weight: 700;
    cursor: pointer; transition: background 0.18s, color 0.18s, transform 0.15s;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-family: inherit; line-height: 1;
}
.hdr-about-btn:hover { background: rgba(255,255,255,0.28); color: #fff; transform: scale(1.1); }

/* ── About Modal ── */
.about-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 8200; display: none; opacity: 0;
    transition: opacity 0.28s; backdrop-filter: blur(2px);
}
.about-overlay.open { display: block; opacity: 1; }

.about-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.93);
    width: min(560px, 96vw); max-height: 92vh;
    background: #fff; border-radius: 18px; overflow: hidden;
    z-index: 8201; display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    opacity: 0; transition: opacity 0.28s, transform 0.28s cubic-bezier(0.34,1.36,0.64,1);
}
.about-modal.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* Hero / header gradasi */
.about-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 55%, #1971c2 100%);
    padding: 32px 24px 28px; text-align: center; flex-shrink: 0;
}
.about-hero-glow {
    position: absolute; top: -40%; left: 50%; transform: translateX(-50%);
    width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.18) 0%, transparent 70%);
    pointer-events: none;
}
.about-hero-content { position: relative; z-index: 1; }
.about-logo { font-size: 2.8em; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3)); }
.about-title { font-size: 1.7em; font-weight: 800; color: #fff; margin: 0 0 2px; letter-spacing: 0.5px; }
.about-subtitle {
    font-size: 0.78em; color: rgba(255,255,255,0.75); margin: 0 0 10px;
    font-style: italic; letter-spacing: 0.3px;
}
.about-tagline {
    display: inline-block; background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.28); border-radius: 20px;
    padding: 4px 14px; font-size: 0.76em; color: rgba(255,255,255,0.92); font-weight: 600;
}
.about-close {
    position: absolute; top: 12px; right: 14px;
    background: rgba(255,255,255,0.16); border: none; color: white;
    border-radius: 50%; width: 30px; height: 30px; cursor: pointer;
    font-size: 1em; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; z-index: 2;
}
.about-close:hover { background: rgba(255,255,255,0.32); }

/* Body */
.about-body { overflow-y: auto; flex: 1; }

.about-section {
    padding: 16px 24px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.about-section:last-of-type { border-bottom: none; }
.about-section-title {
    font-size: 0.88em; font-weight: 700; color: #1e3c72;
    margin: 0 0 9px; display: flex; align-items: center; gap: 6px;
}
.about-desc {
    font-size: 0.82em; color: #444; line-height: 1.65; margin: 0;
}

/* Fitur grid */
.about-features {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.about-feat {
    display: flex; gap: 10px; align-items: flex-start;
    background: #f8f9fa; border-radius: 10px; padding: 10px 12px;
    font-size: 0.78em; color: #444; line-height: 1.4;
    border: 1px solid #e9ecef;
}
.about-feat-icon { font-size: 1.4em; flex-shrink: 0; line-height: 1; margin-top: 1px; }

/* Research badge */
.about-research {
    background: linear-gradient(135deg, #f0f4ff, #e7f5ff);
    border-left: 4px solid #4dabf7;
}
.about-research-badge {
    display: inline-block; background: #2a5298; color: #fff;
    font-size: 0.75em; font-weight: 700; padding: 3px 12px;
    border-radius: 12px; margin-bottom: 8px;
}
.about-research-text {
    font-size: 0.81em; color: #333; line-height: 1.6; margin: 0 0 8px;
}
.about-research-target {
    font-size: 0.76em; color: #555; line-height: 1.6;
}

/* Dev card */
.about-dev-card {
    display: flex; gap: 16px; align-items: center;
    background: linear-gradient(135deg, #fff9db, #fff3cd);
    border: 1.5px solid #ffd43b; border-radius: 14px;
    padding: 16px 18px;
}
.about-dev-avatar {
    width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 12px rgba(30,60,114,0.35);
    border: 3px solid rgba(255,255,255,0.8);
}
.about-dev-initials {
    font-size: 1.4em; font-weight: 800; color: #fff; letter-spacing: 1px;
}
.about-dev-name {
    font-size: 0.94em; font-weight: 800; color: #1e3c72; margin-bottom: 3px;
}
.about-dev-role {
    font-size: 0.78em; color: #666; margin-bottom: 7px; font-weight: 500;
}
.about-dev-uni {
    font-size: 0.76em; color: #444; line-height: 1.55;
}
.about-dev-uni-badge {
    display: inline-block; background: #1e3c72; color: #fff;
    font-size: 0.85em; font-weight: 700; padding: 1px 7px;
    border-radius: 6px; margin-right: 5px;
}

/* Footer modal */
.about-footer {
    padding: 12px 24px; background: #f8f9fa;
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 0.72em; color: #888; flex-shrink: 0;
    border-top: 1px solid #eee;
}
.about-footer-dot { opacity: 0.4; }

/* Mobile: modal full-screen hampir penuh */
@media (max-width: 768px) {
    .about-modal {
        top: auto; left: 0; right: 0; bottom: 0;
        transform: translateY(100%);
        width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0;
        transition: opacity 0.28s, transform 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    .about-modal.open { transform: translateY(0); opacity: 1; }
    .about-features { grid-template-columns: 1fr; }
    .about-hero { padding: 24px 18px 20px; }
    .about-logo { font-size: 2.2em; }
    .about-title { font-size: 1.4em; }
    .about-section { padding: 13px 16px 10px; }
    .about-dev-card { gap: 12px; padding: 13px 14px; }
    .about-dev-avatar { width: 52px; height: 52px; }
    .about-dev-name { font-size: 0.88em; }
    .hdr-about-btn { width: 24px; height: 24px; font-size: 0.82em; }
}

/* ── Help Panel ── */
.help-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.42);
    z-index: 8100; display: none; opacity: 0; transition: opacity 0.25s;
}
.help-overlay.open { display: block; opacity: 1; }

.help-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw;
    background: #fff; z-index: 8101;
    display: flex; flex-direction: column;
    box-shadow: -6px 0 28px rgba(0,0,0,0.22);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.help-panel.open { transform: translateX(0); }

.help-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px 12px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white; font-size: 0.95em; font-weight: 700; flex-shrink: 0;
}
.help-close {
    background: rgba(255,255,255,0.18); border: none; color: white;
    border-radius: 50%; width: 28px; height: 28px; cursor: pointer;
    font-size: 1em; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.help-close:hover { background: rgba(255,255,255,0.34); }

.help-panel-body { flex: 1; overflow-y: auto; }

.help-section {
    padding: 13px 18px 10px;
    border-bottom: 1px solid #f0f0f0;
}
.help-section:last-child { border-bottom: none; }
.help-section-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 0.88em; font-weight: 700; color: #1e3c72; margin-bottom: 9px;
}
.help-section-icon { font-size: 1.1em; }
.help-item {
    display: flex; gap: 8px; margin-bottom: 6px;
    font-size: 0.8em; color: #444; line-height: 1.45;
}
.help-item-badge {
    flex-shrink: 0; background: #e7f5ff; color: #1971c2;
    font-size: 0.72em; font-weight: 700; padding: 1px 6px;
    border-radius: 6px; align-self: flex-start; margin-top: 1px; white-space: nowrap;
}
.help-item-badge.mob { background: #f3f0ff; color: #7048e8; }
.help-kbd {
    display: inline-block; background: #f1f3f5; border: 1px solid #ced4da;
    border-radius: 4px; padding: 0 5px; font-family: monospace;
    font-size: 0.88em; color: #333;
}

/* Desktop: hide mobile-only sections; Mobile: hide desktop-only */
@media (min-width: 769px) { .help-mobile-only { display: none; } }
@media (max-width: 768px) {
    .help-desktop-only { display: none; }
    /* Help panel sebagai bottom sheet di mobile */
    .help-panel {
        top: auto; right: 0; left: 0; bottom: 0;
        width: 100%; height: 82vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .help-panel.open { transform: translateY(0); }
    /* Header buttons lebih kecil di mobile */
    .hdr-btn { padding: 4px 10px; }
    .hdr-btn-label { display: none; }
    .user-avatar-ring { width: 32px; height: 32px; }
    .header-right { gap: 8px; }
}

/* ── Feedback Panel ── */
.feedback-panel { display: flex; flex-direction: column; height: 100%; background: #fff; font-size: 0.85em; }
.feedback-header {
    background: linear-gradient(135deg, #1e3c72, #2a5298); color: white;
    padding: 10px 15px; display: flex; justify-content: space-between; align-items: center;
}
.feedback-header-title { font-weight: bold; font-size: 0.95em; }
.feedback-timer { background: rgba(255,255,255,0.2); padding: 3px 10px; border-radius: 12px; font-size: 0.8em; font-family: 'Courier New', monospace; }
.feedback-body { padding: 10px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.feedback-step {
    padding: 8px 10px; margin-bottom: 6px; border-radius: 8px; display: flex;
    align-items: center; gap: 10px; transition: all 0.3s; border: 1px solid #dee2e6; background: #f8f9fa;
}
.feedback-step.done { background: #d3f9d8; border-color: #8ce99a; }
.feedback-step.active { background: #e7f5ff; border-color: #4dabf7; box-shadow: 0 0 8px rgba(77,171,247,0.3); }
.feedback-step.active .step-num { background: #228be6; color: white; }
.step-num {
    width: 24px; height: 24px; border-radius: 50%; background: #dee2e6;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75em; flex-shrink: 0;
}
.feedback-step.done .step-num { background: #51cf66; color: white; }
.feedback-hint {
    margin-top: 8px; padding: 10px 12px; background: #fff3cd; border: 1px solid #ffc107;
    border-radius: 8px; font-size: 0.88em; color: #856404; animation: fadeInHint 0.4s ease;
}
.feedback-hint.lv2 { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.feedback-warning {
    margin-top: 6px; padding: 8px 10px; background: #fff3cd; border: 1px solid #ffc107;
    border-radius: 8px; font-size: 0.85em; color: #856404; animation: fadeInHint 0.4s ease;
}
.feedback-warning.error { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
@keyframes fadeInHint { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.feedback-footer {
    padding: 8px 14px; border-top: 1px solid #eee; display: flex;
    justify-content: space-between; align-items: center; font-size: 0.82em; color: #888;
}

/* ── Laporan Modal ── */
.laporan-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); z-index: 3000; align-items: center; justify-content: center;
}
.laporan-overlay.active { display: flex; }
.laporan-card {
    background: #fff; border-radius: 18px; max-width: 480px; width: 92%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35); overflow: hidden; animation: scaleIn 0.3s ease;
}
@keyframes scaleIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.laporan-header { background: linear-gradient(135deg, #1e3c72, #2a5298); color: white; padding: 20px 24px; text-align: center; }
.laporan-header h2 { margin: 0 0 4px; font-size: 1.3em; }
.laporan-header p { opacity: 0.8; font-size: 0.85em; margin: 0; }
.laporan-score-ring { width: 120px; height: 120px; margin: 20px auto; position: relative; }
.laporan-score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.laporan-score-ring .ring-bg { fill: none; stroke: #e9ecef; stroke-width: 10; }
.laporan-score-ring .ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.5s ease; }
.laporan-score-value { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2.2em; font-weight: 800; color: #1e3c72; }
.laporan-body { padding: 16px 24px; }
.laporan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.laporan-stat { background: #f8f9fa; border-radius: 10px; padding: 10px 12px; text-align: center; }
.laporan-stat-val { font-size: 1.5em; font-weight: 700; color: #2a5298; }
.laporan-stat-label { font-size: 0.75em; color: #888; margin-top: 2px; }
.laporan-bonus { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.laporan-bonus-tag { background: #d3f9d8; color: #2f9e44; padding: 4px 10px; border-radius: 12px; font-size: 0.78em; font-weight: 600; }
.laporan-bonus-tag.penalty { background: #ffe3e3; color: #c92a2a; }
.laporan-footer { padding: 14px 24px; border-top: 1px solid #eee; display: flex; gap: 10px; justify-content: center; }
.laporan-footer button { padding: 10px 24px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 0.9em; }
.laporan-footer .btn-primary { background: linear-gradient(135deg, #1e3c72, #2a5298); color: white; }
.laporan-footer .btn-secondary { background: #e9ecef; color: #555; }
.laporan-footer button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* ── Level-Up Overlay ── */
.levelup-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 4000; align-items: center; justify-content: center; flex-direction: column;
}
.levelup-overlay.active { display: flex; }
.levelup-content { text-align: center; animation: levelUpBounce 0.6s ease; }
@keyframes levelUpBounce { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.levelup-icon { font-size: 5em; margin-bottom: 10px; }
.levelup-title {
    font-size: 2.5em; font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ffaa00); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 8px;
}
.levelup-subtitle { color: rgba(255,255,255,0.8); font-size: 1.2em; margin-bottom: 20px; }
.levelup-level { display: inline-block; background: linear-gradient(135deg, #ffd700, #ffaa00); color: #5a3e00; padding: 8px 30px; border-radius: 25px; font-size: 1.3em; font-weight: 800; }
.levelup-particles { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; }
.levelup-particle { position: absolute; width: 10px; height: 10px; border-radius: 50%; animation: particleFall 2s ease-out forwards; }
@keyframes particleFall { 0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* ── Badge Popup ── */
.badge-popup {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5);
    background: white; border-radius: 16px; padding: 24px 32px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35); z-index: 3500; text-align: center;
    opacity: 0; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); pointer-events: none;
}
.badge-popup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.badge-popup-icon { font-size: 3em; margin-bottom: 8px; }
.badge-popup-title { font-size: 0.75em; text-transform: uppercase; color: #888; letter-spacing: 2px; margin-bottom: 4px; }
.badge-popup-name { font-size: 1.3em; font-weight: 700; color: #2a5298; }
.badge-popup-shine {
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255,215,0,0.15), transparent, rgba(255,215,0,0.1), transparent);
    animation: badgeSpin 3s linear infinite; pointer-events: none; border-radius: 16px;
}
@keyframes badgeSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Component Nomenclature Label ── */
.comp-label {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-family: 'Roboto Mono', 'Courier New', monospace; font-size: 10px; font-weight: 700;
    color: #1a3a6e; background: linear-gradient(160deg, #dce8ff, #c4d8ff);
    border: 1px solid #9bb8e8; border-radius: 3px; padding: 1px 6px;
    white-space: nowrap; z-index: 20; cursor: default; pointer-events: all;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.7), 0 1px 3px rgba(0,0,0,0.18);
    letter-spacing: 0.8px; user-select: none;
    transition: background 0.15s, border-color 0.15s;
}
.comp-label:hover {
    background: linear-gradient(160deg, #c4d8ff, #a8c5f8); border-color: #4a7fd4;
    cursor: text;
}
.comp-label-input {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-family: 'Roboto Mono', 'Courier New', monospace; font-size: 10px; font-weight: 700;
    color: #1a3a6e; background: #fff; border: 2px solid #4a7fd4; border-radius: 3px;
    padding: 1px 4px; width: 54px; text-align: center; outline: none; z-index: 200;
    box-shadow: 0 0 0 3px rgba(74,127,212,0.25);
}

/* ── Gamifi Detail Modal ── */
.gd-modal { max-width: 460px !important; text-align: left !important; padding: 0 !important; overflow: hidden; }
.gd-header {
    background: linear-gradient(135deg, #1e3c72, #2a5298); color: #fff;
    padding: 16px 20px 12px;
}
.gd-title { font-size: 1.15em; font-weight: 800; margin-bottom: 6px; }
.gd-summary-lv { font-size: 1.4em; font-weight: 800; }
.gd-summary-xp { font-size: 0.8em; opacity: 0.85; margin-top: 2px; }
.gd-tabs { display: flex; border-bottom: 2px solid #dee2e6; background: #f8f9fa; }
.gd-tab {
    flex: 1; padding: 9px 4px; border: none; background: none; cursor: pointer;
    font-size: 0.82em; font-weight: 600; color: #666; transition: all 0.2s;
}
.gd-tab.active { color: #2a5298; border-bottom: 2px solid #2a5298; margin-bottom: -2px; background: #fff; }
.gd-tab:hover:not(.active) { background: #e9ecef; color: #333; }
.gd-body { min-height: 180px; max-height: 290px; overflow-y: auto; }
.gd-pane { display: none; padding: 12px 16px; }
.gd-pane.active { display: block; }
/* Level rows */
.gd-level-row {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    border-radius: 8px; margin-bottom: 4px; background: #f8f9fa;
}
.gd-level-row.active { background: #e7f5ff; border: 1px solid #74c0fc; }
.gd-level-row.done { background: #d3f9d8; border: 1px solid #8ce99a; }
.gd-level-icon { font-size: 1.4em; flex-shrink: 0; }
.gd-level-info { flex: 1; min-width: 0; }
.gd-level-name { font-size: 0.82em; font-weight: 700; color: #333; display: block; }
.gd-level-bar { height: 6px; background: #dee2e6; border-radius: 3px; margin-top: 3px; overflow: hidden; }
.gd-level-fill { height: 100%; background: linear-gradient(90deg, #4dabf7, #1971c2); border-radius: 3px; transition: width 0.6s ease; }
.gd-level-row.done .gd-level-fill { background: linear-gradient(90deg, #51cf66, #2f9e44); }
.gd-level-row.active .gd-level-fill { background: linear-gradient(90deg, #ffd43b, #f59f00); }
.gd-level-xp { font-size: 0.72em; color: #888; flex-shrink: 0; }
/* Badge grid */
.gd-badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gd-badge {
    border-radius: 10px; padding: 10px 6px; text-align: center;
    background: #f8f9fa; border: 1px solid #dee2e6; transition: all 0.2s;
}
.gd-badge.earned { background: linear-gradient(135deg, #fff9db, #ffec99); border-color: #ffd43b; }
.gd-badge.locked { opacity: 0.45; filter: grayscale(1); }
.gd-badge-icon { font-size: 1.8em; margin-bottom: 4px; }
.gd-badge-name { font-size: 0.72em; font-weight: 700; color: #333; margin-bottom: 2px; }
.gd-badge-desc { font-size: 0.64em; color: #888; line-height: 1.3; }
/* XP History */
.gd-hist-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px; border-radius: 6px; margin-bottom: 3px; background: #f8f9fa;
    font-size: 0.8em;
}
.gd-hist-src { color: #555; flex: 1; }
.gd-hist-xp { font-weight: 700; color: #2f9e44; flex-shrink: 0; margin-left: 8px; }

/* ═══════════════════════════════════════════
   PAPER MODE CAD — Fase 14
   ═══════════════════════════════════════════ */

/* ── Paper Frame ── */
.paper-frame {
    position: absolute; left: 20px; top: 20px;
    background: #ffffff;
    box-shadow:
        0 0 0 1px #ccc,
        4px 6px 24px rgba(0,0,0,0.28),
        8px 12px 48px rgba(0,0,0,0.14);
    z-index: 0;
    pointer-events: none;
}

/* Inner border frame (25px left binding, 10px others — IEC standard margins) */
.paper-border-frame {
    position: absolute;
    top: 10px; right: 10px; bottom: 10px; left: 25px;
    border: 1.5px solid #333;
    pointer-events: none;
}
/* Binding fold line */
.paper-border-frame::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: -15px;
    border-left: 1px dashed #bbb;
}

/* ── Title Block ── */
.paper-title-block {
    position: absolute;
    bottom: 10px; right: 10px; left: 25px;
    pointer-events: all;
    border-top: 1.5px solid #333;
}

.ptb-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 10px;
    background: #fff;
    table-layout: fixed;
}
.ptb-col-a { width: 18%; }
.ptb-col-b { width: 46%; }
.ptb-col-c { width: 18%; }
.ptb-col-d { width: 18%; }

.ptb-table td {
    border: 1px solid #333;
    padding: 3px 6px;
    vertical-align: middle;
    height: 24px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.ptb-lbl {
    font-size: 8px; text-transform: uppercase;
    letter-spacing: 0.5px; color: #555; font-weight: 600;
    background: #f5f7fa;
}
.ptb-top-lbl { font-size: 7px; color: #777; background: #f5f7fa; }
.ptb-val { font-weight: 600; color: #1a1a1a; }
.ptb-center { text-align: center; }
.ptb-title-cell { font-size: 11px; font-weight: 700; color: #1e3c72; }

/* Editable cells — cursor text + hover highlight */
.ptb-editable {
    cursor: text;
    transition: background 0.15s;
}
.ptb-editable:hover { background: #edf5ff; outline: 1.5px solid #74c0fc; outline-offset: -1px; }

.ptb-input {
    width: 100%; border: none; outline: none; background: #e7f5ff;
    font-family: inherit; font-size: inherit; font-weight: 600; color: #1a1a1a;
    padding: 0; margin: 0;
}

/* School cell — bigger font */
td[data-field="school"] { font-size: 11px; font-weight: 800; color: #1e3c72; white-space: normal; line-height: 1.3; }

/* ── Paper Settings Panel ── */
.paper-settings-panel {
    position: fixed;
    bottom: 75px; right: 16px;
    width: 224px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 500;
    overflow: hidden;
    transform: translateY(12px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
}
.paper-settings-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}
.psp-header {
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff; padding: 10px 14px;
}
.psp-title { font-weight: 700; font-size: 0.9em; }
.psp-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.psp-section { display: flex; flex-direction: column; gap: 5px; }
.psp-label { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #888; }
.psp-btn-row { display: flex; gap: 6px; }

.psp-size-btn, .psp-orient-btn {
    flex: 1; padding: 6px 4px; border: 1.5px solid #dee2e6;
    border-radius: 8px; background: #f8f9fa; cursor: pointer;
    font-size: 0.8em; font-weight: 600; color: #555;
    text-align: center; line-height: 1.4; transition: all 0.15s;
}
.psp-size-btn:hover, .psp-orient-btn:hover { border-color: #74c0fc; background: #e7f5ff; color: #1971c2; }
.psp-size-btn.active, .psp-orient-btn.active {
    border-color: #1971c2; background: #1971c2; color: #fff;
}
.psp-size-btn small, .psp-orient-btn small { display: block; font-weight: 400; font-size: 0.82em; opacity: 0.85; }

.psp-toggle-section { flex-direction: row !important; justify-content: space-between; align-items: center; }

/* Toggle switch */
.psp-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.psp-switch input { opacity: 0; width: 0; height: 0; }
.psp-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #ccc; border-radius: 20px; transition: background 0.2s;
}
.psp-slider::before {
    content: ''; position: absolute;
    width: 14px; height: 14px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.psp-switch input:checked + .psp-slider { background: #1971c2; }
.psp-switch input:checked + .psp-slider::before { transform: translateX(16px); }

.psp-hint {
    font-size: 0.72em; color: #888; line-height: 1.4;
    background: #f8f9fa; border-radius: 6px; padding: 6px 8px;
}

/* ── Toolbar button active states ── */
#paperModeBtn.active { background: #e7f5ff; border-color: #4dabf7; }
#paperModeBtn.active .tool-icon { color: #1971c2; }

/* ── Scale Button (hover, top-left of component) ── */
.scale-btn {
    position: absolute; top: -13px; left: -13px; width: 26px; height: 26px;
    background: #4dabf7; color: white; border: 2px solid white; border-radius: 50%;
    cursor: pointer; font-size: 14px; font-weight: 900; display: none; z-index: 101;
    box-shadow: 0 2px 8px rgba(0,0,0,0.28); line-height: 22px; text-align: center;
    transition: background 0.15s, transform 0.15s;
}
.scale-btn::before { content: '⊞'; }
.placed-component:hover .scale-btn { display: block; }
.scale-btn:hover { background: #1971c2; transform: scale(1.15); }

/* ── Selection box + transform handles (hover & comp-active) ── */
.comp-sel-box {
    position: absolute; inset: -4px;
    border: 2px dashed #4dabf7; border-radius: 4px;
    pointer-events: none; display: none; z-index: 99;
}
.placed-component:hover .comp-sel-box,
.placed-component.comp-active .comp-sel-box { display: block; }

.comp-handle {
    position: absolute; width: 13px; height: 13px;
    background: white; border: 2px solid #4dabf7; border-radius: 50%;
    z-index: 102; display: none; touch-action: none;
}
.placed-component:hover .comp-handle,
.placed-component.comp-active .comp-handle { display: block; }

/* Corner handles — scale drag */
.comp-handle-tl { top: -5px; left: -5px; cursor: nwse-resize; }
.comp-handle-tr { top: -5px; right: -5px; cursor: nesw-resize; }
.comp-handle-bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.comp-handle-br { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Rotation handle — top center, click = rotate 90° CW */
.comp-handle-rot {
    top: -26px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 20px;
    background: #4dabf7; border-color: #1971c2;
    cursor: pointer; color: white;
    font-size: 13px; line-height: 16px; text-align: center;
    display: none;
}
.placed-component:hover .comp-handle-rot,
.placed-component.comp-active .comp-handle-rot { display: flex; align-items: center; justify-content: center; }
/* Stem line connecting rotation handle to component edge */
.comp-handle-rot::after {
    content: ''; position: absolute;
    left: 50%; top: 100%; transform: translateX(-50%);
    width: 1.5px; height: 6px; background: #4dabf7; pointer-events: none;
}

/* ── Floating Scale Toolbar ── */
.scale-toolbar {
    position: fixed; z-index: 8500;
    background: white; border: 1px solid #dee2e6;
    border-radius: 24px; padding: 6px 10px;
    display: flex; align-items: center; gap: 5px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    transform: translateX(-50%);
    user-select: none;
    animation: stbPop 0.16s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes stbPop {
    from { opacity:0; transform: translateX(-50%) scale(0.88) translateY(6px); }
    to   { opacity:1; transform: translateX(-50%) scale(1)    translateY(0);   }
}
.stb-preset {
    padding: 3px 10px; border: 1.5px solid #dee2e6; border-radius: 14px;
    background: #f8f9fa; cursor: pointer; font-size: 0.78em; font-weight: 700;
    color: #555; transition: all 0.12s; min-width: 30px; text-align: center;
}
.stb-preset.active { background: #1971c2; border-color: #1971c2; color: white; }
.stb-preset:hover:not(.active) { border-color: #74c0fc; background: #e7f5ff; color: #1971c2; }
.stb-step {
    width: 28px; height: 28px; border: 1.5px solid #dee2e6; border-radius: 50%;
    background: #f8f9fa; cursor: pointer; font-size: 1.15em; font-weight: 700;
    color: #333; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.12s; line-height: 1;
}
.stb-step:hover { border-color: #4dabf7; background: #e7f5ff; color: #1971c2; }
.stb-sep { width: 1px; height: 22px; background: #e9ecef; margin: 0 2px; flex-shrink: 0; }
.stb-val {
    font-size: 0.75em; font-weight: 700; color: #495057;
    min-width: 30px; text-align: center; font-family: 'Roboto Mono', monospace;
}

/* ── Component Transform Context Menu ── */
.comp-ctx-menu {
    position: fixed; z-index: 9000;
    background: #fff; border: 1px solid #dee2e6;
    border-radius: 10px; padding: 4px 0;
    min-width: 180px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.22);
    font-size: 0.83em;
    animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn { from { opacity:0; transform: scale(0.94); } to { opacity:1; transform: scale(1); } }
.ctx-item {
    padding: 7px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px;
    color: #333; transition: background 0.12s;
}
.ctx-item:hover { background: #e7f5ff; color: #1971c2; }
.ctx-danger { color: #c92a2a !important; }
.ctx-danger:hover { background: #fff5f5 !important; color: #c92a2a !important; }
.ctx-sep { height: 1px; background: #f0f0f0; margin: 3px 0; }

/* ── Export Panel ── */
.export-panel {
    position: fixed;
    bottom: 75px; right: 72px;
    width: 210px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 500;
    overflow: hidden;
    transform: translateY(12px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
}
.export-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}
.exp-header {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff; padding: 10px 14px; font-weight: 700; font-size: 0.88em;
}
.exp-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.exp-btn {
    width: 100%; padding: 8px 12px; border: 1.5px solid #dee2e6;
    border-radius: 8px; background: #f8f9fa; cursor: pointer;
    font-size: 0.82em; font-weight: 600; color: #333;
    text-align: left; transition: all 0.15s;
}
.exp-btn:hover { border-color: #4dabf7; background: #e7f5ff; color: #1971c2; }
.exp-pdf { border-color: #ffa94d; background: #fff4e6; color: #e67700; }
.exp-pdf:hover { border-color: #fd7e14; background: #ffe8cc; color: #d63800; }
.exp-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }
.exp-hint {
    font-size: 0.68em; color: #888; line-height: 1.4;
    background: #f8f9fa; border-radius: 6px; padding: 5px 7px;
}

/* ═══════════════════════════════════════════
   METER INSTRUMENTS — Avometer & Tang Ampere
   ═══════════════════════════════════════════ */

/* ── Floating Meter Panel ── */
.meter-panel {
    position: fixed; z-index: 1800; width: 230px;
    background: #1c1c1e; border-radius: 14px; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.08);
    font-family: Arial, sans-serif; font-size: 0.82em; color: #e0e0e0;
    user-select: none;
}
.meter-hdr {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 12px; background: #2c2c2e; cursor: grab;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-weight: 700; font-size: 0.9em; color: #f5f5f5;
}
.meter-hdr:active { cursor: grabbing; }
.meter-x {
    background: none; border: none; cursor: pointer; color: #888;
    font-size: 1.2em; line-height: 1; padding: 0 2px;
    transition: color 0.15s;
}
.meter-x:hover { color: #ff6b6b; }
.meter-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* ── Digital LCD Display ── */
.meter-lcd {
    background: #0d1a0d; color: #00e040;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 1.8em; font-weight: 700; text-align: right;
    padding: 8px 14px; border-radius: 8px;
    border: 1px solid #0a2a0a; letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(0,224,64,0.6), 0 0 20px rgba(0,224,64,0.2);
    min-height: 54px; display: flex; align-items: center; justify-content: flex-end;
    transition: color 0.2s;
}

/* ── Mode selector (V~, V—, Buzz) ── */
.mm-modes { display: flex; gap: 4px; }
.mm-mode {
    flex: 1; padding: 5px 4px; border: 1px solid #3a3a3c;
    border-radius: 8px; background: #2c2c2e; color: #aaa;
    cursor: pointer; font-size: 0.75em; font-weight: 700;
    text-align: center; transition: all 0.15s;
}
.mm-mode:hover { border-color: #555; color: #eee; }
.mm-mode.active { background: #1a3a1a; border-color: #00e040; color: #00e040; }

/* ── Probe rows ── */
.probe-row {
    display: flex; align-items: center; gap: 6px;
    background: #2c2c2e; border-radius: 8px; padding: 5px 8px;
}
.probe-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 6px currentColor;
}
.probe-btn {
    flex: 1; padding: 4px 6px; border: 1px solid #444; border-radius: 6px;
    background: #3a3a3c; color: #ddd; cursor: pointer;
    font-size: 0.75em; font-weight: 600; text-align: left; transition: all 0.15s;
}
.probe-btn:hover { border-color: #00e040; color: #00e040; background: #1a3a1a; }
.probe-rel {
    background: none; border: none; cursor: pointer; color: #666;
    font-size: 1em; padding: 0 2px; flex-shrink: 0; transition: color 0.15s;
}
.probe-rel:hover { color: #ff6b6b; }

/* ── Clamp jaw button ── */
.clamp-jaw, .clamp-rel-btn {
    padding: 7px 10px; border-radius: 8px; cursor: pointer;
    font-size: 0.82em; font-weight: 700; transition: all 0.15s; border: none;
}
.clamp-jaw { background: #1a3a1a; color: #00e040; border: 1px solid #00e040; }
.clamp-jaw:hover { background: #00e040; color: #0d1a0d; }
.clamp-rel-btn { background: #3a1a1a; color: #ff6b6b; border: 1px solid #ff4444; }
.clamp-rel-btn:hover { background: #ff4444; color: white; }

/* ── Status text ── */
.meter-status {
    font-size: 0.72em; color: #666; line-height: 1.4;
    padding: 4px 6px; background: #2c2c2e; border-radius: 6px;
    min-height: 32px; display: flex; align-items: center;
}

/* ── Cursor overrides in probe/clamp mode ── */
body.probe-mode .canvas-container,
body.probe-mode .canvas-area { cursor: crosshair !important; }
body.clamp-mode .canvas-container,
body.clamp-mode .canvas-area { cursor: cell !important; }

/* ── Meter toolbar button active states ── */
#multimeterBtn.active, #clampBtn.active {
    background: #1a3a1a; border-color: #00e040; color: #00e040;
}
#multimeterBtn.active .tool-icon, #clampBtn.active .tool-icon { filter: none; }

/* ── Export Capture Mode — sembunyikan semua chrome UI ── */
body.exporting .delete-btn,
body.exporting .scale-btn,
body.exporting .comp-sel-box,
body.exporting .comp-handle,
body.exporting .cable-delete-btn,
body.exporting .comp-ctx-menu,
body.exporting #scaleToolbar,
body.exporting .comp-label-input { display: none !important; }
body.exporting .terminal { visibility: hidden !important; }

/* ── Simulation Active Mode — sembunyikan elemen edit ── */
body.sim-active .delete-btn,
body.sim-active .scale-btn,
body.sim-active .comp-sel-box,
body.sim-active .comp-handle         { display: none !important; }
body.sim-active .terminal            { visibility: hidden; pointer-events: none; }
body.sim-active .cable-delete-btn    { display: none; }
body.sim-active .comp-label          { pointer-events: none; }
body.sim-active .placed-component    { cursor: default; }

/* ── Print / PDF export styles ── */
@media print {
    .header, .sidebar, .toolbar, .mobile-drawer-toggle, .right-sidebar,
    .right-dock, .zoom-controls, .delete-btn, .terminal,
    .comp-sel-box, .comp-handle,
    .levelup-overlay, .badge-popup, .modal, .paper-settings-panel,
    .export-panel, .comp-ctx-menu, .comp-label { display: none !important; }

    body { overflow: visible !important; background: white !important; }
    .main-container { display: block !important; }
    .canvas-container { overflow: visible !important; width: 100% !important; height: auto !important; }
    .canvas-area {
        transform: none !important;
        position: relative !important;
        overflow: visible !important;
    }
    .paper-frame { box-shadow: none !important; border: 1px solid #aaa !important; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Tablet
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar { width: 280px; }
    .component-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .header { padding: 8px 12px; flex-direction: row; gap: 8px; }
    .header-left { flex-direction: row; align-items: center; gap: 6px; flex: 1; min-width: 0; }
    .header-title { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-right { gap: 6px; flex-shrink: 0; }
    .header-right .modal-btn { padding: 5px 10px !important; font-size: 0.8em; }
    #simStatusBadge { font-size: 0.7em !important; padding: 3px 8px !important; }
    /* CSS layout tokens for bottom-sheet stacking */
    :root { --mob-toolbar-h: 58px; --mob-toggle-h: 36px; }

    .main-container { flex-direction: column; }
    .canvas-container { order: 1; flex: 1; min-height: 0; touch-action: none; overscroll-behavior: none; }

    /* ── Bottom toolbar — fixed, always visible ── */
    .toolbar {
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
        height: var(--mob-toolbar-h); padding: 6px 8px 6px 8px; gap: 4px;
        /* flex-start agar overflow scroll bekerja; center memotong sisi kiri/kanan */
        justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto;
        background: white; border-top: 1px solid #e9ecef;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.07);
        /* Ruang napas di ujung kanan agar tombol terakhir tidak tersembunyi di balik fade */
        padding-right: 48px;
    }

    /* ── Bottom-sheet handle — drag strip above toolbar ── */
    .mobile-drawer-toggle {
        position: fixed; bottom: var(--mob-toolbar-h); left: 0; right: 0; z-index: 401;
        display: flex; align-items: flex-end; justify-content: center; gap: 6px;
        height: var(--mob-toggle-h); padding: 0 12px 6px;
        background: white; border: none; border-radius: 14px 14px 0 0;
        border-top: 1px solid #e9ecef;
        cursor: pointer; font-size: 0.82em; font-weight: 700; color: #2a5298;
        box-shadow: 0 -3px 12px rgba(0,0,0,0.08); transition: background 0.2s;
    }
    /* Pill drag handle indicator */
    .mobile-drawer-toggle::before {
        content: ''; position: absolute; top: 8px;
        width: 36px; height: 4px; background: #dee2e6; border-radius: 2px;
    }
    .mobile-drawer-toggle:active { background: #f1f3f5; }
    .mobile-drawer-toggle .drawer-arrow { transition: transform 0.28s ease; display: inline-block; }
    .mobile-drawer-toggle.open .drawer-arrow { transform: rotate(180deg); }

    /* ── Component panel — bottom sheet that slides up ── */
    .sidebar {
        position: fixed; left: 0; right: 0; z-index: 400;
        bottom: calc(var(--mob-toolbar-h) + var(--mob-toggle-h));
        width: 100%; max-height: 0; border-radius: 0; border: none; box-shadow: none;
        background: white; overflow: hidden;
        transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.drawer-open {
        max-height: 58vh; overflow-y: auto; overflow-x: hidden;
        box-shadow: 0 -6px 28px rgba(0,0,0,0.13);
    }
    /* Inside bottom sheet: vertical grid layout */
    .sidebar-section { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; border-right: none; min-width: unset; }
    .sidebar-section#simInfoPanel, .sidebar-section:last-child { display: none; }
    .sidebar-section h3 { font-size: 0.85em; margin-bottom: 6px; border-bottom-width: 1px; padding-bottom: 4px; }
    .component-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
    .component-card { flex: none; width: auto; padding: 6px; border-radius: 8px; border-width: 1px; }
    .card-preview { height: 48px; margin-bottom: 3px; }
    .component-name { font-size: 0.65em; white-space: normal; line-height: 1.2; }
    .sidebar-toggle-btn { display: none; } /* collapse not needed on mobile */
    .tool-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; border-width: 1.5px; }
    .tool-icon { font-size: 16px; }
    .tool-label { font-size: 7px; }
    .terminal { width: 14px; height: 14px; margin: -2px 0 0 -2px; }
    .terminal::after { width: 28px; height: 28px; }
    /* comp-active sudah ditangani secara global — tidak perlu override khusus mobile */
    .status-bar { left: 50%; transform: translateX(-50%); right: auto; top: 5px; width: 90%; min-width: auto; }
    .right-dock { width: calc(100% - 10px); right: 5px; }
    .analysis-panel { max-height: 50vh; }
    .gamifi-bar { padding: 3px 8px; gap: 4px; }
    .gamifi-xp-bar { width: 50px; height: 6px; }
    .gamifi-level-badge { font-size: 0.7em; padding: 2px 6px; }
    .gamifi-xp-text { font-size: 0.65em; }
    .right-sidebar.open {
        position: fixed; top: 50px; right: 0;
        bottom: calc(var(--mob-toolbar-h) + var(--mob-toggle-h));
        width: 100% !important; min-width: 100% !important; z-index: 1500;
        border-left: none; box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    }
}

/* ── Mobile Real Device Fixes ── */
@media (max-width: 768px) {
    html, body { overscroll-behavior: none; -webkit-overflow-scrolling: touch; position: fixed; width: 100%; top: 0; left: 0; right: 0; bottom: 0; }
    .main-container { height: 0; flex: 1 1 0; overflow: hidden; display: flex; flex-direction: column; }
    .canvas-container { flex: 1 1 0; min-height: 0; overflow: hidden; }
    /* Toolbar: safe-area padding on notched phones (toolbar height = 58px + safe inset) */
    .toolbar {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        height: calc(var(--mob-toolbar-h) + env(safe-area-inset-bottom, 0px));
        scrollbar-width: none;
    }
    .toolbar::-webkit-scrollbar { display: none; }
    /* Push toggle/sheet above notch-extended toolbar */
    .mobile-drawer-toggle { bottom: calc(var(--mob-toolbar-h) + env(safe-area-inset-bottom, 0px)); }
    .sidebar { bottom: calc(var(--mob-toolbar-h) + var(--mob-toggle-h) + env(safe-area-inset-bottom, 0px)); }
    .header { padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
    .tool-btn { min-width: 48px; min-height: 48px; touch-action: manipulation; }
    .terminal { touch-action: none; }
    .placed-component, .canvas-area { -webkit-user-select: none; user-select: none; touch-action: none; }
    .component-card { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

/* ── Extra Small Phones ── */
@media (max-width: 400px) {
    .tool-btn { width: 40px; height: 40px; border-radius: 6px; }
    .tool-icon { font-size: 14px; }
    .tool-label { font-size: 6px; }
    .header-title { font-size: 0.88em; }
}

/* ═══════════════════════════════════════════
   BAGIAN 17 — MOBILE UX / FASE 17
   Resolusi Total Friksi Antarmuka Layar Sentuh
   ═══════════════════════════════════════════ */

/* §17-1: Toolbar scroll-snap + right-edge fade indicator (JS injects #toolbar-scroll-fade) */
@media (max-width: 768px) {
    .toolbar {
        scroll-snap-type: x proximity;
    }
    .tool-btn {
        scroll-snap-align: start;
    }
    /* Fixed right-edge fade — injected element, positioned fixed over toolbar */
    #toolbar-scroll-fade {
        position: fixed;
        right: 0;
        bottom: 0;
        width: 52px;
        pointer-events: none;
        z-index: 402;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.97) 68%);
        display: none;
        height: calc(var(--mob-toolbar-h, 58px) + env(safe-area-inset-bottom, 0px));
    }
}

/* §17-2 / §18-2: Zoom drawer pada mobile — Safety Zone
   Dipindah dari pojok kiri-bawah ke KANAN-TENGAH layar agar bebas dari
   benturan toolbar, mobile-drawer-toggle, dan sidebar panel komponen. */
@media (max-width: 768px) {
    .zoom-controls {
        /* Anchor kanan — jauh dari semua elemen bawah */
        right: 10px !important;
        left: auto !important;
        /* Posisi vertikal: tengah kanvas — aman antara header dan toolbar */
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 408;           /* di atas toolbar (400) tapi BAWAH overlay sheet (409) */
        align-items: flex-end;  /* panel rata kanan mengikuti trigger */
    }
    .zoom-drawer-toggle {
        font-size: 12px;
        padding: 5px 10px;
        /* Hilangkan 300ms tap-delay di Android — wajib agar tombol terasa responsif */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .zoom-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .zoom-panel {
        max-height: 40vh;
        overflow-y: auto;
        /* Pastikan panel tidak memblok pointer-events saat terbuka */
        pointer-events: auto;
    }
}

/* §17-3: Micro-Terminal Pinning — Re-kalibrasi Anatomi Terminasi Kabel
   ─────────────────────────────────────────────────────────────────────
   Prinsip: Titik terminal di mobile TIDAK di-scale-up (memenuhi ruang dan
   menghalangi pandangan jari). Sebagai gantinya:
   • Visual  : micro-dot 14×14px bertepi putih tajam + cincin merah tipis
   • Hitbox  : area tap tersembunyi 48×48px via ::after (JS proximity 32px)
   • Sumber  : terminal A yang dipilih — warna kuning + denyut lembut
   • Kabel   : preview line diangkat 8px di atas jari (di _setupTouchPreview) */

@media (max-width: 768px) {

    /* ── Semua terminal saat wiring aktif: crisp micro-dot, TANPA scale ── */
    body.wiring-active .terminal {
        transform: none !important;        /* batalkan JS scale(2.4) / scale(1.8) */
        background: #ff6b6b !important;
        border: 2px solid white !important;
        box-shadow:
            0 0 0 2px #c92a2a,
            0 0 0 5px rgba(201, 42, 42, 0.22) !important;
        z-index: 20 !important;
        /* Sengaja tanpa animasi — "crisp" = statis, tidak bergerak */
    }

    /* ── Hitbox tak kasat mata diperluas ke 48×48px (WCAG 48px touch target) ── */
    body.wiring-active .terminal::after {
        width: 48px !important;
        height: 48px !important;
    }

    /* ── Terminal terhubung (kabel sudah ada): hijau crisp ── */
    body.wiring-active .terminal.connected {
        background: #51cf66 !important;
        border-color: white !important;
        box-shadow:
            0 0 0 2px #2f9e44,
            0 0 0 5px rgba(47, 158, 68, 0.22) !important;
    }

    /* ── Terminal SUMBER (Titik-A yang baru dipilih): beacon kuning berdenyut ──
       Class .terminal-source di-toggle oleh _highlightTerminal() di WiringManager */
    body.wiring-active .terminal.terminal-source {
        background: #ffd43b !important;
        border: 2px solid #f59f00 !important;
        box-shadow:
            0 0 0 2px #f59f00,
            0 0 0 7px rgba(255, 212, 59, 0.55),
            0 0 18px rgba(255, 212, 59, 0.30) !important;
        transform: none !important;
        z-index: 50 !important;
        animation: terminalSourcePulse 1.4s ease-in-out infinite !important;
    }
    /* Hitbox terminal sumber juga 48px */
    body.wiring-active .terminal.terminal-source::after {
        width: 48px !important;
        height: 48px !important;
    }
}

/* Denyut hanya untuk terminal sumber (Titik-A) — melebar keluar, bukan berubah ukuran */
@keyframes terminalSourcePulse {
    0%, 100% {
        box-shadow:
            0 0 0 2px #f59f00,
            0 0 0 6px rgba(255, 212, 59, 0.55),
            0 0 16px rgba(255, 212, 59, 0.28);
    }
    50% {
        box-shadow:
            0 0 0 2px #f59f00,
            0 0 0 10px rgba(255, 212, 59, 0.35),
            0 0 22px rgba(255, 212, 59, 0.14);
    }
}

/* §17-5: Tap-and-tap wiring: cancel button is positioned above mobile toolbar in JS,
   but add a safe-area compensation via this rule so it's never hidden by notch bars */
@media (max-width: 768px) {
    #draft-cancel-btn {
        bottom: calc(106px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* §17 Wiring status toast — push it below header on mobile */
@media (max-width: 768px) {
    #wiring-status {
        top: 56px !important;
        font-size: 11px !important;
        padding: 8px 16px !important;
        max-width: 88vw !important;
        text-align: center !important;
        white-space: normal !important;
    }
}

/* ═══════════════════════════════════════════
   BAGIAN 16 — FAULT NOTIFICATION CARDS
   ═══════════════════════════════════════════ */

/* ── Toast Stack Container ── */
.toast-stack {
    position: fixed;
    top: 76px;
    right: 16px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    max-width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

/* ── Toast Card Base ── */
.toast-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    overflow: hidden;
    pointer-events: all;
    animation: toastSlideIn 0.35s cubic-bezier(0.22,1,0.36,1) both;
    position: relative;
    border-left: 5px solid #aaa;
}
.toast-card.toast-leaving {
    animation: toastSlideOut 0.3s ease forwards;
}

/* ── Severity Variants ── */
.toast-card.toast-danger  { border-left-color: #c92a2a; }
.toast-card.toast-warning { border-left-color: #e67700; }
.toast-card.toast-info    { border-left-color: #1864ab; }
.toast-card.toast-success { border-left-color: #2f9e44; }
.toast-card.toast-critical { border-left-color: #ff0000; box-shadow: 0 0 0 2px #ff4d4d, 0 4px 20px rgba(201,42,42,0.45); }

/* ── Header ── */
.toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px 8px;
}
.toast-header-danger  { background: #fff5f5; }
.toast-header-warning { background: #fff9db; }
.toast-header-info    { background: #e7f5ff; }
.toast-header-success { background: #ebfbee; }
.toast-header-critical { background: #ffe0e0; }

.toast-icon { font-size: 1.15em; flex-shrink: 0; }
.toast-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.88em;
    line-height: 1.3;
    color: #1a1a1a;
}
.toast-title.danger  { color: #c92a2a; }
.toast-title.warning { color: #b45309; }
.toast-title.info    { color: #1864ab; }
.toast-title.success { color: #2f9e44; }
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    color: #888;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.toast-close:hover { color: #333; }

/* ── Body ── */
.toast-body {
    padding: 0 12px 10px;
    font-size: 0.82em;
    color: #444;
    line-height: 1.5;
}
.toast-desc {
    margin-bottom: 6px;
    color: #555;
}
.toast-reco {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 6px 9px;
    color: #333;
    margin-bottom: 7px;
    border-left: 3px solid #dee2e6;
}
.toast-reco strong { color: #1a1a1a; }

/* ── PUIL Accordion ── */
.toast-accordion-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.78em;
    color: #1864ab;
    font-weight: 600;
    padding: 3px 0;
    user-select: none;
}
.toast-accordion-toggle:hover { color: #1558a8; text-decoration: underline; }
.toast-accordion-body {
    display: none;
    background: #f0f4ff;
    border-radius: 6px;
    padding: 7px 9px;
    margin-top: 4px;
    font-size: 0.78em;
    color: #2c3e50;
    border-left: 3px solid #4dabf7;
    line-height: 1.6;
}
.toast-accordion-body.open { display: block; }

/* ── Locate Button ── */
.toast-locate-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    padding: 5px 11px;
    background: #1e3c72;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.toast-locate-btn:hover { background: #2a5298; }

/* ── Timer Bar ── */
.toast-timer-bar {
    height: 3px;
    background: #dee2e6;
    position: relative;
    overflow: hidden;
}
.toast-timer-fill {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    animation: toastTimerShrink linear forwards;
}
.toast-danger  .toast-timer-fill { background: #c92a2a; }
.toast-warning .toast-timer-fill { background: #e67700; }
.toast-info    .toast-timer-fill { background: #1864ab; }
.toast-success .toast-timer-fill { background: #2f9e44; }

/* ── Danger Vignette ── */
.danger-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1999;
    border-radius: 0;
    animation: dangerVignette 0.6s ease-out forwards;
}
@keyframes dangerVignette {
    0%   { box-shadow: inset 0 0 80px 30px rgba(201,42,42,0.55); }
    100% { box-shadow: inset 0 0 80px 30px rgba(201,42,42,0); }
}

/* ── Component Locate Blink ── */
@keyframes compLocateBlink {
    0%, 100% { outline: 4px solid transparent; outline-offset: 3px; }
    25%, 75%  { outline: 4px solid #ff6b35; outline-offset: 3px; box-shadow: 0 0 18px 6px rgba(255,107,53,0.65); }
    50%       { outline: 4px solid #ffd43b; outline-offset: 3px; box-shadow: 0 0 24px 8px rgba(255,212,59,0.75); }
}
.comp-locate-blink {
    animation: compLocateBlink 0.5s ease-in-out 5;
    z-index: 999;
}

/* ── Toast Keyframes ── */
@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0);    opacity: 1; max-height: 300px; margin-top: 0; }
    to   { transform: translateX(120%); opacity: 0; max-height: 0;   margin-top: -10px; }
}
@keyframes toastTimerShrink {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── Toast / Notif — mobile override ── */
@media (max-width: 768px) {
    /* Fault cards: pindah ke bawah, di atas toolbar, full-width */
    .toast-stack {
        top: auto !important;
        bottom: calc(var(--mob-toolbar-h, 58px) + var(--mob-toggle-h, 36px) + 8px);
        right: 8px;
        left: 8px;
        width: auto;
        max-width: 100%;
        gap: 6px;
    }
    /* Animasi card: geser dari bawah (bukan dari kanan) */
    .toast-card {
        border-radius: 8px;
        animation: toastSlideInMob 0.28s cubic-bezier(0.22,1,0.36,1) both;
    }
    .toast-card.toast-leaving {
        animation: toastSlideOutMob 0.25s ease forwards;
    }
    /* Kompak: padding & font lebih kecil */
    .toast-header  { padding: 8px 10px 6px; gap: 5px; }
    .toast-title   { font-size: 0.82em; }
    .toast-icon    { font-size: 0.95em; }
    .toast-close   { font-size: 1em; padding: 0 4px; }
    .toast-body    { padding: 0 10px 8px; font-size: 0.78em; }
    .toast-reco    { padding: 5px 8px; font-size: 0.78em; }
    .toast-locate-btn { font-size: 0.78em; padding: 5px 10px; }
}

/* ═══════════════════════════════════════════
   ASSESSMENT REPORT MODAL (Fase 2)
   Prefix: ar-  (assessment report)
   ═══════════════════════════════════════════ */

/* ── Modal Overlay (reuses .laporan-overlay) ── */
.laporan-overlay {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.72);
    z-index: 3000;
    align-items: center; justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.laporan-overlay.active { display: flex; }

/* ── Card ── */
.laporan-card {
    background: #fff;
    border-radius: 20px;
    max-width: 640px; width: 100%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.38);
    overflow: hidden;
    animation: arSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
@keyframes arSlideUp {
    from { transform: translateY(32px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);     opacity: 1; }
}

/* ── Header ── */
.ar-header {
    padding: 22px 24px 18px;
    color: white;
    text-align: center;
    position: relative;
}
.ar-badge {
    display: inline-block;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(6px);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.ar-job-title {
    font-size: 1.25em;
    font-weight: 800;
    margin-bottom: 4px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.ar-timestamp {
    font-size: 0.75em;
    opacity: 0.75;
}
.ar-close-btn {
    position: absolute; top: 14px; right: 16px;
    background: rgba(255,255,255,0.2);
    border: none; color: white;
    width: 32px; height: 32px; border-radius: 50%;
    font-size: 16px; cursor: pointer; transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.ar-close-btn:hover { background: rgba(255,255,255,0.35); }

/* ── Main Row: Score + Radar ── */
.ar-main-row {
    display: flex;
    gap: 0;
    padding: 20px 24px 8px;
    align-items: flex-start;
}

/* ── Score Section ── */
.ar-score-section {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.ar-score-ring-wrap {
    width: 110px; height: 110px;
    position: relative;
    margin-bottom: 4px;
}
.ar-ring-svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.ar-ring-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 10;
}
.ar-ring-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    stroke-dasharray: 314 314;
    stroke-dashoffset: 314;
}
.ar-ring-value {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.1em;
    font-weight: 900;
    color: #1e3c72;
    letter-spacing: -1px;
}
.ar-score-label {
    font-size: 0.68em;
    font-weight: 700;
    color: #999;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ── 3D Competency Pills ── */
.ar-competency-row {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.ar-pill {
    background: #f8f9fa;
    border: 1.5px solid #e9ecef;
    border-radius: 10px;
    padding: 6px 10px;
    text-align: center;
    min-width: 46px;
}
.ar-pill-icon { font-size: 1.1em; line-height: 1; }
.ar-pill-score { font-size: 1.05em; font-weight: 800; line-height: 1.2; }
.ar-pill-label { font-size: 0.6em; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Radar Section ── */
.ar-radar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-left: 8px;
}
#arRadarCanvas {
    max-width: 220px;
    max-height: 220px;
    width: 100%;
    height: auto;
}
.ar-radar-legend {
    display: flex;
    gap: 12px;
    font-size: 0.72em;
    color: #666;
    align-items: center;
}
.ar-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Quick Stats Row ── */
.ar-stats-row {
    display: flex;
    gap: 8px;
    padding: 0 24px 16px;
    justify-content: space-between;
}
.ar-stat {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
}
.ar-stat-icon { font-size: 1.2em; }
.ar-stat-val { font-size: 1.15em; font-weight: 800; color: #2a5298; }
.ar-stat-label { font-size: 0.65em; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Sections ── */
.ar-section {
    margin: 0 16px 12px;
    border: 1.5px solid #e9ecef;
    border-radius: 14px;
    overflow: hidden;
}
.ar-section-title {
    background: #f8f9fa;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.88em;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e9ecef;
    justify-content: space-between;
}
.ar-section-title:hover { background: #f0f2f5; }
.ar-chevron { font-size: 0.8em; color: #aaa; transition: transform 0.2s; }

/* ── Rubric Rows ── */
.ar-rubric-list { padding: 8px 12px; }
.ar-rubric-row {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.ar-rubric-row:last-child { border-bottom: none; }
.ar-rubric-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.ar-rubric-icon { font-size: 0.95em; flex-shrink: 0; }
.ar-rubric-label { flex: 1; font-size: 0.83em; font-weight: 600; color: #333; }
.ar-rubric-weight { font-size: 0.7em; color: #aaa; }
.ar-rubric-score { font-size: 1em; font-weight: 800; min-width: 28px; text-align: right; }
.ar-rubric-bar-wrap { padding: 0 2px 2px; }
.ar-rubric-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: visible;
    position: relative;
}
.ar-rubric-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.ar-rubric-bench {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: #2f9e44;
    border-radius: 1px;
    opacity: 0.7;
}
.ar-rubric-desc { font-size: 0.72em; color: #888; line-height: 1.4; padding-left: 20px; }

/* ── Error Patterns ── */
.ar-patterns { border-color: #ffe3e3; }
.ar-patterns .ar-section-title { background: #fff5f5; color: #c92a2a; border-bottom-color: #ffc9c9; cursor: default; }
.ar-pattern-list {
    list-style: none;
    padding: 10px 14px;
    margin: 0;
}
.ar-pattern-list li {
    padding: 5px 0;
    font-size: 0.82em;
    color: #555;
    border-bottom: 1px dashed #f0f0f0;
}
.ar-pattern-list li::before { content: '⚠ '; color: #e67700; }
.ar-pattern-list li:last-child { border-bottom: none; }

/* ── AI Feedback Section ── */
.ar-feedback-section { border-color: #d0ebff; }
.ar-feedback-section .ar-section-title { background: #e7f5ff; color: #1864ab; border-bottom-color: #a5d8ff; cursor: default; }
.ar-feedback-body { padding: 12px 16px; }
.ar-feedback-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82em;
    color: #666;
}
.ar-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid #e9ecef;
    border-top-color: #1971c2;
    border-radius: 50%;
    animation: arSpin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes arSpin { to { transform: rotate(360deg); } }
.ar-feedback-content { font-size: 0.83em; line-height: 1.6; }
.ar-ai-narrative {
    background: #f0f7ff;
    border-left: 3px solid #1971c2;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    color: #333;
    margin-bottom: 10px;
}
.ar-ai-group { margin-bottom: 10px; }
.ar-ai-group strong { color: #333; display: block; margin-bottom: 4px; }
.ar-ai-group ul { margin: 0; padding-left: 18px; }
.ar-ai-group li { padding: 2px 0; color: #555; }
.ar-ai-encouragement {
    background: linear-gradient(135deg, #ebfbee, #d3f9d8);
    border: 1px solid #8ce99a;
    border-radius: 8px;
    padding: 10px 12px;
    color: #2f9e44;
    font-weight: 600;
    margin-bottom: 8px;
}
.ar-ai-model {
    font-size: 0.72em;
    color: #aaa;
    text-align: right;
    margin-top: 6px;
}

/* ── Footer ── */
.ar-footer {
    padding: 14px 20px;
    border-top: 1.5px solid #e9ecef;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    background: #fafafa;
}
.ar-btn {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.ar-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.ar-btn:active { transform: translateY(0); }
.ar-btn-primary { background: linear-gradient(135deg, #1e3c72, #2a5298); color: white; }
.ar-btn-secondary { background: #e9ecef; color: #495057; }
.ar-btn-export { background: linear-gradient(135deg, #2f9e44, #37b24d); color: white; }

/* ── Toolbar Asesmen button style ── */
.tool-btn.assessment {
    background: linear-gradient(135deg, #fff3cd, #ffe066);
    border-color: #f59f00;
    color: #7c5200;
}
.tool-btn.assessment:hover { border-color: #e67700; }
.tool-btn.assessment.active {
    background: linear-gradient(135deg, #f59f00, #e67700);
    color: white; border-color: #c15500;
}

/* ── AR Empty ── */
.ar-empty { padding: 12px; text-align: center; color: #aaa; font-size: 0.82em; }

/* ── Assessment Responsive ── */
@media (max-width: 600px) {
    .laporan-card { border-radius: 16px; }
    .ar-main-row { flex-direction: column; align-items: center; padding: 16px 16px 8px; }
    .ar-score-section { flex: none; }
    .ar-radar-section { padding-left: 0; }
    #arRadarCanvas { max-width: 200px; }
    .ar-stats-row { padding: 0 12px 12px; gap: 6px; }
    .ar-stat { padding: 8px 4px; }
    .ar-stat-val { font-size: 1em; }
    .ar-footer { justify-content: center; }
    .ar-btn { padding: 8px 14px; font-size: 0.8em; }
    .ar-section { margin: 0 10px 10px; }
}

/* ═══════════════════════════════════════════════════════════
   §18-3 — COMPACT APP-BAR & MORE SHEET  (Mobile Only)
   Perombakan Total Menu Laci Bawah:
   • Desktop : toolbar tetap seperti biasa, semua tombol tampil
   • Mobile  : hanya 5 tombol primer + "More" → sisa masuk grid sheet
   ═══════════════════════════════════════════════════════════ */

/* ── Desktop baseline: sembunyikan elemen khusus mobile ── */
#toolMoreBtn,
.tool-more-overlay,
.tool-more-sheet {
    display: none;
}

/* ── Mobile: aktifkan compact app-bar ── */
@media (max-width: 768px) {

    /* Sembunyikan tombol sekunder dari toolbar, tampilkan More */
    .toolbar .tool-btn:not(.tool-primary) { display: none; }
    #toolMoreBtn {
        display: flex !important;
        background: #f1f3f5;
        border-color: #adb5bd;
        color: #495057;
    }
    #toolMoreBtn:active { background: #dee2e6; }

    /* Compact bar: tengahkan 6 tombol, hapus padding fade lama */
    .toolbar {
        justify-content: center !important;
        gap: 8px !important;
        padding-right: 8px !important;
        overflow-x: hidden !important;
    }

    /* ── Overlay backdrop ── */
    .tool-more-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.38);
        z-index: 409;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s;
        touch-action: none;
    }
    .tool-more-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* ── Bottom sheet container ── */
    .tool-more-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0; right: 0;
        /* Duduk tepat di atas toolbar + safe-area */
        bottom: calc(var(--mob-toolbar-h, 58px) + env(safe-area-inset-bottom, 0px));
        background: #ffffff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.18);
        z-index: 410;
        will-change: transform;
        /* Tersembunyi: geser ke bawah tepat melewati viewport.
           Formula: 100% (tinggi sheet) + toolbar (58px) + safe-area + 2px buffer
           → top sheet berada 2px DI BAWAH viewport bottom, tidak ada yang nongol. */
        transform: translateY(calc(100% + var(--mob-toolbar-h, 58px) + env(safe-area-inset-bottom, 0px) + 2px));
        transition: transform 0.32s cubic-bezier(0.32, 0, 0.07, 1);
        max-height: 55vh;
        overflow: hidden;
    }
    .tool-more-sheet.open {
        transform: translateY(0);
    }

    /* Drag handle pill */
    .tool-more-handle {
        width: 36px; height: 4px;
        background: #dee2e6;
        border-radius: 2px;
        margin: 12px auto 0;
        flex-shrink: 0;
    }

    /* Sheet header */
    .tool-more-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 18px 6px;
        flex-shrink: 0;
    }
    .tool-more-title {
        font-size: 0.82em;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #868e96;
    }
    .tool-more-close {
        width: 28px; height: 28px;
        border: none;
        background: #f1f3f5;
        border-radius: 50%;
        cursor: pointer;
        font-size: 13px;
        color: #868e96;
        display: flex; align-items: center; justify-content: center;
        transition: background 0.15s;
        touch-action: manipulation;
    }
    .tool-more-close:active { background: #dee2e6; }

    /* 4-kolom icon grid */
    .tool-more-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        padding: 10px 16px 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tool-grid-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 14px 6px 12px;
        background: #f8f9fa;
        border: 1.5px solid #e9ecef;
        border-radius: 14px;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s, transform 0.1s;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        /* Reset button defaults */
        font-family: inherit;
        font-size: inherit;
    }
    .tool-grid-card:active {
        background: #e7f5ff;
        border-color: #74c0fc;
        transform: scale(0.95);
    }
    .tgc-icon {
        font-size: 24px;
        line-height: 1;
        display: block;
    }
    .tgc-label {
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        color: #495057;
        text-align: center;
        line-height: 1.2;
        letter-spacing: 0.03em;
    }
}
