/* Excellence Treasure Hunt - Shared Mobile-First Theme */
:root {
    --bg-page: #f4f7fb;
    --bg-card: #ffffff;
    --bg-surface: #eef3f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #0284c7;
    --accent-primary-hover: #0369a1;
    --accent-gold: #d97706;
    --accent-success: #15803d;
    --accent-danger: #b91c1c;
    --accent-warning: #b45309;
    --border-color: #dbe3ee;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-primary);
}

/* Top App Bar */
.topbar {
    background: linear-gradient(135deg, #0f172a 0%, #0c4a6e 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.08rem;
    letter-spacing: 0.2px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-nav a {
    color: #e0f2fe;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.topbar-nav a:hover,
.topbar-nav a.active {
    background-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

/* Main Container */
.app-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 64px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.page-title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.page-subtitle {
    margin: 0 0 18px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: var(--accent-danger);
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

/* Form Inputs */
.input-field {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16);
}

/* Status Banner */
.status-banner {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    font-weight: 500;
    margin-bottom: 14px;
    display: none;
}

.status-banner.visible {
    display: block;
}

.status-banner.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.status-banner.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.status-banner.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* Challenge List */
.challenge-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.challenge-list li a {
    display: block;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.challenge-list li a:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 480px) {
    .topbar {
        padding: 12px 14px;
    }
    .page-title {
        font-size: 1.32rem;
    }
    .card {
        padding: 16px;
    }
}

/* Search & Toolbar */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.toolbar .input-field {
    margin-bottom: 0;
    flex: 1;
}

/* Rich Hunt Card */
.hunt-card-link {
    display: block;
    padding: 18px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.hunt-card-link:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hunt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.hunt-card-title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hunt-card-desc {
    margin: 0 0 12px;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.badge-prize {
    background: #fef3c7;
    color: #92400e;
}

.badge-resume {
    background: #dcfce7;
    color: #166534;
}

.badge-active {
    background: #e0f2fe;
    color: #075985;
}

/* Skeleton Loading (from Week 8a Design & Usability) */
.skeleton-card {
    height: 112px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

/* Question Display & Dynamic Input Controls */
.question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 16px;
    color: var(--text-primary);
    word-break: break-word;
}

.question-link-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.mcq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.choice-btn {
    padding: 16px 14px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.14s ease;
}

.choice-btn:hover {
    border-color: var(--accent-primary);
    background: #e0f2fe;
}

.choice-btn.selected {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: #ffffff;
}

.boolean-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

/* Live Session HUD */
.hud-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.hud-stat {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    text-align: center;
}

.hud-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.hud-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.hud-value.timer-low {
    color: var(--accent-danger);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-surface);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #0ea5e9);
    transition: width 0.35s ease;
}

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.action-row .btn {
    flex: 1;
    min-width: 120px;
}

/* Reusable Modal Dialogs (QR Scanner, Map, History) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 200;
}

.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.qr-video {
    width: 100%;
    border-radius: var(--radius-sm);
    background: #0f172a;
    max-height: 300px;
    object-fit: cover;
    margin-bottom: 10px;
}

.qr-result-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
    word-break: break-all;
}
