/* Apple HIG-Inspired Restrained Tactile Micro-Interactions & Rewards */

.rr-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.77rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    background: rgba(238, 242, 255, 0.9);
    color: #3730a3;
    border: 1px solid rgba(199, 210, 254, 0.85);
    white-space: nowrap;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.22s ease, border-color 0.22s ease;
}

.rr-pill.is-hot {
    background: rgba(254, 243, 199, 0.92);
    color: #92400e;
    border-color: rgba(252, 211, 77, 0.9);
}

.rr-pill.is-pop {
    animation: rrPop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rrPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Apple Dynamic-Island Style Frosted Glass HUD Pill (Restrained & Non-Intrusive) */
.rr-toast-stack {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    max-width: min(340px, calc(100vw - 32px));
}

.rr-toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.84);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    color: #f8fafc;
    font-size: 0.81rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16), inset 0 0.5px 0 rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: rrSlideIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.rr-toast--success {
    background: rgba(6, 78, 59, 0.88);
    border-color: rgba(16, 185, 129, 0.35);
}

.rr-toast--gold {
    background: rgba(28, 25, 23, 0.88);
    color: #fef3c7;
    border-color: rgba(251, 191, 36, 0.35);
}

.rr-toast-out {
    animation: rrFadeOut 0.2s ease-out forwards;
}

@keyframes rrSlideIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rrFadeOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-4px) scale(0.97); }
}

/* Tactile Option Press & Settle Physics (Exam + Study Modes) */
.option-item {
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease !important;
    will-change: transform;
}

.option-item:active:not(.disabled) {
    transform: scale(0.988) !important;
}

.option-item.selected {
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.16), 0 4px 12px rgba(15, 23, 42, 0.04);
}

.option-item.correct {
    animation: rrCorrectSettle 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.option-item.incorrect {
    animation: rrGentleNudge 0.22s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes rrCorrectSettle {
    0% { transform: scale(0.99); }
    50% { transform: scale(1.012); }
    100% { transform: scale(1); }
}

@keyframes rrGentleNudge {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-3px); }
    70% { transform: translateX(3px); }
}

/* Silky Question-to-Question Card Glide & Liquid Progress Bar */
#progress-fill {
    transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.rr-card-enter {
    animation: rrCardEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rrCardEnter {
    from { opacity: 0.45; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.feedback-panel.visible {
    animation: rrCardEnter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Results Medal Shelf */
.rr-medals-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 22px;
    margin: 20px 0 24px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.rr-medals-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.rr-medals-head h2 {
    margin: 0;
    font-size: 1.08rem;
    color: #0f172a;
    letter-spacing: -0.015em;
}

.rr-xp-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-medals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.rr-medal-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    animation: rrMedalReveal 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rr-medal-card--gold {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #fcd34d;
}

.rr-medal-card--emerald {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #6ee7b7;
}

.rr-medal-card--indigo {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-color: #a5b4fc;
}

.rr-medal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.85);
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.rr-medal-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.rr-medal-desc {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 2px;
    line-height: 1.3;
}

@keyframes rrMedalReveal {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .rr-pill.is-pop,
    .rr-toast,
    .rr-toast-out,
    .rr-medal-card,
    .option-item,
    .rr-card-enter,
    .feedback-panel.visible {
        animation: none !important;
        transition: none !important;
    }
}
