@font-face {
  font-family: 'Lato';
  src:
    url('../fonts/Lato-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src:
    url('../fonts/Lato-Light.woff') format('woff');
  font-weight: 300;
  font-style: Light;
  font-display: swap;
}

@font-face {
  font-family: 'Hightide';
  src:
    url('../fonts/HighTide.otf');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Lato', 'Segoe UI', Tahoma, Verdana, sans-serif;
}

.quiz-container {
    width: 100%;
    max-width: 1170px;
    position: relative;
    overflow: hidden;
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2rem;
}

.quiz-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.progress-container {
    margin: 0;
    padding: 30px 44px;
    background: #E5F0F7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    height: 20px;
    background-color: #FFFFFF;
    border-radius: 10px;
    overflow: hidden;
    flex: 1;
}

.progress-fill {
    height: 100%;
    background: #0067B1;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
}

/* When progress is 0% (no answers), keep it at 20px */
.progress-fill[style*="width: 0%"],
.progress-fill[style*="width:0%"] {
    width: 20px !important;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-weight: 400;
    font-style: normal;
    line-height: 120%;
    font-size: 18px;
    color: #0067B1;
    flex: 0 0 auto;
}

.carousel-container {
    position: relative;
    height: 700px; 
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0 40px;
    perspective: 1000px;
    flex-direction: row;
}

.cards-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.quiz-card {
    position: absolute;
    width: 80%; /* Focus card width */
    min-height: 620px; /* Increased height */
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0;
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    left: 50%;
    transform: translateX(-50%) scale(0.85);
    opacity: 0.6;
    z-index: 1;
    overflow: hidden;    
    transition: all 0.5s ease;
    will-change: transform, opacity;

    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Prevent tap highlight on iOS Safari */
    -webkit-tap-highlight-color: transparent;
    
    /* Prevent callout on iOS */
    -webkit-touch-callout: none;
}

.quiz-card * {
    -webkit-tap-highlight-color: transparent;
}

.quiz-card .quiz-holder {
    padding: 30px 44px;
    opacity: 0;
}

.quiz-card .quiz-holder.special {
    display: flex;
    flex-direction: row;
}

.quiz-card .quiz-holder.special .card-content {
    padding-top: 68px;
}

.quiz-card .quiz-holder.special .card-header,
.quiz-card .quiz-holder.special .question-text {
    text-align: left;
}

.quiz-card .quiz-holder.special  > div {
    flex: 1;
}

.quiz-card .quiz-holder.special .options-container {
    flex-direction: column;
}

.quiz-card .quiz-holder.special .options-container .option {
    flex: 1;
}

/* Focus card - larger and centered */
.quiz-card.active {
    width: 80%;
    transform: translateX(-50%) scale(1);
    opacity: 1;
    z-index: 5;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.quiz-card.active .quiz-holder {
    opacity: 1;
}

/* Left and right cards - only show 5-10% */
.quiz-card.prev {
    width: 80%;
    transform: translateX(-65%) scale(0.8);
    opacity: 0.8;
    z-index: 4;
}

.quiz-card.next {
    width: 80%;
    transform: translateX(-35%) scale(0.8);
    opacity: 0.8;
    z-index: 4;
}

/* Further cards - hidden behind */
.quiz-card.far-prev {
    width: 80%;
    transform: translateX(-75%) scale(0.7);
    opacity: 0.7;
    z-index: 3;
}

.quiz-card.far-next {
    width: 80%;
    transform: translateX(-25%) scale(0.7);
    opacity: 0.7;
    z-index: 3;
}

.card-header {
    margin-bottom: 24px;
    text-align: center;
}

.card-header .quote {
    color: #818A91;
    font-size: 17px;
    font-weight: 400;
    line-height: 120%;
    font-style: italic;
    margin-top: 12px;
}

.question-number {
    display: inline-block;
    background-color: #3498db;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    font-weight: bold;
    margin-right: 10px;
}

.question-text {
    color: #0067B1;
    font-weight: 300;
    font-size: 36px;
    line-height: 120%;
    letter-spacing: 0%;
    text-align: center;
}

.question-text span {
    font-weight: 400;
    font-style: normal;
}

.options-container {
    width: 100%;
    flex: 1 1 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.options-container:has(.image-option) {
    flex-wrap: nowrap;
}

.option {
    padding: 14px 12px;
    background-color: #ffffff;
    border-radius: 10px;
    border: 1px solid #CCCCCC;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 400;
    color: #404040;
    display: flex;
    align-items: center;
    flex: 0 0 calc(50% - 6px);
    line-height: 125%;
    letter-spacing: 0%;

    -webkit-tap-highlight-color: transparent !important;
    
    /* Prevent iOS Safari from adding its own touch styles */
    -webkit-appearance: none;
    
    /* For Android Chrome */
    outline: none;
    -webkit-touch-callout: none;
}

.option:hover {
    border: 1px solid #0071C3;
    color: #0067B1;
}

.option.selected {
    border: 1px solid #0071C3;
    background-color: #EFF9FD;
    color: #0067B1;
}

/* Image option styling - only for question 1 */
.image-option {
    flex: 1;
    padding: 8px 20px 20px 20px;
    flex-direction: column;
    text-align: left;
    gap: 10px;
}

.option-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    transition: all 0.2s ease;
}

.option.selected .option-image {
}

.option-text {
    font-weight: 400;
    font-size: 16px;
}

.insight-container {
    padding: 25px 44px 30px 44px;
}

.insight-section {
    background:
        linear-gradient(#ECA15426, #ECA15426),
        url('../images/insights-bg.png') right center no-repeat;
    border-radius: 10px;
    padding: 52px 140px 24px 24px;
    font-size: 16px;
    color: #707070;
    overflow: hidden;
    position: relative;
}

.insight-section .insight-title {
    background: #ECA154;
    color: white;
    min-width: 127px;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    word-wrap: break-word;
    position: absolute;
    top: 0;
    left: 0;
    border-top-left-radius: 4px; 
    border-bottom-right-radius: 12px; 
    padding: 10px;
    text-align: center;
}

.insight-ico {
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='11' height='7' viewBox='0 0 11 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.349609 5.74902L5.51994 0.702263L10.5868 5.74902' stroke='currentColor' stroke-width='1.5' fill='none'/%3E%3C/svg%3E")
        center / contain no-repeat;
    background-color: #FFFFFF;
    width: 11px;
    height: 7px;
    display: none;
    mask: -webkit-mask;
}

.nav-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 30px;
}

/* Next button inside card */
.card-next-button {
    margin: 0;
    display: flex;
    justify-content: center;
}
.card-next-button:has(.submit-btn) {
    justify-content: right;
}

.card-nav-button {    
    padding: 12px 24px;
    background-color: #0067B1;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    word-wrap: break-word;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-nav-button:hover:not(:disabled) {
    background-color: #0071C3;
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(52, 152, 219, 0.3);
}

.card-nav-button:disabled {
    background-color: #818A91;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results card styling */
.results-card {
    text-align: left;
    padding: 48px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    gap: 42px;
    background: url(../images/investquiz_result_bg.png) center center no-repeat;
    background-size: cover;
}

.results-card.results-hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.results-message {
    font-size: 1.1rem;
    color: #404040;
    line-height: 1.6;
}

.result-intro {
    color: #0067B1;
    font-weight: 300;
    font-size: 26px;
}

.result-text {
    font-family: 'Hightide';
    color: #0067B1;
    font-size: 60px;
    margin-top: -10px;
    margin-bottom: 24px;
}

.results-cta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.results_btn {
    background: #FFF;
    color: #0067B1;
    font-size: 16px;
    padding: 8px 12px;
    display: inline-flex;
    gap: 12px;
    border-radius: 28px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.results_btn::before {
    content: '';
    width: 100%;
    height: 100%;
    background: #0067B11A;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

.cta_ico {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #0067B1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Arrow icon */
.arrow-ico {
  width: 12px;
  height: 12px;
  background-color: #0067B1;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M566.6 342.6C579.1 330.1 579.1 309.8 566.6 297.3L406.6 137.3C394.1 124.8 373.8 124.8 361.3 137.3C348.8 149.8 348.8 170.1 361.3 182.6L466.7 288L96 288C78.3 288 64 302.3 64 320C64 337.7 78.3 352 96 352L466.7 352L361.3 457.4C348.8 469.9 348.8 490.2 361.3 502.7C373.8 515.2 394.1 515.2 406.6 502.7L566.6 342.7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: -webkit-mask;
}

.result-image {
    flex: 1
}

.result-image .desktop-img {
    display: block;
}

.result-image .mobile-img {
    display: none;
}

.result-desc {
    flex: 2
}

.result-desc p {
    margin-bottom: 20px;
}

.btn-holder {
    display: flex;
    gap: 8px;
}

.restart-btn {
    margin-top: 20px;
    padding: 12px 24px;
    background-color: #0067B1;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    word-wrap: break-word;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.restart-btn2 {
    margin-top: 20px;
    padding: 12px 24px;
    border: 1px solid #0067B1;
    background: #FFFFFF;
    color: #0067B1;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    word-wrap: break-word;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.restart-btn:hover, .restart-btn2:hover {
    color: #FFF;
    background-color: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 7px 14px rgba(52, 152, 219, 0.3);
}

/* Hide content on non-active cards for cleaner look */
.quiz-card:not(.active) .card-header,
.quiz-card:not(.active) .progress-bar,
.quiz-card:not(.active) .progress-text,
.quiz-card:not(.active) .options-container,
.quiz-card:not(.active) .results-card {
    opacity: 0;
    pointer-events: none;
}

.quiz-card:not(.active) .insight-section {
    display: none;
}

.quiz-card.active .insight-section {
    display: block;
}

/* Add subtle gradient edges to side cards */
.quiz-card.prev::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
    border-radius: 0 15px 15px 0;
}

.quiz-card.next::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
    border-radius: 15px 0 0 15px;
}

/* Answer required warning */
.answer-required {
    color: #FF0000;
    font-style: italic;
    text-align: left;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0;
    line-height: 0;
    height: 0;
}

.answer-required.show {
    opacity: 1;
    font-size: 16px;
    line-height: 125%;
    height: auto;
}

/* For buttons */
.card-nav-button,
.restart-btn {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Remove any focus outlines that might cause blinking */
.option:focus,
.card-nav-button:focus,
.restart-btn:focus {
    outline: none;
    box-shadow: none;
}

/* Specific iOS fix */
@supports (-webkit-touch-callout: none) {
    .quiz-card {
        /* iOS specific fixes */
        -webkit-user-drag: none;
    }
    
    .option {
        /* Prevent iOS long-press menu */
        -webkit-user-select: none;
    }
}

@media (max-width: 1023px) {
    .quiz-container {
        padding: 20px 15px;
    }
    
    .carousel-container {
        height: 760px;
    }
   
    .quiz-card {
        height: 730px;
    }

    .quiz-card .quiz-holder {
        padding: 24px 20px; 
    }

    .quiz-card:has(.image-option)  .quiz-holder {
        padding: 24px 20px 0 20px; 
    }

    .nav-button {
        padding: 12px 25px;
    }

    .quiz-card.active {
        width: 95%;
    }
    
    /* Adjust side card visibility for mobile */
    .quiz-card.prev {
        transform: translateX(-92%) scale(0.8);
    }
    
    .quiz-card.next {
        transform: translateX(-8%) scale(0.8);
    }

    .options-container:has(.image-option) {
        flex-wrap: wrap;
    }
    
    .image-option {
        flex: 0 0 calc(50% - 6px);
    }

    .option-image {
        height: 80px;
    }
    
    .results-card h2 {
        font-size: 1.8rem;
    }

    .results-message {
        flex-direction: column;
    }   
    
    .result-text {
        font-size: 40px;
    }

    .results-cta {
        flex-direction: column;
        align-items: start;
    }

    .result-image .desktop-img {
        display: block;
    }

    .result-image .mobile-img {
        display: none;
    }
}

@media (max-width: 480px) {
    .carousel-container {
        height: 100dvh;
    }
    
    .question-text {
        font-size: 24px;
    }
    
    .nav-controls {
        justify-content: center;
    }
    
    .nav-button {
        width: 100%;
        justify-content: center;
    }

    .quiz-card {
        height: 650px;
        min-height: 650px;
        padding: 0;
        transition: height 0.3s ease;
    }
    
    /* Results card specific height */
    .quiz-card[data-results-height="true"] {
        height: 800px !important;
        min-height: 800px !important;
        opacity: 0;
    }

    .quiz-card.active[data-results-height="true"] {
        opacity: 1;
    }
    
    /* Adjust carousel for taller card */
    .carousel-container:has(.quiz-card[data-results-height="true"].active) {
        height: 800px;
    }

    .quiz-card.active {
        width: 100%;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.15);
    }
    
    .quiz-card.prev {
        transform: translateX(-90%) scale(0.8);
        opacity: 0;
    }
    
    .quiz-card.next {
        transform: translateX(-10%) scale(0.8);
        opacity: 0;
    }

    .quiz-card .quiz-holder {
        padding: 20px;
    }

    .quiz-card .quiz-holder.special {
        flex-direction: column;
    }

    .quiz-card .quiz-holder.special .card-content {
        padding-top: 0;
    }

    .options-container {
        flex-direction: column;
    }

    .options-container:has(.image-option) {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .option {
        flex: 1;
    }

    .option.image-option {
        flex: 0 0 calc(50% - 6px);
        padding: 8px 16px;
    }
    
    .option-image {
        height: 70px;
    }
    
    .option-text {
        font-size: 0.9rem;
    }

    .answer-required.show {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .results-card {
        flex-direction: column;
        padding: 20px;
        gap: 0;
        background: url(../images/investquiz_result_bg-mobile.png);
        background-repeat: no-repeat;
    }

    .result-image .desktop-img {
        display: none;
    }

    .result-image .mobile-img {
        display: block;
    }

    .result-image {
        flex: 0 0 auto;
        margin-bottom: 8px;
    }

    .result-image img { 
        max-width: 100%; 
    }

    .results-cta {
        align-items: start;
        flex-direction: column;
    }

    .result-text {
        font-size: 40px;
    }
    
    .score-circle {
        width: 110px;
        height: 110px;
        margin-bottom: 20px;
    }
    
    .score-inner {
        width: 85px;
        height: 85px;
        font-size: 1.5rem;
    }
    
    .results-message {
        font-size: 1rem;
    }

    .btn-holder {
        flex-direction: column;
        gap: 0;
    }

    .restart-btn,
    .restart-btn2 {
        justify-content: center;
    }
    
    .restart-btn {
        padding: 12px 30px;
        font-size: 1rem;
        margin-top: 8px;
    }

    .card-next-button {
        z-index: 1;
    }

    .card-next-button:has(.submit-btn) {
        justify-content: center;
    }

    .progress-container {
        padding: 20px;
    }

    .insight-container {
        padding: 0 20px;
        position: absolute;
        bottom: 0;
        background: #FFF;
    }

    .insight-section {
        padding: 0;
        background: #ECA15426;
        border-left: #ECA154 1px solid;
        border-right: #ECA154 1px solid;
        border-radius: 10px 10px 0 0;
    }

    .insight-section .insight-desc {
        padding: 0;
        height: 0;
        line-height: 0;
        font: 0;
    }

    .insight-container.show .insight-section .insight-desc{
        padding: 16px;
        height: auto;
        line-height: 125%;
        font-size: 14px;
    }

    .insight-section .insight-title {
        width: 100%;
        border-bottom-right-radius: 0;
        position: relative;
        display: flex;
        gap: 6px;
        justify-content: center;
        align-items: center;
        font-weight: 300;
    }

    .insight-ico {
        display: flex;
        align-items: center;
        transition: transform 0.25s ease;
    }

    .insight-container.show .insight-ico {
        transform: rotate(180deg);
    }
}