/* ═══════════════════════════════════════════════════════════════
   Dashboard — main home screen
   ═══════════════════════════════════════════════════════════════ */

/* ─── Keyframes ─── */
@keyframes card-enter {
    from { opacity: 0; transform: translateY(22px) }
    to   { opacity: 1; transform: translateY(0) }
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50% }
    50%       { background-position: 100% 50% }
}

@keyframes hero-glow {
    0%, 100% { box-shadow: 0 10px 40px rgba(67,56,202,0.38), 0 2px 8px rgba(0,0,0,0.1) }
    50%       { box-shadow: 0 16px 55px rgba(99,102,241,0.52), 0 2px 8px rgba(0,0,0,0.1) }
}

@keyframes shimmer-sweep {
    0%        { left: -80% }
    45%, 100% { left: 130% }
}

@keyframes online-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5) }
    50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0) }
}

@keyframes progress-fill {
    from { width: 0 !important }
}

@keyframes badge-float {
    0%, 100% { transform: translateY(0) }
    50%       { transform: translateY(-3px) }
}

@keyframes db-toast-in {
    from { transform: translateX(-50%) translateY(80px); opacity: 0 }
    to   { transform: translateX(-50%) translateY(0); opacity: 1 }
}

/* ─── Page wrap ─── */
.db-wrap {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    min-height: calc(100vh - 68px);
    direction: rtl;
    align-items: flex-start;
    box-sizing: border-box;
    position: relative;
    background:
        radial-gradient(ellipse 700px 550px at 90%  0%,  rgba(99,102,241,0.18),  transparent),
        radial-gradient(ellipse 550px 450px at 8%   90%, rgba(168,85,247,0.13),  transparent),
        radial-gradient(ellipse 450px 380px at 55%  55%, rgba(20,184,166,0.09),  transparent),
        radial-gradient(ellipse 350px 300px at 20%  20%, rgba(239,68,68,0.05),   transparent),
        linear-gradient(145deg, #eef2ff 0%, #faf5ff 45%, #f0f9ff 100%);
}

/* ─── Card entrance animation helper ─── */
.db-animated {
    animation: card-enter 0.55s cubic-bezier(.22,.68,0,1.2) both;
}

/* ─── Greeting banner ─── */
.db-greeting {
    background: linear-gradient(135deg, #fff 0%, #f5f3ff 55%, #e0f2fe 100%);
    border-radius: 18px;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: rtl;
    box-shadow: 0 2px 20px rgba(99,102,241,0.1), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid rgba(209,213,219,0.5);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.db-greeting::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f59e0b);
}
.db-greeting-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.db-greeting-wave {
    font-size: 2rem;
    animation: badge-float 3s ease-in-out infinite;
    flex-shrink: 0;
}
.db-greeting-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -0.3px;
    margin-bottom: 3px;
}
.db-greeting-sub {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}
.db-greeting-info {
    text-align: left;
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 500;
    flex-shrink: 0;
}
.db-greeting-day {
    font-size: 0.88rem;
    font-weight: 800;
    color: #6366f1;
    margin-bottom: 2px;
}

/* ─── Base card ─── */
.db-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid rgba(226,232,240,0.75);
}

/* ═══════════════════════════════════════════════════════════════
   SPECIAL CHALLENGES — left panel
   ═══════════════════════════════════════════════════════════════ */
.db-special {
    width: 268px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dbs-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid rgba(226,232,240,0.75);
    overflow: hidden;
    flex: 1;
    position: relative;
}

.dbs-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #14b8a6, #6366f1, #a855f7);
}

/* Header */
.dbs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #ddd6fe;
    direction: rtl;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 65%, #e0e7ff 100%);
}

.dbs-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.2px;
}

.dbs-title-icon { font-size: 1.1rem }

.dbs-all-btn {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    border: none;
    border-radius: 99px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 10px rgba(20,184,166,0.35);
}
.dbs-all-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(20,184,166,0.5);
}

/* Challenge list */
.dbs-list { padding: 6px 0 4px }

.dbs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f8fafc;
    direction: rtl;
    cursor: pointer;
    transition: background 0.18s;
    position: relative;
    overflow: hidden;
}
.dbs-item:last-child { border-bottom: none }
.dbs-item:not(.dbs-item--locked):hover { background: #f8faff }
.dbs-item--locked { cursor: default; opacity: 0.72 }

.dbs-item-icon {
    font-size: 1.4rem;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.dbs-item:not(.dbs-item--locked):hover .dbs-item-icon { transform: scale(1.1) rotate(-5deg) }

.dbs-item-info { flex: 1; text-align: right; min-width: 0 }

.dbs-item-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dbs-item-game {
    font-size: 0.66rem;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 2px;
}

.dbs-item-desc {
    font-size: 0.67rem;
    color: #94a3b8;
}

.dbs-item-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.dbs-status {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}
.dbs-status--available { background: #dcfce7; color: #166534 }
.dbs-status--locked    { background: #f1f5f9; color: #94a3b8 }

.dbs-coins {
    font-size: 0.7rem;
    font-weight: 700;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ─── Booster shop card ─── */
.dbs-shop-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #3730a3 100%);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: rtl;
    box-shadow: 0 6px 28px rgba(49,46,129,0.38);
    border: 1px solid rgba(99,102,241,0.25);
    position: relative;
    overflow: hidden;
}

.dbs-shop-card::before {
    content: '';
    position: absolute;
    top: -30px; left: -30px;
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(99,102,241,0.3), transparent 70%);
    pointer-events: none;
}

.dbs-shop-info { text-align: right; position: relative }

.dbs-shop-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #e2e8f0;
    margin-bottom: 3px;
}

.dbs-shop-desc {
    font-size: 0.66rem;
    color: #64748b;
}

.dbs-shop-btn {
    font-size: 0.74rem;
    font-weight: 800;
    color: #1e1b4b;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: none;
    border-radius: 10px;
    padding: 9px 15px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(245,158,11,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}
.dbs-shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(245,158,11,0.65);
}

/* ═══════════════════════════════════════════════════════════════
   CENTER
   ═══════════════════════════════════════════════════════════════ */
.db-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* ─── Top row: hero action cards ─── */
.db-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    direction: ltr;
}

.dbmc {
    border-radius: 20px;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    border: none;
    outline: none;
}

/* Glass shine layer */
.dbmc::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
    pointer-events: none;
}

/* Shimmer sweep on hover */
.dbmc::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -80%;
    width: 50%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-18deg);
    pointer-events: none;
    transition: none;
}

/* Personal game card */
.dbmc--personal {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 25%, #6d28d9 60%, #9333ea 100%);
    background-size: 200% 200%;
    box-shadow: 0 10px 40px rgba(67,56,202,0.42), 0 2px 8px rgba(0,0,0,0.1);
    animation: gradient-shift 8s ease-in-out infinite, hero-glow 3.5s ease-in-out infinite;
    transition: transform 0.25s, box-shadow 0.25s;
}
.dbmc--personal:hover {
    animation: none;
    transform: translateY(-7px) scale(1.02);
    box-shadow: 0 22px 60px rgba(67,56,202,0.6), 0 2px 8px rgba(0,0,0,0.1);
}
.dbmc--personal:hover::after { animation: shimmer-sweep 0.7s ease forwards }

/* Brain room (disabled) */
.dbmc--brain {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 45%, #312e81 80%, #3730a3 100%);
    box-shadow: 0 4px 18px rgba(15,23,42,0.28);
    cursor: default;
    filter: saturate(0.5) brightness(0.68);
}
.dbmc--brain::after {
    background: repeating-linear-gradient(
        -45deg,
        transparent 0px, transparent 5px,
        rgba(255,255,255,0.04) 5px, rgba(255,255,255,0.04) 6px
    );
    animation: none;
    left: 0;
    width: 100%;
}

/* Emoji icon */
.dbmc-emoji {
    font-size: 2.6rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.28));
    position: relative;
}

.dbmc-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.22);
    letter-spacing: -0.3px;
    position: relative;
}

.dbmc-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.72);
    font-weight: 500;
    position: relative;
}

.dbmc-soon {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.95);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 99px;
    font-family: 'Heebo', sans-serif;
    backdrop-filter: blur(8px);
    letter-spacing: 0.3px;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

/* Decorative circle in corner */
.dbmc-deco {
    position: absolute;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    bottom: -50px; right: -40px;
    pointer-events: none;
}

/* ─── Bottom row: challenge cards ─── */
.db-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    direction: ltr;
}

.dbcc {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
    direction: rtl;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.22s, transform 0.22s;
}

.dbcc:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Gradient top stripe */
.dbcc::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 18px 18px 0 0;
}

/* Faint background glow in corner */
.dbcc::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.07;
    pointer-events: none;
}

.dbcc--weekly::before { background: linear-gradient(90deg, #6366f1, #a855f7) }
.dbcc--weekly::after  { background: #6366f1; width:180px;height:180px; top:-70px; left:-50px }

.dbcc--daily::before  { background: linear-gradient(90deg, #16a34a, #22c55e) }
.dbcc--daily::after   { background: #22c55e; width:180px;height:180px; bottom:-60px; right:-40px }

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

.dbcc-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dbcc-icon { font-size: 1.35rem }

.dbcc-title {
    font-size: 1rem;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -0.2px;
}

.dbcc-all {
    font-size: 0.66rem;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 99px;
    padding: 4px 11px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    transition: opacity 0.15s, transform 0.15s;
}
.dbcc--weekly .dbcc-all { background: linear-gradient(135deg,#6366f1,#8b5cf6); box-shadow:0 2px 10px rgba(99,102,241,0.35) }
.dbcc--daily  .dbcc-all { background: linear-gradient(135deg,#16a34a,#22c55e); box-shadow:0 2px 10px rgba(34,197,94,0.3) }
.dbcc-all:hover { opacity: 0.85; transform: translateY(-1px) }

.dbcc-game-name {
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 10px;
    font-weight: 700;
}

.dbcc-meta-top {
    font-size: 0.71rem;
    color: #94a3b8;
    margin-bottom: 7px;
    font-weight: 500;
}

.dbcc-progress {
    height: 8px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 5px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.dbcc-fill {
    height: 100%;
    border-radius: 99px;
    animation: progress-fill 1s cubic-bezier(.4,0,.2,1) both;
}
.dbcc--weekly .dbcc-fill { background: linear-gradient(90deg, #6366f1, #a855f7); box-shadow: 0 0 8px rgba(99,102,241,0.4) }
.dbcc--daily  .dbcc-fill { background: linear-gradient(90deg, #16a34a, #22c55e); box-shadow: 0 0 8px rgba(34,197,94,0.35) }

.dbcc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.dbcc-time {
    font-size: 0.71rem;
    color: #f59e0b;
    font-weight: 700;
}

.dbcc-prize {
    font-size: 0.71rem;
    color: #64748b;
    font-weight: 600;
}

.dbcc-play-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 9px;
    border: none;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
    position: relative;
    z-index: 1;
}
.dbcc--weekly .dbcc-play-btn {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #4c1d95;
    box-shadow: 0 2px 10px rgba(109,40,217,0.12);
}
.dbcc--daily  .dbcc-play-btn {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #14532d;
    box-shadow: 0 2px 10px rgba(22,163,74,0.12);
}
.dbcc-play-btn:hover { opacity: 0.88; transform: translateY(-1px) }

/* ═══════════════════════════════════════════════════════════════
   FRIENDS — right panel
   ═══════════════════════════════════════════════════════════════ */
.db-friends {
    width: 316px;
    flex-shrink: 0;
}

.db-friends-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid rgba(226,232,240,0.75);
    background: #fff;
    position: relative;
}

.db-friends-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

/* Header */
.dbf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
    flex-shrink: 0;
}

.dbf-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.2px;
}

.dbf-title svg { width: 18px; height: 18px; color: #6366f1 }

.dbf-online-count {
    font-size: 0.68rem;
    font-weight: 700;
    color: #16a34a;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    padding: 3px 10px;
    border-radius: 99px;
    box-shadow: 0 1px 6px rgba(34,197,94,0.2);
}

/* Scrollable body */
.dbf-body {
    overflow-y: auto;
    flex: 1;
}
.dbf-body::-webkit-scrollbar { width: 4px }
.dbf-body::-webkit-scrollbar-track { background: transparent }
.dbf-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px }

/* Section */
.dbf-section { border-bottom: 1px solid #f1f5f9 }
.dbf-section:last-child { border-bottom: none }

.dbf-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    direction: rtl;
}

.dbf-section-title {
    font-size: 0.71rem;
    font-weight: 700;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dbf-section-all {
    font-size: 0.63rem;
    font-weight: 700;
    color: #6366f1;
    background: #eef2ff;
    border: none;
    border-radius: 99px;
    padding: 3px 9px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    transition: background 0.15s;
}
.dbf-section-all:hover { background: #e0e7ff }

/* Suggestion item */
.dbf-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    direction: rtl;
    transition: background 0.15s;
}
.dbf-suggestion:hover { background: #fafbff }

.dbf-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.18s;
}
.dbf-suggestion:hover .dbf-avatar { transform: scale(1.08) }

.dbf-suggestion-info { flex: 1; text-align: right }

.dbf-suggestion-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
}

.dbf-suggestion-mutual {
    font-size: 0.65rem;
    color: #94a3b8;
}

.dbf-add-btn {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(99,102,241,0.3);
    transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.dbf-add-btn:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,0.45) }
.dbf-add-btn:disabled { background: linear-gradient(135deg,#dcfce7,#bbf7d0); color: #166534; cursor: default; transform: none; box-shadow: none }

/* Friend item */
.dbf-friend-wrap { direction: rtl }

.dbf-friend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid #f8fafc;
    direction: rtl;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.dbf-friend:hover { background: #fafbff }
.dbf-friend.open   { background: #f8f9ff }

.dbf-friend:hover .dbf-avatar { transform: scale(1.06) }

.dbf-friend-info { flex: 1; text-align: right }

.dbf-friend-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 3px;
}

.dbf-friend-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
}

.dbf-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dbf-dot--online  { background: #22c55e; animation: online-pulse 2.2s ease-in-out infinite }
.dbf-dot--offline { background: #cbd5e1 }

.dbf-friend-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.dbf-rank-badge {
    font-size: 0.57rem;
    font-weight: 800;
    color: #fff;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.1px;
}

.dbf-last-seen {
    font-size: 0.64rem;
    color: #94a3b8;
}

.dbf-friend-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.dbf-envelope {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s, transform 0.15s;
    line-height: 1;
    position: relative;
    color: #94a3b8;
}
.dbf-envelope:hover { background: #f1f5f9; transform: scale(1.15) }
.dbf-envelope--active { color: #6366f1; animation: badge-float 2.5s ease-in-out infinite }
.dbf-envelope--active::after {
    content: '';
    position: absolute;
    top: 2px; right: 2px;
    width: 7px; height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.dbf-chevron {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: transform 0.22s, background 0.15s;
    line-height: 1;
}
.dbf-chevron:hover { background: #f1f5f9 }
.dbf-chevron.open { transform: rotate(180deg); color: #6366f1 }

/* Friend action menu */
.dbf-menu {
    background: linear-gradient(145deg, #f8f9ff, #f4f6ff);
    border-bottom: 1px solid #ede9fe;
    padding: 10px 14px;
    direction: rtl;
    animation: card-enter 0.18s ease;
}

.dbf-achievement-notice {
    font-size: 0.72rem;
    font-weight: 600;
    color: #92400e;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 6px 10px;
    margin-bottom: 8px;
    text-align: right;
    box-shadow: 0 1px 6px rgba(245,158,11,0.15);
}

.dbf-menu-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.dbf-menu-row:last-child { margin-bottom: 0 }

.dbf-btn {
    font-size: 0.69rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 6px 11px;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s;
    white-space: nowrap;
}
.dbf-btn:hover { opacity: 0.85; transform: translateY(-1px) }
.dbf-btn:active { transform: translateY(0) }

.dbf-btn--kudos  { background: linear-gradient(135deg,#fef3c7,#fde68a); color: #78350f; box-shadow:0 1px 6px rgba(245,158,11,0.2) }
.dbf-btn--msg    { background: linear-gradient(135deg,#ede9fe,#ddd6fe); color: #4c1d95; box-shadow:0 1px 6px rgba(109,40,217,0.15) }
.dbf-btn--invite { background: linear-gradient(135deg,#dcfce7,#bbf7d0); color: #14532d; box-shadow:0 1px 6px rgba(34,197,94,0.15) }
.dbf-btn--room   { background: linear-gradient(135deg,#e0f2fe,#bae6fd); color: #0c4a6e; box-shadow:0 1px 6px rgba(14,165,233,0.12) }
.dbf-btn--remove { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #7f1d1d; box-shadow:0 1px 6px rgba(239,68,68,0.15) }
.dbf-btn--block  { background: #f1f5f9; color: #475569 }

/* Guest / empty state */
.dbf-empty {
    text-align: center;
    padding: 28px 16px;
    color: #94a3b8;
    font-size: 0.82rem;
}
.dbf-empty-icon { font-size: 2.2rem; margin-bottom: 8px }
.dbf-empty-text { line-height: 1.6; color: #64748b }

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.db-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.db-modal-overlay.open { display: flex }

.db-modal {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.2), 0 0 0 1px rgba(226,232,240,0.6);
    width: 480px;
    max-width: 95vw;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    animation: card-enter 0.28s cubic-bezier(.22,.68,0,1.2);
}

.db-modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f8faff, #fff);
}

.db-modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.2px;
}

.db-modal-close {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 9px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    font-family: 'Heebo', sans-serif;
}
.db-modal-close:hover { background: #e2e8f0; color: #1e293b }

.db-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 16px 22px;
}
.db-modal-body::-webkit-scrollbar { width: 4px }
.db-modal-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px }

/* Message modal */
.db-msg-modal { width: 420px }

.db-msg-sender {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    direction: rtl;
}

.db-msg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.db-msg-from { font-size: 0.72rem; color: #94a3b8 }
.db-msg-name { font-size: 0.9rem; font-weight: 800; color: #1e293b }

.db-msg-bubble {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 14px 14px 4px 14px;
    padding: 14px 16px;
    font-size: 0.88rem;
    color: #1e293b;
    line-height: 1.55;
    margin-bottom: 14px;
    text-align: right;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.db-msg-close-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    transition: opacity 0.15s, box-shadow 0.15s;
    box-shadow: 0 3px 14px rgba(79,70,229,0.35);
}
.db-msg-close-btn:hover { opacity: 0.88; box-shadow: 0 6px 20px rgba(79,70,229,0.5) }

/* Booster shop modal */
.db-booster-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.db-booster-item {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    cursor: pointer;
    background: linear-gradient(145deg, #fafbff, #fff);
}
.db-booster-item:hover {
    border-color: #a5b4fc;
    box-shadow: 0 6px 20px rgba(99,102,241,0.14);
    transform: translateY(-2px);
}

.db-booster-emoji { font-size: 2.2rem; margin-bottom: 7px }
.db-booster-name { font-size: 0.82rem; font-weight: 800; color: #1e293b; margin-bottom: 4px }
.db-booster-desc { font-size: 0.67rem; color: #64748b; margin-bottom: 10px; line-height: 1.45 }
.db-booster-price {
    font-size: 0.74rem;
    font-weight: 800;
    color: #b45309;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 4px 12px;
    border-radius: 99px;
    display: inline-block;
    box-shadow: 0 1px 6px rgba(245,158,11,0.2);
}

/* Generic list modal */
.db-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
    direction: rtl;
    transition: background 0.15s;
}
.db-list-item:last-child { border-bottom: none }

/* Challenge locked overlay */
.db-locked-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248,250,252,0.45);
    backdrop-filter: blur(1.5px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    z-index: 2;
}

.db-locked-badge {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    padding: 9px 20px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Heebo', sans-serif;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 6px 22px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    white-space: nowrap;
}
.db-locked-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* ─── Toast ─── */
#db-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    padding: 10px 24px;
    border-radius: 99px;
    font-size: 0.84rem;
    font-weight: 600;
    z-index: 10000;
    transition: transform 0.32s cubic-bezier(.22,.68,0,1.2), opacity 0.28s;
    opacity: 0;
    font-family: 'Heebo', sans-serif;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
#db-toast.on { transform: translateX(-50%) translateY(0); opacity: 1 }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — tablet 768–1023px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
    .db-wrap { gap: 10px; padding: 12px 12px }
    .db-friends { width: 270px }
    .db-special  { width: 230px }
    .dbmc { min-height: 165px; padding: 22px 18px }
    .dbmc-title { font-size: 1.15rem }
    .dbmc-emoji { font-size: 2.6rem }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — mobile < 768px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .db-wrap {
        flex-direction: column;
        padding: 10px 10px 80px;
        gap: 12px;
        align-items: stretch;
    }

    /* Reorder: Center first, Friends second, Special third */
    .db-center  { order: 1 }
    .db-friends { order: 2; width: 100% }
    .db-special { order: 3; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 10px }

    /* Hero cards: single column */
    .db-top-row    { grid-template-columns: 1fr; gap: 10px; align-items: stretch }
    .db-bottom-row { grid-template-columns: 1fr; gap: 10px }

    .dbmc { min-height: 130px; padding: 18px 16px }

    .db-greeting { padding: 12px 16px }
    .db-greeting-info { display: none }
    .dbmc-title { font-size: 1.15rem }
    .dbmc-emoji { font-size: 2.5rem }

    /* Friends: no max-height, scroll naturally */
    .db-friends-card { max-height: none }

    /* Special: card + shop side by side on mobile */
    .dbs-card      { flex: 1; min-width: 220px }
    .dbs-shop-card { flex: 1; min-width: 160px; align-items: flex-start; flex-direction: column; gap: 10px }

    /* Challenges full width on mobile */
    .dbcc { width: 100% }
}

@media (max-width: 480px) {
    .db-wrap { padding: 8px 8px 80px }
    .db-top-row, .db-bottom-row { gap: 8px }
    .dbmc-title { font-size: 1rem }
    .dbs-shop-card { flex-direction: column }
    .db-special { flex-direction: column }
}
