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

:root {
    --teal: #1a8a7d;
    --teal-dark: #0d6b60;
    --orange: #f5a623;
    --orange-dark: #e8961a;
    --green-text: #1a8a7d;
    --question-color: #f5a623;
    --white: #ffffff;
    --bubble-bg: rgba(255,255,255,0.95);
    --gray-light: #f0f0f0;
    --gray: #999;
    --red: #d94040;
    --yellow: #e8c840;
    --green: #4caf50;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%; height: 100%;
    position: relative;
}

#survey-container {
    width: 100%; height: 100%;
    min-width: 320px;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

#background-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #d6edf5;
    transition: background-image 0.3s ease;
}

#content-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 80px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.nav-arrow:hover { opacity: 1; }
.nav-arrow img { width: clamp(10px, 2vmin, 18px); height: auto; }
.nav-arrow svg { width: 32px; height: 32px; }
#nav-left { left: 16px; }
#nav-right { right: 16px; }
.nav-arrow.hidden { display: none; }

/* Page content area */
#page-content {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 60px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* When content is bounded within the image's bubble area */
#page-content.bounded {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
}
#page-content.bounded .bubble {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 4px 0;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    min-height: 0;
    flex-shrink: 1;
}
#page-content.bounded .question-text {
    font-size: calc(var(--img-h, 600px) * 0.034 * var(--title-scale, 1));
    margin-bottom: calc(var(--img-h, 600px) * 0.02);
}
#page-content.bounded .subtitle-text {
    font-size: calc(var(--img-h, 600px) * 0.024 * var(--subtitle-scale, 1));
}
#page-content.bounded .options-list {
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(var(--img-h, 600px) * 0.006);
}
#page-content.bounded .options-list.single-column {
    grid-template-columns: 1fr;
}
#page-content.bounded .option-item {
    font-size: calc(var(--img-h, 600px) * 0.024 * var(--font-scale, 1));
    padding: calc(var(--img-h, 600px) * 0.004) calc(var(--img-h, 600px) * 0.008);
    gap: calc(var(--img-h, 600px) * 0.008);
}
#page-content.bounded .option-item .check-box {
    width: calc(var(--img-h, 600px) * 0.032 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.032 * var(--font-scale, 1));
}
#page-content.bounded .option-item.selected .check-box::after {
    width: calc(var(--img-h, 600px) * 0.016 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.016 * var(--font-scale, 1));
}
#page-content.bounded .smiley-scale {
    gap: calc(var(--img-h, 600px) * 0.04);
    margin-top: calc(var(--img-h, 600px) * 0.06);
}
#page-content.bounded .smiley-item {
    width: calc(var(--img-h, 600px) * 0.1 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.1 * var(--font-scale, 1));
}
#page-content.bounded .smiley-wrapper {
    max-width: calc(var(--img-h, 600px) * 0.14);
}
#page-content.bounded .scale-slider {
    max-width: calc(var(--img-h, 600px) * 0.4);
}
#page-content.bounded .bubble > .scale-slider {
    margin-top: calc(var(--img-h, 600px) * 0.12);
}
.scalebar-clickable {
    position: relative;
    cursor: pointer;
}
.scale-slider.with-labels {
    text-align: center;
}
.scale-slider.with-labels .scalebar-clickable {
    display: inline-block;
    padding-top: calc(var(--img-h, 600px) * 0.025 * var(--font-scale, 1));
    text-align: left;
}
.scale-slider.with-labels .scalebar-full-img {
    width: auto;
    height: calc(var(--img-h, 600px) * 0.06);
    max-width: 100%;
    max-height: none;
}
.scalebar-edge-label {
    position: absolute;
    top: 0;
    font-size: calc(var(--img-h, 600px) * 0.016 * var(--font-scale, 1));
    color: var(--green-text, #1a5f5f);
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}
.scalebar-edge-label-left { left: 0; }
.scalebar-edge-label-right { right: 0; }
.scalebar-full-img {
    width: 100%;
    height: auto;
    max-height: calc(var(--img-h, 600px) * 0.06);
    object-fit: contain;
    display: block;
}
#page-content.bounded .scale-dot {
    width: calc(var(--img-h, 600px) * 0.05 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.05 * var(--font-scale, 1));
}
#page-content.bounded .scale-number {
    font-size: calc(var(--img-h, 600px) * 0.02 * var(--font-scale, 1));
}
#page-content.bounded .scale-labels {
    font-size: calc(var(--img-h, 600px) * 0.02 * var(--font-scale, 1));
}
#page-content.bounded .sub-label {
    font-size: calc(var(--img-h, 600px) * 0.022 * var(--font-scale, 1));
    margin-bottom: calc(var(--img-h, 600px) * 0.005);
}
#page-content.bounded .multi-slider-group {
    margin-top: calc(var(--img-h, 600px) * 0.005);
}
#page-content.bounded .multi-slider-item {
    margin-bottom: calc(var(--img-h, 600px) * 0.008);
    gap: calc(var(--img-h, 600px) * 0.015);
}
#page-content.bounded .multi-slider-item .sub-label {
    flex: 1;
}
#page-content.bounded .multi-slider-bar {
    flex: 1;
}
#page-content.bounded .scale-labels {
    margin-top: calc(var(--img-h, 600px) * 0.001);
}
#page-content.bounded .scale-track::before {
    height: calc(var(--img-h, 600px) * 0.006);
}
#page-content.bounded .swipe-hint {
    display: none;
}
#page-content.bounded .smiley-label {
    font-size: calc(var(--img-h, 600px) * 0.018 * var(--font-scale, 1));
}
#page-content.bounded .free-text-input {
    font-size: calc(var(--img-h, 600px) * 0.028 * var(--font-scale, 1));
}
#page-content.bounded .ynm-item img {
    width: calc(var(--img-h, 600px) * 0.1 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.1 * var(--font-scale, 1));
}
#page-content.bounded .ynm-item span {
    font-size: calc(var(--img-h, 600px) * 0.02 * var(--font-scale, 1));
}
#page-content.bounded .icon-item img {
    width: calc(var(--img-h, 600px) * 0.06 * var(--font-scale, 1));
    height: calc(var(--img-h, 600px) * 0.06 * var(--font-scale, 1));
}
#page-content.bounded .icon-item {
    padding: calc(var(--img-h, 600px) * 0.005);
}
#page-content.bounded .icon-label-small {
    font-size: calc(var(--img-h, 600px) * 0.018 * var(--font-scale, 1));
    max-width: calc(var(--img-h, 600px) * 0.18);
}
#page-content.bounded .rank-card .card-title {
    font-size: calc(var(--img-h, 600px) * 0.022 * var(--font-scale, 1));
}
#page-content.bounded .rank-card .card-desc {
    font-size: calc(var(--img-h, 600px) * 0.018 * var(--font-scale, 1));
}
#page-content.bounded .rank-card .card-img {
    width: 100%;
    height: auto;
}
#page-content.bounded .drag-hint {
    font-size: calc(var(--img-h, 600px) * 0.02 * var(--font-scale, 1));
}

/* Bubble (white blob shape) */
.bubble {
    background: var(--bubble-bg);
    border-radius: 40px;
    padding: 48px 52px;
    max-width: 700px;
    width: 100%;
    text-align: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    position: relative;
    border: 3px solid rgba(100,100,100,0.15);
}

.question-text {
    color: var(--question-color);
    font-size: clamp(1rem, 3vmin, 1.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.question-hint {
    color: #7a8a99;
    font-size: 0.78em;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.01em;
}

.subtitle-text {
    color: var(--green-text);
    font-size: clamp(0.75rem, 2vmin, 0.95rem);
    line-height: 1.5;
    margin-top: 8px;
}

/* Landing pages - text positioned over SVG's built-in speech bubble by JS */
.landing-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
}
.landing-content .question-text {
    color: var(--orange);
}
.landing-content .subtitle-text {
    margin-top: 12px;
    color: var(--green-text);
}
/* Uppercase only on actual LANDING pages, not CONSENT/INFO overlays */
.landing-page .question-text {
    text-transform: uppercase;
}
/* Badge - landing pages: positioned bottom-right over background */
.badge-img {
    width: 120px; height: 120px;
    margin: 16px auto;
}
.landing-content .badge-img {
    position: absolute;
    bottom: 15%;
    right: 15%;
    width: clamp(80px, 15vw, 140px);
    height: clamp(80px, 15vw, 140px);
    margin: 0;
}
/* Badge - ending pages: larger and prominent */
.ending-content .badge-img {
    width: clamp(100px, 18vw, 160px);
    height: clamp(100px, 18vw, 160px);
}

/* Wrap-up icon on final page */
.wrap-up-icon {
    width: calc(var(--img-h, 600px) * 0.08);
    height: auto;
    margin-bottom: calc(var(--img-h, 600px) * 0.01);
}

/* Consent page */
.consent-page {
    text-align: left;
    align-items: flex-start;
}
.bubble.consent-page {
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    padding: 8px 16px;
}
.consent-title {
    color: #1a237e;
    font-size: calc(var(--img-h, 600px) * 0.032 * var(--font-scale, 1));
    font-weight: 700;
    margin-bottom: 0.4em;
    line-height: 1.2;
}
.consent-body {
    color: var(--teal-dark);
    font-size: calc(var(--img-h, 600px) * 0.02 * var(--font-scale, 1));
    line-height: 1.45;
    margin-bottom: 0.5em;
}
.consent-action {
    color: var(--teal-dark);
    font-weight: 700;
    font-size: calc(var(--img-h, 600px) * 0.024 * var(--font-scale, 1));
    text-align: right;
    cursor: pointer;
    margin-bottom: 0.3em;
    align-self: flex-end;
}
.consent-action:hover { text-decoration: underline; }
.consent-link {
    color: var(--teal);
    font-size: calc(var(--img-h, 600px) * 0.018 * var(--font-scale, 1));
    text-decoration: none;
    display: inline;
}
.consent-link:hover { text-decoration: underline; }

/* Options list */
.options-list {
    text-align: left;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: 560px;
    margin: 0 auto;
    padding: 0;
}
.options-list.single-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
}
.options-list.single-column li {
    width: 100%;
    min-width: 0;
    text-align: left;
}
.options-list.single-column .option-item {
    width: 100%;
    justify-content: flex-start;
}
.options-list.single-column-center {
    display: grid;
    grid-template-columns: max-content;
    justify-content: center;
    max-width: 100%;
}
.options-list.single-column-center li {
    width: 100%;
}
.options-list.single-column-center .option-item {
    width: 100%;
    justify-content: flex-start;
}
.option-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.92rem;
    color: #333;
}
.option-item:hover { background: rgba(26,138,125,0.08); }
.option-item.selected { background: rgba(26,138,125,0.15); font-weight: 600; }
.option-item .check-box {
    width: 20px; height: 20px;
    border: 2px solid var(--teal);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.option-item .check-box.radio { border-radius: 50%; }
.option-item.selected .check-box {
    background: var(--teal);
}
.option-item.selected .check-box::after {
    content: '';
    width: 10px; height: 10px;
    background: white;
    border-radius: 2px;
}
.option-item.selected .check-box.radio::after { border-radius: 50%; }
.option-text-input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: calc(var(--img-h, 600px) * 0.018);
    width: calc(100% - 28px);
    display: block;
    margin-top: 4px;
    margin-left: 28px;
}

/* Smiley scale */
.smiley-scale {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    margin-top: 12px;
}
.smiley-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 80px;
}
.smiley-label {
    font-size: 0.7rem;
    color: var(--teal-dark);
    text-align: center;
    line-height: 1.2;
}
.smiley-item {
    width: 60px; height: 60px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    opacity: 0.7;
}
.smiley-item:hover { transform: scale(1.15); opacity: 1; }
.smiley-item.selected { transform: scale(1.2); opacity: 1; filter: brightness(0.85); }

/* 7-point discrete scale slider */
.scale-slider {
    width: 100%;
    max-width: 500px;
    margin: 12px auto 0;
}
.scale-track {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 8px;
}
.scale-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 8px;
    right: 8px;
    height: 4px;
    background: linear-gradient(to right, #d94040, #e87040, #e8c840, #a0c840, #4caf50);
    border-radius: 2px;
    transform: translateY(-50%);
    z-index: 0;
}
.scale-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 1;
    padding: 4px;
    gap: 4px;
}
.scale-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--teal);
    transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.scale-point:hover .scale-dot {
    transform: scale(1.15);
    border-color: var(--orange);
}
.scale-point.active .scale-dot {
    background: var(--teal);
    border-color: var(--teal-dark);
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.scale-number {
    font-size: 0.75rem;
    color: var(--teal-dark);
    font-weight: 600;
}
.scale-point.active .scale-number {
    color: var(--orange);
    font-weight: 700;
}
.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

/* Multi-slider */
.multi-slider-group { margin-top: 8px; }
.multi-slider-item {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.multi-slider-item .sub-label {
    color: var(--green-text);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0;
    text-align: left;
    flex: 1;
    min-width: 0;
}
.multi-slider-bar {
    flex: 1;
    min-width: 0;
}
.multi-slider-bar .scale-slider {
    margin-top: 0;
}

/* Free text */
.free-text-input {
    width: 90%;
    max-width: 400px;
    border: none;
    border-bottom: 2px solid #ccc;
    padding: 12px;
    font-size: 1.1rem;
    text-align: center;
    background: transparent;
    outline: none;
    color: #555;
    transition: border-color 0.2s;
}
.free-text-input:focus { border-bottom-color: var(--teal); }

/* Dropdown sub-options */
.dropdown-suboptions {
    margin-left: 28px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.dropdown-suboptions.open {
    max-height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#page-content.bounded .dropdown-suboptions.open {
    max-height: calc(var(--img-h, 600px) * 0.35);
}
.dropdown-suboptions .option-item {
    padding: 4px 8px;
    font-size: 0.85rem;
}

/* Drag and drop ranking */
.rank-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--img-h, 600px) * 0.015);
    max-width: calc(var(--img-h, 600px) * 0.5);
    margin: calc(var(--img-h, 600px) * 0.01) auto 0;
}
.rank-slot {
    position: relative;
}
.cardbox-bg {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}
.rank-card {
    position: relative;
    z-index: 1;
    border: none;
    background: none;
    padding: 0;
    cursor: grab;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    overflow: visible;
}
.rank-card:active { cursor: grabbing; transform: scale(1.05); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.rank-card .card-title {
    font-weight: 700;
    color: var(--teal-dark);
    font-size: calc(var(--img-h, 600px) * 0.018);
    margin: calc(var(--img-h, 600px) * 0.005) 0;
}
.rank-card .card-desc {
    font-size: calc(var(--img-h, 600px) * 0.014);
    color: #555;
    line-height: 1.3;
}
.rank-card .card-img {
    width: 100%;
    height: auto;
    display: block;
}
.rank-number {
    position: absolute;
    top: 2px;
    left: 2px;
    background: var(--orange);
    color: white;
    width: calc(var(--img-h, 600px) * 0.03);
    height: calc(var(--img-h, 600px) * 0.03);
    border-radius: 50%;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--img-h, 600px) * 0.016);
    z-index: 2;
}
.drag-hint {
    color: var(--orange);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 8px;
}

/* Icon select */
.icon-select-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}
.icon-grid-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    scrollbar-width: none;
}
.icon-grid-scroll::-webkit-scrollbar {
    display: none;
}
.icon-scroll-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.icon-scroll-arrow {
    display: flex;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.icon-scroll-arrow:hover { opacity: 1; }
.icon-scroll-arrow img {
    width: calc(var(--img-h, 600px) * 0.1);
    height: auto;
}
.icon-scroll-up img {
    transform: rotate(180deg);
}
.icon-scroll-arrow.hidden {
    visibility: hidden;
}
.icon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--img-h, 600px) * 0.01);
    max-width: 100%;
    margin: calc(var(--img-h, 600px) * 0.01) auto 0;
}
.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.15s, transform 0.15s, opacity 0.15s;
}
.icon-item:hover { background: rgba(26,138,125,0.08); }
.icon-item.selected { outline: 1px solid var(--teal); outline-offset: -2px; }
.icon-item.locked { opacity: 0.4; }
.icon-item.left-out { opacity: 0.3; text-decoration: line-through; }
.icon-item img { width: 128px; height: 128px; }
.icon-label-small {
    font-size: 0.85rem;
    color: var(--teal-dark);
    text-align: center;
    line-height: 1.25;
    margin-top: 4px;
    max-width: 130px;
}

/* Icon detail modal */
.icon-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-modal {
    background: var(--bubble-bg);
    border-radius: 36px;
    padding: 40px 36px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.icon-modal img { width: 90px; height: 90px; margin-bottom: 16px; }
.icon-modal .icon-label { font-weight: 700; color: var(--teal-dark); font-size: 1.15rem; margin-bottom: 16px; line-height: 1.4; }
.icon-modal-btns { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.icon-modal-btns button {
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-leave { background: var(--gray-light); color: #555; }
.btn-leave:hover { background: #ddd; }
.btn-lock { background: var(--orange); color: white; }
.btn-lock:hover { background: var(--orange-dark); }

/* Yes/No/Maybe */
.ynm-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}
.ynm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    transition: background 0.15s;
    min-width: 70px;
}
.ynm-item:hover { background: rgba(26,138,125,0.08); }
.ynm-item.selected { background: rgba(26,138,125,0.15); }
.ynm-item img, .ynm-item svg { width: 64px; height: 64px; }
.ynm-item span { font-size: 0.8rem; color: var(--teal-dark); margin-top: 6px; font-style: italic; text-align: center; }

/* Conditional text */
.conditional-input {
    margin-top: 16px;
    display: none;
}
.conditional-input.visible { display: block; }
.conditional-input textarea,
.conditional-input .conditional-email-input {
    width: calc(var(--img-h, 600px) * 0.4);
    max-width: 80%;
    border: 1px solid var(--teal);
    border-radius: 8px;
    padding: 8px;
    font-size: calc(var(--img-h, 600px) * 0.02);
    outline: none;
}
.conditional-input textarea {
    resize: none;
    min-height: calc(var(--img-h, 600px) * 0.05);
    height: calc(var(--img-h, 600px) * 0.06);
}
.conditional-input .conditional-email-input {
    font-family: inherit;
}

/* Scale bar (e.g. q3.3) */
.scalebar-container {
    width: 100%;
    margin: calc(var(--img-h, 600px) * 0.04) auto 0;
    padding: 0 3%;
}
.scalebar-img-wrap {
    position: relative;
    width: 100%;
    cursor: pointer;
    border-radius: 4px;
    overflow: visible;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}
.scalebar-img {
    width: 100%;
    height: auto;
    display: block;
}
.scalebar-pointer-area {
    position: relative;
    width: 100%;
    top: -10px;
    height: calc(var(--img-h, 600px) * 0.04);
    overflow: visible;
}
.scalebar-pointer {
    position: absolute;
    top: 0;
    width: calc(var(--img-h, 600px) * 0.025);
    height: calc(var(--img-h, 600px) * 0.035);
    transform: translateX(-50%);
    transition: left 0.15s;
    cursor: grab;
    z-index: 2;
}
.scalebar-pointer:active {
    cursor: grabbing;
}
.scalebar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: calc(var(--img-h, 600px) * 0.01);
}
.scalebar-label {
    flex: 1;
    text-align: center;
    cursor: pointer;
    padding: calc(var(--img-h, 600px) * 0.005);
    border-radius: 4px;
    transition: background 0.15s;
}
.scalebar-label span {
    font-size: calc(var(--img-h, 600px) * 0.018 * var(--font-scale, 1));
    color: var(--teal-dark);
    line-height: 1.2;
}
.scalebar-label:hover {
    background: rgba(26,138,125,0.08);
}
.scalebar-label.active {
    background: rgba(26,138,125,0.15);
    font-weight: 600;
}

/* Ending badges inline */
.ending-badges {
    display: flex;
    justify-content: center;
    gap: calc(var(--img-h, 600px) * 0.02);
    margin: calc(var(--img-h, 600px) * 0.02) 0;
}
.ending-badge {
    width: calc(var(--img-h, 600px) * 0.14);
    height: calc(var(--img-h, 600px) * 0.14);
}

/* Ending page */
.ending-content {
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}
.ending-content .question-text {
    white-space: pre-line;
}
/* Continue text positioned at bottom of image */
.continue-text-abs {
    color: var(--orange);
    font-style: italic;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: calc(var(--img-h, 600px) * 0.01);
    font-size: calc(var(--img-h, 600px) * 0.026);
}
.continue-text-abs img {
    width: calc(var(--img-h, 600px) * 0.06);
    height: calc(var(--img-h, 600px) * 0.06);
    opacity: 0.8;
}
.continue-text-abs:hover { text-decoration: underline; }
/* Legacy continue-text (keep for non-ending pages if needed) */
.continue-text {
    color: var(--teal);
    font-size: 1rem;
    margin-top: 20px;
    font-style: italic;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.continue-text:hover { text-decoration: underline; }
.continue-text .scroll-arrows {
    width: 32px;
    height: 32px;
    opacity: 0.7;
}

/* Swipe hint */
.swipe-hint {
    position: absolute;
    bottom: 20px; right: 24px;
    color: var(--teal);
    font-size: 0.85rem;
    font-style: italic;
    z-index: 5;
}

/* Subtitle absolute (on image, separate from title) */
.subtitle-abs .subtitle-text {
    color: var(--white);
    font-size: calc(var(--img-h, 600px) * 0.02);
    line-height: 1.5;
}

/* Swipe hint absolute (on image) */
.swipe-hint-abs {
    color: var(--teal);
    font-size: calc(var(--img-h, 600px) * 0.022);
    font-style: italic;
    pointer-events: none;
}

/* Scroll indicator */
.scroll-hint {
    color: var(--teal);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
}

/* Initial page loader */
#loader {
    position: fixed;
    inset: 0;
    background: #c6e5f8;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
#loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(26,138,125,0.2);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: loader-spin 0.9s linear infinite;
}
@keyframes loader-spin {
    to { transform: rotate(360deg); }
}
#app { visibility: hidden; }
#app.ready { visibility: visible; }

/* Progress indicator */
#progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 4px;
    background: var(--orange);
    z-index: 50;
    transition: width 0.3s ease;
}
#progress-counter {
    position: fixed;
    top: 8px;
    right: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    background: rgba(255,255,255,0.85);
    padding: 2px 10px;
    border-radius: 12px;
    z-index: 51;
    letter-spacing: 0.02em;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* Required question warning (appended to body, not page-content) */
.required-warning {
    position: fixed;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.95);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10000;
    text-align: center;
    max-width: 80%;
    pointer-events: none;
    animation: reqFade 3s ease forwards;
}
@keyframes reqFade {
    0% { opacity: 0; }
    10% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    #page-content { padding: 16px 44px; }
    .bubble { padding: 32px 28px; border-radius: 32px; }
    .question-text { font-size: clamp(0.9rem, 3vmin, 1.2rem); }
    .options-list { grid-template-columns: 1fr; }
    #page-content.bounded .options-list { grid-template-columns: 1fr; }
    .smiley-item { width: 48px; height: 48px; }
    .icon-grid { grid-template-columns: repeat(3, 1fr); }
    .icon-item img { width: 96px; height: 96px; }
    .rank-card .card-desc { font-size: 0.7rem; }
    .ynm-options { gap: 12px; }
    .ynm-item img, .ynm-item svg { width: 56px; height: 56px; }
    .nav-arrow { width: 36px; }
    .nav-arrow svg { width: 24px; height: 24px; }
    #nav-left { left: 4px; }
    #nav-right { right: 4px; }
    .scale-dot { width: 24px; height: 24px; }
    .scale-number { font-size: 0.65rem; }
    .multi-slider-item .sub-label { font-size: 0.8rem; }
    #page-content.bounded .bubble > .scale-slider { margin-top: calc(var(--img-h, 600px) * 0.03); }
}

@media (max-width: 480px) {
    #page-content { padding: 12px 36px; }
    .bubble { padding: 24px 20px; border-radius: 24px; }
    .bubble.consent-page { max-width: 100%; padding: 4px 8px; }
    .question-text { font-size: clamp(0.85rem, 3vmin, 1.05rem); }
    .option-item { font-size: 0.82rem; padding: 6px 8px; }
    .icon-grid { grid-template-columns: repeat(3, 1fr); }
    .icon-item img { width: 80px; height: 80px; }
    .smiley-item { width: 40px; height: 40px; }
    .smiley-label { font-size: 0.6rem; }
    .ynm-item img, .ynm-item svg { width: 48px; height: 48px; }
    .icon-modal img { width: 70px; height: 70px; }
    .scale-dot { width: 20px; height: 20px; border-width: 2px; }
    .scale-number { font-size: 0.6rem; }
    .scale-labels { font-size: 0.65rem; }
    .ynm-item { padding: 8px; min-width: 60px; }
    .ynm-item span { font-size: 0.7rem; }
    #page-content.bounded .bubble > .scale-slider { margin-top: calc(var(--img-h, 600px) * 0.02); }
}

/* Portrait mode - tall screens */
@media (max-aspect-ratio: 3/4) {
    #background-layer {
        background-position: center center;
    }
}
