* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f7f8fa;
    overflow: hidden; 
}

body.result-open {
    overflow: auto; 
}

/* ── NAV ── */
nav {
    background: #e74c3c;
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: white;
    text-decoration: none;
}

.nav-logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-logo img {
    width: 30px;
    height: 30px;
}

.nav-brand-text {
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 1px;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity .3s;
}

.nav-menu a:hover {
    opacity: .8;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .5rem;
    user-select: none;
    color: white;
}

.dropdown-arrow {
    font-size: .7rem;
    transition: transform .3s;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    min-width: 250px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
    border-radius: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s, transform .3s;
    margin-top: .5rem;
    padding: .5rem 0;
    max-height: 0;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    max-height: 500px;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: .8rem 1.5rem;
    color: #666;
    transition: background .3s, color .3s;
    border-radius: 5px;
    margin: 0 .5rem;
}

.dropdown-menu a:hover {
    background: #f8f8f8;
    color: #e74c3c;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
}

/* ── LAYOUT ── */
.main-content {
    margin-top: 70px;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.main-content.scrollable {
    height: auto;
    overflow: visible;
}

.page-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
}

.page-wrapper.scrollable {
    height: auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── HERO SECTION ── */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 70px);
    padding: 2rem 1.5rem;
    overflow: hidden;
    position: relative;
}

.back-btn {
    position: absolute;
    top: 7.5rem;
    left: 1.5rem;
    color: #e74c3c;
    text-decoration: none;
    font-size: .98rem;
    font-weight: 600;
    transition: opacity .2s;
}

.back-btn:hover {
    opacity: .7;
}

.hero-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.1rem;
    animation: fadeUp .5s ease-out;
}

.header-badge {
    display: inline-block;
    background: #fff3e0;
    border: 1.5px solid #ffcc80;
    color: #e65100;
    font-size: .72rem;
    font-weight: 700;
    padding: 5px 18px;
    border-radius: 30px;
    letter-spacing: .8px;
}

.page-title {
    color: #e74c3c;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

.page-sub {
    color: #888;
    font-size: .95rem;
    max-width: 440px;
    line-height: 1.65;
}

.btn-start {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 15px 48px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, transform .2s, box-shadow .2s;
    box-shadow: 0 4px 20px rgba(231, 76, 60, .35);
    margin-top: .5rem;
}

.btn-start:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(231, 76, 60, .45);
}

/* ── RESULT WRAPPER ── */
.result-wrapper {
    animation: fadeUp .4s ease-out;
}

.page-header {
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.content-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto;
}

.summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sum-pill {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: .78rem;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.single-result-card {
    background: white;
    border-radius: 16px;
    padding: .5rem 1.6rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .07);
}

.single-row {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 0;
    gap: 6px;
}

.single-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #e74c3c;
    margin-bottom: 4px;
}

.single-val {
    font-size: .9rem;
    color: #444;
    line-height: 1.65;
}

.single-divider {
    height: 1px;
    background: #f3f3f3;
}

.save-row {
    display: flex;
    gap: 10px;
}

.btn-reset {
    background: #f5f5f5;
    color: #666;
    border: none;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
}

.btn-reset:hover {
    background: #eee;
}

.btn-save {
    flex: 1;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 11px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
}

.btn-save:hover {
    background: #c0392b;
}


/*  QUIZ MODAL */
.quiz-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn .25s ease;
}

.quiz-overlay.hidden {
    display: none;
}

.quiz-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
    animation: slideUp .3s ease-out;
}

/* Progress */
.quiz-progress-track {
    height: 5px;
    background: #f0f0f0;
    flex-shrink: 0;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #ff7f70);
    border-radius: 0 5px 5px 0;
    transition: width .4s ease;
}

/* Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.quiz-step-label {
    font-size: .78rem;
    font-weight: 700;
    color: #e74c3c;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.quiz-close-btn {
    background: #f5f5f5;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: .85rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.quiz-close-btn:hover {
    background: #eee;
}

/* Body */
.quiz-body {
    flex: 1;
    overflow-y: auto;
    padding: 26px 26px 12px;
}

.quiz-q {
    display: none;
    animation: fadeUp .3s ease-out;
}

.quiz-q.active {
    display: block;
}

.q-emoji {
    font-size: 2rem;
    margin-bottom: 10px;
}

.q-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 5px;
    line-height: 1.35;
}

.q-hint {
    font-size: .8rem;
    color: #bbb;
    margin-bottom: 18px;
}

/* Grid options (Q1, Q4) */
.opts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.opt-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 16px 8px;
    border: 2px solid #ebebeb;
    border-radius: 14px;
    cursor: pointer;
    transition: all .2s;
    background: white;
    text-align: center;
}

.opt-tile:hover {
    border-color: #e74c3c;
    background: #fff8f8;
}

.opt-tile.selected {
    border-color: #e74c3c;
    background: #fdecea;
}

.ot-icon {
    font-size: 1.7rem;
}

.ot-name {
    font-size: .8rem;
    font-weight: 700;
    color: #333;
}

.opt-tile.selected .ot-name {
    color: #c0392b;
}

.ot-desc {
    font-size: .68rem;
    color: #bbb;
}

/* List options (Q2, Q3, Q5) */
.opts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border: 2px solid #ebebeb;
    border-radius: 14px;
    cursor: pointer;
    transition: all .2s;
    background: white;
}

.opt-row:hover {
    border-color: #e74c3c;
    background: #fff8f8;
}

.opt-row.selected {
    border-color: #e74c3c;
    background: #fdecea;
}

.or-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.or-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.or-name {
    font-size: .88rem;
    font-weight: 600;
    color: #333;
}

.opt-row.selected .or-name {
    color: #c0392b;
}

.or-desc {
    font-size: .73rem;
    color: #aaa;
    margin-top: 2px;
}

.or-check {
    font-size: 1.1rem;
    color: #ccc;
    flex-shrink: 0;
    transition: color .2s;
}

.opt-row.selected .or-check {
    color: #e74c3c;
}

/* Footer */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 26px 20px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.quiz-btn-back {
    background: none;
    border: 1.5px solid #ddd;
    color: #888;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}

.quiz-btn-back:hover {
    border-color: #aaa;
    color: #444;
}

.quiz-btn-next {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 11px 28px;
    border-radius: 10px;
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}

.quiz-btn-next:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
}

.quiz-btn-next:disabled {
    background: #ddd;
    color: #aaa;
    cursor: not-allowed;
    transform: none;
}


/* GENERATING OVERLAY */
.gen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gen-overlay.hidden {
    display: none;
}

.gen-box {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2.2rem;
    text-align: center;
    max-width: 320px;
    width: 90%;
    animation: slideUp .3s ease-out;
}

.gen-emoji {
    font-size: 3rem;
    animation: bounce 1s ease-in-out infinite;
    margin-bottom: .8rem;
}

.gen-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #222;
    margin-bottom: .4rem;
}

.gen-status {
    font-size: .85rem;
    color: #999;
    margin-bottom: 1.2rem;
    min-height: 1.3em;
    transition: opacity .3s;
}

.gen-bar-wrap {
    height: 6px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.gen-bar {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #ff7f70);
    border-radius: 6px;
    width: 0%;
    transition: width .5s ease;
}

.gen-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.gen-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e74c3c;
    animation: dotPulse 1.2s ease-in-out infinite;
    opacity: .3;
}

.gen-dots span:nth-child(2) {
    animation-delay: .2s;
}

.gen-dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        opacity: .3;
        transform: scale(1);
    }

    40% {
        opacity: 1;
        transform: scale(1.3);
    }
}


/* SAVE MODAL */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 4000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    max-width: 360px;
    width: 90%;
    text-align: center;
    animation: slideUp .3s ease-out;
}

.modal-icon {
    font-size: 2.2rem;
    margin-bottom: .7rem;
}

.modal-content h3 {
    font-size: 1.2rem;
    color: #222;
    margin-bottom: .4rem;
}

.modal-content p {
    color: #666;
    font-size: .9rem;
    margin-bottom: 1.6rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-modal {
    padding: 9px 24px;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    min-width: 100px;
}

.btn-yes {
    background: #e74c3c;
    color: white;
}

.btn-yes:hover {
    background: #c0392b;
}

.btn-no {
    background: #f0f0f0;
    color: #555;
}

.btn-no:hover {
    background: #e0e0e0;
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #27ae60;
    color: white;
    padding: .75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: .9rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    opacity: 0;
    transition: opacity .3s, transform .3s;
    z-index: 5000;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── UTILITY ── */
.hidden {
    display: none !important;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* RESPONSIVE */

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #e74c3c;
        padding: 1rem;
        gap: .75rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .dropdown-menu {
        position: static;
        transform: none !important;
        box-shadow: none;
        background: rgba(255, 255, 255, .12);
        border-radius: 8px;
        margin: 0;
        display: none;
        max-height: none;
        overflow: visible;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-menu a {
        color: white;
        padding: .7rem 1.2rem;
        margin: 0;
    }

    .dropdown-menu a:hover {
        background: rgba(255, 255, 255, .15);
        color: white;
    }

    .hero-section {
        padding: 1.5rem 1rem;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .page-sub {
        font-size: .9rem;
    }

    .btn-start {
        width: 100%;
        max-width: 320px;
    }

    .quiz-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .quiz-modal {
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
        width: 100%;
    }

    .quiz-body {
        padding: 18px 18px 8px;
    }

    .quiz-footer {
        padding: 14px 18px 18px;
        flex-direction: column;
        gap: 10px;
    }

    .quiz-btn-back,
    .quiz-btn-next {
        width: 100%;
    }

    .opts-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gen-box {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .opts-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .hero-body {
        gap: .9rem;
    }

    .summary-pills {
        gap: 6px;
    }

    .sum-pill {
        font-size: .72rem;
        padding: 4px 10px;
    }

    .single-result-card {
        padding: .5rem 1rem;
    }

    .quiz-header {
        padding: 12px 16px;
    }

    .quiz-body {
        padding: 16px 14px 6px;
    }

    .quiz-footer {
        padding: 12px 14px 16px;
    }

    .modal-content {
        padding: 2rem 1.5rem;
    }

    .save-row {
        flex-direction: column;
    }

    .btn-reset,
    .btn-save {
        width: 100%;
    }
}