﻿/* ============================================================
   ALVA QUIZ â€” style.css
   Target: 1080 x 1920 portrait kiosk
   ============================================================ */

@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_thin.otf') format('opentype');
    font-weight: 100;
    font-style: normal;
}
@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'MadeOuterSans';
    src: url('../assets/fonts/made_outer_sans_black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
}

/* ---- Reset & Base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --w: 1080px;
    --h: 1920px;
    --green:  #2afec4;
    --green2: #1fd9a8;
    --blue:   #29fec4;
    --dark:   #050a14;
    --glass:  rgba(5, 10, 20, 0.72);
    --glass2: rgba(42, 254, 196, 0.08);
    --border: rgba(42, 254, 196, 0.25);
    --radius: 28px;
    --font:   'MadeOuterSans', sans-serif;
}

html, body {
    width: var(--w);
    height: var(--h);
    overflow: hidden;
    background: #000;
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ---- Screen Layer ---------------------------------------- */
.screen {
    position: absolute;
    inset: 0;
    width: var(--w);
    height: var(--h);
    display: none;
    overflow: hidden;
}
.screen.active { display: block; }

#s1 {
    opacity: 0;
    transition: opacity 1s ease;
}
#s1.active {
    display: block;
}
#s1.fade-in-done {
    opacity: 1;
}

/* ---- Video Background ------------------------------------ */
.video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ---- Dark Gradient Overlay ------------------------------- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 120px;
    background: linear-gradient(
        to top,
        rgba(5,10,20,0.92) 0%,
        rgba(5,10,20,0.55) 45%,
        transparent 100%
    );
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
#s-loading {
    background: var(--dark);
    z-index: 100;
    transition: opacity 0.8s ease;
}
#s-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 80px;
}
.loading-logo {
    width: 280px;
    opacity: 0.9;
}
.loading-title {
    font-size: 36px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    letter-spacing: 8px;
    text-transform: uppercase;
}
.loading-bar-wrap {
    width: 700px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}
.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--green), var(--blue));
    border-radius: 3px;
    transition: width 0.3s ease;
}
.loading-status {
    font-size: 30px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
}
.loading-pct {
    font-size: 80px;
    font-weight: 900;
    color: var(--green);
    text-shadow: 0 0 40px rgba(42,254,196,0.5);
    line-height: 1;
}

/* ============================================================
   STATE 0 â€” IDLE
   ============================================================ */
#s0 .overlay { justify-content: center; background: none; }

.logo-idle {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    z-index: 3;
}

.btn-start {
    position: relative;
    z-index: 5;
    width: 560px;
    height: 160px;
    border: none;
    border-radius: 0;
    background: url('../assets/images/play.png') center / contain no-repeat;
    background-color: transparent;
    color: #fff;
    font-family: var(--font);
    font-size: 50px;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
    margin-top: 80vh;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}
.btn-start:active {
    transform: scale(0.96);
}
.btn-start-pulse {
    animation: pulse-start 2s ease-in-out infinite;
}
@keyframes pulse-start {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 18px rgba(42, 254, 196, 0.7))
                drop-shadow(0 0 40px rgba(41, 254, 196, 0.4));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 40px rgba(42, 254, 196, 1))
                drop-shadow(0 0 80px rgba(41, 254, 196, 0.7));
    }
}

/* ============================================================
   STATE 2-5 â€” QUESTION
   ============================================================ */
.question-overlay {
    justify-content: center;
    background: transparent;
    padding: 80px;
    padding-bottom: 80px; /* Override the 120px bottom padding from .overlay */
    gap: 40px;
}

.question-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(255,255,255,0.1);
    z-index: 10;
}
.question-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--blue));
    transition: width 0.5s ease;
}

.question-counter {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}
.question-num {
    font-size: 96px;
    font-weight: 900;
    color: var(--green);
    line-height: 1;
    text-shadow: 0 0 40px rgba(42,254,196,0.5);
}
.question-of {
    font-size: 40px;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
}

.question-text {
    font-size: 52px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    text-align: left;
    width: 100%;
    margin-bottom: 20px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
}

/* wrapper = border layer dengan clip-path */
.choice-btn-wrap {
    width: 100%;
    padding: 2px;
    background: var(--border);
    clip-path: polygon(
        15px 0%, calc(100% - 15px) 0%,
        100% 15px, 100% calc(100% - 15px),
        calc(100% - 15px) 100%, 15px 100%,
        0% calc(100% - 15px), 0% 15px
    );
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.choice-btn-wrap.selected {
    background: var(--green);
    box-shadow: 0 0 50px rgba(42,254,196,0.4);
}

/* button = konten di dalam wrapper */
.choice-btn {
    width: 100%;
    min-height: 130px;
    padding: 20px 48px;
    border: none;
    border-radius: 0;
    background: var(--glass);
    backdrop-filter: blur(20px);
    color: #fff;
    font-family: var(--font);
    font-size: 38px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 36px;
    clip-path: polygon(
        13px 0%, calc(100% - 13px) 0%,
        100% 13px, 100% calc(100% - 13px),
        calc(100% - 13px) 100%, 13px 100%,
        0% calc(100% - 13px), 0% 13px
    );
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.choice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--green2), var(--blue));
    opacity: 0;
    transition: opacity 0.2s ease;
}
.choice-btn:active::before { opacity: 0.15; }
.choice-btn:active { transform: scale(0.98); }
.choice-btn-wrap.selected .choice-btn {
    background: rgba(42,254,196,0.15);
}

.choice-label {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    color: var(--dark);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.choice-text {
    position: relative;
    z-index: 1;
    line-height: 1.3;
}

/* ============================================================
   STATE 7 â€” RESULT SCREEN
   ============================================================ */
#s7 {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.result-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 80px 40px;
    background: transparent;
    text-align: center;
    overflow: hidden;
}
.result-badge {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--green);
    border: 2px solid var(--border);
    padding: 14px 44px;
    border-radius: 60px;
    margin-bottom: 28px;
    background: var(--glass2);
}
.result-motor-img {
    width: 760px;
    height: 340px;
    object-fit: contain;
    filter: drop-shadow(0 0 50px rgba(42,254,196,0.45));
    margin-bottom: 20px;
}
.result-motor-name {
    font-size: 76px;
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 0 60px rgba(42,254,196,0.4), 2px 4px 16px rgba(0,0,0,0.9);
    margin-bottom: 14px;
}
.result-tagline {
    font-size: 38px;
    font-weight: 600;
    color: var(--green);
    text-shadow: 2px 4px 16px rgba(0,0,0,0.9);
    margin-bottom: 16px;
}
.result-desc {
    font-size: 30px;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    text-shadow: 1px 2px 10px rgba(0,0,0,0.9);
    line-height: 1.45;
    max-width: 860px;
    margin-bottom: 28px;
}
/* Answers section */
.result-answers-section {
    width: 100%;
    max-width: 920px;
    margin-bottom: 32px;
}
.result-answers-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--green);
    text-transform: uppercase;
    margin-bottom: 18px;
    opacity: 0.85;
}
.result-answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* wrapper border untuk answer item */
.result-answer-wrap {
    width: 100%;
    padding: 1px;
    background: rgba(42,254,196,0.25);
    clip-path: polygon(
        10px 0%, calc(100% - 10px) 0%,
        100% 10px, 100% calc(100% - 10px),
        calc(100% - 10px) 100%, 10px 100%,
        0% calc(100% - 10px), 0% 10px
    );
}
.result-answer-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(42,254,196,0.06);
    border: none;
    border-radius: 0;
    padding: 16px 28px;
    text-align: left;
    clip-path: polygon(
        9px 0%, calc(100% - 9px) 0%,
        100% 9px, 100% calc(100% - 9px),
        calc(100% - 9px) 100%, 9px 100%,
        0% calc(100% - 9px), 0% 9px
    );
}
.answer-num {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    min-width: 48px;
}
.answer-key-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--blue));
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
    flex-shrink: 0;
}
.answer-text-val {
    font-size: 26px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    line-height: 1.3;
}

/* ============================================================
   STATE 8 â€” PHOTO BOOTH
   ============================================================ */
.photobooth-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
}
.webcam-frame {
    width: 800px;
    height: 800px;
    border-radius: 50%;
    overflow: hidden;
    border: 6px solid var(--green);
    box-shadow: 0 0 80px rgba(42,254,196,0.5);
    position: relative;
    background: #000;
}
#webcam-live {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.countdown-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    z-index: 5;
}
.countdown-overlay.hidden { display: none; }
#countdown-num {
    font-size: 280px;
    font-weight: 900;
    color: var(--green);
    text-shadow: 0 0 80px rgba(42,254,196,0.8);
    animation: countdown-pop 1s ease-in-out;
}
@keyframes countdown-pop {
    0%   { transform: scale(1.4); opacity: 0; }
    30%  { transform: scale(1);   opacity: 1; }
    80%  { transform: scale(1);   opacity: 1; }
    100% { transform: scale(0.6); opacity: 0; }
}

.btn-capture {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 6px solid var(--green);
    background: var(--glass);
    backdrop-filter: blur(20px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px rgba(42,254,196,0.4);
    transition: all 0.2s ease;
}
.btn-capture:active {
    transform: scale(0.92);
    box-shadow: 0 0 30px rgba(42,254,196,0.3);
}
.btn-capture svg { width: 100px; height: 100px; fill: var(--green); }
.capture-hint {
    font-size: 36px;
    color: rgba(255,255,255,0.7);
    font-weight: 400;
    letter-spacing: 2px;
}

/* ============================================================
   STATE 8b â€” PHOTO PREVIEW
   ============================================================ */
.photo-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 50px;
    background: rgba(5,10,20,0.7);
    backdrop-filter: blur(10px);
}
/* btn-process override */
#btn-process {
    font-size: 38px;
}
.preview-label {
    font-size: 48px;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 4px;
    text-transform: uppercase;
}
#photo-canvas {
    width: 700px;
    height: 700px;
    border-radius: 32px;
    border: 4px solid var(--border);
    object-fit: cover;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
}

/* ============================================================
   STATE 9 â€” PROCESSING
   ============================================================ */
#s9 {
    background: var(--dark);
}
.processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    text-align: center;
    padding: 80px;
    transform: scale(0.8);
    transform-origin: center center;
}
.ai-spinner {
    width: 200px;
    height: 200px;
    border: 8px solid rgba(42,254,196,0.15);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.processing-title {
    font-size: 64px;
    font-weight: 800;
    color: #fff;
    text-shadow: 2px 4px 16px rgba(0,0,0,0.9);
}
.processing-subtitle {
    font-size: 40px;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
    text-shadow: 1px 2px 10px rgba(0,0,0,0.9);
    max-width: 800px;
    line-height: 1.4;
}
.progress-bar-wrap {
    width: 800px;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--blue));
    border-radius: 6px;
    animation: progress-anim 90s ease-out forwards;
}
@keyframes progress-anim {
    0%   { width: 0%; }
    20%  { width: 40%; }
    50%  { width: 70%; }
    75%  { width: 85%; }
    90%  { width: 92%; }
    100% { width: 95%; }
}
#processing-status {
    font-size: 36px;
    color: var(--green);
    font-weight: 500;
    text-shadow: 1px 2px 10px rgba(0,0,0,0.9);
}
.ai-error-box {
    margin-top: 32px;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    border-radius: 16px;
    padding: 28px 36px;
    text-align: center;
    max-width: 700px;
}
.ai-error-msg {
    font-size: 28px;
    color: #fca5a5;
    margin-bottom: 24px;
    line-height: 1.5;
}
.ai-error-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-retry {
    padding: 18px 40px;
    font-size: 26px;
    font-weight: 700;
    background: var(--green);
    color: #000;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}
.btn-retry:hover { opacity: 0.85; }
.btn-retake-err {
    padding: 18px 40px;
    font-size: 26px;
    font-weight: 700;
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}
.btn-retake-err:hover { opacity: 0.85; }
.btn-cancel-err {
    padding: 18px 40px;
    font-size: 26px;
    font-weight: 700;
    background: #7f1d1d;
    color: #fca5a5;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}
.btn-cancel-err:hover { opacity: 0.85; }
.hidden { display: none !important; }

/* ============================================================
   STATE 10 â€” FINAL RESULT
   ============================================================ */
#s10 {
    background: var(--dark);
}
.final-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 60px 40px;
    overflow-y: hidden;
    gap: 40px;
    background: linear-gradient(180deg, rgba(5,10,20,0.95) 0%, rgba(5,10,20,0.85) 100%);
}
.final-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
}
.ai-result-frame {
    width: 506px;
    height: 900px;
    overflow: hidden;
    border-radius: 40px;
    border: 4px solid var(--border);
    box-shadow: 0 0 80px rgba(42,254,196,0.3);
    flex-shrink: 0;
}
#ai-result-img {
    width: auto;
    height: 100%;
    display: block;
}
.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.qr-label {
    font-size: 38px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    text-align: center;
}
#qr-code-container canvas,
#qr-code-container img {
    border-radius: 20px;
    background: #fff;
    padding: 16px;
}

/* ============================================================
   SHARED BUTTONS
   ============================================================ */
.btn-primary-wrap {
    padding: 2px;
    background: var(--green);
    clip-path: polygon(
        15px 0%, calc(100% - 15px) 0%,
        100% 15px, 100% calc(100% - 15px),
        calc(100% - 15px) 100%, 15px 100%,
        0% calc(100% - 15px), 0% 15px
    );
    box-shadow: 0 0 60px rgba(42,254,196,0.5);
    transition: all 0.15s ease;
    display: inline-block;
}
.btn-primary-wrap:active {
    transform: scale(0.96);
    box-shadow: 0 0 30px rgba(42,254,196,0.3);
}
.btn-primary {
    width: 800px;
    height: 140px;
    border: none;
    border-radius: 0;
    font-family: var(--font);
    font-size: 50px;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--dark);
    background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
    cursor: pointer;
    clip-path: polygon(
        13px 0%, calc(100% - 13px) 0%,
        100% 13px, 100% calc(100% - 13px),
        calc(100% - 13px) 100%, 13px 100%,
        0% calc(100% - 13px), 0% 13px
    );
    transition: all 0.15s ease;
}
.btn-primary:active {
    transform: scale(0.96);
}
.btn-secondary {
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 70px;
    font-family: var(--font);
    font-size: 38px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    padding: 28px 80px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-secondary:active {
    border-color: var(--green);
    color: var(--green);
}
.btn-restart {
    width: 600px;
    height: 110px;
    border: 2px solid var(--border);
    border-radius: 55px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    font-family: var(--font);
    font-size: 38px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 2px;
}
.btn-restart:active {
    border-color: var(--green);
    color: var(--green);
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* State 9 â€” needs flex not block */
.s9-flex.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
