@font-face {
    font-family: 'Cairo';
    src: url('/assets/cairo.ttf') format('truetype');
    font-weight: 200 1000; /* Supports all variable weights */
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    overflow-x: hidden; /* Prevents floating badge wings from causing horizontal scroll */
    max-width: 100vw;
}

:root {
    --bg-1: linear-gradient(135deg, #E0C3FC 0%, #8EC5FC 100%); /* Indigo */
    --bg-2: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%); /* Sky */
    --bg-3: linear-gradient(135deg, #DCFCE7 0%, #BBF7D0 100%); /* Mint */
    --bg-4: linear-gradient(135deg, #F3E8FF 0%, #E9D5FF 100%); /* Lavender */
    --bg-5: linear-gradient(135deg, #FEF9C3 0%, #FEF08A 100%); /* Lemon */
    --bg-6: linear-gradient(135deg, #FFEDD5 0%, #FED7AA 100%); /* Peach */
    --bg-7: linear-gradient(135deg, #CCFBF1 0%, #99F6E4 100%); /* Teal */
    --bg-8: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%); /* Silver */
    
    --badge-text: #2d3436;
    --shadow-light: 0 4px 0 rgba(0,0,0,0.1);
    --border-light: rgba(0,0,0,0.05);
}

body {
    background: var(--bg-1);
    background-attachment: fixed;
    color: #2d3436;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Keeps everything perfectly centered horizontally in column mode */
    padding: 20px;
    margin: 0;
    min-height: 100vh; 
    box-sizing: border-box; 
    transition: background 0.6s ease;
}

.q-badge {
    color: var(--badge-text);
    background-clip: padding-box !important; /* Forces override against JS */
    -webkit-backface-visibility: hidden; /* Forces smooth edge rendering */
    backface-visibility: hidden;
}

.container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
    animation: dropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative; 
    z-index: 10;
}

.app-card {
    background: #ffffff;
    border-radius: 28px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 0 rgba(0,0,0,0.1), 0 20px 40px rgba(0,0,0,0.2);
    padding: 30px 25px;
    width: 100%;
    text-align: center;
    position: relative;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-40px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

h1, h2 {
    color: #2c3e50;
}

button {
    background-color: #6C5CE7;
    color: white;
    border: none;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 800;
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 rgba(0, 0, 0, 0.2);
}

.question-block {
    margin: 0;
    text-align: left;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.option-btn {
    background-color: #ffffff;
    color: #2d3436;
    padding: 15px 10px;
    font-size: 15px;
    font-weight: 700;
    border: 2px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    transition: all 0.1s ease;
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(0,0,0,0.1);
    /* Removed capitalization so the creator's exact casing is respected */
}

/* Hover only after a real mouse move: never on phones, and not on a fresh question
   just because the mouse happens to sit where the last answer was (see quiz.js) */
:where(.hover-ok) .option-btn:hover {
    background-color: #ffffff;
    border-color: rgba(0,0,0,0.15);
    transform: translateY(2px);
    box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}
/* ...and switch off the general button hover for answers until then */
:where(body:not(.hover-ok)) .option-btn:hover {
    filter: none;
    transform: none;
    box-shadow: 0 5px 0 rgba(0,0,0,0.1);
}

.option-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0px 0 rgba(0,0,0,0.1);
}

/* Instant Feedback Colors */
.option-btn.correct {
    background-color: #2ed573 !important;
    color: white !important;
    border: 2px solid #21a057 !important;
    box-shadow: 0 4px 0 #21a057 !important;
    transform: translateY(2px);
}

.option-btn.wrong {
    background-color: #ff4757 !important;
    color: white !important;
    border: 2px solid #d63031 !important;
    box-shadow: 0 4px 0 #d63031 !important;
    transform: translateY(2px);
}

/* Phones keep the tapped button "hovered" (iPhone). These stronger rules make
   green/red win over the hover colour, in light AND dark mode. */
.option-btn.correct:hover, .option-btn.correct:active {
    background-color: #2ed573 !important;
    color: white !important;
    border: 2px solid #21a057 !important;
    box-shadow: 0 4px 0 #21a057 !important;
    transform: translateY(2px);
}
.option-btn.wrong:hover, .option-btn.wrong:active {
    background-color: #ff4757 !important;
    color: white !important;
    border: 2px solid #d63031 !important;
    box-shadow: 0 4px 0 #d63031 !important;
    transform: translateY(2px);
}
/* ✓ / ✗ marks so the result is clear even for colour-blind players.
   Placed right after the answer, but "weightless" (0 width), so the text stays exactly where it was. */
.option-btn {
    padding-left: 32px;
    padding-right: 32px;
    overflow-wrap: anywhere; /* very long words wrap inside the button */
}
.option-btn.correct::after, .option-btn.wrong::after {
    display: inline-block;
    width: 0;
    white-space: nowrap;
    font-size: 17px;
    line-height: 0; /* never makes the button taller */
}
.option-btn.correct::after { content: "\00a0\00a0✓"; }
.option-btn.wrong::after { content: "\00a0\00a0✗"; }

.hidden {
    display: none !important;
}

/* New UI Additions */
.steps-container {
    text-align: left;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 16px;
    border: 2px solid rgba(0,0,0,0.05);
}

.step {
    margin-bottom: 15px;
}

.step:last-child {
    margin-bottom: 0;
}

.step p {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #636e72;
}

.input-field {
    width: 100%;
    padding: 14px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.q-card {
    background: #fff;
    border: 2px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.opt-row {
    display: flex;
    align-items: center; /* PERFECT vertical centering across all browsers */
    gap: 10px;
    margin-bottom: 12px;
}

.opt-row input[type="text"],
.opt-row textarea.opt-input {
    flex: 1;
    padding: 10px 12px;
    margin: 0;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px; /* Unified from 8px to 12px */
    outline: none;
    min-height: 44px;
    font-size: 15px;
    line-height: 1.4;
    resize: none;
    overflow: hidden;
    box-sizing: border-box;
    transition: border 0.2s ease, background-color 0.2s ease, box-shadow 0.2s;
}

textarea.input-field {
    resize: none;
    overflow: hidden;
    line-height: 1.4;
    min-height: 50px;
    padding-top: 12px; /* Pulls text up slightly to center it visually */
    padding-bottom: 16px;
}

.opt-row textarea.opt-input {
    padding-top: 9px; /* Pulls text up slightly in options */
    padding-bottom: 12px;
}

/* Highlight for the chosen correct answer text box */
.opt-row input[type="text"].correct-input,
.opt-row textarea.opt-input.correct-input {
    background-color: #e8f9f0;
    border-color: #21a057;
    color: #1e8449; /* Deep green text for readability */
}

/* Custom "correct answer" check circle (replaces the browser's own radio dot so it looks
   the same on iPhone, Android and desktop). Empty grey ring -> green circle with a white ✓ */
.opt-row input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin: 0 4px;
    border: 2.5px solid #b2bec3;
    border-radius: 50%;
    background: #ffffff center / 15px 15px no-repeat;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.opt-row input[type="radio"]:hover {
    border-color: #21a057;
}
.opt-row input[type="radio"]:checked {
    border-color: #21a057;
    background-color: #21a057;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    animation: check-pop 0.25s ease;
}
.opt-row input[type="radio"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 160, 87, 0.3);
}
@keyframes check-pop {
    0% { transform: scale(0.7); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .opt-row input[type="radio"]:checked { animation: none; }
}
@media (prefers-color-scheme: dark) {
    .opt-row input[type="radio"] { background-color: #16181d; border-color: #4a5363; }
    .opt-row input[type="radio"]:hover { border-color: #2ed573; }
    .opt-row input[type="radio"]:checked { background-color: #21a057; border-color: #21a057; }
}

.delete-btn {
    background: #ff7675;
    color: white;
    border: none;
    width: 44px; 
    height: 40px; /* 40px height + 4px shadow = exactly 44px visual height */
    padding: 0;
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    border-radius: 12px; /* Unified from 8px to 12px */
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    cursor: pointer;
}

.delete-btn:hover {
    filter: brightness(1.1);
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

.delete-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 rgba(0,0,0,0.2);
}

.add-opt-btn {
    background: #74b9ff;
    color: white;
    border: none;
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 12px; /* Unified from 8px to 12px */
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    margin: 15px auto 5px;
    display: block;
    transition: all 0.1s ease;
    cursor: pointer;
}

.add-opt-btn:hover {
    filter: brightness(1.1);
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

.add-opt-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 rgba(0,0,0,0.2);
}

/* --- VIRAL UI ENHANCEMENTS --- */
.status-badge {
    background: #2d3436; color: #fff; padding: 6px 16px; border-radius: 12px; 
    font-size: 13px; font-weight: 900; position: absolute; top: -16px; 
    left: 50%; transform: translateX(-50%); letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.link-label {
    display: block; font-size: 13px; font-weight: 900; background: #2d3436; 
    color: #fff; width: fit-content; margin: 0 auto -12px auto; 
    padding: 6px 16px; border-radius: 20px; position: relative; z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.title-badge {
    --badge-bg: #2d3436;
    display: block; width: fit-content; margin: 15px auto 20px auto;
    background: var(--badge-bg); color: #fff; padding: 10px 24px; 
    border-radius: 16px; font-size: 18px; font-weight: 900; 
    text-transform: uppercase; letter-spacing: 1.5px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.2); 
    border: 2px solid rgba(255,255,255,0.1);
}
.title-badge.green { --badge-bg: #2ed573; background: var(--badge-bg); color: white; }
.title-badge.indigo { --badge-bg: #6C5CE7; background: var(--badge-bg); color: white; }

/* Winged modifier for floating container badges */
.title-badge.winged {
    position: relative; /* Anchor for the absolutely positioned outside dots */
    margin: 0 auto; /* Relies on the container's 20px gap for perfect vertical spacing */
}

.title-badge.winged::before,
.title-badge.winged::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--badge-bg);
}

.title-badge.winged::before {
    left: -16px; 
    box-shadow: -10px 0 0 -1.5px var(--badge-bg), -18px 0 0 -2.5px var(--badge-bg);
}

.title-badge.winged::after {
    right: -16px; 
    box-shadow: 10px 0 0 -1.5px var(--badge-bg), 18px 0 0 -2.5px var(--badge-bg);
}
.share-input-box {
    margin-bottom: 10px; text-align: center; font-weight: bold; 
    color: #2d3436 !important; padding-top: 22px; border: 2px solid #ccc !important; 
    font-size: 14px;
    transition: border 0.2s ease, background-color 0.2s ease;
}
.share-input-box:focus {
    border: 2px dashed #6C5CE7 !important;
    background-color: #f8f9fa !important;
}

/* --- SCOREBOARD STYLES --- */
.score-grid-header {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
    background: #e8f9f0; color: #21a057; font-size: 13px; font-weight: 900;
    text-transform: uppercase; padding: 10px 14px; border-radius: 20px;
    margin-bottom: 12px; text-align: center; align-items: center;
}
.score-grid-header span:first-child { text-align: left; padding-left: 5px; }

.score-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
    align-items: center; text-align: center;
    background: #fff; border: 2px solid rgba(0,0,0,0.05); 
    padding: 12px; border-radius: 12px; margin-bottom: 8px;
}
.score-row .score-name { 
    text-align: left; font-weight: bold; color: #2d3436; font-size: 14px; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 5px;
}
.score-row .score-num { font-weight: 900; color: #2d3436; font-size: 15px; }

.icon-action-btn { 
    background: transparent; border: none; font-size: 18px; cursor: pointer; 
    padding: 5px; margin: 0 auto; box-shadow: none !important; transition: transform 0.2s; 
    display: flex; align-items: center; justify-content: center;
}
.icon-action-btn:hover { transform: scale(1.2); background: transparent; }
.icon-action-btn.view { color: #3498db; }
.icon-action-btn.del { color: #ff4757; }

.speech-bubble {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 25px 20px;
    border: 2px solid rgba(0,0,0,0.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 14px 14px 0;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    z-index: 1;
}
.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 17px 17px 0;
    border-style: solid;
    border-color: rgba(0,0,0,0.05) transparent transparent transparent;
}

.highlight-green {
    background-color: #2ed573;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: inline-block;
    vertical-align: text-bottom;
}

/* v-inner-card removed in favor of global .app-card */
.v-step {
    display: flex;
    align-items: flex-start;
    text-align: left;
    gap: 15px;
    margin-bottom: 20px;
}
.v-step:last-child { margin-bottom: 0; }
.v-step-num {
    background: #2ed573; /* Arcade Green */
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
}
.v-step-text p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #636e72;
    line-height: 1.4;
}

/* --- VIRAL UI ENHANCEMENTS --- */
.reload-banner {
    background: #ffffff;
    color: #636e72;
    border: 2px solid rgba(0,0,0,0.05);
    border-radius: 20px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    width: 100%;
    cursor: pointer;
    transition: filter 0.2s;
    margin-bottom: 10px;
}
.reload-banner:hover { filter: brightness(0.95); }
.reload-banner span { text-align: left; font-size: 12px; line-height: 1.4; font-weight: bold; }

/* --- VIRAL SOCIAL STACK --- */
.social-stack {
    display: flex;
    flex-direction: column;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    margin: 0 -25px; /* Pulls it flush with the card edges on desktop */
    border-top: 2px solid rgba(0,0,0,0.05);
}
.social-stack-btn {
    border-radius: 0;
    margin: 0;
    box-shadow: none !important;
    padding: 15px 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    transition: filter 0.2s;
}
.social-stack-btn:last-child { border-bottom: none; }
/* Dimming effect feels much more premium than brightening */
.social-stack-btn:hover { filter: brightness(0.85); transform: none; }
.social-stack-btn:active { transform: scale(0.98); }

/* Brand Colors */
.btn-ig { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.btn-fb { background: #1877F2; }
.btn-x { background: #0f1419; } /* Official X Dark Mode Hex */
.btn-tt { background: #000000; } 
.btn-wa { background: #25D366; }
.btn-msgr { background: #0084FF; }
.btn-wastatus { background: #128C7E; }
.btn-snap { background: #FFFC00; color: #000; }

/* Image Popup Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: none; /* Safely hidden by default! */
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show-modal {
    display: flex; /* Safely overwrites none when toggled */
}
/* Close button: sits INSIDE the share card, in the corner opposite the step badge,
   lined up with the yellow step pill (same top + height) */
.modal-close-btn {
    position: absolute;
    top: 14px; right: 14px;
    width: 34px; height: 34px;
    background: rgba(0, 0, 0, 0.28);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    font-size: 15px; font-weight: bold;
    cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    box-shadow: none !important; padding: 0; margin: 0; line-height: 1;
}
.modal-close-btn:hover { background: rgba(0, 0, 0, 0.45); transform: none; filter: none; }
.modal-close-btn:active { transform: scale(0.92); box-shadow: none !important; }
[dir="rtl"] .modal-close-btn { right: auto; left: 14px; }

/* Phones: less outer padding and slimmer side tabs so the card stays large */
@media (max-width: 480px) {
    .modal-overlay { padding: 8px; }
}
.carousel-img-wrapper {
    position: relative;
    width: 100%;
    max-width: min(345px, calc(100% - 50px)); /* leaves room for the two side arrow tabs */
    aspect-ratio: 9 / 16; /* Locks exact 9:16 vertical Story proportions on all screens */
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

#popup-modal,
#popup-modal * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
}

.share-guide-card {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 50px 18px 0 18px;
    border: 4px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
    cursor: grab;
    touch-action: pan-y;

    /* Stylish Brand Palette Background (Arcade Indigo + Lavender + Sky Blue + Subtle Glow Orbs) */
    background:
        radial-gradient(circle at 88% 14%, rgba(251, 197, 49, 0.32) 0%, transparent 36%),
        radial-gradient(circle at 12% 32%, rgba(46, 213, 115, 0.25) 0%, transparent 42%),
        linear-gradient(160deg, #4834d4 0%, #6C5CE7 52%, #54a0ff 100%);

    /* =========================================================================
       OPTIONAL CUSTOM STATIC IMAGE BACKGROUND:
       If you ever want to use your own custom background image from /assets/
       instead of the brand CSS gradient above, UNCOMMENT the 3 lines below:
       ========================================================================= */
    /* background-image: url('/assets/share-card-bg.webp'); */
    /* background-size: cover; */
    /* background-position: center; */
}

.share-guide-card:active {
    cursor: grabbing;
}

.share-step-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 52px;
    background: #ffffff;
    color: #2d3436;
    font-weight: 900;
    font-size: 24px;
    border-radius: 0 0 26px 0;
    border-right: 3px solid rgba(0, 0, 0, 0.15);
    border-bottom: 3px solid rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 2px;
    padding-right: 2px;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Top Center Step Navigator (yellow pill): progress dots + animated "next" chevrons.
   Centered so it never sits under the modal's X button on phones. */
.share-step-nav {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    height: 34px;
    padding: 0 6px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fbc531;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
}
.share-step-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}
.share-step-dots span {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(45, 52, 54, 0.3);
    cursor: pointer;
    transition: width 0.25s ease, background 0.25s ease;
}
.share-step-dots span.active {
    width: 22px;
    background: #2d3436;
}
.share-step-arrows {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 6px;
    color: #2d3436;
    cursor: pointer;
    animation: share-arrows-nudge 1.4s ease-in-out infinite;
}
.share-step-arrows i {
    font-size: 17px;
    margin: 0 -2px;
    animation: share-arrows-wave 1.4s ease-in-out infinite;
}
.share-step-arrows i:nth-child(2) { animation-delay: 0.18s; }
.share-step-arrows i:nth-child(3) { animation-delay: 0.36s; }
/* Last step: no "next" arrows, the pill just shows the dots */
.share-step-arrows.is-hidden { display: none; }
.share-step-nav:has(.share-step-arrows.is-hidden) { padding: 0 14px; }
@keyframes share-arrows-wave {
    0%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}
@keyframes share-arrows-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}
@keyframes share-arrows-nudge-rtl {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    .share-step-arrows,
    .share-step-arrows i { animation: none; opacity: 1; }
}

.share-guide-bullets {
    list-style: none;
    padding: 0 6px;
    margin: 2px 0 12px 0;
    text-align: left;
    z-index: 2;
    min-height: 24%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[dir="rtl"] .share-guide-bullets,
[dir="rtl"] .share-guide-bullets li {
    text-align: right !important;
    direction: rtl;
}

[dir="rtl"] .share-step-badge {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 3px solid rgba(0, 0, 0, 0.15);
    border-radius: 0 0 0 26px;
    padding-right: 0;
    padding-left: 2px;
    box-shadow: -2px 4px 12px rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .share-step-nav {
    padding: 0 14px 0 6px;
}

[dir="rtl"] .share-step-arrows {
    animation-name: share-arrows-nudge-rtl;
}

[dir="rtl"] .share-step-arrows i {
    transform: scaleX(-1);
}

.share-guide-bullets li {
    color: #ffffff !important;
    font-size: 15.5px;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 7px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.share-guide-bullets li:last-child {
    margin-bottom: 0;
}

.share-guide-bullets li::before {
    content: "-";
    color: #2ed573;
    font-weight: 900;
    font-size: 18px;
    line-height: 1.2;
    flex-shrink: 0;
}

/* Built-in CSS iPhone Mockup Frame (Takes ~2/3 of Card Height) */
.share-phone-frame {
    position: relative;
    width: 88%;
    flex: 1;
    min-height: 67%;
    margin: auto auto 0 auto;
    background: #0f1419;
    border-radius: 40px 40px 0 0;
    border: 10px solid #12151a;
    border-bottom: none;
    /* Metallic titanium outer rim + subtle inner glass highlight + side buttons illusion */
    box-shadow:
        inset 0 0 0 1.5px rgba(255, 255, 255, 0.14),
        0 0 0 3px #d2dae2,
        0 0 0 4.5px rgba(0, 0, 0, 0.45),
        0 -14px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Realistic iPhone Dynamic Island Pill + Camera Lens Detail */
.share-phone-notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 96px;
    height: 24px;
    background: #000000;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    z-index: 3;
    pointer-events: none;
}

.share-phone-notch::after {
    content: "";
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #2f3640 0%, #0b0e14 60%, #1e3799 100%);
    box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.35);
}

.share-phone-screen {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: none;
    background: #ffffff;
}

.share-phone-placeholder {
    color: #ffffff;
    text-align: center;
    padding: 20px;
    font-weight: 800;
    font-size: 13px;
    line-height: 1.5;
}
/* Side arrows: half-round tabs attached to the outside edges of the share card
   (round on the outer side, flat where they touch the card). White like the step badge. */
.carousel-btn {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 25px; height: 48px;
    background: #ffffff;
    color: #2d3436;
    border: none;
    font-size: 14px;
    cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    box-shadow: none !important; padding: 0; margin: 0;
}
.carousel-btn.left { left: -25px; border-radius: 24px 0 0 24px; }
.carousel-btn.right { right: -25px; border-radius: 0 24px 24px 0; }
.carousel-btn:hover { background: #f1f2f6; transform: translateY(-50%); filter: none; }
/* Optical centering: nudge each chevron toward the card (the rounded side has less visual mass) */
.carousel-btn.left i { transform: translateX(1.5px); }
.carousel-btn.right i { transform: translateX(-1.5px); }
.carousel-btn:active { transform: translateY(-50%) scale(0.95); box-shadow: none !important; }

/* Removed unused Dark Mode modal overrides */

/* Custom Toast Notification */
.toast {
    position: fixed;
    top: -100px; /* Hidden above the screen */
    left: 50%;
    transform: translateX(-50%);
    background: #2d3436;
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s ease, top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Bouncy drop animation */
    z-index: 9999;
    pointer-events: none;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    width: max-content;
    max-width: min(500px, calc(100vw - 40px));
    line-height: 1.4;
}

.toast.show {
    top: 25px; /* Drops down nicely from the top */
    opacity: 1;
}

.toast.error {
    background-color: #ff4757 !important; /* Bright Arcade Red */
}

.toast.success {
    background-color: #6C5CE7 !important; /* Brand Indigo */
}

/* Universal Input Focus Ring (Kills the default pink/blue browser outline) */
.input-field:focus, .opt-row input[type="text"]:focus, .opt-row textarea.opt-input:focus {
    border-color: #6C5CE7 !important;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15) !important;
}

/* Correct inputs get a green focus ring instead of indigo to prevent color clashing */
.opt-row input[type="text"].correct-input:focus, .opt-row textarea.opt-input.correct-input:focus {
    border-color: #21a057 !important;
    box-shadow: 0 0 0 3px rgba(33, 160, 87, 0.15) !important;
}

/* --- QUICK TIPS CAROUSEL --- */
.tips-dots {
    display: flex; gap: 6px;
}
.tip-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #dfe6e9; transition: background 0.3s ease;
}
.tip-dot.active {
    background: #2ed573; /* Active green dot */
}
/* Story-style hit zones */
.click-zone {
    position: absolute; top: 0; bottom: 0;
    cursor: pointer; z-index: 10; display: flex; align-items: center;
    -webkit-tap-highlight-color: transparent; 
}
/* Left zone tightly hugs the left arrow (30px padding + icon) */
.click-zone.left { left: 0; width: 60px; justify-content: flex-start; }
/* Right zone stretches across the entire rest of the container */
.click-zone.right { left: 60px; right: 0; width: auto; justify-content: flex-end; }

.zone-icon {
    color: #b2bec3; font-size: 20px; transition: transform 0.2s, color 0.2s;
}
.click-zone:hover .zone-icon { color: #636e72; transform: scale(1.2); }
.click-zone:active .zone-icon { transform: scale(0.9); }

/* --- VIRAL STORY BUTTON --- */
.viral-story-btn {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border: none;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 900;
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 6px 0 rgba(220, 39, 67, 0.4);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: pulse-viral 2s infinite;
}
.viral-story-btn:hover {
    filter: brightness(1.1);
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(220, 39, 67, 0.4);
}
.viral-story-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 rgba(220, 39, 67, 0.4);
}
@keyframes pulse-viral {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* --- FLOATING AUDIO TOGGLE --- */
.audio-toggle-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    transition: bottom 0.3s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #6C5CE7;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: none; /* Hidden by default! Revealed by JS when applicable */
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.audio-toggle-btn:hover { transform: scale(1.1); }
.audio-toggle-btn:active { transform: scale(0.9); box-shadow: 0 0 0 rgba(0,0,0,0); }
.audio-toggle-btn.muted { background: #ff4757; }

/* --- APP LOGO --- */
.app-logo-container {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    z-index: 20;
    position: relative;
    animation: dropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.app-logo {
    max-width: 220px; /* Adjust this later based on your real logo dimensions */
    height: auto;
    display: inline-block;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}
.app-logo:hover {
    transform: scale(1.05);
}

/* --- SECONDARY BUTTONS --- */
.btn-secondary {
    background: #f1f2f6; color: #2d3436; box-shadow: none; border: 2px solid rgba(0,0,0,0.05);
}
.btn-secondary:hover { background: #e4e5e9; transform: translateY(2px); box-shadow: none; }

/* --- FRIEND ANSWERS REVIEW UI --- */
.review-opt {
    padding: 12px 15px; border-radius: 12px; font-weight: 700; font-size: 14px; 
    display: flex; justify-content: space-between; align-items: center; 
    transition: all 0.2s ease;
}
.review-label { font-size: 13px; font-weight: 900; letter-spacing: 0.5px; }

.review-opt-default { background: #f8f9fa; border: 2px solid rgba(0,0,0,0.05); color: #636e72; }
.review-opt-correct { background: #e8f9f0; border: 2px solid #2ed573; color: #21a057; }
.review-opt-wrong { background: #ffefef; border: 2px solid #ff7675; color: #d63031; }

/* --- QUESTION DROPDOWN MENU --- */
.q-menu-btn {
    position: absolute; top: 20px; right: 15px; z-index: 10;
    background: transparent; border: none; color: #a4b0be; font-size: 20px; 
    cursor: pointer; padding: 6px 12px; box-shadow: none !important; transition: color 0.2s; width: auto;
}
.q-menu-btn:hover { color: #2d3436; transform: none; background: transparent; }
.q-menu-btn:active { transform: scale(0.9); box-shadow: none !important; }

.q-dropdown {
    position: absolute; top: 50px; right: 15px; background: white; border: 2px solid rgba(0,0,0,0.05);
    border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 300px; max-width: 85vw; z-index: 100;
    display: none; flex-direction: column; max-height: 360px; overflow-y: auto; overflow-x: hidden;
}
.q-dropdown.show { display: flex; }
.q-dropdown-item {
    padding: 14px 15px; text-align: left; background: transparent; border: none;
    border-bottom: 1px solid rgba(0,0,0,0.05); width: 100%; font-size: 14px; font-weight: 700;
    color: #636e72; cursor: pointer; border-radius: 0; box-shadow: none !important;
    white-space: normal; line-height: 1.4; text-transform: none;
}
.q-dropdown-item:last-child { border-bottom: none; }
.q-dropdown-item:hover { background: #f8f9fa; transform: none; box-shadow: none !important; color: #6C5CE7; }
.q-dropdown-item.custom { color: #2d3436; font-weight: 800; }
.q-dropdown-divider { height: 4px; background: rgba(0,0,0,0.03); width: 100%; }

/* Color Picker Swatches */
.palette-wrapper {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed var(--border-light);
    text-align: center;
}

.palette-label {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: bold;
    color: #636e72;
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(8, 32px); /* 8 columns strictly on desktop */
    gap: 12px;
    justify-content: center;
}

/* On mobile, break it down into a perfect 4x2 grid */
@media (max-width: 450px) {
    .color-picker {
        grid-template-columns: repeat(4, 32px);
        gap: 16px; /* Slightly larger gap on mobile for better touch targets */
    }
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s ease, border 0.1s ease;
    background-clip: padding-box !important; /* Forces override against JS */
    -webkit-backface-visibility: hidden; /* Forces smooth edge rendering */
    backface-visibility: hidden;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border: 3px solid #6C5CE7; /* Replaces the black circle with a beautiful Indigo ring */
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.3); /* Adds a soft glow */
    transform: scale(1.15);
}

/* --- INFO BOX --- */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    text-align: left;
    border: 2px solid rgba(0,0,0,0.05);
}
.info-box i { color: #636e72; font-size: 20px; margin-top: 2px; }
.info-box span { font-size: 13px; font-weight: 700; color: #636e72; line-height: 1.4; }

/* --- EXPIRY NOTICE SPECIFIC COLORS --- */
#expiry-notice { background-color: #fff9db; border-color: #ffeaa7; }
#expiry-notice i { color: #fdcb6e; }
#expiry-text { color: #d63031; }
#renew-btn { background-color: #fdcb6e; color: #2d3436; }

/* --- REPORT THIS QUIZ LINK (friend page; disabled in quiz.html until you enable it) --- */
.report-quiz-wrap {
    width: 100%;
    max-width: 500px;
    text-align: center;
    margin-top: 25px;
    position: relative;
    z-index: 10;
}
.report-quiz-wrap a {
    color: #636e72;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.2s, color 0.2s;
}
.report-quiz-wrap a:hover { opacity: 1; color: #ff4757; }
@media (prefers-color-scheme: dark) {
    .report-quiz-wrap a { color: #abb2bf; }
}

/* --- PRIVATE RESULTS LINK BOX (dashboard, same look as the expiry notice) --- */
.private-link-box {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px;
    border-radius: 16px;
    margin: 0;
}
.private-link-text {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.private-link-box i { color: #6C5CE7; font-size: 18px; margin: 0; }
.private-link-box strong { color: #2d3436; font-size: 14px; }
#private-link-btn {
    margin: 0;
    padding: 8px 14px;
    font-size: 13px;
    width: auto;
    flex-shrink: 0;
    border-radius: 12px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

/* --- SEO ACCORDION CARD --- */
.seo-card {
    text-align: left;
    padding: 25px 22px;
}
.seo-heading {
    font-size: 17px;
    font-weight: 900;
    color: #2d3436;
    text-transform: uppercase;
    margin: 0 0 10px 0;
}
.seo-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #636e72;
    line-height: 1.6;
    margin: 0;
}
.seo-faq {
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding: 12px 0;
}
.seo-faq:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
.seo-faq summary {
    font-size: 14px;
    font-weight: 800;
    color: #2d3436;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.seo-faq summary::-webkit-details-marker {
    display: none;
}
.seo-faq summary::after {
    content: '+';
    font-size: 18px;
    font-weight: 900;
    color: #6C5CE7;
    transition: transform 0.2s ease;
}
.seo-faq[open] summary::after {
    content: '−';
}
.seo-faq p {
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
    line-height: 1.5;
    margin: 8px 0 0 0;
}

/* --- FOOTER & TOOLTIP --- */
.app-footer {
    margin-top: auto; /* Pushes footer to the very bottom */
    padding: 40px 10px 10px 10px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    z-index: 10;
}
.footer-links {
    display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 15px;
}
.footer-links a, .footer-links span.fun-link {
    color: #636e72; 
    text-decoration: none; font-size: 13px; font-weight: 800; text-transform: uppercase;
    transition: color 0.2s; cursor: pointer;
    display: flex; align-items: center; /* Locks vertical alignment */
}
.footer-links a:hover, .footer-links span.fun-link:hover { color: #6C5CE7; }
.footer-copyright { color: #636e72; font-size: 12px; font-weight: 700; } /* Matches the link color perfectly */

.footer-langs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.footer-langs a,
.footer-langs a:visited,
.footer-langs a:active {
    color: #636e72 !important;
    text-decoration: none !important;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.45;
    transition: opacity 0.2s, color 0.2s;
}
.footer-langs a:hover {
    opacity: 0.9;
    color: #6C5CE7 !important;
}

.tooltip-container { position: relative; display: inline-block; }
.tooltip-text {
    visibility: hidden; width: 220px; background-color: #2d3436; color: #fff; text-align: center;
    border-radius: 12px; padding: 10px 15px; position: absolute; z-index: 100;
    bottom: 130%; left: 50%; transform: translateX(-50%); opacity: 0; transition: opacity 0.3s, bottom 0.3s;
    font-size: 11px; font-weight: 700; line-height: 1.4; box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    pointer-events: none; text-transform: none;
}
.tooltip-text::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px;
    border-width: 6px; border-style: solid; border-color: #2d3436 transparent transparent transparent;
}
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; bottom: 140%; }

/* --- ARCADE LOADING SPINNER --- */
.arcade-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fbc531; /* Electric Yellow */
    border-right-color: #2ed573; /* Arcade Green */
    border-bottom-color: #ff4757; /* Arcade Red */
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-top: -3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- AUTOMATIC DARK MODE --- */
@media (prefers-color-scheme: dark) {
    body {
        /* Overrides the default vibrant gradient so the app baseline is a sleek, professional dark gray */
        background: linear-gradient(135deg, #1a1d24 0%, #121418 100%);
    }

    :root {
        /* Playful, vibrant neon arcade colors that pop in dark mode! */
        --bg-1: linear-gradient(135deg, #3A38E0 0%, #5250FC 100%); /* Vibrant Indigo */
        --bg-2: linear-gradient(135deg, #0097e6 0%, #00a8ff 100%); /* Bright Sky */
        --bg-3: linear-gradient(135deg, #44bd32 0%, #4cd137 100%); /* Arcade Green */
        --bg-4: linear-gradient(135deg, #8c7ae6 0%, #9c88ff 100%); /* Neon Purple */
        --bg-5: linear-gradient(135deg, #e1b12c 0%, #fbc531 100%); /* Electric Yellow */
        --bg-6: linear-gradient(135deg, #e84118 0%, #FF6349 100%); /* Coral/Red */
        --bg-7: linear-gradient(135deg, #0097e6 0%, #00cec9 100%); /* Bright Teal */
        --bg-8: linear-gradient(135deg, #e84393 0%, #fd79a8 100%); /* Hot Pink */
        
        --badge-text: #ffffff;
        --shadow-light: 0 4px 0 rgba(0,0,0,0.5);
        --border-light: rgba(255,255,255,0.2);
    }
    
    .app-card {
        background: #23272f !important;
        color: #f5f6fa !important;
        border: 4px solid rgba(255,255,255,0.05) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.4) !important;
    }
    .q-card, .steps-container {
        background: #23272f !important;
        color: #f5f6fa !important;
        border: 2px solid rgba(255,255,255,0.05) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.4) !important;
    }
    .step, #scoreboard-container div {
        background: #2d323c !important;
        border: 2px solid rgba(255,255,255,0.05) !important;
    }
    
    /* Info Box */
    .info-box {
        background-color: #16181d !important;
        border: 2px solid #3b424f !important;
    }
    .info-box i, .info-box span {
        color: #8b95a5 !important;
    }
    
    /* Prevent Expiry Notice from becoming dull gray in Dark Mode */
    #expiry-notice { 
        background-color: rgba(253, 203, 110, 0.1) !important; 
        border-color: rgba(253, 203, 110, 0.3) !important; 
    }
    #expiry-notice i { color: #fdcb6e !important; }
    #expiry-text { color: #ff7675 !important; } /* Neon red/pink for better dark contrast */
    #renew-btn { background-color: #fdcb6e !important; color: #2d3436 !important; }

    /* Text Boxes */
    .input-field, .opt-row input[type="text"], .opt-row textarea.opt-input {
        background-color: #16181d !important;
        color: #fff !important;
        border: 2px solid #3b424f !important;
    }
    .input-field::placeholder, .opt-row textarea.opt-input::placeholder {
        color: #8b95a5 !important;
    }
    
    /* Dark Mode version of the correct answer highlight */
    .opt-row input[type="text"].correct-input, .opt-row textarea.opt-input.correct-input {
        background-color: rgba(33, 160, 87, 0.15) !important;
        border-color: #21a057 !important;
        color: #2ed573 !important; /* Bright arcade green text */
    }
    
    /* Fixes missing shadows by using near-black instead of gray */
    button, .option-btn, .delete-btn {
        box-shadow: 0 5px 0 #08090a !important; 
    }
    button:active, .option-btn:active, .delete-btn:active {
        box-shadow: 0 0px 0 #08090a !important;
        transform: translateY(5px);
    }
    
    .option-btn {
        background-color: #2d323c !important;
        color: #f5f6fa !important;
        border: 2px solid #1a1d24 !important;
    }
    :where(.hover-ok) .option-btn:hover {
        background-color: #3b424f !important;
        border-color: #4a5363 !important;
        box-shadow: 0 3px 0 #08090a !important;
    }
    
    /* UI Text elements */
    h1, h2, h3, p, strong, label {
        color: #f5f6fa !important;
    }
    .step p, #q-counter, .palette-label {
        color: #abb2bf !important;
    }
    
    /* Glowing Swatch Selection Ring */
    .color-swatch.selected {
        border: 3px solid #f5f6fa !important; 
        box-shadow: 0 0 12px rgba(255,255,255,0.4) !important;
    }
    
    /* Dark Mode UI Enhancements */
    .speech-bubble {
        background: #2d323c !important;
        border-color: rgba(255,255,255,0.05) !important;
    }
    .speech-bubble::after {
        border-color: #2d323c transparent transparent transparent !important;
    }
    .speech-bubble::before {
        border-color: rgba(255,255,255,0.05) transparent transparent transparent !important;
    }
    .v-step-num {
        box-shadow: 0 3px 0 #08090a !important;
    }
    .reload-banner {
        background: #2d323c !important;
        border-color: rgba(255,255,255,0.05) !important;
        color: #f5f6fa !important;
    }
    .status-badge, .link-label, .title-badge {
        --badge-bg: #f5f6fa;
        background: var(--badge-bg) !important;
        color: #2d323c !important;
    }
    .title-badge.green { --badge-bg: #2ed573; background: var(--badge-bg) !important; color: white !important; }
    .title-badge.indigo { --badge-bg: #6C5CE7; background: var(--badge-bg) !important; color: white !important; }
    .share-input-box {
        color: #fff !important;
        border-color: #3b424f !important;
        background-color: #16181d !important;
    }
    .share-input-box:focus {
        border: 2px dashed #6C5CE7 !important;
        background-color: #121418 !important;
    }
    
    .score-grid-header { background: rgba(33,160,87,0.15) !important; color: #2ed573 !important; }
    .score-row { background: #2d323c !important; border-color: rgba(255,255,255,0.05) !important; }
    .score-row .score-name, .score-row .score-num { color: #f5f6fa !important; }
    
    /* Dark Mode Quick Tips */
    .tip-dot { background: #3b424f !important; }
    .tip-dot.active { background: #2ed573 !important; }
    .zone-icon { color: #4a5363 !important; }
    .click-zone:hover .zone-icon { color: #f5f6fa !important; }

    /* Dark Mode Question Menu */
    .q-dropdown { background: #2d323c !important; border-color: rgba(255,255,255,0.05) !important; }
    .q-dropdown-item { color: #abb2bf !important; border-color: rgba(255,255,255,0.05) !important; }
    .q-dropdown-item.custom { color: #f5f6fa !important; }
    .q-dropdown-item:hover { background: #3b424f !important; color: #2ed573 !important; }
    .q-dropdown-divider { background: rgba(255,255,255,0.05) !important; }
    .q-menu-btn { color: #abb2bf !important; }
    .q-menu-btn:hover { color: #f5f6fa !important; }

    /* Dark Mode Answers Review */
    .btn-secondary { background: #2d323c !important; color: #f5f6fa !important; border: 2px solid rgba(255,255,255,0.05) !important; }
    .review-opt-default { background: #16181d !important; border: 2px solid #3b424f !important; color: #8b95a5 !important; }
    .review-opt-correct { background: rgba(33, 160, 87, 0.15) !important; border: 2px solid #21a057 !important; color: #2ed573 !important; }
    .review-opt-wrong { background: rgba(214, 48, 49, 0.15) !important; border: 2px solid #d63031 !important; color: #ff7675 !important; }
    
    /* Dark Mode SEO Card */
    .seo-heading, .seo-faq summary { color: #f5f6fa !important; }
    .seo-text, .seo-faq p { color: #abb2bf !important; }
    .seo-faq { border-color: rgba(255,255,255,0.06) !important; }
    .seo-faq summary::after { color: #2ed573 !important; }

    /* Dark Mode Footer */
    .footer-links a, .footer-links span.fun-link, .footer-langs a, .footer-langs a:visited, .footer-langs a:active { color: #abb2bf !important; } 
    .footer-links a:hover, .footer-links span.fun-link:hover, .footer-langs a:hover { color: #f5f6fa !important; }
    .footer-copyright { color: #abb2bf !important; } 
    .tooltip-text { background-color: #f5f6fa !important; color: #2d323c !important; }
    .tooltip-text::after { border-color: #f5f6fa transparent transparent transparent !important; }

    /* Dark Mode GDPR Banner */
    .gdpr-banner { background: #1a1d24 !important; color: #f5f6fa !important; border-top: 1px solid rgba(255,255,255,0.1) !important; box-shadow: 0 -5px 20px rgba(0,0,0,0.5) !important; }
    .gdpr-banner a { color: #2ed573 !important; }
    .gdpr-banner button { background: #2ed573 !important; color: #2d3436 !important; }
}

/* --- HALAL FLOATING BACKGROUND EMOJIS --- */
#floating-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Prevents them from blocking clicks */
    z-index: 1; /* Renders behind the container (z-index 10) */
    overflow: hidden;
}

.floating-emoji {
    position: absolute;
    top: -10%;
    opacity: 0.3; /* Subtle transparency so it doesn't distract */
    animation: fall linear infinite;
    will-change: transform, opacity; /* GPU acceleration for buttery smooth falling emojis on mobile */
}

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* --- EXTREME MOBILE OPTIMIZATIONS (Screens under 480px) --- */
@media (max-width: 480px) {
    /* 1. Reclaim screen real estate by reducing outer and inner paddings */
    body { padding: 10px; }
    .app-card { padding: 20px 15px; }
    .toast { width: max-content; max-width: calc(100vw - 20px); padding: 12px 15px; font-size: 14px; }
    .q-card { padding: 15px; }
    .speech-bubble { padding: 20px 15px; }
    
    /* 2. Scale down heavy typography slightly */
    h1 { font-size: 22px !important; }
    h2 { font-size: 24px !important; }
    .q-badge { font-size: 14px !important; }
    
    /* 3. Optimize the scoreboard so the 4 columns don't crash into each other */
    .score-grid-header { padding: 8px; font-size: 10px; gap: 5px; }
    .score-row { padding: 10px 8px; gap: 5px; }
    .score-row .score-name { font-size: 13px; }
    .score-row .score-num { font-size: 14px; }
    .icon-action-btn { font-size: 16px; }

    /* 4. Fix Social Stack Overflow & text-wrapping */
    .social-stack { margin: 0 -15px; /* Matches mobile card padding perfectly */ }
    .social-stack-btn { padding: 12px 10px; font-size: 12px; }
    
    /* 5. Tidy up the footer links */
    .footer-links { gap: 12px; }
    
    /* 6. Ensure inputs and buttons don't feel too bulky on small screens */
    .input-field, .opt-row input[type="text"] { padding: 12px; font-size: 15px; }
    button { padding: 14px 16px; font-size: 16px; }
}

/* iPhone/iPad only: Safari auto-zooms into any text box smaller than 16px and stays zoomed in.
   16px on Apple touch devices prevents that; Android and desktop keep their current sizes. */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* --- RTL (ARABIC) SUPPORT OVERRIDES --- */
/* Removed .app-card so perfectly centered titles stay centered! Only explicitly left-aligned containers get flipped. */
[dir="rtl"] .q-card, [dir="rtl"] label, [dir="rtl"] .question-block, [dir="rtl"] .steps-container, [dir="rtl"] .v-step, [dir="rtl"] .info-box, [dir="rtl"] .reload-banner span, [dir="rtl"] .seo-card {
    text-align: right !important;
}

/* Mirror the absolutely positioned Quick Tips click zones so they don't overlap */
[dir="rtl"] .click-zone.left { left: auto; right: 0; }
[dir="rtl"] .click-zone.right { left: 0; right: 60px; }

/* Flip the chevron arrows horizontally to match the RTL flow, and preserve their hover animations */
[dir="rtl"] .click-zone .zone-icon { transform: scaleX(-1); }
[dir="rtl"] .click-zone:hover .zone-icon { transform: scaleX(-1) scale(1.2); }
[dir="rtl"] .click-zone:active .zone-icon { transform: scaleX(-1) scale(0.9); }
/* Mirror both the menu button and its dropdown box to the left side */
[dir="rtl"] .q-menu-btn, [dir="rtl"] .q-dropdown { right: auto; left: 15px; }
[dir="rtl"] .q-dropdown-item { text-align: right; }
[dir="rtl"] .score-grid-header span:first-child, [dir="rtl"] .score-row .score-name {
    text-align: right; padding-right: 5px; padding-left: 0;
}

/* Instantly applies the premium Arabic font, but safely excludes Font Awesome icons so they don't break! */
[dir="rtl"] *:not(.fa-solid):not(.fa-brands) {
    font-family: 'Cairo', sans-serif !important;
}

/* GDPR Banner (Sticky Bottom Bar) */
.gdpr-banner {
    position: fixed; bottom: 0; left: 0; width: 100%; 
    background: #ffffff; color: #2d3436; border-top: 1px solid rgba(0,0,0,0.1);
    padding: 15px 20px; display: flex; justify-content: space-between; align-items: center;
    z-index: 10000; box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
    font-size: 13px; font-weight: 700; line-height: 1.4; gap: 15px;
}
.gdpr-banner a { color: #6C5CE7; text-decoration: underline; font-weight: 900; }
.gdpr-banner button { background: #6C5CE7; color: white; padding: 10px 20px; font-size: 14px; width: auto; border-radius: 12px; margin: 0; border: none; cursor: pointer; transition: filter 0.2s; }
.gdpr-banner button:hover { filter: brightness(1.1); }

@media (max-width: 480px) {
    .gdpr-banner { flex-direction: column; text-align: center; }
    .gdpr-banner button { width: 100%; }
}

/* --- GLOBAL AD PLACEMENT STYLES --- */
/* Strip default margins and prevent empty ad slots from causing 20px flex gaps */
div[id^="ad-slot-"] {
    margin: 0 !important;
    padding: 0 !important;
}
/* Extra bottom clearance so dashboardMiddle never collides with the floating #status-badge */
#ad-slot-dashboard-mid {
    margin-bottom: 10px !important;
}
div[id^="ad-slot-"]:empty,
div[id^="ad-slot-"]:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
}
div[id^="ad-slot-"] ins {
    margin: 0 auto !important;
    display: block !important;
}
/* Sidebars (Only visible on wide desktop screens) */
.ad-sidebar {
    display: none; 
    position: fixed; 
    top: 120px; 
    width: 160px; 
    height: 600px; 
    z-index: 5;
}
.ad-sidebar.left { left: 15px; }
.ad-sidebar.right { right: 15px; }
@media (max-width: 1099px) {
    .ad-sidebar { display: none !important; }
}
@media (min-width: 1100px) {
    .ad-sidebar { display: block; }
}

/* Sticky Bottom Ad */
.ad-sticky-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 100px;
    z-index: 9998; /* Sits just underneath the GDPR banner and Audio button */
    background: #ffffff;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
}
/* Prevent content from hiding behind the sticky ad ONLY when active */
body.has-sticky-ad { padding-bottom: 120px; }

/* --- QUICK TIPS VIDEO AESTHETICS --- */
#tip-image {
    width: 100%;
    border-radius: 12px;
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-light);
    background-color: #ffffff; /* Keeps it crisp even if the video has transparency */
    display: block;
    margin: 0 auto;
}

/* --- DYNAMIC SWAP BUTTON ALIGNMENT (AUTO-CENTERED TO .q-badge) --- */
.q-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%;
}

.q-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 0 !important;
    left: auto !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
}

.q-menu-btn:hover {
    transform: translateY(-50%) !important;
}

.q-menu-btn:active {
    transform: translateY(-50%) scale(0.9) !important;
}

[dir="rtl"] .q-menu-btn {
    right: auto !important;
    left: 0 !important;
}

/* Dropdown anchors cleanly right below the header row */
.q-dropdown {
    top: calc(100% + 6px) !important;
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .q-dropdown {
    right: auto !important;
    left: 0 !important;
}

/* --- TIGHTEN WELCOME TEXT GAPS --- */
[data-i18n="creatorWelcome"] {
    margin: 0 0 6px 0 !important; /* Strips top margin, leaves a tight 6px gap below */
    line-height: 1.1;
}

[data-i18n="creatorDesc"] {
    margin: 0 0 15px 0 !important; /* Pushes the next element down by just 15px */
    line-height: 1.4;
}