/* =============================================================
   BUTTONS — base
   ============================================================= */
.menu-btn {
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: background-color var(--transition),
                border-color var(--transition),
                color var(--transition),
                transform var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.menu-btn:hover {
    transform: translateY(-2px);
    color: var(--white);
    border-color: var(--border-hi);
    background-color: var(--surface-2);
}

.menu-btn:active {
    transform: translateY(0) scale(0.98);
}

/* PRIMARY — white fill on hover */
.menu-btn.primary:hover,
.menu-btn.primary.keyboard-selected {
    background-color: var(--white);
    border-color: var(--white) !important;
    color: #1c1c1e !important;
    transform: translateY(-2px);
}

/* SECONDARY — subtle brighten */
.menu-btn.secondary:hover,
.menu-btn.secondary.keyboard-selected {
    background-color: var(--surface-2);
    border-color: var(--border-hi) !important;
    color: var(--white);
    transform: translateY(-2px);
}

/* DAILY — white fill */
.daily-btn:hover,
.daily-btn.keyboard-selected {
    background-color: var(--white) !important;
    border-color: var(--white) !important;
    color: #1c1c1e !important;
    transform: translateY(-2px);
}

/* =============================================================
   PLAY BUTTON — purple signature
   ============================================================= */
.play-main-btn {
    background-color: var(--surface-2);
    color: var(--white);
    font-size: 22px;
    font-weight: 800;
    padding: 22px 40px;
    border: 1px solid var(--purple);
    border-radius: var(--radius-md);
    box-shadow: 0 0 22px var(--purple-dim);
    transition: all var(--transition);
    letter-spacing: 2px;
}

.play-main-btn:hover,
.play-main-btn.keyboard-selected {
    background-color: var(--white) !important;
    border-color: var(--white) !important;
    color: #1c1c1e !important;
    box-shadow: 0 4px 28px rgba(162, 155, 254, 0.4) !important;
    transform: translateY(-2px);
}

/* =============================================================
   DIFFICULTY BUTTONS
   ============================================================= */
.difficulty-btn {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--white);
    transition: all var(--transition);
    min-width: 100%;
    display: inline-block;
    margin-bottom: 10px;
}

.game-over-card .difficulty-btn {
    width: 250px !important;
    justify-content: center;
    margin: 5px auto;
}

.diff-easy:hover, .diff-easy.keyboard-selected {
    background-color: #4a8a45;
    border-color: #4a8a45 !important;
    color: var(--white);
    transform: scale(1.02);
}

.diff-normal:hover, .diff-normal.keyboard-selected {
    background-color: #c9a030 !important;
    border-color: #c9a030 !important;
    color: #1c1c1e;
    transform: scale(1.02);
}

.diff-hard:hover, .diff-hard.keyboard-selected {
    background-color: #c93535;
    border-color: #c93535 !important;
    color: var(--white);
    transform: scale(1.02);
}

.diff-expert:hover, .diff-expert.keyboard-selected {
    background-color: #7b0000;
    border-color: #b30000 !important;
    color: var(--white);
    transform: scale(1.02);
}

#difficultyModal .menu-btn {
    width: 100%;
    margin-bottom: 10px;
}

/* =============================================================
   YES / NO BUTTONS
   ============================================================= */
.btn-yes, .btn-no {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--white);
    width: 100px;
    transition: all var(--transition);
}

.btn-yes:hover, .btn-yes.keyboard-selected {
    background-color: #4a8a45;
    border-color: #4a8a45 !important;
    color: var(--white);
    transform: scale(1.05);
}

.btn-no:hover, .btn-no.keyboard-selected {
    background-color: #8a2828;
    border-color: #8a2828 !important;
    color: var(--white);
    transform: scale(1.05);
}

/* =============================================================
   TIME ATTACK BUTTON
   ============================================================= */
.time-attack-btn {
    border-color: var(--white) !important;
    color: var(--white) !important;
}

.time-attack-btn:hover {
    background-color: var(--white) !important;
    color: #1c1c1e !important;
}

/* =============================================================
   SAVE / CONTINUE / QUIT
   ============================================================= */
#btnSaveAndQuit:hover, #btnSaveAndQuit.keyboard-selected {
    background-color: #4a8a45 !important;
    border-color: #4a8a45 !important;
    color: var(--white) !important;
    transform: scale(1.02);
}

#btnContinueGame {
    margin-bottom: 15px;
    color: var(--white);
    border-color: var(--white);
}

#btnContinueGame:hover, #btnContinueGame.keyboard-selected {
    background-color: var(--white) !important;
    border-color: var(--white) !important;
    color: #1c1c1e !important;
    transform: scale(1.02);
}

/* =============================================================
   VARIANT CLASSES
   ============================================================= */
.btn-loading { opacity: 0.45; cursor: not-allowed; }
.btn-loading:hover { transform: none !important; box-shadow: none !important; border-color: var(--border) !important; color: var(--text-muted) !important; }

.btn-custom-game          { border-color: #ffffff; color: #ffffff; }
.btn-custom-game:hover    { background-color: #ffffff !important; border-color: #ffffff !important; color: #1c1c1e !important; }
.btn-tier-list            { border-color: #ffffff; color: #ffffff; }
.btn-tier-list:hover      { background-color: #ffffff !important; border-color: #ffffff !important; color: #1c1c1e !important; }
.btn-online               { border-color: #ffffff; color: #ffffff; }
.btn-online:hover         { background-color: #ffffff !important; border-color: #ffffff !important; color: #1c1c1e !important; }
.btn-competitive          { border-color: var(--purple); color: var(--purple); }
.btn-competitive:hover    { background-color: var(--purple) !important; border-color: var(--purple) !important; color: #1c1c1e !important; }
.btn-sm          { padding: 5px 14px; font-size: 12px; }
.btn-green       { border-color: #4a8a45; color: #4a8a45; }
.btn-add-friend  { background-color: #a29bfe; border-color: #a29bfe; }

/* =============================================================
   BACK BUTTON (FIXED)
   ============================================================= */
.back-btn {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left));
    z-index: 1000;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text-muted);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.back-btn:hover {
    color: var(--white);
    background-color: var(--surface-2);
    border-color: var(--border-hi);
    transform: translateX(-2px);
}

/* =============================================================
   SETTINGS BUTTONS (BOTTOM RIGHT)
   ============================================================= */
.settings-buttons {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.round-btn {
    width: 120px;
    height: 44px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background-color: var(--surface-2);
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.round-btn:hover {
    border-color: var(--border-hi);
    color: var(--white);
}

/* =============================================================
   INPUT & SEARCH
   ============================================================= */
input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    background: var(--surface-1);
    border: 1px solid var(--border);
    color: var(--white);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    transition: border-color var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-dim);
}

.guest-input {
    width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 15px;
    color: var(--white);
    background: var(--surface-1);
    text-align: center;
    font-family: inherit;
}

.search-container {
    position: relative;
    margin-bottom: 28px;
    width: min(500px, 90%);
    margin-left: auto;
    margin-right: auto;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-1);
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.suggestions li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    transition: background-color var(--transition);
}

.suggestions li:hover                  { background: var(--surface-2); }
.suggestions li.active                 { background: var(--purple-dim); color: var(--white); }
.suggestions li.suggestion-guessed    { opacity: 0.4; text-decoration: line-through; cursor: default; color: var(--text-muted); }
.suggestions li.suggestion-guessed:hover { background: transparent; }

.suggestion-img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%;
}

/* =============================================================
   MENU BUTTON LAYOUT
   ============================================================= */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
}

.menu-buttons h3 {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* =============================================================
   LIFE BAR
   ============================================================= */
.life-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
    height: 18px;
}

.life-box {
    width: 24px;
    height: 8px;
    background-color: var(--surface-2);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.life-box.wrong {
    background-color: #c93535;
}

/* =============================================================
   FILTER SELECTS
   ============================================================= */
.filter-select {
    background-color: var(--surface-1);
    color: var(--white);
    border: 1px solid var(--border);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    flex: 1;
    max-width: 200px;
    transition: border-color var(--transition);
}

.filter-select:hover { border-color: var(--border-hi); }
.filter-select option { background-color: var(--surface-1); color: var(--white); }

/* =============================================================
   ACCORDION
   ============================================================= */
.accordion {
    background-color: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    padding: 14px 16px;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: background-color var(--transition), border-color var(--transition);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion:hover { border-color: var(--purple); color: var(--purple); }

.accordion-highlight {
    border-color: var(--purple);
    background: linear-gradient(135deg, var(--surface-2) 0%, rgba(108,92,231,0.12) 100%);
    color: var(--white);
}
.accordion-highlight:hover { background: linear-gradient(135deg, var(--surface-2) 0%, rgba(108,92,231,0.22) 100%); }

.accordion.active {
    background-color: var(--surface-2);
    border-color: var(--purple);
    color: var(--purple);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom-color: var(--border);
}

.accordion:after { content: '\002B'; font-weight: bold; font-size: 18px; }
.accordion.active:after { content: '\2212'; }

.panel {
    padding: 16px 20px;
    background-color: var(--surface-1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border: 1px solid var(--border);
    border-top: none;
    margin-top: -1px;
}

.list-item {
    padding: 10px 5px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-item:last-child { border-bottom: none; }

/* =============================================================
   RULES SCREEN
   ============================================================= */
.rules-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 60px 0 32px 0;
    animation: fadeIn 0.6s ease-out;
}

.rules-container {
    width: 90%;
    max-width: 700px;
    text-align: left;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 60px;
}

.rules-container p { margin: 0 0 12px 0; color: var(--text); }

.rules-intro {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.7;
}

/* --- MODE LIST (inside accordion panels) --- */
.mode-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 4px 0 8px 0;
}

.mode-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.mode-icon {
    font-size: 20px;
    line-height: 1.4;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.mode-title {
    display: block;
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 3px;
}

.mode-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}

.modes-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin: 16px 0 10px 0;
}

.modes-group-label:first-child { margin-top: 4px; }

.modes-group-note {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-muted);
    opacity: 0.75;
}

.panel-note {
    font-size: 12px;
    color: var(--text-muted);
    border-left: 2px solid var(--border-hi);
    padding-left: 10px;
    margin-top: 14px;
    line-height: 1.55;
}

/* --- HINT COLOR BOXES (inside Reading the Clues panel) --- */
.example-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.example-row p { margin: 0; font-size: 14px; }

.example-row .box {
    width: 72px;
    min-width: 72px;
    min-height: 44px;
    flex-shrink: 0;
    font-size: 13px;
}

/* =============================================================
   DASHBOARD LAYOUT
   ============================================================= */
.gamemode-layout {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 460px;
}

@media (max-width: 1000px) {
    .gamemode-layout { flex-direction: column; align-items: center; gap: 30px; }
    .calendar-container { position: relative !important; left: auto !important; }
    #modelOfDayCard { position: relative !important; right: auto !important; }
}

/* =============================================================
   CALENDAR
   ============================================================= */
.calendar-container {
    position: absolute;
    left: 0;
    top: 0;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 340px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.45);
}

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

.cal-nav-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 6px 12px;
    font-family: inherit;
    transition: all var(--transition);
}

.cal-nav-btn:hover {
    background: var(--purple-dim);
    color: var(--purple);
    border-color: var(--purple);
}

/* --- streak / XP strip --- */
.cal-streak-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    margin-bottom: 14px;
}

.cal-streak-badge {
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
}

.cal-month-xp {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- day-of-week header --- */
.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --- grid --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

/* --- day cells --- */
.cal-day {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    cursor: help;
    transition: transform var(--transition), border-color var(--transition);
    border: 1px solid transparent;
}

.cal-day:hover:not(.empty) { border-color: var(--border-hi); transform: scale(1.1); z-index: 2; }

.cal-day.empty   { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }

/* logged-in: white is secondary colour — use it as the "success" fill */
.cal-day.logged-in {
    background: var(--white);
    color: #1c1c1e;
    border-color: transparent;
}

.cal-day.logged-in:hover { border-color: var(--purple); }

/* missed: subtle red to signal a broken streak */
.cal-day.missed {
    background: rgba(200, 60, 60, 0.14);
    color: #c07070;
    border-color: rgba(200, 60, 60, 0.25);
}

/* today: purple ring, slightly enlarged */
.cal-day.today {
    border: 2px solid var(--purple);
    transform: scale(1.1);
    z-index: 2;
    color: var(--purple);
}

.cal-day.today.logged-in { color: #1c1c1e; }

/* future (no class beyond .cal-day) — slightly dimmer than past */
/* (already covered by default .cal-day style; no extra rule needed) */

/* --- legend --- */
.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
    column-gap: 14px;
}

.cal-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.cal-legend-logged { background: var(--white); }
.cal-legend-missed { background: rgba(200,60,60,0.25); border: 1px solid rgba(200,60,60,0.4); }
.cal-legend-today  { background: transparent; border: 2px solid var(--purple); border-radius: 3px; }

/* --- calendar day tooltip --- */
#calendarTooltip {
    display: none;
    position: fixed;
    background: var(--surface-1);
    border: 1px solid var(--border-hi);
    border-top: 2px solid var(--purple);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    z-index: 10000;
    min-width: 190px;
    max-width: 250px;
    text-align: left;
    box-shadow: 0 8px 28px rgba(0,0,0,0.7);
    pointer-events: auto;
    line-height: 1.5;
    color: var(--text);
}

.cal-tip-date  { color: var(--white); font-size: 14px; font-weight: 700; display: block; text-align: center; margin-bottom: 8px; }
.cal-tip-hr    { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.cal-tip-xp    { color: #85c97e; font-weight: 700; font-size: 13px; text-align: center; margin-bottom: 8px; }
.cal-tip-milestone-label { color: var(--purple); font-weight: 700; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.cal-tip-event { color: var(--white); font-size: 12px; margin-bottom: 3px; }
.cal-tip-event-link { color: #5cdb95; font-size: 12px; margin-bottom: 5px; cursor: pointer; text-decoration: underline; }
.cal-tip-empty { color: var(--text-muted); font-size: 12px; font-style: italic; text-align: center; }

/* =============================================================
   CUSTOM SELECT
   ============================================================= */
select.settings-input {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--surface-1);
    color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 38px 10px 14px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a29bfe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: border-color var(--transition);
}

select.settings-input:focus  { border-color: var(--border-hi); }
select.settings-input:disabled { opacity: 0.4; cursor: not-allowed; }
select.settings-input option { background-color: var(--surface-1); color: var(--white); padding: 8px; }

/* =============================================================
   TOOLTIP
   ============================================================= */
.tooltip-text {
    visibility: hidden;
    width: 140px;
    background-color: var(--surface-2);
    color: var(--text);
    text-align: center;
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 500;
    position: absolute;
    z-index: 101;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    pointer-events: none;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--surface-2) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* =============================================================
   ANIMATION KEYFRAMES
   ============================================================= */
@keyframes zoom {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* =============================================================
   COLLECTION COMPLETION PROGRESS BAR
   ============================================================= */

.collection-progress-wrap {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 16px;
}

.coll-prog-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.coll-prog-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 12px;
    margin-bottom: 4px;
}

.coll-prog-label {
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 11px;
}

.coll-prog-count {
    color: var(--white);
    font-weight: 600;
    font-size: 12px;
}

.coll-prog-track {
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.coll-prog-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), #a29bfe);
    border-radius: 99px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.coll-prog-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--purple);
    min-width: 36px;
    text-align: right;
}

/* =============================================================
   PERSONAL BESTS PANEL
   ============================================================= */

.pb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 4px 0;
}

.pb-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color var(--transition);
}

.pb-card:hover { border-color: var(--border-hi); }

.pb-icon {
    font-size: 22px;
    line-height: 1;
}

.pb-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pb-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

/* =============================================================
   CLANS
   ============================================================= */

/* Tag badge */
.clan-tag-badge {
    display: inline-block;
    background: var(--purple-dim);
    color: var(--purple);
    border: 1px solid var(--purple);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 7px;
    flex-shrink: 0;
}
.clan-tag-lg {
    font-size: 15px;
    padding: 4px 10px;
}

/* Clan hero header (inside my clan view) */
.clan-hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    text-align: left;
}
.clan-hero-text { flex: 1; min-width: 0; }
.clan-hero-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    margin: 4px 0 6px;
    word-break: break-word;
}
.clan-hero-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 6px;
    word-break: break-word;
}
.clan-hero-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* Section label */
.clan-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.clan-section {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 12px;
}

/* Member list */
.clan-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.clan-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 10px;
}
.clan-member-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.clan-role-emoji { font-size: 15px; flex-shrink: 0; }
.clan-member-name {
    font-size: 14px;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.clan-you-badge {
    font-size: 10px;
    background: var(--surface-1);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 4px;
}
.clan-role-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
}
.clan-role-leader  { background: rgba(255,215,0,0.15); color: #ffd700; }
.clan-role-officer { background: rgba(162,155,254,0.15); color: var(--purple); }
.clan-role-member  { background: var(--surface-1); color: var(--text-muted); }

/* --- MODEL RARITY BADGE (Collection cards + Tier List chips) --- */
.rarity-badge {
    position: absolute;
    top: 5px;
    right: 6px;
    z-index: 20;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 2px 6px;
    pointer-events: none;
    white-space: nowrap;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}
.rarity-common { background: rgba(255,255,255,0.12); color: var(--text-muted); }
.rarity-rare   { background: rgba(162,155,254,0.18); color: var(--purple); }
.rarity-icon   { background: rgba(212,175,55,0.18);  color: #d4af37; }

/* Tier List chips are 78px square — shrink the badge to an icon-only dot */
.tier-card .rarity-badge {
    top: 2px;
    right: 2px;
    font-size: 10px;
    padding: 1px 3px;
}

.clan-member-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Extra-small button */
.btn-xs {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-width: unset !important;
}

/* Invite card (pending invites) */
.clan-invite-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
    border: 1px solid var(--purple);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    gap: 12px;
    flex-wrap: wrap;
}
.clan-invite-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.clan-invite-name {
    font-weight: 700;
    color: var(--white);
    font-size: 14px;
}
.clan-invite-btns { display: flex; gap: 8px; flex-shrink: 0; }

/* Search result card */
.clan-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    text-align: left;
    transition: border-color 0.15s;
}
.clan-card:hover { border-color: var(--border-hi); }
.clan-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.clan-card-name  { font-size: 15px; color: var(--white); }
.clan-card-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.clan-card-desc  { font-size: 13px; color: var(--text-muted); margin: 0; }

/* =============================================================
   DISABLED BUTTON STATE (CSS replaces inline style.opacity/cursor)
   ============================================================= */
.menu-btn:disabled,
.difficulty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================
   MISC COMPONENT HELPERS (moved from HTML/JS inline styles)
   ============================================================= */
.heart-unfavorited  { opacity: 0.6; }
.credits-nav-btn    { padding: 5px 15px !important; }

/* =============================================================
   COLLECTION SEARCH ROW (moved from HTML inline styles)
   ============================================================= */
.collection-search-row    { display: flex; flex-direction: row; gap: 15px; justify-content: center; align-items: center; flex-wrap: wrap; }
.collection-theme-select  { min-width: 200px; margin: 0; padding: 12px !important; }
.collection-search-input  { flex: 1; min-width: 200px; margin: 0 !important; }

/* =============================================================
   NOTIFICATION BELL & PANEL
   ============================================================= */
.notif-bell {
    position: fixed;
    top: calc(max(20px, env(safe-area-inset-top)) + 82px);   /* profile-display: top + height 70 + 12 gap */
    right: max(20px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    padding: 0;
    font-family: inherit;
}
.notif-bell:hover {
    transform: scale(1.06);
    border-color: var(--purple);
    box-shadow: 0 4px 16px var(--purple-dim);
}

.notif-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #e03b3b;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
    line-height: 1;
    font-family: inherit;
}
.notif-badge.d-none { display: none; }

/* Panel */
.notif-panel {
    position: fixed;
    top: calc(max(20px, env(safe-area-inset-top)) + 138px);   /* bell top + height 44 + 12 gap */
    right: max(16px, env(safe-area-inset-right));
    width: 310px;
    max-height: 440px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notif-drop 0.18s ease;
}
.notif-panel.d-none { display: none; }

@keyframes notif-drop {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.3px;
}
.notif-mark-all {
    background: none;
    border: none;
    color: var(--purple);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: opacity var(--transition);
}
.notif-mark-all:hover { opacity: 0.75; }

.notif-list {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.notif-seen { opacity: 0.65; }

.notif-icon-col {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}
.notif-text-col   { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.35; }
.notif-item-body  { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; word-break: break-word; }
.notif-item-time  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.notif-dot {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--purple);
    flex-shrink: 0;
}

.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

/* =============================================================
   INTERACTIVE ONBOARDING TUTORIAL OVERLAY
   Fixed overlay + bottom-anchored tutorial card.
   The CSS spotlight effect is achieved with a large inset
   box-shadow on the overlay itself rather than z-index tricks,
   so it works regardless of the page's stacking-context tree.
   ============================================================= */

#onbOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 6000;
    pointer-events: none; /* card handles its own clicks */
}

#onbOverlay.d-none { display: none; }

/* Fade-out animation when dismissed */
#onbOverlay.onb-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ── Tutorial card ─────────────────────────────────────────── */
.onb-card {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, calc(100vw - 28px));
    background: var(--surface-1);
    border: 1.5px solid var(--purple);
    border-radius: var(--radius-lg);
    padding: 22px 24px 20px;
    z-index: 6001;
    pointer-events: auto;
    box-shadow:
        0 0 0 1.5px var(--purple-dim),
        0 20px 56px rgba(0, 0, 0, 0.7);
    animation: onb-slide-up 0.3s ease;
}

/* Welcome step: centred vertically */
.onb-card.onb-center {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
}

@keyframes onb-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(18px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

.onb-card.onb-center {
    animation: onb-fade-in 0.3s ease;
}

@keyframes onb-fade-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
    to   { opacity: 1; transform: translate(-50%, -50%);              }
}

/* ── Progress dots ─────────────────────────────────────────── */
.onb-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.onb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}

.onb-dot.active { background: var(--purple); }

/* ── Text ──────────────────────────────────────────────────── */
.onb-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--white);
    margin: 0 0 10px;
}

.onb-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0 0 18px;
}

/* ── Action row ────────────────────────────────────────────── */
.onb-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.onb-primary-btn {
    padding: 10px 20px !important;
    font-size: 13px !important;
    flex: 1;
}

.onb-skip-btn {
    padding: 10px 14px !important;
    font-size: 12px !important;
    flex-shrink: 0;
}

.onb-auto-msg {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .onb-card {
        bottom: max(20px, env(safe-area-inset-bottom));
        padding: 18px 18px 16px;
    }
    .onb-card.onb-center {
        top: 50%;
        bottom: auto;
    }
}

/* =============================================================
   PUBLIC HALL OF FAME
   Three record cards shown in the Hall of Fame stat sub-tab.
   ============================================================= */

.hof-heading {
    text-align: center;
    font-size: 18px;
    color: var(--white);
    margin: 0 0 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.hof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.hof-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 16px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color var(--transition);
}

.hof-card:hover { border-color: var(--purple-dim); }

.hof-medal {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 4px;
}

.hof-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--purple);
    font-weight: 700;
    margin: 0;
}

.hof-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--white);
    margin: 4px 0;
}

.hof-holder {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
}

.hof-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.hof-avatar-placeholder {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-1);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.hof-name {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
