/* ============================================================
   Shared Duolingo-style theme (based on theme.html)
   Used by every screen and every question type.
   ============================================================ */

body {
    font-family: 'Nunito', sans-serif;
    background-color: #ffffff;
    color: #4b4b4b;
    user-select: none;
}

/* ---- Buttons ---- */
.btn {
    transition: all 0.1s ease;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
}

.btn:active:not(:disabled) {
    transform: translateY(4px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-primary {
    background-color: #58cc02;
    color: white;
    border-bottom: 4px solid #58a700;
}

.btn-primary:active:not(:disabled) {
    border-bottom: 0px solid #58a700;
    margin-top: 4px;
}

.btn-secondary {
    background-color: #ffffff;
    color: #1cb0f6;
    border: 2px solid #e5e5e5;
    border-bottom: 4px solid #e5e5e5;
}

/* Big selectable cards (menu / question type picker / multiple choice) */
.btn-category {
    background-color: #ffffff;
    color: #3c3c3c;
    border: 2px solid #e5e5e5;
    border-bottom: 4px solid #e5e5e5;
    text-transform: none;
    font-size: 1.1rem;
    justify-content: start;
    padding: 20px;
}

.btn-category:hover {
    background-color: #f7f7f7;
    border-color: #1cb0f6;
}

/* ---- Inputs ---- */
.duo-input {
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    font-size: 1.25rem;
    padding: 16px 20px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    font-weight: 700;
    color: #3c3c3c;
}

.duo-input:focus {
    border-color: #1cb0f6;
}

/* ---- Footer (shared by all question types) ---- */
#footer {
    transition: background-color 0.2s, color 0.2s;
    border-top: 2px solid #e5e5e5;
}

.footer-correct   { background-color: #d7ffb8 !important; border-top-color: #d7ffb8 !important; }
.footer-incorrect { background-color: #ffdfe0 !important; border-top-color: #ffdfe0 !important; }

/* ---- Animations ---- */
.pop-in {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0%   { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ============================================================
   Scroll-wheel picker (iOS-alarm style)
   Shared widget — used by the "century" question type, reusable
   by any future type that needs a swipeable value wheel.
   Geometry is driven by --wheel-item (item height); the picker
   shows 5 rows with the middle row as the selected value.
   ============================================================ */
.wheel-wrap {
    position: relative;
    width: 88px;
}

.wheel {
    --wheel-item: 48px;
    height: calc(var(--wheel-item) * 5);
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-y;
    /* fade the top/bottom rows for the classic wheel look */
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
            mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
}

.wheel::-webkit-scrollbar { display: none; }

/* top/bottom spacers so the first/last value can reach the centre */
.wheel-pad { height: calc(var(--wheel-item) * 2); }

.wheel-item {
    height: var(--wheel-item);
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 1.7rem;
    font-weight: 800;
    color: #3c3c3c;
    transition: opacity 0.12s ease, transform 0.12s ease;
    will-change: opacity, transform;
}

.wheel-item-active { color: #1cb0f6; }

/* highlight band marking the selected (centre) row */
.wheel-band {
    position: absolute;
    left: -6px;
    right: -6px;
    top: calc(var(--wheel-item, 48px) * 2);
    height: var(--wheel-item, 48px);
    border-top: 2px solid #e5e5e5;
    border-bottom: 2px solid #e5e5e5;
    border-radius: 10px;
    pointer-events: none;
}

/* ============================================================
   Multiple-choice option states (type "choice")
   ============================================================ */
.opt-selected {
    border-color: #1cb0f6 !important;
    background-color: #ddf4ff !important;
    color: #1899d6 !important;
}

.opt-correct {
    border-color: #58a700 !important;
    background-color: #d7ffb8 !important;
    color: #58a700 !important;
}

.opt-wrong {
    border-color: #ea2b2b !important;
    background-color: #ffdfe0 !important;
    color: #ea2b2b !important;
}

/* faded out by the "Help" 50:50 elimination */
.opt-eliminated {
    opacity: 0.35;
    text-decoration: line-through;
}

/* ============================================================
   Matching pairs (type "match")
   ============================================================ */
.match-tile {
    position: relative;
    text-transform: none;
    letter-spacing: normal;
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 12px;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
}

/* small numbered badge shown on both tiles of a formed link */
.match-badge {
    position: absolute;
    top: -9px;
    right: -9px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: #ffffff;
    background: #777;
}

/* ============================================================
   Categorize / sort into buckets (type "sort")
   ============================================================ */
.sort-bucket {
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, background-color 0.15s;
}

.sort-bucket-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #777;
    text-align: center;
    margin-bottom: 8px;
}

.sort-bucket-body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    justify-content: center;
    flex-grow: 1;
    min-height: 56px;
}

/* highlighted while an item is selected, to show it can receive */
.sort-armed { border-color: #1cb0f6; background-color: #f0faff; }

.sort-chip {
    border: 2px solid #e5e5e5;
    border-bottom-width: 3px;
    border-radius: 12px;
    background: #ffffff;
    color: #3c3c3c;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.sort-chip:active:not(:disabled) { transform: translateY(2px); }

/* ============================================================
   Category card (menu): info row + two action buttons
   ============================================================ */
.cat-card {
    background: #ffffff;
    border: 2px solid #e5e5e5;
    border-bottom: 4px solid #e5e5e5;
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.cat-btn {
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 10px 8px;
    cursor: pointer;
    text-align: center;
    line-height: 1.15;
    transition: all 0.1s ease;
}

.cat-btn:active { transform: translateY(2px); }

.cat-btn-play {
    background: #58cc02;
    color: #ffffff;
    border-bottom: 4px solid #58a700;
}
.cat-btn-play:active { border-bottom: 0; margin-top: 4px; }

.cat-btn-practice {
    background: #ffffff;
    color: #1cb0f6;
    border: 2px solid #e5e5e5;
    border-bottom: 4px solid #e5e5e5;
}
.cat-btn-practice:active { border-bottom-width: 2px; margin-top: 2px; }

/* ---- lesson selection rows ---- */
.lesson-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border: 2px solid #e5e5e5;
    border-bottom: 4px solid #e5e5e5;
    border-radius: 16px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.lesson-row:hover { border-color: #1cb0f6; }

/* selected (checked) state, toggled by JS */
.lesson-row.lesson-on {
    border-color: #1cb0f6;
    background: #ddf4ff;
}

.lesson-check {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    accent-color: #1cb0f6;
}

/* ---- leave-app modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    animation: popIn 0.2s ease forwards;
}

/* ============================================================
   Fill-in-the-blank (type "blank")
   ============================================================ */
.blank-slot {
    display: inline-block;
    min-width: 64px;
    border-bottom: 3px solid #1cb0f6;
    color: #1cb0f6;
    font-weight: 800;
    text-align: center;
    padding: 0 6px;
}

/* ============================================================
   Word bank (type "wordbank")
   ============================================================ */
.wb-passage {
    font-size: 1.25rem;
    line-height: 2.4;
    font-weight: 700;
    color: #3c3c3c;
    text-align: center;
}

/* a gap in the passage; holds a placed tile or shows an empty underline */
.wb-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 40px;
    margin: 0 4px;
    vertical-align: middle;
    border-bottom: 3px solid #d0d0d0;
    transition: border-color 0.15s;
}

.wb-slot.wb-slot-filled { border-bottom-color: transparent; }
.wb-slot.wb-slot-correct { border-bottom-color: #58a700; }
.wb-slot.wb-slot-wrong   { border-bottom-color: #ea2b2b; }

.wb-tile {
    border: 2px solid #e5e5e5;
    border-bottom-width: 3px;
    border-radius: 12px;
    background: #ffffff;
    color: #3c3c3c;
    font-weight: 700;
    font-size: 1rem;
    padding: 8px 14px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.wb-tile:active { transform: translateY(2px); }
.wb-tile-hidden { visibility: hidden; }    /* reserve space in bank while placed */

.wb-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ============================================================
   Hotspot (type "hotspot")
   ============================================================ */
.hotspot-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e5e5;
    cursor: crosshair;
    touch-action: manipulation;
}

.hotspot-img { width: 100%; height: auto; display: block; }

.hotspot-pin {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    background: #1cb0f6;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    pointer-events: none;
}

.hotspot-pin.pin-correct { background: #58cc02; }
.hotspot-pin.pin-wrong   { background: #ff4b4b; }

/* correct target area, revealed after submitting */
.hotspot-target {
    position: absolute;
    border: 3px solid #58a700;
    background: rgba(88, 204, 2, 0.25);
    border-radius: 8px;
    pointer-events: none;
    display: none;
}

/* ============================================================
   Ordering / timeline (type "order")
   ============================================================ */
.order-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-badge {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1cb0f6;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-slot {
    flex-grow: 1;
    min-height: 48px;
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-weight: 700;
    color: #3c3c3c;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.order-slot-filled {
    border-style: solid;
    border-color: #e5e5e5;
    background: #ffffff;
}
