/* ===========================================================
   Pint League — componentes
   =========================================================== */

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sm);
    border-radius: var(--r-pill);
    padding: 15px 20px;
    font-weight: 900; font-size: 15px; letter-spacing: 1px; text-transform: uppercase;
    transition: transform .08s ease, filter .15s ease;
    width: 100%;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #000; box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--error); border: 1.5px solid var(--error); }
.btn-sm { padding: 9px 16px; font-size: 12px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Inputs ---------- */
.field { margin-bottom: var(--lg); }
.field label { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.input, .textarea {
    width: 100%; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 14px; color: var(--text); font-size: 15px;
    transition: border-color .15s ease;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); }
.textarea { resize: vertical; min-height: 80px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--lg);
}
.card + .card { margin-top: var(--md); }

/* ---------- Header de pantalla ---------- */
.screen-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--xl); gap: var(--md); }
.screen-head h1 { font-size: 26px; }
.greeting { color: var(--text-soft); font-size: 14px; }
.greeting + .name { font-size: 28px; font-weight: 900; letter-spacing: 1px; font-family: var(--font-display); }
.back-btn { font-size: 22px; color: var(--text); padding: 4px 8px; margin-left: -8px; }

/* ---------- Avatar ---------- */
.avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; color: #000; font-size: 18px; flex-shrink: 0;
    background-size: cover; background-position: center;
    font-family: var(--font-display);
}
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar.lg { width: 88px; height: 88px; font-size: 34px; }

/* ---------- Stat cards ---------- */
.stats-row { display: flex; gap: var(--sm); margin-bottom: var(--lg); }
.stat {
    flex: 1; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--md); text-align: center;
}
.stat.hl { background: var(--primary); border-color: var(--primary); color: #000; box-shadow: var(--glow); }
.stat .emoji { font-size: 22px; }
.stat .value { font-size: 24px; font-weight: 900; font-family: var(--font-display); margin-top: 2px; }
.stat .label { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.stat.hl .label { color: #000; opacity: .7; }

/* ---------- Section header ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: var(--xl) 0 var(--md); }
.section-head h2 { font-size: 17px; }
.section-head .link { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ---------- Grupo / bar card ---------- */
.group-strip { display: flex; gap: var(--md); overflow-x: auto; padding-bottom: var(--sm); }
.group-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--md); min-width: 180px;
    display: block; position: relative; overflow: hidden;
}
.group-card .cover { position: absolute; inset: 0; opacity: .25; background-size: cover; background-position: center; }
.group-card > * { position: relative; }
.group-card .gname { font-size: 16px; font-weight: 800; }
.group-card .gmeta { color: var(--text-soft); font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.group-card .gpts { font-size: 26px; font-weight: 900; color: var(--primary); font-family: var(--font-display); margin-top: var(--md); }
.group-card .gpts small { font-size: 11px; color: var(--text-soft); font-weight: 500; display: block; }
.group-list { display: flex; flex-direction: column; gap: var(--md); }
.group-list .group-card { min-width: 0; width: 100%; }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sm); }
.ach {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: var(--md) var(--sm); text-align: center;
    position: relative;
}
.ach.unlocked { border-color: var(--primary); box-shadow: 0 0 12px rgba(253,224,71,.2); }
.ach .icon { font-size: 30px; }
.ach.locked .icon { filter: grayscale(1); opacity: .3; }
.ach .title { font-size: 11px; font-weight: 700; margin-top: 4px; }
.ach.locked .title { color: var(--text-muted); }
.ach .bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.ach .bar > i { display: block; height: 100%; background: var(--primary); }
.ach { cursor: pointer; }

/* Comentarios */
.comment { display: flex; gap: var(--sm); padding: 8px 0; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sm); }
.comment-head b { font-size: 14px; }
.comment-text { margin-top: 2px; font-size: 14px; color: var(--text-soft); word-break: break-word; }

/* Cabecera de perfil */
.profile-hero { position: relative; text-align: center; padding: var(--xl) var(--lg); border-radius: var(--r-xl); border: 1px solid var(--border); background: radial-gradient(120% 90% at 50% 0%, rgba(253,224,71,.14), transparent 60%), var(--surface); }
.profile-hero .ph-name { font-size: 28px; margin-top: var(--md); }
.profile-hero .edit-ico { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.avatar.xl { width: 120px; height: 120px; font-size: 46px; margin: 0 auto; }
.avatar.ring { border: 3px solid var(--primary); box-shadow: var(--glow); }

/* ---------- Tabs (segmented) ---------- */
.segmented { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 4px; gap: 4px; margin-bottom: var(--lg); }
.segmented button { flex: 1; padding: 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; }
.segmented button.active { background: var(--primary); color: #000; }

/* ---------- Ranking ---------- */
.rank-row { display: flex; align-items: center; gap: var(--md); padding: var(--md); border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-pos { width: 34px; text-align: center; font-weight: 900; font-size: 18px; font-family: var(--font-display); color: var(--text-soft); }
.rank-pos.medal { font-size: 24px; }
.rank-info { flex: 1; min-width: 0; }
.rank-info .rn { font-weight: 700; font-size: 15px; }
.rank-info .rm { font-size: 12px; color: var(--text-soft); }
.rank-pts { font-weight: 900; font-size: 18px; color: var(--primary); font-family: var(--font-display); }
.rank-row.me { background: rgba(253,224,71,.06); border-radius: var(--r-md); }

/* ---------- Feed de rondas ---------- */
.round { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: var(--lg); }
.round-head { display: flex; align-items: center; gap: var(--sm); padding: var(--md); }
.round-head .rh-name { font-weight: 700; font-size: 14px; }
.round-head .rh-time { font-size: 11px; color: var(--text-muted); }
.round-photo { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.round-body { padding: var(--md); }
.round-drink { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: var(--r-pill); padding: 6px 12px; font-weight: 700; font-size: 13px; }
.round-drink .pts { color: var(--primary); }
.round-drinks { display: flex; flex-wrap: wrap; gap: 6px; }
.round-total { font-family: var(--font-display); font-weight: 900; font-size: 18px; color: var(--primary); flex-shrink: 0; }
.round-caption { margin-top: var(--sm); font-size: 14px; color: var(--text-soft); }
.round-actions { display: flex; align-items: center; gap: var(--lg); margin-top: var(--md); }
.round-actions button { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text-soft); }
.round-actions button.liked { color: var(--secondary); }

/* ---------- Chat ---------- */
.chat-wrap { display: flex; flex-direction: column; gap: var(--sm); }
.msg { display: flex; gap: var(--sm); align-items: flex-end; }
.msg.mine { flex-direction: row-reverse; }
.msg .bubble { background: var(--surface-2); border-radius: var(--r-lg); padding: 9px 13px; max-width: 75%; font-size: 14px; }
.msg.mine .bubble { background: var(--primary); color: #000; }
.msg .bubble .mn { font-size: 11px; font-weight: 800; color: var(--cyan); margin-bottom: 2px; }
.chat-input { display: flex; gap: var(--sm); position: sticky; bottom: 0; padding-top: var(--sm); }
.chat-input .input { border-radius: var(--r-pill); }
.chat-input button { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; background: var(--primary); color: #000; font-size: 20px; }

/* ---------- Member list ---------- */
.member { display: flex; align-items: center; gap: var(--md); padding: var(--md) 0; border-bottom: 1px solid var(--border); }
.member:last-child { border: none; }
.member .mname { font-weight: 700; flex: 1; }
.member .badge-owner { font-size: 10px; background: var(--primary); color: #000; padding: 2px 8px; border-radius: var(--r-pill); font-weight: 800; }

/* ---------- Drinks picker ---------- */
.drink-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sm); }
.drink-opt { background: var(--surface); border: 2px solid var(--border); border-radius: var(--r-md); padding: var(--md); text-align: center; }
.drink-opt.sel { border-color: var(--primary); background: rgba(253,224,71,.08); }
.drink-opt .de { font-size: 30px; }
.drink-opt .dn { font-weight: 700; font-size: 14px; margin-top: 4px; }
.drink-opt .dp { font-size: 12px; color: var(--primary); font-weight: 800; }

/* ---------- Juegos ---------- */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--md); }
.game-tile { aspect-ratio: 1; border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sm); font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: #000; font-family: var(--font-display); font-size: 16px; padding: var(--md); }
.game-tile .ge { font-size: 44px; }
.g-yellow { background: var(--primary); box-shadow: var(--glow); }
.g-pink { background: var(--secondary); color: #fff; }
.g-cyan { background: var(--cyan); }
.g-green { background: var(--green); }
.prompt-card { min-height: 200px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 22px; font-weight: 700; line-height: 1.4; padding: var(--xl); }

/* Jugadores (modo fiesta) */
.roster-card { margin-bottom: var(--lg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sm); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 6px 8px 6px 12px; font-size: 13px; font-weight: 700; }
.chip button { color: var(--text-muted); font-weight: 900; font-size: 12px; line-height: 1; padding: 2px; }
.chip button:hover { color: var(--error); }
.turn-card { text-align: center; padding: var(--md) var(--lg); background: var(--surface); border: 1px solid var(--primary); border-radius: var(--r-lg); box-shadow: 0 0 14px rgba(253,224,71,.18); margin-bottom: var(--lg); }
.turn-card .muted { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.turn-card .who { font-size: 28px; font-weight: 900; font-family: var(--font-display); color: var(--primary); margin-top: 2px; }

/* ---------- Animaciones y juegos ---------- */
.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: .3; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }

.burst-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.burst-layer span { position: absolute; top: 45%; animation: burstUp 1.5s ease-out forwards; }
@keyframes burstUp { 0% { transform: translate(0,0) scale(.4); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), -70vh) scale(1.2) rotate(220deg); opacity: 0; } }

.g-red { background: #EF4444; color: #fff; }
.game-tile.wide { grid-column: 1 / -1; aspect-ratio: auto; flex-direction: row; padding: 20px; gap: 14px; }
.game-tile.wide .ge { font-size: 40px; }

.bomb-stage { position: relative; min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.bomb-emoji { font-size: 90px; }
.bomb-stage.running .bomb-emoji { animation: bombShake .35s infinite; }
.bomb-stage.boom { border-color: var(--error); box-shadow: 0 0 24px rgba(239,68,68,.4); }
.bomb-stage.boom .bomb-emoji { font-size: 120px; animation: pop .4s ease; }
.bomb-msg { margin-top: var(--md); font-weight: 800; text-align: center; font-size: 18px; }
@keyframes bombShake { 0%,100% { transform: rotate(-9deg) scale(1); } 50% { transform: rotate(9deg) scale(1.08); } }

/* ---------- Empty / loader ---------- */
.empty { text-align: center; padding: var(--xxl) var(--lg); }
.empty .ee { font-size: 52px; }
.empty .et { font-size: 17px; font-weight: 800; margin-top: var(--sm); }
.empty .es { color: var(--text-soft); margin: 6px 0 var(--lg); }
.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--surface-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tab bar ---------- */
.tabbar {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--max-w);
    height: var(--tabbar-h);
    background: rgba(24,24,27,.92); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex; align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); font-size: 10px; font-weight: 700; }
.tabbar button .ti { font-size: 22px; line-height: 1; }
.tabbar button.active { color: var(--primary); }

/* ---------- Auth ---------- */
.auth-screen { display: flex; flex-direction: column; justify-content: center; min-height: 88vh; }
.brand { text-align: center; margin-bottom: var(--xxl); }
.brand .logo { font-size: 60px; }
.brand h1 { font-size: 38px; margin-top: var(--sm); }
.brand h1 .y { color: var(--primary); }
.brand p { color: var(--text-soft); margin-top: var(--xs); }
.auth-switch { text-align: center; margin-top: var(--lg); color: var(--text-soft); font-size: 14px; }
.auth-error { background: rgba(239,68,68,.12); border: 1px solid var(--error); color: #fca5a5; padding: var(--md); border-radius: var(--r-md); font-size: 13px; margin-bottom: var(--lg); text-align: center; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: calc(var(--tabbar-h) + var(--md)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: var(--sm); z-index: 100; pointer-events: none; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); padding: 12px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toastIn .2s ease; max-width: 90%; }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--error); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; z-index: 90; animation: toastIn .15s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--xl) var(--xl) calc(var(--xl) + env(safe-area-inset-bottom)); width: 100%; max-width: var(--max-w); max-height: 85vh; overflow-y: auto; }
.modal h3 { font-size: 20px; margin-bottom: var(--lg); }

/* ---------- Misc ---------- */
.row { display: flex; gap: var(--md); align-items: center; }
.row.between { justify-content: space-between; }
.mt { margin-top: var(--lg); }
.muted { color: var(--text-soft); font-size: 13px; }
.invite-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: var(--r-pill); padding: 6px 14px; font-weight: 800; letter-spacing: 2px; font-family: var(--font-display); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery img { aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); }

/* ---------- Registrar ronda: contador de bebidas ---------- */
.drink-row { display: flex; align-items: center; gap: var(--md); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--md); margin-bottom: 10px; }
.drink-row .de { font-size: 30px; }
.drink-row .di { flex: 1; }
.drink-row .di .dn { font-weight: 800; }
.drink-row .di .dp { font-size: 12px; color: var(--text-soft); }
.stepper { display: flex; align-items: center; gap: var(--md); }
.stepper button { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.stepper button.plus { background: var(--primary); color: #000; }
.stepper button:active { transform: scale(.9); }
.stepper .count { font-weight: 900; font-size: 18px; min-width: 24px; text-align: center; font-family: var(--font-display); }
.round-footer { position: sticky; bottom: calc(var(--tabbar-h) + var(--sm)); display: flex; align-items: center; justify-content: space-between; padding: var(--md) 0; margin-top: var(--lg); background: linear-gradient(transparent, var(--bg) 35%); }
.round-footer .total small { display: block; color: var(--text-soft); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.round-footer .total b { font-size: 24px; color: var(--primary); font-family: var(--font-display); }

/* ---------- Cámara ---------- */
.camera-stage { position: relative; background: #000; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; }
.camera-stage video, .camera-stage img { width: 100%; height: 100%; object-fit: cover; }
.camera-stage video.mirror { transform: scaleX(-1); }
.shutter { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: 74px; height: 74px; border-radius: 50%; background: var(--primary); border: 5px solid #fff; box-shadow: var(--glow); }
.shutter:active { transform: translateX(-50%) scale(.92); }
.camera-msg { color: #fff; text-align: center; padding: var(--xl); line-height: 1.5; font-size: 16px; }

/* ---------- Portada del bar ---------- */
.cover-cam { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.group-cover { position: relative; border-radius: var(--r-lg); overflow: hidden; margin-bottom: var(--lg); min-height: 150px; display: flex; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); }
.group-cover .cimg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.group-cover .cplaceholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 70px; opacity: .25; }
.group-cover .cshade { position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(0,0,0,.85)); }
.group-cover .cinfo { position: relative; width: 100%; padding: var(--md); align-items: flex-end; }
.group-cover .ctitle { font-size: 26px; font-weight: 900; font-family: var(--font-display); text-transform: uppercase; }
.group-cover .cinfo .btn-sm { width: auto; flex-shrink: 0; }
