/* =========================================
   RESET & VARIABLES
========================================= */
:root {
    --bg: #000;
    --surface: #0d0d0d;
    --surface2: #141414;
    --border: rgba(255,255,255,0.09);
    --border-strong: rgba(255,255,255,0.18);
    --text: #f5f5f5;
    --muted: #666;
    --muted2: #444;
    --white: #fff;
    --radius: 14px;
    --radius-sm: 9px;
    --radius-pill: 50px;
    --bottom-nav-h: 64px;
    --mobile-bottom-nav-h: 88px;
    /* Safe area para iPhone con notch/Dynamic Island */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

/* Evitar zoom por doble tap en elementos interactivos */
a, button, input, select, textarea, label {
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh; /* dynamic viewport height para móvil */
    overflow: hidden;
    /* Evitar el rebote en iOS */
    overscroll-behavior: none;
}

/* =========================================
   LOGIN
========================================= */
.login-screen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    z-index: 200;
    padding: 1.5rem;
    padding-top: calc(1.5rem + var(--safe-top));
    padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.login-card {
    width: 100%; max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 2.6rem 2.2rem 1.8rem;
    display: flex; flex-direction: column; align-items: center;
}

.login-logo-img {
    width: 120px;
    height: auto;
    margin-bottom: 0.5rem;
    object-fit: contain;
}

.login-tagline {
    font-size: 0.8rem; color: var(--muted);
    margin-bottom: 1.1rem; letter-spacing: 0.1px;
}

.login-tabs {
    width: 100%; display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.35rem; margin-bottom: 0.8rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.25rem;
}
.login-tab {
    border: none; background: transparent; color: var(--muted);
    border-radius: 7px; padding: 0.55rem 0.4rem;
    font-size: 0.78rem; font-weight: 700; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.login-tab.active { background: var(--white); color: #000; }

.login-form { width: 100%; display: flex; flex-direction: column; gap: 0.65rem; }
.login-form .hidden { display: none; }

.login-field { position: relative; display: flex; align-items: center; }
.login-field input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    padding: 0.85rem 1rem;
    outline: none;
    transition: border-color 0.15s;
}
.login-field input:focus { border-color: var(--border-strong); }
.login-field input::placeholder { color: var(--muted2); font-size: 0.88rem; }

.login-error {
    color: #e05555; font-size: 0.78rem; text-align: center;
    padding: 0.45rem; background: rgba(224,85,85,0.08);
    border-radius: 7px; border: 1px solid rgba(224,85,85,0.18);
}
.login-error.hidden { display: none; }

.btn-login {
    width: 100%;
    background: var(--white); color: #000;
    border: none; padding: 0.82rem;
    border-radius: var(--radius-sm);
    font-weight: 700; font-size: 0.92rem;
    cursor: pointer; margin-top: 0.3rem;
    transition: opacity 0.15s;
    /* Área táctil mínima recomendada */
    min-height: 44px;
}
.btn-login:hover { opacity: 0.88; }
.btn-secondary { background: var(--surface2); color: var(--white); border: 1px solid var(--border-strong); }

/* =========================================
   APP
========================================= */
.app-screen {
    display: flex; flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    padding-top: var(--safe-top);
    overflow: hidden;
}
.app-screen.hidden { display: none !important; }

/* NAVBAR */
.navbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.6rem; height: 56px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-shrink: 0; position: relative; z-index: 10;
}

.nav-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.navbar-right { display: flex; align-items: center; gap: 0.5rem; }

.user-pill {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.8rem 0.3rem 0.35rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s;
    min-height: 36px;
}
.user-pill:hover { border-color: var(--border-strong); }

.user-pill-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--white); color: #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
    overflow: hidden;
}

/* Estilo universal para las imágenes de perfil */
.user-pill-avatar img,
.top3-avatar img,
.rest-avatar img,
.request-avatar img,
.member-avatar img {
    width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
}

.icon-btn {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 50%; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--muted);
    transition: color 0.15s, border-color 0.15s;
    /* Área mínima táctil */
    min-width: 36px;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn i { width: 14px; height: 14px; }

/* LAYOUT */
.container {
    display: flex; flex: 1;
    min-height: 0;
    padding: 1.2rem;
    gap: 1.2rem;
    overflow: hidden;
    position: relative;
}

/* SIDEBAR */
.sidebar {
    width: 250px; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    display: flex; flex-direction: column; gap: 1rem;
    overflow-y: auto;
}

.sidebar-section { display: flex; flex-direction: column; gap: 0.4rem; }
.sidebar-label {
    font-size: 0.64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--muted); padding: 0 0.2rem;
}

.btn-primary {
    display: flex; align-items: center; gap: 0.45rem;
    background: var(--white); color: #000;
    border: none; padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700; font-size: 0.85rem;
    cursor: pointer; transition: opacity 0.15s;
    min-height: 44px;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary i { width: 14px; height: 14px; }

.group-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }

.group-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.85rem; font-weight: 500;
    color: var(--muted); border: 1px solid transparent;
    transition: all 0.15s;
    min-height: 44px;
}
.group-item:hover { color: var(--text); background: var(--surface2); }
.group-item.active { color: var(--white); background: var(--surface2); border-color: var(--border); }

/* Miniaturas en sidebar */
.group-list-img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.group-list-img-fallback {
    width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
    background: var(--surface2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.group-list-img-fallback i { width: 12px; height: 12px; color: var(--muted); }

.group-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-item-badge {
    font-size: 0.6rem; padding: 0.15rem 0.45rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 50px; color: var(--muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* Discover items */
.discover-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.85rem; font-weight: 500;
    color: var(--muted); border: 1px solid transparent;
    transition: all 0.15s;
    min-height: 44px;
}
.discover-item:hover { color: var(--text); background: var(--surface2); }
.discover-item-info { flex: 1; min-width: 0; }
.discover-item-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.83rem; }
.discover-item-sub { font-size: 0.7rem; color: var(--muted2); }
.discover-btn {
    font-size: 0.7rem; font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: 50px; cursor: pointer;
    border: 1px solid var(--border-strong);
    background: transparent; color: var(--text);
    transition: background 0.15s;
    white-space: nowrap; flex-shrink: 0;
    min-height: 32px;
}
.discover-btn:hover { background: var(--white); color: #000; border-color: var(--white); }
.discover-btn.pending { color: var(--muted); border-color: var(--border); cursor: default; }
.discover-btn.pending:hover { background: transparent; color: var(--muted); border-color: var(--border); }

/* CONTENT */
.content {
    flex: 1; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; flex-direction: column;
    overflow: hidden; min-width: 0; min-height: 0;
}

/* PLACEHOLDER */
.placeholder-view {
    margin: auto; text-align: center; padding: 2rem; max-width: 300px;
}
.placeholder-icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--surface2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.1rem;
}
.placeholder-icon i { width: 24px; height: 24px; color: var(--muted2); }
.placeholder-view h2 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.placeholder-view p { font-size: 0.82rem; color: var(--muted); line-height: 1.6; }

/* =========================================
   VISTA DE GRUPO
========================================= */
.group-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Header del grupo */
.group-head {
    display: flex; align-items: center; gap: 1rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.group-head-pic { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.group-head-pic-fallback {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    background: var(--surface2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.group-head-pic-fallback i { width: 20px; height: 20px; color: var(--muted); }

.group-head-clickable { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.group-head-info { flex: 1; min-width: 0; }
.group-head-info h2 { font-size: 1.1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-head-info p { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.group-head-mobile-meta { display: none; }
.group-head-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; }

.badge-priv {
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0.28rem 0.65rem; border-radius: 50px;
    border: 1px solid var(--border); color: var(--muted);
    background: var(--surface2);
}
.badge-priv.pub { border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.5); }

.btn-score {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--white); color: #000;
    border: none; padding: 0.55rem 0.9rem;
    border-radius: 50px; font-weight: 700; font-size: 0.8rem;
    cursor: pointer; transition: opacity 0.15s;
    min-height: 36px;
}
.btn-score:hover { opacity: 0.85; }
.btn-score i { width: 13px; height: 13px; }

.btn-requests {
    display: flex; align-items: center; gap: 0.35rem;
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border); padding: 0.5rem 0.8rem;
    border-radius: 50px; font-weight: 600; font-size: 0.78rem;
    cursor: pointer; transition: border-color 0.15s;
    min-height: 36px;
}
.btn-requests:hover { border-color: var(--border-strong); }
.btn-requests i { width: 13px; height: 13px; }
.req-count {
    background: var(--white); color: #000;
    font-size: 0.65rem; font-weight: 800;
    padding: 0.05rem 0.45rem; border-radius: 50px; min-width: 18px; text-align: center;
}

/* =========================================
   LEADERBOARD
========================================= */
.leaderboard { flex: 1; overflow-y: auto; padding: 1.4rem; }

.top3 {
    display: flex; gap: 1rem;
    margin-bottom: 1.4rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.4rem 1.2rem;
}

.top3-card {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 1rem 0.6rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; position: relative; text-align: center;
    transition: border-color 0.2s;
}

.top3-card.r1 {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 0 22px rgba(255,255,255,0.06);
    order: 2;
}
.top3-card.r2 { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.1); order: 1; }
.top3-card.r3 { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.07); order: 3; }

.top3-medal {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    font-size: 1.1rem; line-height: 1;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 50px; padding: 0.15rem 0.45rem;
}

.top3-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 800; margin-bottom: 0.7rem;
    overflow: hidden;
}
.r1 .top3-avatar { background: var(--white); color: #000; }
.r2 .top3-avatar { background: rgba(255,255,255,0.12); color: var(--white); border: 1px solid rgba(255,255,255,0.2); }
.r3 .top3-avatar { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.1); }

.top3-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; margin-bottom: 0.25rem; }
.top3-pts { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.r1 .top3-pts { color: var(--white); }
.r2 .top3-pts { color: rgba(255,255,255,0.7); }
.r3 .top3-pts { color: rgba(255,255,255,0.45); }
.top3-label { font-size: 0.68rem; color: var(--muted); margin-top: 0.15rem; }

.rest-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 0.6rem; }
.rest-list { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.rest-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.85rem; border-radius: var(--radius-sm);
    background: var(--surface2); border: 1px solid var(--border);
}
.rest-rank { width: 18px; text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.rest-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.06); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    overflow: hidden;
}
.rest-name { flex: 1; font-size: 0.85rem; font-weight: 500; }
.rest-pts {
    font-size: 0.83rem; font-weight: 700;
    background: rgba(255,255,255,0.06); padding: 0.18rem 0.55rem;
    border-radius: 6px;
}

/* =========================================
   BOTTOM NAV (solo móvil)
========================================= */
.bottom-nav {
    display: none;
    align-items: center; justify-content: space-around;
    height: var(--bottom-nav-h);
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    /* Permite que el + sobresalga */
    overflow: visible;
}

.bottom-nav-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.25rem; flex: 1; height: 100%;
    background: none; border: none; color: var(--muted);
    font-size: 0.62rem; font-weight: 600;
    cursor: pointer; transition: color 0.15s;
    letter-spacing: 0.3px;
    box-sizing: border-box;
}
.bottom-nav-btn i { width: 20px; height: 20px; }
.bottom-nav-btn:hover,
.bottom-nav-btn.active { color: var(--white); }

/* Botón + flotante: sobresale ligeramente hacia arriba */
.bottom-nav-primary {
    position: relative;
    width: 56px; height: 56px; flex: none;
    background: var(--white); color: #000 !important;
    border-radius: 50%;
    border: 3px solid var(--bg);
    box-shadow: 0 -2px 20px rgba(255,255,255,0.18);
    transition: opacity 0.15s;
    /* Sube el botón solo un poco */
    margin-top: -10px;
    align-self: flex-start;
    z-index: 10;
}
.bottom-nav-primary i { width: 24px; height: 24px; }
.bottom-nav-primary:hover { opacity: 0.88; }

/* Overlay para cerrar sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 40;
}
.sidebar-overlay.active { display: block; }

/* =========================================
   MODAL BASE
========================================= */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 1.5rem;
}
.modal.hidden { display: none; }

.modal-box {
    width: 100%; max-width: 440px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 1.8rem;
    position: relative;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    max-height: 90dvh;
    overflow-y: auto;
}
.modal-box::before { display: none; }

.modal-sm { max-width: 400px; }

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.3rem;
}
.modal-head h2 { font-size: 1.05rem; font-weight: 700; }
.modal-sub { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; margin-top: -0.8rem; }

/* =========================================
   SUBIDA DE IMAGEN
========================================= */
.group-photo-upload { display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.upload-label { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; cursor: pointer; }
.upload-preview {
    width: 68px; height: 68px; border-radius: 16px;
    background: var(--surface2); border: 1px dashed var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative; transition: border-color 0.15s;
}
.user-upload-preview { border-radius: 50%; width: 80px; height: 80px; }

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview i { width: 24px; height: 24px; color: var(--muted2); }
.upload-text { font-size: 0.75rem; color: var(--muted); font-weight: 600; transition: color 0.15s; }
.upload-label:hover .upload-preview { border-color: var(--white); }
.upload-label:hover .upload-text { color: var(--text); }
.hidden-input { display: none; }

/* =========================================
   CREAR GRUPO - FORM
========================================= */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }

label {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted);
}
.opt { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.7rem; }

input[type="text"], input[type="password"], textarea, select {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); outline: none;
    font-size: 16px; /* Evita zoom en iOS */
    padding: 0.72rem 0.85rem;
    font-family: inherit; transition: border-color 0.15s;
    -webkit-appearance: none;
}
textarea { resize: none; }
input:focus, textarea:focus, select:focus { border-color: var(--border-strong); }
input::placeholder, textarea::placeholder { color: var(--muted2); font-size: 0.87rem; }

/* PRIVACY TOGGLE */
.privacy-toggle { display: flex; gap: 0.5rem; }

.priv-btn {
    flex: 1; display: flex; align-items: center; gap: 0.65rem;
    padding: 0.7rem 0.85rem; border-radius: var(--radius-sm);
    background: var(--surface2); border: 1px solid var(--border);
    cursor: pointer; color: var(--muted); text-align: left;
    transition: all 0.15s;
    min-height: 44px;
}
.priv-btn:hover { border-color: var(--border-strong); color: var(--text); }
.priv-btn.active { border-color: var(--white); color: var(--white); background: rgba(255,255,255,0.06); }
.priv-btn i { width: 16px; height: 16px; flex-shrink: 0; }
.priv-title { display: block; font-size: 0.82rem; font-weight: 700; }
.priv-desc { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 0.1rem; }
.priv-btn.active .priv-desc { color: rgba(255,255,255,0.45); }

.btn-submit {
    width: 100%;
    background: var(--white); color: #000;
    border: none; padding: 0.78rem;
    border-radius: var(--radius-sm);
    font-weight: 700; font-size: 0.9rem;
    cursor: pointer; margin-top: 0.3rem;
    transition: opacity 0.15s;
    min-height: 44px;
}
.btn-submit:hover { opacity: 0.88; }

/* =========================================
   ACTION GRID (PUNTOS)
========================================= */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.55rem;
}
.btn-action {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text); padding: 0.9rem 0.65rem;
    border-radius: var(--radius-sm); cursor: pointer;
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 0.25rem; text-align: left; transition: all 0.15s;
    min-height: 60px;
}
.btn-action:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.05); }
.action-name { font-size: 0.82rem; font-weight: 600; }
.action-pts { font-size: 0.72rem; font-weight: 800; }
.action-pts.pos { color: var(--white); }
.action-pts.neg { color: #e05555; }

/* =========================================
   REQUESTS
========================================= */
.requests-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.request-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.85rem; border-radius: var(--radius-sm);
    background: var(--surface2); border: 1px solid var(--border);
}
.request-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    overflow: hidden;
}
.request-name { flex: 1; font-size: 0.85rem; font-weight: 500; }
.request-actions { display: flex; gap: 0.4rem; }
.btn-accept, .btn-deny {
    padding: 0.4rem 0.65rem; border-radius: 50px;
    font-size: 0.72rem; font-weight: 700; cursor: pointer; border: 1px solid;
    transition: all 0.15s;
    min-height: 32px;
}
.btn-accept { background: var(--white); color: #000; border-color: var(--white); }
.btn-accept:hover { opacity: 0.85; }
.btn-deny { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-deny:hover { color: #e05555; border-color: rgba(224,85,85,0.4); }

.empty-requests { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.83rem; }

/* =========================================
   MIEMBROS DEL GRUPO
========================================= */
.members-group-meta {
    display: none;
}

.members-group-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.members-group-desc:empty { display: none; }

.members-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.member-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.8rem; border-radius: var(--radius-sm);
    background: var(--surface2); border: 1px solid var(--border);
}
.member-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    overflow: hidden; flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.member-name {
    font-size: 0.85rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.4rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-admin-badge {
    font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px;
    background: rgba(255,255,255,0.12); color: var(--white);
    padding: 0.12rem 0.42rem; border-radius: 50px; flex-shrink: 0;
}
.member-pts { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.member-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.btn-make-admin, .btn-kick {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: transparent;
    color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.btn-make-admin i, .btn-kick i { width: 15px; height: 15px; }
.btn-make-admin:hover { color: var(--white); border-color: var(--border-strong); }
.btn-kick:hover { color: #e05555; border-color: rgba(224,85,85,0.4); }

.empty-members { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.83rem; }

/* =========================================
   TOAST
========================================= */
.toast {
    position: fixed; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.75rem); left: 50%; transform: translateX(-50%);
    background: var(--surface); border: 1px solid var(--border-strong);
    color: var(--text); padding: 0.6rem 1.2rem;
    border-radius: 50px; font-size: 0.82rem; font-weight: 500;
    z-index: 300; white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: opacity 0.25s, transform 0.25s;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(6px); }

/* Odds grid */
.odds-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.1rem;
}
.odds-btn {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--muted); border-radius: var(--radius-sm);
    padding: 0.55rem 0.3rem; font-size: 0.82rem; font-weight: 700;
    cursor: pointer; transition: all 0.15s; text-align: center;
    min-height: 40px;
}
.odds-btn:hover { border-color: var(--border-strong); color: var(--text); }
.odds-btn.active {
    background: var(--white); color: #000;
    border-color: var(--white);
}

/* Stake stepper */
.stake-stepper {
    display: flex; align-items: center; gap: 0;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
.stake-stepper input[type="number"] {
    flex: 1; text-align: center;
    border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent; color: var(--text);
    font-size: 1rem; font-weight: 700;
    padding: 0.72rem 0.5rem;
    -moz-appearance: textfield;
}
.stake-stepper input[type="number"]::-webkit-outer-spin-button,
.stake-stepper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.stake-stepper input[type="number"]:focus { outline: none; }
.stake-btn {
    width: 52px; flex-shrink: 0;
    background: transparent; border: none;
    color: var(--muted); font-size: 1.3rem; font-weight: 300;
    cursor: pointer; transition: color 0.15s, background 0.15s;
    display: flex; align-items: center; justify-content: center;
    height: 100%; min-height: 48px;
    padding: 0;
}
.stake-btn:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.stake-minus { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stake-plus  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* =========================================
   PESTAÑAS DE GRUPO
========================================= */
.group-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding: 0 1rem;
}
.group-tab {
    display: flex; align-items: center; gap: 0.4rem;
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--muted); font-size: 0.82rem; font-weight: 700;
    padding: 0.75rem 0.8rem; cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    min-height: 44px;
    white-space: nowrap;
}
.group-tab i { width: 14px; height: 14px; }
.group-tab:hover { color: var(--text); }
.group-tab.active { color: var(--white); border-bottom-color: var(--white); }

.tab-hidden { display: none !important; }

/* =========================================
   ESTADÍSTICAS
========================================= */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.2rem;
    height: 100%;
    overflow-y: auto;
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.stats-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    min-width: 0;
}
.stats-card span {
    display: block;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.stats-card strong {
    display: block;
    color: var(--white);
    font-size: 1rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-select-label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stats-select {
    width: 100%;
    background: var(--surface2);
    color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    font-size: 0.92rem;
    font-weight: 800;
    outline: none;
    cursor: pointer;
}
.stats-select:focus {
    border-color: var(--border-strong);
}

.stats-content {
    min-height: 0;
}

.stats-category-list,
.stats-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.stats-category-card,
.stats-ranking-row {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
}

.stats-category-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
}
.stats-category-card:hover { border-color: var(--border-strong); }
.stats-category-name {
    display: block;
    color: var(--white);
    font-weight: 800;
    font-size: 0.9rem;
}
.stats-category-leader {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 0.2rem;
}
.stats-category-numbers {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    flex-shrink: 0;
}
.stats-category-numbers strong {
    color: var(--white);
    font-size: 1.15rem;
    line-height: 1;
}
.stats-category-numbers span {
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.stats-ranking-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}
.stats-ranking-head p {
    color: var(--muted);
    font-size: 0.76rem;
    margin-top: 0.2rem;
}

.stats-ranking-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
}
.stats-ranking-row-empty {
    opacity: 0.55;
}
.stats-rank {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 900;
    min-width: 1.2rem;
    text-align: center;
}
.stats-user-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.stats-user-info small {
    color: var(--muted);
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stats-user-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    white-space: nowrap;
}
.stats-user-score strong {
    color: var(--white);
    font-size: 1rem;
    line-height: 1;
}
.stats-user-score span {
    font-size: 0.72rem;
    font-weight: 800;
}

@media (max-width: 900px) {
    .group-tabs {
        overflow-x: auto;
        padding: 0 0.75rem;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .group-tabs::-webkit-scrollbar {
        display: none;
    }
    .group-tab {
        flex-shrink: 0;
        min-height: 48px;
        padding: 0.85rem 0.9rem;
        scroll-snap-align: start;
    }
    .stats-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .stats-section {
        padding: 0.9rem;
    }
    .stats-summary-grid {
        grid-template-columns: 1fr;
    }
    .stats-ranking-row {
        grid-template-columns: auto auto 1fr;
    }
    .stats-user-score {
        grid-column: 3;
        align-items: flex-start;
        flex-direction: row;
        gap: 0.45rem;
    }
}

/* =========================================
   APUESTAS
========================================= */
.bets-section {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 1.2rem;
}

.bets-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.4rem;
}

.bets-history-header {
    display: flex; align-items: center; gap: 0.5rem;
    margin-top: 1rem; margin-bottom: 0.4rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.bets-title {
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
}

.bets-count {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--muted); font-size: 0.62rem; font-weight: 800;
    padding: 0.1rem 0.5rem; border-radius: 50px;
}

.btn-new-bet {
    display: flex; align-items: center; gap: 0.35rem;
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border); padding: 0.42rem 0.75rem;
    border-radius: 50px; font-weight: 600; font-size: 0.75rem;
    cursor: pointer; transition: border-color 0.15s;
    min-height: 32px;
}
.btn-new-bet:hover { border-color: var(--border-strong); }
.btn-new-bet i { width: 12px; height: 12px; }

.bet-card {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.9rem 1rem;
    display: flex; flex-direction: column; gap: 0.55rem;
    transition: border-color 0.15s;
}
.bet-card:hover { border-color: var(--border-strong); }
.bet-card-closed { opacity: 0.55; }

.bet-card-top {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem;
}
.bet-card-text {
    font-size: 0.88rem; font-weight: 600; line-height: 1.4; flex: 1;
    word-break: break-word;
    white-space: normal;
}
.bet-odds-badge {
    background: var(--white); color: #000;
    font-size: 0.72rem; font-weight: 800;
    padding: 0.22rem 0.6rem; border-radius: 50px;
    white-space: nowrap; flex-shrink: 0;
}

.bet-card-meta {
    display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
    font-size: 0.72rem; color: var(--muted);
}

.bet-status-open  { color: #6ee7b7; font-weight: 700; }
.bet-status-won   { color: #fcd34d; font-weight: 700; }
.bet-status-lost  { color: #e05555; font-weight: 700; }

.bet-participants {
    display: flex; flex-direction: column; gap: 0.3rem;
}
.bet-participant {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}
.bet-participant-me {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
.bet-p-name { font-weight: 600; }
.bet-p-stake { color: var(--muted); display: flex; align-items: center; gap: 0.35rem; }
.bet-p-won { color: #6ee7b7; font-weight: 700; }

.bet-actions {
    display: flex; gap: 0.45rem; flex-wrap: wrap;
}
.btn-bet-join, .btn-bet-resolve {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.45rem 0.85rem; border-radius: 50px;
    font-size: 0.75rem; font-weight: 700; cursor: pointer;
    border: 1px solid; transition: all 0.15s;
    min-height: 34px;
}
.btn-bet-join {
    background: var(--white); color: #000; border-color: var(--white);
}
.btn-bet-join:hover { opacity: 0.85; }
.btn-bet-join i { width: 12px; height: 12px; }

.btn-bet-resolve {
    background: transparent; color: var(--muted); border-color: var(--border);
}
.btn-bet-resolve:hover { color: var(--text); border-color: var(--border-strong); }
.btn-bet-resolve i { width: 12px; height: 12px; }

.bets-open, .bets-closed { display: flex; flex-direction: column; gap: 0.55rem; }

.bets-empty {
    font-size: 0.82rem; color: var(--muted);
    padding: 0.8rem 0; text-align: center;
}

/* Modal summary */
.bet-modal-summary {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.8rem 0.9rem;
    margin-bottom: 1.1rem;
}
.bet-summary-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.4rem; }
.bet-meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    font-size: 0.72rem; color: var(--muted);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* =========================================
   RESPONSIVE — MÓVIL (≤ 640px)
========================================= */
@media (max-width: 640px) {

    /* Navbar más grande */
    .navbar {
        height: 70px;
        padding: 0 1.2rem;
    }

    .nav-logo-img {
        height: 40px;
    }

    .user-pill {
        min-height: 42px;
        padding: 0.4rem 1rem 0.4rem 0.45rem;
        font-size: 0.88rem;
        gap: 0.6rem;
    }

    .user-pill-avatar {
        width: 28px; height: 28px;
        font-size: 0.78rem;
    }

    .icon-btn {
        width: 42px; height: 42px; min-width: 42px;
    }
    .icon-btn i { width: 17px; height: 17px; }

    /* Sidebar arranca justo debajo de la navbar grande */
    .sidebar {
        position: fixed;
        top: calc(70px + var(--safe-top));
        left: 0; bottom: 0;
        width: 280px;
        border-radius: 0 var(--radius) var(--radius) 0;
        border-left: none;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.5);
    }

    .bottom-nav {
        display: flex;
        height: var(--mobile-bottom-nav-h);
        padding-bottom: calc(var(--safe-bottom) + 10px);
        padding-top: 6px;
        align-items: flex-start;
    }

    /* El contenido respira sobre la bottom nav y evita que el botón + invada la última fila */
    .container {
        padding: 1rem 0.75rem;
        padding-bottom: calc(1.35rem + var(--safe-bottom));
        min-height: 0;
    }

    .content {
        border-radius: var(--radius);
    }

    /* Toast por encima de la bottom nav */
    .toast {
        bottom: calc(var(--mobile-bottom-nav-h) + var(--safe-bottom) + 0.75rem);
    }

    /* Modales como sheet que sube desde abajo */
    .modal {
        align-items: flex-end;
        padding: 0 0 var(--safe-bottom);
    }

    .modal-box {
        border-radius: 20px 20px 0 0;
        max-height: 92dvh;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
    }

    /* Pill indicador en móvil */
    .modal-box::before {
        display: block;
        content: '';
        width: 36px; height: 4px;
        background: var(--border-strong);
        border-radius: 4px;
        margin: 0 auto 1.2rem;
    }

    /* Header del grupo */
    .group-head {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }

    .group-head-clickable {
        cursor: pointer;
    }

    /* En móvil solo se ven la foto y el nombre del grupo;
       la descripción, la privacidad, "Editar" y miembros viven dentro del modal de Miembros */
    .group-head-info p {
        display: none;
    }

    .group-head-mobile-meta {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-wrap: wrap;
        margin-top: 0.2rem;
        color: var(--muted);
        font-size: 0.7rem;
        font-weight: 600;
    }
    .group-head-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 0.12rem;
        min-width: 0;
    }
    .group-head-mobile-meta span:not(:last-child)::after {
        content: '·';
        color: var(--muted2);
        margin-left: 0.35rem;
    }
    .group-head-mobile-meta i {
        width: 12px;
        height: 12px;
    }

    .btn-members {
        display: none;
    }

    .header-priv-badge {
        display: none;
    }

    .btn-edit-group {
        display: none;
    }

    /* "Mis puntos" (y Solicitudes si aplica) quedan a la derecha, en la misma fila que la foto/nombre */
    .group-head-actions {
        flex-shrink: 0;
    }

    /* Opciones del grupo (privacidad + editar) dentro del modal de Miembros, solo en móvil */
    .members-group-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border);
    }

    /* Leaderboard */
    .leaderboard { padding: 1rem; }
    .top3 {
        display: grid;
        grid-template-columns: 1fr;
        padding: 0;
        gap: 0.55rem;
        background: transparent;
        border: none;
    }
    .top3-card {
        min-height: 76px;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 0.85rem 0.9rem;
        gap: 0.8rem;
        background: var(--surface2);
        border-color: var(--border);
        order: initial !important;
    }
    .top3-card.r1 {
        min-height: 88px;
        background: rgba(255,255,255,0.08);
        border-color: rgba(255,255,255,0.24);
        order: 1 !important;
    }
    .top3-card.r2 { order: 2 !important; }
    .top3-card.r3 { order: 3 !important; }
    .top3-medal {
        position: static;
        transform: none;
        flex-shrink: 0;
        font-size: 0.95rem;
    }
    .top3-avatar { width: 48px; height: 48px; font-size: 1.15rem; margin-bottom: 0; flex-shrink: 0; }
    .top3-name { max-width: none; font-size: 0.9rem; flex: 1; }
    .top3-pts { font-size: 1.15rem; margin-left: auto; }
    .top3-label { display: none; }

    /* Login */
    .login-card {
        border-radius: 16px;
        padding: 2rem 1.6rem 1.6rem;
    }

    /* Action grid — 2 columnas */
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Bottom nav botones más grandes */
    .bottom-nav-btn {
        font-size: 0.72rem;
        gap: 0.3rem;
        padding-top: 6px;
        justify-content: flex-start;
        min-height: 52px;
    }
    .bottom-nav-btn i,
    .bottom-nav-btn svg {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px;
        min-height: 24px;
        display: block;
    }

    /* + sobresale solo un poco hacia arriba */
    .bottom-nav-primary {
        width: 56px; height: 56px;
        margin-top: -18px;
        margin-bottom: 0;
        padding-top: 0;
        align-self: flex-start;
        justify-content: center;
    }
    .bottom-nav-primary i { width: 28px; height: 28px; }
}

/* Tablets: sidebar más estrecha pero visible */
@media (min-width: 641px) and (max-width: 900px) {
    .sidebar {
        width: 200px;
    }

    .group-head-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* =========================================
   BETS + HISTORIAL — LAYOUT DOS COLUMNAS
========================================= */
.bets-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
    height: 100%;
}

.bets-col {
    min-width: 0;
    overflow-y: auto;
    height: 100%;
}

.hist-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.hist-col .bets-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* =========================================
   HISTORIAL DE PUNTOS
========================================= */
.hist-header-fixed {
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0;
}

.hist-header-fixed .hist-subtabs {
    margin-bottom: 0.75rem;
}

.hist-scroll-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 0.75rem 0.75rem;
}

.hist-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hist-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.hist-row:last-child {
    border-bottom: none;
}

.hist-user {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.hist-action {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hist-pts {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.hist-pts-pos { color: #4ade80; }
.hist-pts-neg { color: #f87171; }

.hist-date {
    color: var(--muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

/* En móvil, el layout pasa a una columna */
@media (max-width: 900px) {
    .bets-layout {
        grid-template-columns: 1fr;
    }

    .hist-list {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .hist-scroll-area {
        padding: 0 0.75rem 1rem;
    }
    .hist-list {
        gap: 0.45rem;
    }
    .hist-row {
        grid-template-columns: 1fr auto;
        gap: 0.25rem 0.65rem;
        padding: 0.75rem 0.85rem;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
    }
    .hist-row:last-child {
        border-bottom: 1px solid var(--border);
    }
    .hist-user {
        max-width: none;
        font-size: 0.85rem;
    }
    .hist-pts {
        grid-column: 2;
        grid-row: 1;
        font-size: 0.9rem;
    }
    .hist-action {
        grid-column: 1;
        grid-row: 2;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.35;
    }
    .hist-date {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
        font-size: 0.68rem;
    }
}

/* =========================================
   TAB HISTORIAL — solo visible en móvil
========================================= */
/* En escritorio el tab de Historial está oculto (el historial va en la columna de la derecha) */
.tab-history-mobile {
    display: none;
}

@media (max-width: 900px) {
    /* En móvil mostrar el tab de Historial */
    .tab-history-mobile {
        display: flex;
    }

    /* En móvil ocultar la columna hist-col dentro de bets-layout */
    .hist-col {
        display: none;
    }
}

/* =========================================
   SUB-TABS HISTORIAL (Personal / Grupo)
========================================= */
.hist-subtabs {
    display: flex;
    gap: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.2rem;
    margin-bottom: 0;
}
.hist-subtab {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.45rem 0.4rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.hist-subtab.active {
    background: var(--white);
    color: #000;
}

/* =========================================
   BOTÓN SALIR DEL GRUPO
========================================= */
.btn-leave-group {
    background: transparent;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
}
.btn-leave-group:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: #f87171;
}

/* Badge fundador */
.member-founder-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 50px;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    margin-left: 0.4rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}

@media (max-width: 640px) {
    /* En móvil, el botón salir va dentro del modal de miembros, no en el header */
    .btn-leave-group {
        display: none;
    }
    .btn-leave-group-modal {
        display: flex;
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border);
        justify-content: center;
    }
}

.btn-leave-group-modal {
    display: none;
}

/* Pending actions summary in updateModal */
.pending-summary {
    margin-top: 0.75rem;
    min-height: 1.4rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.9rem;
    display: none;
}
.pending-summary:not(:empty) {
    display: block;
}

/* =========================================
   MOBILE-FIRST HUD POLISH
========================================= */
@media (max-width: 640px) {
    .btn-score,
    .btn-requests,
    .btn-new-bet,
    .btn-accept,
    .btn-deny,
    .btn-bet-join,
    .btn-bet-resolve,
    .discover-btn,
    .odds-btn {
        min-height: 44px;
    }

    .btn-score,
    .btn-requests,
    .btn-new-bet,
    .btn-bet-join,
    .btn-bet-resolve {
        padding: 0.65rem 0.9rem;
        font-size: 0.82rem;
    }

    .request-item {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .request-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .member-item {
        padding: 0.8rem 0.9rem;
        gap: 0.65rem;
    }
    .member-name {
        white-space: normal;
        line-height: 1.25;
    }
    .btn-make-admin,
    .btn-kick {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }
    .btn-make-admin i,
    .btn-kick i {
        width: 17px;
        height: 17px;
    }

    .bets-section {
        padding: 0.95rem;
        gap: 0.75rem;
    }
    .bets-header,
    .bets-history-header,
    .stats-header {
        align-items: center;
        gap: 0.75rem;
    }
    .btn-new-bet {
        flex-shrink: 0;
    }
    .bet-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    .bet-card-top {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }
    .bet-odds-badge {
        align-self: flex-start;
        padding: 0.3rem 0.7rem;
    }
    .bet-card-meta {
        gap: 0.45rem 0.65rem;
        line-height: 1.35;
    }
    .bet-participant {
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0.55rem 0.7rem;
    }
    .bet-p-stake {
        flex-wrap: wrap;
        justify-content: flex-end;
        text-align: right;
    }
    .bet-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .btn-bet-join,
    .btn-bet-resolve {
        justify-content: center;
        width: 100%;
        border-radius: var(--radius-sm);
    }

    .odds-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .odds-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    .stats-section {
        padding: 0.95rem;
        gap: 0.75rem;
    }
    .stats-select {
        min-height: 48px;
        font-size: 1rem;
    }
    .stats-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }
    .stats-card {
        padding: 0.7rem 0.75rem;
    }
    .stats-ranking-head {
        margin-bottom: 0.3rem;
    }
    .stats-ranking-row {
        grid-template-columns: auto 1fr;
        gap: 0.45rem 0.65rem;
        padding: 0.8rem 0.9rem;
    }
    .stats-ranking-row .rest-avatar {
        grid-column: 1;
        grid-row: 1 / span 2;
    }
    .stats-rank {
        display: none;
    }
    .stats-user-info {
        grid-column: 2;
    }
    .stats-user-score {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        gap: 0.55rem;
    }

    .modal {
        padding: 0 0 var(--safe-bottom);
    }
    .modal-box {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - var(--safe-top) - 0.75rem);
        padding: 1.35rem 1.1rem calc(1.35rem + var(--safe-bottom));
    }
    .modal-head {
        margin-bottom: 1rem;
    }
    .action-grid {
        gap: 0.55rem;
    }
    .btn-action {
        min-height: 64px;
        padding: 0.85rem 0.75rem;
    }
    .btn-leave-group-modal {
        display: flex;
    }
}

@media (max-width: 360px) {
    .navbar {
        padding: 0 0.8rem;
    }
    .nav-logo-img {
        height: 34px;
    }
    .user-pill {
        padding-right: 0.6rem;
        max-width: 132px;
    }
    #navUsername {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .action-grid {
        grid-template-columns: 1fr;
    }
    .stats-summary-grid {
        grid-template-columns: 1fr;
    }
}
