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

:root {
    --bg: #F7F7F7;
    --card-bg: #EFEFEF;
    --text-primary: #2D2D2D;
    --text-secondary: #6B6B6B;
    --text-muted: #A0A0A0;
    --border: #D8D8D8;
    --accent: #2D2D2D;
    --white: #FFFFFF;
}

html, body {
    height: 100%;
    /* Default: no scroll - viewer mode */
    overflow: hidden;
}

body.viewer-scroll,
body.editor-mode {
    overflow: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text-primary);
}

/* Top Navigation */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.logo svg {
    color: var(--text-primary);
}

.nav-spacer {
    width: 120px;
}

/* Dynamic Stepper */
.dynamic-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    height: 40px;
    width: 100%;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 0.4;
    transform: scale(0.9);
}

.step-item.mulai-step {
    opacity: 1;
    transform: scale(1);
    background: var(--text-primary);
    color: var(--white);
    cursor: default;
}

.step-item.mulai-step .step-circle {
    width: 10px;
    height: 10px;
    background: transparent;
    border: 2px solid var(--white);
}

.step-item.active {
    opacity: 1;
    transform: scale(1);
    background: var(--text-primary);
    color: var(--white);
}

.step-item.active .step-circle {
    background: var(--white);
    color: var(--text-primary);
}

.step-item.completed {
    opacity: 0.7;
    transform: scale(0.95);
}

.step-item.completed:hover {
    opacity: 1;
    transform: scale(1);
}

.step-item:hover:not(.active) {
    opacity: 0.8;
    background: rgba(45, 45, 45, 0.08);
}

.step-item.hoverable:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.step-item.active .step-circle {
    background: var(--white);
    color: var(--text-primary);
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.step-item.active .step-label {
    font-weight: 600;
}

.step-separator {
    width: 24px;
    height: 2px;
    background: var(--border);
    transition: all 0.3s ease;
}

.step-item.completed + .step-separator,
.step-item.completed ~ .step-separator {
    background: var(--text-primary);
    opacity: 0.3;
}

/* Question numbers (when not first step) */
.step-item.question-step {
    padding: 6px 12px;
}

.step-item.question-step .step-circle {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
}

/* Main Container - Full screen, centered */
.main-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
    background: var(--bg);
    z-index: 10;
}

/* When the Back/Next bar is visible, lift the card so nothing hides behind it */
body.nav-visible .main-container {
    padding-bottom: 88px;
}

.form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 640px;
}

/* Question Card */
.question-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 48px 56px;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

/* Start Screen */
.start-screen {
    text-align: center;
    animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes cardFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

.question-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    animation: fadeSlideIn 0.4s ease 0.1s both;
    flex-shrink: 0;
}

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

.q-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.q-arrow {
    color: var(--text-muted);
}

.question-text {
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.question-text strong {
    font-weight: 700;
}

.question-text .greeting {
    font-weight: 700;
}

.question-text.changing {
    opacity: 0;
    transform: translateY(8px);
}

.question-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    animation: fadeSlideIn 0.4s ease 0.15s both;
    flex-shrink: 0;
}

/* Question Image */
.question-image {
    width: 100%;
    height: 200px;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
    background: var(--card-bg);
    flex-shrink: 0;
    animation: fadeSlideIn 0.4s ease 0.12s both;
}

.question-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    pointer-events: none;
    user-select: none;
}

/* Options List */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
    min-height: 120px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 8px;
    flex-shrink: 1;
    scroll-behavior: smooth;
}

/* Many options (5+): compact grid that fits the screen — no hidden-below-the-fold options */
.options-list.grid-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    max-height: none;
    overflow-y: visible;
    min-height: 0;
    padding-right: 0;
    align-items: stretch;
}

.option-btn.compact {
    padding: 11px 13px;
    gap: 10px;
    border-radius: 10px;
    min-height: 46px;
    animation-delay: 0.15s !important;
}

.option-btn.compact .option-text {
    font-size: 0.86rem;
    line-height: 1.35;
}

.option-btn.compact .option-key {
    flex-shrink: 0;
}

.options-list::-webkit-scrollbar {
    width: 4px;
}

.options-list::-webkit-scrollbar-track {
    background: transparent;
}

.options-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.options-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Text Input Container */
.text-input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-input {
    width: 100%;
    padding: 16px 20px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    transition: all 0.2s ease;
    line-height: 1.6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.text-input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(45, 45, 45, 0.1);
}

.text-input::placeholder {
    color: var(--text-muted);
}

.text-input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Option Buttons */
.option-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    width: 100%;
    opacity: 0;
    transform: translateY(12px);
    animation: optionFadeIn 0.4s ease forwards;
}

.option-btn:nth-child(1) { animation-delay: 0.2s; }
.option-btn:nth-child(2) { animation-delay: 0.3s; }
.option-btn:nth-child(3) { animation-delay: 0.4s; }
.option-btn:nth-child(4) { animation-delay: 0.45s; }

@keyframes optionFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option-btn:hover {
    border-color: var(--text-secondary);
    background: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.option-btn.selected {
    border-color: var(--text-primary);
    background: var(--white);
    box-shadow: 0 0 0 2px var(--text-primary), 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.option-btn.selected:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px var(--text-primary), 0 12px 28px rgba(0, 0, 0, 0.15);
}

.option-key {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-btn.selected .option-key {
    background: var(--text-primary);
    color: var(--white);
    transform: scale(1.05);
}

.option-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Continue Button */
.continue-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--text-primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    animation: btnFadeIn 0.4s ease 0.5s forwards;
    flex-shrink: 0;
}

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

.continue-btn:hover:not(:disabled) {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.continue-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.continue-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 60%, transparent);
}

.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--text-primary);
    transform: scale(1.03);
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.nav-btn.next-btn {
    background: var(--text-primary);
    color: var(--white);
    border-color: var(--text-primary);
}

.nav-btn.next-btn:hover:not(:disabled) {
    background: #1a1a1a;
}

.scroll-arrows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scroll-btn {
    width: 28px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.scroll-btn:hover:not(:disabled) {
    background: var(--card-bg);
    color: var(--text-primary);
    transform: scale(1.05);
}

.scroll-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Start Screen Styles */
.start-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.start-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.name-input {
    width: 100%;
    padding: 16px 20px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    background: var(--white);
}

.name-input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.1);
}

.name-input::placeholder {
    color: var(--text-muted);
}

/* Results Summary */
.results-summary {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 48px 56px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    animation: cardFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-summary h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    animation: fadeSlideIn 0.4s ease 0.1s both;
}

.results-summary > p {
    color: var(--text-muted);
    margin-bottom: 32px;
    animation: fadeSlideIn 0.4s ease 0.15s both;
}

.result-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
    text-align: left;
}

.result-item {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    align-items: center;
    gap: 16px;
    opacity: 0;
    animation: fadeSlideIn 0.4s ease forwards;
}

.result-item:nth-child(1) { animation-delay: 0.3s; }
.result-item:nth-child(2) { animation-delay: 0.4s; }
.result-item:nth-child(3) { animation-delay: 0.5s; }

.result-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.result-item .bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.result-item .fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-item span:last-child {
    text-align: right;
    font-weight: 600;
    font-size: 1rem;
}

.results-summary > .continue-btn {
    opacity: 1;
    animation: fadeSlideIn 0.4s ease 0.6s both;
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Shake animation for validation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* Responsive */
@media (max-width: 768px) {
    .top-nav {
        padding: 16px 20px;
    }

    .nav-spacer {
        display: none;
    }

    .step-label {
        display: none;
    }

    .step-item {
        padding: 6px 10px;
    }

    .step-separator {
        width: 16px;
    }

    .question-card {
        padding: 32px 24px;
    }

    .question-text {
        font-size: 1.4rem;
    }

    .option-btn {
        padding: 14px 16px;
    }

    .option-btn.compact {
        padding: 9px 11px;
        min-height: 42px;
    }

    .option-btn.compact .option-text {
        font-size: 0.78rem;
    }

    .results-summary {
        padding: 32px 24px;
    }

    .main-container {
        padding: 70px 16px 60px;
    }
}

/* Checkbox option buttons */
.option-btn.checkbox-btn .option-key {
    width: 20px;
    height: 20px;
    padding: 3px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 4px;
}

.option-btn.checkbox-btn.selected .option-key {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.option-btn.checkbox-btn.selected .checkbox-icon {
    display: none !important;
}

.option-btn.checkbox-btn.selected .checkbox-checked-icon {
    display: block !important;
}

/* Section Screen */
.section-screen {
    text-align: center;
    padding: 32px 16px;
    background: var(--white);
    border-radius: 16px;
    border: 1.5px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.section-screen .section-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.section-continue-btn {
    opacity: 1 !important;
    animation: none !important;
    display: inline-block;
    width: auto;
    padding: 14px 40px;
}

/* Section stepper */
.step-item.section-step .step-circle {
    background: #1e88e5;
    color: #fff;
}

.step-item.section-step.active .step-circle {
    background: #fff;
    color: #1e88e5;
}

.step-item.section-step .step-label {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1e88e5;
}

.step-item.section-step.active .step-label {
    color: #fff;
}