/* ========================================================
   TOR TOR AI - Web Deteksi Gerakan Tarian Batak
   Desktop: Studio Light Theme
   Mobile (HP): 100% Fullscreen Portrait Camera (TikTok Style)
   ======================================================== */

:root {
    /* Backgrounds */
    --bg-page: #f8fafc;
    --bg-page-alt: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-border: #e2e8f0;
    --bg-card-border-subtle: #cbd5e1;

    /* Batak Gorga Colors */
    --gorga-red: #d90429;
    --gorga-red-dark: #b00220;
    --gorga-gold: #d97706;
    --gorga-gold-light: #fef3c7;
    --gorga-cyan: #0d9488;

    /* Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-card: 0 4px 14px -2px rgba(15, 23, 42, 0.06);
    --shadow-modal: 0 20px 45px -10px rgba(15, 23, 42, 0.22);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
}

/* ========================================================
   HEADER & NAVIGASI ATAS (DESKTOP)
   ======================================================== */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--bg-card-border);
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    gap: 0.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gorga-red), #9b0000);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(217, 4, 41, 0.25);
}

.brand h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Tombol */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.84rem;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gorga-red), #b00220);
    color: #fff;
    box-shadow: 0 2px 8px rgba(217, 4, 41, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 4, 41, 0.35);
}

.btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

.btn-outline {
    background: #ffffff;
    color: var(--text-secondary);
    border: 1px solid var(--bg-card-border-subtle);
}

.btn-outline:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    border-color: #94a3b8;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Status Badge Koneksi MySQL */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid var(--bg-card-border);
}

.status-online {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.status-offline {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.dot-online {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.dot-offline {
    width: 7px;
    height: 7px;
    background: #f97316;
    border-radius: 50%;
}

/* ========================================================
   KONTAINER UTAMA & HUD BAR (DESKTOP)
   ======================================================== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* HUD Statistik Bar */
.hud-bar {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.2rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1.2fr;
    gap: 1rem;
    align-items: center;
    box-shadow: var(--shadow-card);
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.hud-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.hud-val-highlight {
    color: var(--gorga-red);
}

.combo-high {
    color: var(--gorga-gold);
    animation: comboPulse 0.4s ease infinite alternate;
}

/* Gauge Akurasi Lingkaran */
.accuracy-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.accuracy-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: conic-gradient(var(--gorga-cyan) 0deg, #e2e8f0 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 6px rgba(13, 148, 136, 0.2);
    transition: background 0.2s ease;
}

.accuracy-circle::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
}

.accuracy-percent {
    position: relative;
    z-index: 2;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Timer Progress */
.hud-timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer-bar-container {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.timer-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--gorga-red), var(--gorga-gold));
    transition: width 0.1s linear;
}

/* Beat Pulse Indicator */
.beat-box {
    display: flex;
    align-items: center;
}

.beat-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: transform 0.1s ease, background 0.1s ease;
}

.beat-indicator.pulse-active {
    background: var(--gorga-gold);
    transform: scale(1.5);
    box-shadow: 0 0 8px rgba(217, 119, 6, 0.6);
}

/* ========================================================
   LAYOUT GAMEPLAY (DESKTOP)
   ======================================================== */
.game-viewport {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(350px, 1fr);
    gap: 1.25rem;
    align-items: start;
}

/* Kolom Kamera */
.camera-column {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.camera-container {
    position: relative;
    background: #0f172a;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--bg-card-border);
    box-shadow: var(--shadow-card);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Video element disembunyikan secara visual namun tetap aktif untuk iOS Safari & MediaPipe */
#webcamVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0.001;
    pointer-events: none;
    z-index: -10;
}

#poseCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Mode Luas: tidak terpotong / tidak nge-zoom */
    display: block;
}

/* Opsi Mode Penuh jika pengguna ingin layar penuh terpotong */
.camera-container.mode-cover #poseCanvas {
    object-fit: cover !important;
}

/* Coaching Strip di Bawah Kamera */
.coaching-strip {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-left: 4px solid var(--gorga-gold);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    box-shadow: var(--shadow-sm);
}

.coaching-icon {
    font-size: 1.15rem;
    color: var(--gorga-gold);
    flex-shrink: 0;
}

#coachingTip {
    line-height: 1.35;
    word-break: break-word;
}

/* Feedback Popups */
.judgment-toast {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

.judgment-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.judgment-perfect {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
    color: #1e1b4b;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.judgment-great {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(13, 148, 136, 0.6);
}

/* Countdown Overlay */
.countdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 30;
}

.countdown-overlay.active {
    display: flex;
}

.countdown-number {
    font-size: 4.8rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
    animation: zoomPulse 0.8s ease infinite;
}

.countdown-subtext {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f8fafc;
    margin-top: 0.4rem;
}

/* Pose Transition Alert */
.pose-transition-alert {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(217, 4, 41, 0.95);
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 15;
    box-shadow: 0 4px 15px rgba(217, 4, 41, 0.5);
}

.pose-transition-alert.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================================
   KARTU PANDUAN GERAKAN (DESKTOP SIDEBAR)
   ======================================================== */
.guide-card {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--border-radius);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
}

.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--bg-card-border);
    padding-bottom: 0.65rem;
    margin-bottom: 0.65rem;
}

.guide-title-box h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gorga-red);
}

.guide-batak-name {
    font-size: 0.78rem;
    color: var(--gorga-gold);
    font-weight: 700;
}

.timer-badge {
    background: #fef2f2;
    color: var(--gorga-red);
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #fecaca;
    white-space: nowrap;
}

/* Step Progress Tracker 4 Gerakan */
.step-progress-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 0.65rem;
}

.step-progress-item {
    background: #f8fafc;
    border: 1px solid var(--bg-card-border);
    border-radius: 6px;
    padding: 5px 2px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.step-progress-item:hover {
    background: #f1f5f9;
}

.step-progress-item .step-num {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
}

.step-progress-item .step-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 600;
}

.step-progress-item.active {
    background: #fff1f2;
    border-color: var(--gorga-red);
    box-shadow: 0 0 8px rgba(217, 4, 41, 0.2);
}

.step-progress-item.active .step-num,
.step-progress-item.active .step-label {
    color: var(--gorga-red);
    font-weight: 800;
}

/* Container Siluet & Foto Panduan Gerakan */
.silhouette-container {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 10px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    margin: 0.4rem 0;
    border: 1px solid var(--bg-card-border);
    position: relative;
}

.pose-img-card {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid var(--bg-card-border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, border-color 0.2s ease;
    padding: 0.4rem;
}

.pose-img-card:hover {
    transform: translateY(-2px);
    border-color: var(--gorga-red);
}

.pose-guide-img {
    height: 300px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 3px 8px rgba(15, 23, 42, 0.1));
}

.pose-img-overlay {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    padding: 0.25rem 0.65rem;
    border-radius: 16px;
    opacity: 0.9;
    pointer-events: none;
}

.pose-zoom-btn {
    font-size: 0.72rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

.pose-guide-hint {
    font-size: 0.78rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    text-align: center;
    margin-top: 0.5rem;
    width: 100%;
    line-height: 1.35;
    font-weight: 600;
}

.guide-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0.4rem 0;
}

.guide-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

/* ========================================================
   MODALS
   ======================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-modal);
    animation: modalIn 0.25s ease;
    color: var(--text-primary);
    max-height: 92vh;
    overflow-y: auto;
}

.modal-box.modal-wide {
    max-width: 820px;
}

.modal-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.modal-header-banner {
    text-align: center;
    margin-bottom: 1rem;
}

.modal-header-banner h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--gorga-red);
}

.modal-header-banner p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Form Inputs */
.form-group {
    margin-bottom: 0.85rem;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--gorga-red);
    box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.12);
    background: #ffffff;
}

/* Pratinjau 4 Gerakan di Modal Start */
.modal-start-box {
    max-width: 580px;
}

.start-poses-preview {
    background: #f8fafc;
    border: 1px solid var(--bg-card-border);
    border-radius: 10px;
    padding: 0.65rem;
    margin-bottom: 1rem;
}

.preview-heading {
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--gorga-red);
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.preview-poses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.preview-pose-card {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.preview-pose-card:hover {
    transform: translateY(-2px);
    border-color: var(--gorga-red);
}

.preview-pose-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f1f5f9 100%);
    padding: 3px;
    display: block;
}

.preview-badge {
    font-size: 0.65rem;
    color: var(--text-primary);
    padding: 4px 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #ffffff;
    border-top: 1px solid var(--bg-card-border);
    font-weight: 700;
}

.btn-start-action {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: 800;
}

/* Modal Lightbox */
.modal-lightbox {
    max-width: 560px;
    width: 94%;
    padding: 1.25rem;
}

.lightbox-modal-title {
    color: var(--gorga-red);
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
}

.lightbox-img-wrapper {
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f1f5f9 100%);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--bg-card-border);
    padding: 0.75rem;
}

.lightbox-img-wrapper img {
    max-height: 65vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.lightbox-tip {
    font-size: 0.82rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    text-align: center;
    margin-top: 0.65rem;
    font-weight: 600;
}

/* Modal Galeri 4 Ragam Gerakan */
.modal-all-poses {
    max-width: 900px;
    width: 96%;
    padding: 1.25rem;
}

.gallery-modal-title {
    color: var(--gorga-red);
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
}

.all-poses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.pose-gallery-card {
    background: #ffffff;
    border: 1px solid var(--bg-card-border);
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.gallery-img-box {
    position: relative;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f1f5f9 100%);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 0.5rem;
    border: 1px solid var(--bg-card-border);
    padding: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-img-box img {
    width: 100%;
    height: 190px;
    object-fit: contain;
    display: block;
}

.gallery-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--gorga-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.pose-gallery-card h4 {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 800;
}

.gallery-sub {
    font-size: 0.72rem;
    color: var(--gorga-gold);
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: block;
}

.pose-gallery-card p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Modal Game Over */
.modal-gameover-box {
    max-width: 480px;
}

.gameover-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--gorga-red);
}

.gameover-sub {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.player-name-highlight {
    color: var(--text-primary);
    font-weight: 800;
}

.text-red { color: var(--gorga-red); }
.text-gold { color: var(--gorga-gold); }
.text-cyan { color: var(--gorga-cyan); }
.text-center { text-align: center; }

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
}

.result-card {
    background: #f8fafc;
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.result-val {
    font-size: 1.45rem;
    font-weight: 800;
    margin-top: 0.15rem;
}

.grade-badge {
    display: inline-block;
    padding: 0.2rem 0.9rem;
    border-radius: 20px;
    font-size: 1.8rem;
    font-weight: 900;
}

.grade-s {
    background: #fef3c7;
    color: #b45309;
    border: 2px solid #f59e0b;
}

.grade-a {
    background: #ecfdf5;
    color: #047857;
    border: 2px solid #10b981;
}

.grade-b {
    background: #eff6ff;
    color: #1d4ed8;
    border: 2px solid #3b82f6;
}

.grade-c, .grade-d {
    background: #fef2f2;
    color: #b91c1c;
    border: 2px solid #ef4444;
}

.db-notice {
    font-size: 0.8rem;
    padding: 0.55rem;
    background: #f8fafc;
    border: 1px solid var(--bg-card-border);
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Leaderboard Table */
.table-responsive {
    overflow-x: auto;
    max-height: 380px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.custom-table th {
    background: #f8fafc;
    padding: 0.6rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid var(--bg-card-border);
}

.custom-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--bg-card-border);
    color: var(--text-primary);
}

.tab-nav {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--bg-card-border);
    padding-bottom: 0.4rem;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--gorga-red);
    color: #fff;
}

/* Animasi */
@keyframes zoomPulse {
    0% { transform: scale(0.6); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}


/* ==========================================================================
   KHUSUS HP / SMARTPHONE (LAYAR <= 768px):
   KAMERA 100% FULLSCREEN PORTRAIT (TIKTOK STYLE)
   SEMUA ELEMEN MENGAMBANG DI PINGGIR LAYAR (TIDAK MENGHALANGI BADAN PENARI)
   ========================================================================== */
@media (max-width: 768px) {
    html, body {
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        overflow: hidden !important;
        position: relative !important;
        background: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 1. Header Mengambang di Atas Layar */
    .app-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 50 !important;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%) !important;
        border: none !important;
        padding: 8px 12px !important;
        box-shadow: none !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .brand-icon {
        width: 26px !important;
        height: 26px !important;
    }

    .brand h1 {
        font-size: 0.95rem !important;
        color: #ffffff !important;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7) !important;
    }

    #dbStatusBadge {
        display: none !important;
    }

    .header-controls .btn-outline {
        background: rgba(15, 23, 42, 0.65) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
    }

    .btn-sm {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.74rem !important;
    }

    /* Tombol Zoom di header HP */
    #btnZoomToggle {
        background: rgba(15, 23, 42, 0.65) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
    }

    /* 2. Main Container & Game Viewport: Tidak Membatasi Layar */
    .main-container {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        overflow: hidden !important;
        display: block !important;
    }

    .game-viewport {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .camera-column {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. KAMERA PORTRAIT 100% FULLSCREEN SEPERTI TIKTOK */
    .camera-container {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        aspect-ratio: auto !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #000000 !important;
        z-index: 1 !important;
        overflow: hidden !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Canvas di HP: Default Mode Luas (contain) agar pandangan kamera luas & TIDAK NGE-ZOOM */
    #poseCanvas {
        position: absolute !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important; /* Luas, seluruh badan & tangan terlihat */
        display: block !important;
        margin: auto !important;
    }

    /* Opsi Layar Penuh (Cover) jika pengguna mengaktifkannya */
    .camera-container.mode-cover #poseCanvas {
        object-fit: cover !important;
    }

    /* 4. Bar HUD Statistik: Mengambang di Atas (Bawah Header) */
    .hud-bar {
        position: fixed !important;
        top: 48px !important;
        left: 8px !important;
        right: 8px !important;
        z-index: 45 !important;
        background: rgba(15, 23, 42, 0.68) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 12px !important;
        padding: 4px 10px !important;
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    }

    .hud-player {
        display: none !important;
    }

    .hud-label {
        font-size: 0.58rem !important;
        color: #94a3b8 !important;
    }

    .hud-val {
        font-size: 1.05rem !important;
        color: #ffffff !important;
    }

    .accuracy-circle {
        width: 28px !important;
        height: 28px !important;
        background: conic-gradient(var(--gorga-cyan) 0deg, rgba(255, 255, 255, 0.2) 0deg) !important;
    }

    .accuracy-circle::after {
        width: 20px !important;
        height: 20px !important;
        background: #0f172a !important;
    }

    .accuracy-percent {
        font-size: 0.6rem !important;
        color: #ffffff !important;
    }

    .timer-bar-container {
        height: 4px !important;
        background: rgba(255, 255, 255, 0.2) !important;
    }

    /* 5. Guide Card Kontainer: Transparan & Lepas (Children Menjadi Floating) */
    .guide-card {
        display: contents !important;
    }

    /* 6. Pill Judul Gerakan Mengambang di Bawah HUD */
    .guide-header {
        position: fixed !important;
        top: 102px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 44 !important;
        background: rgba(15, 23, 42, 0.72) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        border-radius: 20px !important;
        padding: 3px 12px !important;
        margin: 0 !important;
        border-bottom: none !important;
        pointer-events: auto !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
    }

    .guide-title-box h3 {
        font-size: 0.8rem !important;
        color: #ffd700 !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6) !important;
    }

    .guide-batak-name {
        display: none !important;
    }

    #poseTimerBadge {
        display: none !important;
    }

    .guide-desc {
        display: none !important;
    }

    /* 7. Step Indicator Vertikal di Pojok Kiri Atas */
    .step-progress-wrapper {
        position: fixed !important;
        top: 102px !important;
        left: 8px !important;
        z-index: 45 !important;
        pointer-events: auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        width: 28px !important;
        margin: 0 !important;
    }

    .step-progress-item {
        width: 28px !important;
        height: 28px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        background: rgba(15, 23, 42, 0.7) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35) !important;
    }

    .step-progress-item .step-num {
        font-size: 0.72rem !important;
        color: #e2e8f0 !important;
    }

    .step-progress-item .step-label {
        display: none !important;
    }

    .step-progress-item.active {
        background: var(--gorga-red) !important;
        border-color: #ffd700 !important;
        box-shadow: 0 0 10px rgba(217, 4, 41, 0.9) !important;
    }

    .step-progress-item.active .step-num {
        color: #ffffff !important;
        font-weight: 900 !important;
    }

    /* 8. Floating PiP Target Pose di Pojok Kanan Atas (Aman, Tidak Mengganggu Tubuh Penari) */
    .silhouette-container {
        position: fixed !important;
        top: 102px !important;
        right: 8px !important;
        z-index: 45 !important;
        pointer-events: auto !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
        width: 80px !important;
    }

    .pose-img-card {
        width: 80px !important;
        border-radius: 10px !important;
        background: rgba(15, 23, 42, 0.75) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1.5px solid var(--gorga-gold) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
        padding: 2px !important;
        overflow: hidden !important;
    }

    .pose-guide-img {
        height: 120px !important;
        width: 100% !important;
        object-fit: contain !important;
    }

    .pose-img-overlay {
        display: none !important;
    }

    .pose-guide-hint {
        display: none !important;
    }

    /* 9. Coaching Strip Mengambang di Bawah */
    .coaching-strip {
        position: fixed !important;
        bottom: 58px !important;
        left: 10px !important;
        right: 10px !important;
        z-index: 45 !important;
        background: rgba(15, 23, 42, 0.75) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-left: 3px solid var(--gorga-gold) !important;
        border-radius: 20px !important;
        padding: 5px 12px !important;
        color: #ffffff !important;
        font-size: 0.8rem !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    #coachingTip {
        color: #f8fafc !important;
    }

    /* 10. Tombol Kontrol Mengambang di Paling Bawah Layar */
    .guide-controls {
        position: fixed !important;
        bottom: 12px !important;
        left: 10px !important;
        right: 10px !important;
        z-index: 45 !important;
        pointer-events: auto !important;
        display: flex !important;
        gap: 6px !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    .guide-controls .btn {
        background: rgba(15, 23, 42, 0.72) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.22) !important;
        color: #ffffff !important;
        border-radius: 20px !important;
        padding: 6px 14px !important;
        font-size: 0.8rem !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
    }

    .guide-controls .btn:hover {
        background: rgba(217, 4, 41, 0.85) !important;
        border-color: var(--gorga-red) !important;
    }

    /* 11. Modal Start & Lightbox Full Responsif di HP */
    .modal-box {
        padding: 1.15rem 0.95rem;
        max-height: 90vh;
        width: 94%;
        border-radius: 14px;
    }

    .modal-start-box {
        max-width: 95%;
    }

    .preview-poses-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .preview-pose-card img {
        height: 80px;
        padding: 2px;
    }

    .preview-badge {
        font-size: 0.6rem;
        padding: 3px 1px;
    }

    .all-poses-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .gallery-img-box img {
        height: 140px;
    }

    .pose-gallery-card {
        padding: 0.5rem;
    }

    .pose-gallery-card h4 {
        font-size: 0.8rem;
    }

    .gallery-sub {
        font-size: 0.68rem;
    }

    .pose-gallery-card p {
        font-size: 0.7rem;
    }

    .result-val {
        font-size: 1.25rem;
    }
}
