/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e8e8e8;
    --text: #111111;
    --text-1: #111111;
    --text-2: #666666;
    --text-3: #999999;
    --accent: #111111;
    --accent-soft: #f0f0f0;
    --green: #22c55e;
    --gold: #eab308;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.15s ease;
}

[data-theme="dark"] {
    --bg: #0f0f10;
    --surface: #1a1a1c;
    --border: #2a2a2d;
    --text: #f5f5f5;
    --text-1: #f5f5f5;
    --text-2: #b0b0b0;
    --text-3: #777777;
    --accent: #f5f5f5;
    --accent-soft: #1f1f22;
}
[data-theme="dark"] img.qr-img { background: #fff; }
[data-theme="dark"] .btn-secondary { background: #1a1a1c; color: var(--text); border-color: var(--border); }

html, body {
    height: 100%;
    overscroll-behavior: none;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* Prevent double-tap zoom on all interactive elements */
button, a, [onclick] {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.app {
    max-width: 460px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    background: var(--surface);
    position: relative;
    overflow: hidden;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: absolute;
    inset: 0;
    background: var(--bg);
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
.screen.active {
    display: flex;
    position: relative;
    z-index: 2;
    animation: slideIn 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    padding-top: calc(14px + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}
.btn-back {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
    margin: -8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.topbar-title {
    font-weight: 700;
    font-size: 0.9rem;
}
.badge {
    background: var(--text);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

/* ===== HOME ===== */
.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 24px;
    padding-top: calc(40px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    gap: 40px;
}
.brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.brand-logo {
    width: 110px;
    height: 110px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(22, 163, 74, 0.25), 0 4px 12px rgba(8, 145, 178, 0.18);
    animation: brandFloat 4s ease-in-out infinite;
}
@keyframes brandFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-6px) rotate(-1.5deg); }
}
.brand h1 {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--text);
    line-height: 1.1;
}
.brand-tld {
    color: var(--text-3);
    font-weight: 700;
    font-size: 0.95em;
}
.brand p {
    color: var(--text-3);
    font-size: 0.9rem;
    margin-top: 2px;
    font-weight: 500;
}

/* ===== SPLASH INTRO ===== */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: splashOut 0.5s ease 1.8s forwards;
    pointer-events: none;
}
.splash-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: splashIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.splash-logo {
    width: 140px;
    height: 140px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(22, 163, 74, 0.35), 0 8px 20px rgba(8, 145, 178, 0.2);
    animation: splashPulse 1.3s ease-in-out 0.4s infinite;
}
.splash-a {
    animation: splashAPath 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) both;
    transform-origin: 256px 400px;
}
.splash-dot {
    animation: splashDot 0.6s ease 0.55s both;
    transform-origin: 256px 430px;
}
.splash-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #111;
    animation: splashTitleIn 0.5s ease 0.5s both;
}
.splash-tld {
    color: #9ca3af;
    font-weight: 700;
}
@keyframes splashIn {
    0%   { opacity: 0; transform: scale(0.6); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes splashOut {
    0%   { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}
@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}
@keyframes splashAPath {
    0%   { opacity: 0; transform: translateY(-40px) scale(0.5); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes splashDot {
    0%   { opacity: 0; transform: scale(0); }
    60%  { opacity: 1; transform: scale(1.4); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes splashTitleIn {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
.splash.done { display: none; }

/* Respeta reduce-motion */
@media (prefers-reduced-motion: reduce) {
    .splash, .splash-logo, .splash-logo-wrap, .splash-a, .splash-dot, .splash-title, .brand-logo {
        animation: none !important;
    }
    .splash { animation: splashOut 0.3s linear 0.6s forwards !important; }
}

.credit-footer {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-3);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    font-weight: 400;
    flex-shrink: 0;
    margin-top: auto;
}
.credit-footer strong { font-weight: 600; }
.footer-version {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text-3);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.footer-version:hover {
    background: #16a34a;
    color: #fff;
}
/* On screens with scroll content (players, tournament), keep it at natural flow */
#screen-players .credit-footer,
#screen-tournament .credit-footer { margin-top: 0; }

.home-options {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}
.sport-pick {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.sport-pick:hover { border-color: var(--text); }
.sport-pick:active { transform: scale(0.95); border-color: var(--text); }
.sport-pick-icon {
    font-size: 2.4rem;
}
.sport-pick-name {
    font-weight: 700;
    font-size: 0.95rem;
}

/* ===== CAFECITO ===== */
.cafecito-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding: 10px 18px;
    background: transparent;
    border: 1.5px dashed var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}
.cafecito-link:hover {
    border-color: #16a34a;
    color: #16a34a;
    background: rgba(22, 163, 74, 0.06);
}
.cafecito-link:active { transform: scale(0.97); }
.cafecito-icon { font-size: 1.1rem; }
.cafecito-text { white-space: nowrap; }
@media (max-width: 380px) {
    .cafecito-link { font-size: 0.76rem; padding: 9px 14px; }
}

/* ===== SCREEN BODY ===== */
.screen-body {
    flex: 1;
    padding: 20px 16px;
    min-height: 0;
}

/* ===== PILL GRID (futbol types) ===== */
.pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.pill {
    padding: 22px 0;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition), transform 0.1s;
    text-align: center;
    color: var(--text);
    min-height: 64px;
}
.pill:hover { border-color: var(--text); }
.pill:active { transform: scale(0.95); background: var(--accent-soft); }

/* ===== FORM STACK (padel config) ===== */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.field-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.field-card label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    margin-bottom: 16px;
}

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}
.stepper-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.stepper-btn:hover { border-color: var(--text); }
.stepper-value {
    font-size: 2rem;
    font-weight: 900;
    min-width: 48px;
    text-align: center;
}

.toggle-row {
    display: flex;
    gap: 8px;
}
.toggle-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-2);
}
.toggle-btn:hover { border-color: var(--text-3); }
.toggle-btn.active {
    border-color: var(--text);
    color: var(--text);
    background: var(--accent-soft);
}

/* Alias for JS compatibility */
.points-btn { /* same as toggle-btn, handled by class */ }

/* ===== ACTION OPTIONS ===== */
.action-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}
.action-card:hover { border-color: var(--text); }
.action-card:active { transform: scale(0.98); }

.action-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: var(--accent-soft);
}
.action-icon-wrap.green { background: #ecfdf5; }
.action-icon-wrap.gold { background: #fefce8; }

.action-text h3 { font-size: 0.95rem; font-weight: 700; }
.action-text p { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
.action-arrow {
    margin-left: auto;
    color: var(--text-3);
    font-size: 1.2rem;
}

/* ===== CHOICE CARDS (mode) ===== */
.choice-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.choice-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}
.choice-card:hover { border-color: var(--text); }
.choice-card:active { transform: scale(0.98); }
.choice-emoji { font-size: 1.8rem; flex-shrink: 0; }
.choice-card strong { font-size: 0.95rem; display: block; }
.choice-card p { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }

/* ===== FORMAT CARDS ===== */
.format-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
}
.format-card-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.ida-vuelta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--accent-soft);
    border-left: 2px solid var(--border);
    border-right: 2px solid var(--border);
    cursor: pointer;
    font-size: 0.8rem;
}
.ida-vuelta-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #16a34a;
    flex-shrink: 0;
}
.ida-vuelta-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ida-vuelta-label strong {
    color: var(--text);
    font-weight: 700;
    font-size: 0.82rem;
}
.ida-vuelta-hint {
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 500;
}
.format-info-btn {
    background: none;
    border: none;
    border-left: 2px solid var(--border);
    border-right: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    border-radius: 0 0 var(--radius) var(--radius);
}
.format-info-btn:active, .format-info-btn.active {
    background: var(--accent-soft);
    color: var(--text-1);
}
.format-detail {
    background: var(--accent-soft);
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 14px 18px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-2);
}
.format-detail b { color: var(--text-1); }
.format-card-wrap .format-card {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border);
}
.format-card-wrap .format-info-btn:last-of-type:not(.active) + .format-detail.hidden ~ * {
    border-radius: 0 0 var(--radius) var(--radius);
}
.format-card-wrap .format-detail.hidden + * { display: none; }
.format-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}
.format-card:hover { border-color: var(--text); }
.format-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: var(--accent-soft);
}

/* ===== PLAYER FORM ===== */
.players-body { display: flex; flex-direction: column; }
.player-form { margin-bottom: 16px; }
.input-row {
    display: flex;
    gap: 8px;
}
.input-row input {
    flex: 1;
    padding: 13px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px; /* prevent iOS zoom */
    font-family: inherit;
    outline: none;
    background: var(--surface);
    transition: var(--transition);
    -webkit-appearance: none;
}
.input-row input:focus { border-color: var(--text); }
.input-row input::placeholder { color: var(--text-3); }

.btn-add {
    width: 48px;
    height: 48px;
    border: 2px solid var(--text);
    background: var(--text);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity var(--transition), transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-add:hover { opacity: 0.85; }
.btn-add:active { transform: scale(0.92); }

.skill-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.skill-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-3);
}
.stars-input { display: flex; gap: 4px; }
.star-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #ddd;
    transition: color 0.1s;
    padding: 2px;
}
.star-btn.active { color: var(--gold); }
.star-btn:hover { color: var(--gold); }

/* ===== CATEGORY ROW (pádel) ===== */
.category-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.cat-btns {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
}
.cat-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 40px;
    min-height: 32px;
}
.cat-btn.active {
    background: var(--text);
    color: var(--surface);
    border-color: var(--text);
}
.cat-btn:hover:not(.active) { border-color: var(--text); }
.player-cat {
    font-size: 0.68rem;
    font-weight: 800;
    background: var(--text);
    color: var(--surface);
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.3px;
}

/* ===== PLAYER LIST ===== */
.player-list-wrap {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
.player-list { list-style: none; }
.reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-right: 6px;
    flex-shrink: 0;
}
.reorder-btn {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 0.55rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.1s;
}
.reorder-btn:hover:not(:disabled) { color: var(--text); }
.reorder-btn:disabled { opacity: 0.2; cursor: default; }
.reorder-btn:active:not(:disabled) { color: var(--text); }

.player-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    margin-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.15s ease;
    min-height: 48px;
}
.player-info { display: flex; align-items: center; gap: 10px; }
.player-number {
    width: 26px; height: 26px;
    background: var(--text);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.player-name { font-weight: 600; font-size: 0.9rem; cursor: pointer; border-bottom: 1px dashed var(--border); }
.player-name:active { opacity: 0.6; }
.player-stars { color: var(--gold); font-size: 0.75rem; letter-spacing: 1px; }
.btn-remove {
    background: none; border: none;
    color: var(--text-3); font-size: 1.2rem;
    cursor: pointer; padding: 8px;
    margin: -8px -4px -8px 0;
    border-radius: 4px; transition: var(--transition);
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.btn-remove:hover { color: #dc2626; background: #fef2f2; }
.btn-remove:active { color: #dc2626; }

/* ===== BOTTOM BAR ===== */
.bottom-bar {
    padding-top: 14px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    margin-top: auto;
    flex-shrink: 0;
}
.helper-text {
    font-size: 0.8rem;
    color: var(--text-3);
    text-align: center;
    margin-bottom: 12px;
    min-height: 18px;
}
.bottom-buttons { display: flex; gap: 10px; }

/* ===== BUTTONS ===== */
.btn-main {
    flex: 1;
    padding: 15px 20px;
    background: var(--text);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--transition), transform 0.1s;
    min-height: 52px;
}
.btn-main:hover:not(:disabled) { opacity: 0.85; }
.btn-main:active:not(:disabled) { transform: scale(0.97); }
.btn-main:disabled { opacity: 0.25; cursor: not-allowed; }

.btn-secondary {
    flex: 1;
    padding: 15px 20px;
    background: var(--surface);
    color: var(--text-2);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition), transform 0.1s;
    min-height: 52px;
}
.btn-secondary:hover { border-color: var(--text-3); }
.btn-secondary:active { transform: scale(0.97); }

/* Aliases for JS compatibility */
.btn.primary { /* same as btn-main */ }
.btn.ghost { /* same as btn-secondary */ }
.btn.outline { /* same as btn-secondary */ }
.full-width { width: 100%; flex: none; }
.hidden { display: none !important; }

/* ===== TEAMS RESULT ===== */
.teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    align-content: start;
}
.team-card {
    border-radius: var(--radius);
    padding: 16px;
    color: white;
    animation: teamPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes teamPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.team-card h3 {
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.team-name-editable {
    cursor: pointer;
}
.team-name-pencil {
    font-size: 0.65rem;
    opacity: 0.5;
    cursor: pointer;
    margin-left: 2px;
    font-style: normal;
}
.team-name-input {
    background: rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 4px;
    color: white;
    font: inherit;
    font-weight: 800;
    font-size: 0.8rem;
    font-family: inherit;
    padding: 1px 6px;
    width: 110px;
    outline: none;
}
.team-avg {
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 2px 7px;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0;
}
.team-card ol { list-style: none; counter-reset: tp; }
.team-card ol li {
    counter-increment: tp;
    padding: 4px 0;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    font-weight: 500;
}
.team-card ol li:last-child { border-bottom: none; }
.team-card ol li::before {
    content: counter(tp);
    margin-right: 8px;
    opacity: 0.5;
    font-size: 0.7rem;
    font-weight: 700;
}
.team-player-stars { font-size: 0.65rem; opacity: 0.7; }
.suplentes-card { grid-column: 1 / -1; background: #888 !important; }

/* ===== SWAP / EDIT MODE ===== */
.swap-hint-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
    padding: 11px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 0.88rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    animation: swapHintIn 0.25s ease;
}
.swap-hint-icon { font-size: 1.1rem; flex-shrink: 0; }
.swap-hint-text { flex: 1; min-width: 0; }
.swap-undo-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(26, 26, 26, 0.12);
    color: #1a1a1a;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}
.swap-undo-btn:hover { background: rgba(26, 26, 26, 0.22); }
.swap-undo-btn:active { transform: scale(0.92); }
#screen-teams-result.swap-mode-active .swap-hint-banner { display: flex; }
@keyframes swapHintIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.team-card ol li.swappable {
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.team-card ol li.swappable:active { transform: scale(0.97); }
.team-card ol li.swap-selected {
    background: rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 0 0 2px #fbbf24, 0 0 0 2px rgba(251, 191, 36, 0.4);
    animation: swapSelectedPulse 1.2s ease-in-out infinite;
}
@keyframes swapSelectedPulse {
    0%, 100% { box-shadow: inset 0 0 0 2px #fbbf24, 0 0 0 2px rgba(251, 191, 36, 0.4); }
    50%      { box-shadow: inset 0 0 0 2px #fbbf24, 0 0 0 4px rgba(251, 191, 36, 0.6); }
}
#screen-teams-result.swap-mode-active .btn-regen,
#screen-teams-result.swap-mode-active .btn-copy-action,
#screen-teams-result.swap-mode-active .btn-share-img,
#screen-teams-result.swap-mode-active .btn-wa { display: none; }
#screen-teams-result.swap-mode-active .btn-edit {
    flex: 1 0 100%;
    background: linear-gradient(135deg, #16a34a, #0891b2);
    color: #fff;
    border-color: transparent;
}

.result-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
    padding-top: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
}
.result-bar .btn-regen,
.result-bar .btn-edit,
.result-bar .btn-copy-action {
    flex: 1 1 calc(33% - 8px);
    min-width: 0;
}
.result-bar .btn-wa {
    flex: 1 0 100%; /* WhatsApp always full width */
    order: 4;
}

/* ===== SCREEN BODY FLEX CHILDREN ===== */
#screen-teams-result .screen-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== TOURNAMENT ===== */
.tournament-body { padding: 0 !important; }

.tabs {
    display: flex;
    padding: 4px;
    margin: 12px 20px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-3);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.tab.active {
    background: var(--text);
    color: white;
}

.tab-content {
    display: none;
    padding: 0 20px 20px;
    animation: fadeIn 0.18s ease;
}
.tab-content.active { display: block; }

.round-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}
.round-btn {
    width: 44px; height: 44px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--transition), transform 0.1s;
    color: var(--text);
}
.round-btn:hover { border-color: var(--text); }
.round-btn:active:not(:disabled) { transform: scale(0.92); }
.round-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.round-label { font-weight: 800; font-size: 0.9rem; min-width: 100px; text-align: center; }

/* ===== MATCHES ===== */
.matches-list { display: flex; flex-direction: column; gap: 10px; }
.match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.match-card.played { border-color: var(--green); border-width: 2px; }

.match-header {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}
.match-teams { display: flex; align-items: center; gap: 8px; }
.match-team { flex: 1; text-align: center; }
.match-team-name { font-weight: 700; font-size: 0.85rem; }
.match-team-players { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; }
.match-vs {
    font-weight: 800;
    color: var(--text-3);
    font-size: 0.7rem;
    padding: 3px 6px;
    background: var(--accent-soft);
    border-radius: 4px;
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}
/* ===== SCORE +/- CONTROLS ===== */
.score-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.score-adj {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text);
    flex-shrink: 0;
    transition: background 0.1s, transform 0.1s;
    line-height: 1;
}
.score-adj:active { transform: scale(0.88); background: var(--accent-soft); }

/* ===== RESTING CARD ===== */
.rest-card {
    border-style: dashed !important;
    background: var(--accent-soft) !important;
    opacity: 0.75;
}
.sub-card {
    border-color: #f59e0b !important;
    background: rgba(245,158,11,0.07) !important;
}
.sub-rotation-text {
    text-align: center;
    padding: 6px 0 2px;
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.7;
}
.sub-in { font-weight: 700; color: var(--green); }
.sub-out { font-weight: 700; color: #ef4444; }
.sub-team { font-size: 0.78rem; color: var(--text-3); display: block; margin-top: 2px; }

/* ===== PLAYER EMPTY STATE ===== */
.player-empty {
    text-align: center;
    color: var(--text-3);
    font-size: 0.85rem;
    padding: 32px 0;
    border: none !important;
    background: none !important;
    list-style: none;
}

/* ===== RESUME CARD (home) ===== */
.resume-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--green);
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    max-width: 320px;
    text-align: left;
    transition: var(--transition);
    animation: fadeIn 0.3s ease;
}
.resume-card:active { transform: scale(0.97); }
.resume-icon { font-size: 1.4rem; flex-shrink: 0; }
.resume-text { display: flex; flex-direction: column; gap: 2px; }
.resume-text strong { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.resume-text span  { font-size: 0.75rem; color: var(--text-3); }

/* ===== HOME HISTORY ===== */
.home-history {
    width: 100%;
    margin-top: 24px;
}
.home-history-title {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    margin-bottom: 10px;
    text-align: left;
    padding-left: 2px;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 6px;
}
.history-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.history-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.history-item-info strong { font-size: 0.82rem; font-weight: 700; color: var(--text-1); }
.history-item-info span { font-size: 0.72rem; color: var(--text-3); }
.history-item-date { font-size: 0.7rem; color: var(--text-3); flex-shrink: 0; }

.match-score input {
    width: 60px; height: 50px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 800;
    font-family: inherit;
    outline: none;
    background: var(--surface);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}
.match-score input::-webkit-outer-spin-button,
.match-score input::-webkit-inner-spin-button { -webkit-appearance: none; }
.match-score input:focus { border-color: var(--text); }
.match-score-sep { font-weight: 800; color: var(--text-3); font-size: 1.1rem; }

.match-points-hint {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-3);
    margin-top: 6px;
}

.btn-save-score {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    background: var(--text);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--transition), transform 0.1s;
    min-height: 46px;
}
.btn-save-score:hover { opacity: 0.85; }
.btn-save-score:active { transform: scale(0.98); }

.btn-finish-tournament {
    background: var(--green) !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}
.btn-finish-tournament:active { transform: scale(0.97); }
.tourney-end-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 0;
}
.btn-add-rounds {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    border: 2px dashed var(--border);
    background: var(--accent-soft);
    color: var(--text);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-add-rounds:hover { border-color: var(--text); }
.btn-add-rounds:active { transform: scale(0.97); }

.match-points-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-3);
    margin: 4px 0 2px;
}

/* ===== STANDINGS TABLE ===== */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.standings-table thead th {
    padding: 10px 6px;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-3);
    border-bottom: 2px solid var(--border);
}
.standings-table thead th:first-child { padding-left: 12px; }
.standings-table thead th:not(:first-child):not(:nth-child(2)) { text-align: center; }
.standings-table tbody tr { transition: var(--transition); }
.standings-table tbody tr:hover { background: var(--accent-soft); }
.standings-table tbody td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}
.standings-table tbody tr:last-child td { border-bottom: none; }
.standings-table tbody td:first-child { padding-left: 12px; font-weight: 800; width: 28px; }
.standings-table tbody td:not(:first-child):not(:nth-child(2)) { text-align: center; }
.standings-table tbody td:nth-child(2) { font-weight: 700; }
.standings-table tbody td:last-child { font-weight: 800; }
.standings-table tbody tr.top-1 td { background: #f0fdf4; }

/* Fewer games played highlight */
.pj-fewer { color: #e65100; font-weight: 700; background: #fff3e0; border-radius: 4px; padding: 2px 4px; }
.pj-diff { font-size: 0.7rem; color: #e65100; font-weight: 600; }

/* Compensation modal */
.comp-list { display: flex; flex-direction: column; gap: 8px; }
.comp-player {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff3e0; border: 1px solid #ffcc80; border-radius: 10px;
    padding: 10px 14px; gap: 8px;
}
.comp-name { font-weight: 700; flex: 1; }
.comp-detail { color: #e65100; font-size: 0.82rem; font-weight: 600; }
.comp-bonus { color: var(--green); font-weight: 800; font-size: 0.85rem; white-space: nowrap; }
.bonus-tag { font-size: 0.65rem; color: var(--green); font-weight: 700; background: #e8f5e9; border-radius: 4px; padding: 1px 4px; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 200;
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== POSITION SELECTOR ===== */
.position-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.pos-btns { display: flex; gap: 6px; }
.pos-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.1rem;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.pos-btn:hover { border-color: var(--text-3); }
.pos-btn.active { border-color: var(--text); background: white; }

.player-pos { font-size: 0.85rem; }

/* ===== LADO SELECTOR (PÁDEL) ===== */
.lado-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.lado-btns { display: flex; gap: 6px; }
.lado-btn {
    padding: 7px 12px;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-2);
    transition: var(--transition);
}
.lado-btn.active {
    border-color: var(--text);
    color: var(--text);
    background: var(--accent-soft);
}
.lado-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--text-2);
}

/* ===== PRO BAR ===== */
.pro-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.pro-bar-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.switch-btn {
    width: 44px; height: 24px;
    border-radius: 12px;
    border: none;
    background: var(--border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.switch-btn::after {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: white;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch-btn.on { background: var(--text); }
.switch-btn.on::after { left: 23px; }

/* ===== WHATSAPP BUTTON ===== */
.btn-wa { background: #25d366 !important; }
.btn-wa:hover:not(:disabled) { background: #20b858 !important; opacity: 1 !important; }

/* ===== CELEBRATION OVERLAY ===== */
.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}
.celebration-overlay.hidden { display: none; }

#confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    top: -20px;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.celebration-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: celebPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celebPop {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.celebration-emoji {
    font-size: 4rem;
    margin-bottom: 8px;
    animation: bounce 1s ease infinite alternate;
}
@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}
.celebration-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--text);
}
.celebration-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.podium-entry {
    flex: 1;
    max-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.podium-medal { font-size: 1.6rem; }
.podium-name {
    font-size: 0.75rem;
    font-weight: 700;
    word-break: break-word;
    max-width: 90px;
}
.podium-pts {
    font-size: 0.7rem;
    color: var(--text-3);
}
.podium-block {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: var(--accent-soft);
}
.podium-block.first  { height: 60px; background: #FEF9C3; }
.podium-block.second { height: 44px; background: #F1F5F9; }
.podium-block.third  { height: 32px; background: #FEF3C7; }

.celebration-btns { display: flex; gap: 10px; }
.celebration-saved {
    width: 100%;
    text-align: center;
    padding: 8px 12px;
    margin: 4px 0 12px;
    background: #16a34a;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.3px;
}
.celebration-close-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}
.celebration-close-btn:hover { color: #dc2626; }
.celebration-stats { width: 100%; margin: 12px 0 4px; }
.celebration-stats-inner {
    background: var(--bg);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.stat-item {
    font-size: 0.78rem;
    color: var(--text-2);
    line-height: 1.5;
}
.stat-item strong { color: var(--text-1); }

/* ===== STANDINGS SHARE ===== */
.standings-share {
    padding: 16px 0 8px;
}
.standings-share .btn-wa {
    flex: none;
    width: 100%;
}

/* ===== BRACKET ===== */
.bracket {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    align-items: flex-start;
}
.bracket-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 130px;
    flex-shrink: 0;
}
.bracket-col-title {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    text-align: center;
    padding: 4px 0 6px;
}
.bracket-match {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.bracket-match.played { border-color: var(--green); }
.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    gap: 6px;
}
.bracket-team:last-child { border-bottom: none; }
.bracket-team.winner {
    font-weight: 800;
    color: var(--green);
    background: rgba(34,197,94,0.07);
}
[data-theme="dark"] .bracket-team.winner { background: rgba(34,197,94,0.12); }
.bracket-team-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bracket-score {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-2);
    flex-shrink: 0;
}
.bracket-team.winner .bracket-score { color: var(--green); }

/* ===== PÁDEL PAREJAS ===== */
.pairs-hint {
    font-size: 0.75rem;
    color: var(--text-3);
    text-align: center;
    margin: 0 0 16px;
}
.pairs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 100px;
}
.pair-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
}
.pair-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.pair-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
}
.pair-sides { font-size: 0.7rem; color: var(--text-3); }
.pair-rename-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.6;
}
.pair-rename-btn:active { opacity: 1; }
.pp-lado {
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 1px 4px;
    margin-right: 3px;
    vertical-align: middle;
}
.pair-players {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pair-player {
    flex: 1;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-1);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 44px;
}
.pair-player.selected {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
}
.pair-player.swap-target {
    border-color: #f59e0b;
    border-style: dashed;
}
.pair-slash {
    font-weight: 700;
    color: var(--text-3);
    font-size: 1rem;
    flex-shrink: 0;
}
.pair-odd {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-3);
    padding: 8px;
}
.pair-swap-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 600;
    padding: 8px 0;
    animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* ===== MULTICOURT ===== */
.court-group {
    margin-bottom: 18px;
}
.court-group-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    padding: 0 0 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.court-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
    margin-bottom: 4px;
    letter-spacing: 0.4px;
    text-transform: none;
}
.match-card-court {
    padding-top: 6px;
}

/* ===== HISTORIAL ===== */
.history-section {
    margin-bottom: 20px;
}
.history-round-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    padding: 0 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.history-match {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}
.history-match.played { border-color: var(--green); }
.history-team {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-team.right { text-align: right; }
.history-score {
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
    color: var(--text-2);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}
.history-match.played .history-score { color: var(--text); }

/* ===== TEAM NAME EDIT IN TOURNAMENT ===== */
.tname-edit {
    cursor: pointer;
    border-bottom: 1px dashed var(--text-3);
}
.tname-edit:hover { color: var(--text); }

/* ===== STANDINGS SCROLL ===== */
.standings-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 320px) {
    .teams-grid { grid-template-columns: 1fr; }
    .home-options { flex-direction: column; }
}

/* ===== LIVE MATCH OVERLAY ===== */
.lm-overlay {
    position: fixed; inset: 0; z-index: 600;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: flex-end;
    padding: 0;
}
.lm-overlay.hidden { display: none; }
.lm-card {
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    animation: slideUp 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.lm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.lm-sport-label { font-size: 0.8rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.lm-close { background: none; border: none; font-size: 1.4rem; color: var(--text-3); cursor: pointer; padding: 4px; }
.lm-timer-wrap { text-align: center; margin-bottom: 24px; }
.lm-timer { font-size: 3.5rem; font-weight: 900; letter-spacing: -2px; color: var(--text); font-variant-numeric: tabular-nums; }
.lm-timer-btns { display: flex; gap: 10px; margin-top: 12px; }
.lm-btn-pause {
    flex: 1; padding: 12px; border: 2px solid var(--border); background: var(--surface);
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 700; font-family: inherit;
    cursor: pointer; color: var(--text); transition: var(--transition);
}
.lm-btn-pause:active { background: var(--accent-soft); }
.lm-btn-finish {
    flex: 1; padding: 12px; border: none; background: var(--green);
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 700; font-family: inherit;
    cursor: pointer; color: white; transition: var(--transition);
}
.lm-btn-finish:active { opacity: 0.85; }
.lm-scoreboard { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.lm-team-col { flex: 1; text-align: center; }
.lm-team-name { font-size: 0.82rem; font-weight: 700; margin-bottom: 10px; }
.lm-score-ctrl { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lm-score { font-size: 2.8rem; font-weight: 900; min-width: 48px; font-variant-numeric: tabular-nums; }
.lm-adj {
    width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--border);
    background: var(--surface); font-size: 1.5rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--text);
    transition: background 0.1s, transform 0.1s;
}
.lm-adj:active { transform: scale(0.88); background: var(--accent-soft); }
.lm-sep { font-size: 2rem; font-weight: 900; color: var(--text-3); }
.lm-elapsed-label { text-align: center; font-size: 0.8rem; color: var(--green); font-weight: 600; min-height: 20px; }
.btn-live-match {
    margin-top: 8px; width: 100%; padding: 10px; background: var(--accent-soft);
    color: var(--text); border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.82rem; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: background var(--transition);
}
.btn-live-match:active { background: var(--border); }

/* ===== SCORING MODE ROW (wraps when needed) ===== */
.toggle-row.mode-row {
    flex-wrap: wrap;
}
.toggle-row.mode-row .toggle-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    padding: 10px 6px;
    font-size: 0.85rem;
}

/* ===== CHECKBOX ROW (super tiebreak) ===== */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--text);
    cursor: pointer;
    margin: 0;
}

/* ===== SETS-BASED MATCH SCORE INPUT ===== */
.match-score-sets {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    align-items: center;
}
.set-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    width: 100%;
}
.set-row.multi {
    padding: 6px 10px;
    background: var(--accent-soft);
    border-radius: 10px;
}
.set-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-3);
    min-width: 42px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.set-row .score-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.set-row input {
    width: 48px;
    height: 42px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: inherit;
    outline: none;
    background: var(--surface);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}
.set-row input::-webkit-outer-spin-button,
.set-row input::-webkit-inner-spin-button { -webkit-appearance: none; }
.set-row input:focus { border-color: var(--text); }
.set-row .score-adj {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.set-row .score-adj:active { background: var(--accent-soft); transform: scale(0.9); }

/* ===== PRESETS ===== */
.preset-card .preset-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.preset-empty {
    font-size: 0.78rem;
    color: var(--text-3);
    text-align: center;
    padding: 10px 0;
    font-style: italic;
}
.preset-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 36px 10px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.preset-item:hover { border-color: var(--text-3); }
.preset-item:active { background: var(--accent-soft); }
.preset-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-1);
}
.preset-info {
    font-size: 0.72rem;
    color: var(--text-3);
}
.preset-del {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.preset-del:hover { background: var(--border); color: var(--text-1); }
.preset-save {
    width: 100%;
    padding: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px;
}

/* ===== CALCULADORA DE GASTOS ===== */
/* ========== UPDATE BANNER ========== */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: linear-gradient(135deg, #16a34a, #0891b2);
    color: #fff;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    animation: updateSlideDown 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.update-banner.hidden { display: none; }
@keyframes updateSlideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
.update-banner-inner {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
}
.update-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.update-banner-text strong {
    font-size: 0.9rem;
    font-weight: 800;
}
.update-banner-text span {
    font-size: 0.75rem;
    opacity: 0.92;
}
.update-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.update-banner-btn-ghost {
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    cursor: pointer;
}
.update-banner-btn-main {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #16a34a;
    background: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.update-banner-btn-main:hover { transform: translateY(-1px); }

/* ========== FAB CALCULADORA ========== */
.calc-fab {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #0891b2);
    color: #fff;
    border: none;
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.4), 0 4px 12px rgba(8, 145, 178, 0.3);
    font-size: 1.75rem;
    cursor: pointer;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.calc-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(22, 163, 74, 0.5), 0 6px 14px rgba(8, 145, 178, 0.35); }
.calc-fab:active { transform: scale(0.92); }
.calc-fab-icon {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
    line-height: 1;
}
/* Ocultar el FAB mientras se muestra el splash o cuando hay modales arriba */
body.splash-active .calc-fab { display: none; }
.calc-fab.hidden { display: none; }

.calc-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: calcFadeIn 0.25s ease;
}
.calc-overlay.hidden { display: none; }
@keyframes calcFadeIn {
    from { background: rgba(0,0,0,0); }
    to { background: rgba(0,0,0,0.55); }
}
.calc-modal {
    background: var(--surface);
    width: 100%;
    max-width: 460px;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    animation: calcSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}
@keyframes calcSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.calc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.calc-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}
.calc-close {
    background: var(--accent-soft);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calc-close:active { transform: scale(0.9); }

.calc-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px;
    -webkit-overflow-scrolling: touch;
}
.calc-section {
    margin-bottom: 20px;
}
.calc-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.calc-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
}
.calc-total-badge {
    background: linear-gradient(135deg, #16a34a, #0891b2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}
.calc-import-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}
.calc-import-btn:hover { border-color: var(--text); color: var(--text); }
.calc-import-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.calc-expenses-list, .calc-people-list, .calc-result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.calc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 46px;
}
.calc-row .calc-row-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    border: none;
    background: transparent;
    font-family: inherit;
    padding: 0;
    outline: none;
}
.calc-row .calc-row-amount {
    width: 90px;
    text-align: right;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
    border: none;
    background: transparent;
    font-family: inherit;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
}
.calc-row .calc-row-amount::-webkit-outer-spin-button,
.calc-row .calc-row-amount::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-row-weight {
    width: 60px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-family: inherit;
    padding: 4px 0;
    outline: none;
    -moz-appearance: textfield;
}
.calc-row-weight:focus { border-color: var(--text); }
.calc-row-weight::-webkit-outer-spin-button,
.calc-row-weight::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-row .calc-row-del {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.calc-row .calc-row-del:hover { color: #dc2626; }
.calc-empty {
    font-size: 0.78rem;
    color: var(--text-3);
    text-align: center;
    padding: 14px 0;
    font-style: italic;
}

.calc-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.calc-add-row input[type="text"],
.calc-add-row input[type="number"] {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    outline: none;
    min-width: 0;
}
.calc-add-row input:focus { border-color: var(--text); }
.calc-add-row input[type="number"] {
    max-width: 100px;
    -moz-appearance: textfield;
}
.calc-add-row input[type="number"]::-webkit-outer-spin-button,
.calc-add-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-add-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--text);
    color: var(--surface);
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.calc-add-btn:active { transform: scale(0.92); }

.calc-mode-row {
    display: flex;
    gap: 10px;
}
.calc-mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}
.calc-mode-btn strong {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
}
.calc-mode-btn span {
    font-size: 0.72rem;
    color: var(--text-3);
}
.calc-mode-btn.active {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.06);
}

.calc-result-section {
    background: var(--accent-soft);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 0;
}
.calc-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}
.calc-result-row:last-child { border-bottom: none; }
.calc-result-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.calc-result-amount {
    font-size: 1rem;
    font-weight: 800;
    color: #16a34a;
}
.calc-result-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 2px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.calc-result-total span:last-child { color: var(--text); }

/* Persona row con chips */
.calc-person-row {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
}
.calc-person-row .calc-person-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
}
.calc-person-row.with-chips .calc-person-head {
    padding-bottom: 8px;
}
.calc-person-row .calc-row-name {
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
}
.calc-share-chips {
    display: flex;
    gap: 6px;
    padding: 0 10px 12px;
}
.calc-chip {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-2);
    background: var(--accent-soft);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.calc-chip:hover { border-color: var(--text-3); }
.calc-chip.active {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.calc-chip.active.skip {
    background: #dc2626;
    border-color: #dc2626;
}

/* Alias / CBU para transferir */
.calc-alias-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--accent-soft);
    border: 2px solid var(--border);
    border-radius: 14px;
}
.calc-alias-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease;
}
.calc-alias-input:focus {
    border-color: #16a34a;
}
.calc-alias-input::placeholder {
    color: var(--text-3);
    font-weight: 500;
}
.calc-alias-hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-3);
    line-height: 1.4;
}

.calc-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.calc-footer button {
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
}

/* =====================================================
   REVEAL ANIMATION (team cards staggered)
===================================================== */
@keyframes teamReveal {
    0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.team-card.reveal {
    opacity: 0;
    animation: teamReveal 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@media (prefers-reduced-motion: reduce) {
    .team-card.reveal { animation: none; opacity: 1; }
}

/* =====================================================
   HOME: Repeat last config chip
===================================================== */
.repeat-last-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px auto 0;
    padding: 10px 16px;
    background: var(--accent-soft);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.repeat-last-chip:hover { border-color: var(--text); }
.repeat-last-chip:active { transform: scale(0.96); }
.repeat-last-chip.hidden { display: none; }

/* =====================================================
   PLAYERS: "Agregar desde libreta" button
===================================================== */
.roster-pick-btn {
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 10px;
    background: transparent;
    border: 1.5px dashed var(--border);
    border-radius: 12px;
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.roster-pick-btn:hover { border-color: var(--text); color: var(--text); }
.roster-pick-btn:active { transform: scale(0.98); }

/* =====================================================
   OVERLAYS (settings / info / roster / ranking)
   Shared base behavior via compound selector
===================================================== */
.settings-overlay,
.info-overlay,
.roster-overlay,
.ranking-overlay,
.roster-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: overlayFade 0.2s ease;
}
.settings-overlay.hidden,
.info-overlay.hidden,
.roster-overlay.hidden,
.ranking-overlay.hidden,
.roster-picker-overlay.hidden { display: none; }
@keyframes overlayFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes sheetSlide {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
.settings-modal,
.info-modal,
.roster-modal,
.ranking-modal,
.roster-picker-modal {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: sheetSlide 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
}
@media (min-width: 640px) {
    .settings-overlay,
    .info-overlay,
    .roster-overlay,
    .ranking-overlay,
    .roster-picker-overlay { align-items: center; }
    .settings-modal,
    .info-modal,
    .roster-modal,
    .ranking-modal,
    .roster-picker-modal {
        border-radius: 20px;
        max-height: 82vh;
        animation: modalPop 0.22s ease;
    }
}
.settings-header,
.info-header,
.roster-header,
.ranking-header,
.roster-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.settings-header h2,
.info-header h2,
.roster-header h2,
.ranking-header h2,
.roster-picker-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.settings-close,
.info-close,
.roster-close,
.ranking-close,
.roster-picker-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: var(--text-2);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.settings-body,
.info-body,
.roster-body,
.ranking-body,
.roster-picker-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}
.info-body h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 14px 0 6px;
    color: var(--text);
}
.info-body p { margin: 0 0 10px; color: var(--text-2); }
.info-body ul { margin: 0 0 12px 18px; color: var(--text-2); }
.info-body li { margin-bottom: 4px; }
.info-body strong { color: var(--text); }

/* =====================================================
   SETTINGS items
===================================================== */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}
.settings-item:last-child { border-bottom: none; }
.settings-item.clickable { cursor: pointer; }
.settings-item.clickable:active { background: var(--accent-soft); }
.settings-item-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.settings-item-icon { font-size: 1.1rem; flex-shrink: 0; }
.settings-item-arrow { color: var(--text-3); font-size: 1.2rem; font-weight: 400; }
.settings-item-count {
    background: var(--accent-soft);
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}
.settings-item-version {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
}
/* Toggle switch */
.settings-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
    display: inline-block;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 0.2s ease;
}
.settings-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.settings-toggle input:checked + .settings-toggle-slider { background: var(--text); }
.settings-toggle input:checked + .settings-toggle-slider::before { transform: translateX(18px); }

/* =====================================================
   CHANGELOG version block
===================================================== */
.changelog-version {
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--accent-soft);
    border-radius: 12px;
    border-left: 3px solid var(--text);
}
.changelog-version h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    margin: 0 0 8px;
    color: var(--text);
}
.changelog-date {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-3);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 999px;
}
.changelog-version ul { margin: 0 0 0 18px; }
.changelog-version li { font-size: 0.82rem; color: var(--text-2); margin-bottom: 3px; }

/* =====================================================
   ROSTER manager + picker
===================================================== */
.roster-empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-3);
    font-size: 0.85rem;
}
.roster-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.roster-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border-radius: 10px;
}
.roster-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.roster-item-info strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.roster-item-info small {
    font-size: 0.7rem;
    color: var(--text-3);
}
.roster-item-del {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
}
.roster-item-del:hover { color: #dc2626; }
.roster-clear-btn {
    margin-top: 14px;
    padding: 10px;
    width: 100%;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.roster-pick-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.roster-pick-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.roster-pick-item span {
    flex: 1;
    color: var(--text);
    font-size: 0.88rem;
}
.roster-pick-item strong { font-weight: 600; }
.roster-pick-item em {
    font-style: normal;
    color: var(--text-3);
    font-size: 0.75rem;
    margin-left: 6px;
}
.roster-picker-foot {
    display: flex;
    gap: 10px;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.roster-picker-foot button {
    flex: 1;
    padding: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
}

/* =====================================================
   RANKING + ROSTER hints
===================================================== */
.ranking-hint,
.roster-hint {
    font-size: 0.78rem;
    color: var(--text-3);
    margin: 0 0 14px;
    line-height: 1.5;
}
.ranking-empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-3);
    font-size: 0.85rem;
}
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ranking-row {
    display: grid;
    grid-template-columns: 32px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border-radius: 10px;
}
.ranking-row.top1 { background: linear-gradient(90deg, #fef3c7, var(--accent-soft)); }
.ranking-row.top2 { background: linear-gradient(90deg, #e5e7eb, var(--accent-soft)); }
.ranking-row.top3 { background: linear-gradient(90deg, #fde6d0, var(--accent-soft)); }
[data-theme="dark"] .ranking-row.top1 { background: linear-gradient(90deg, #3d2f0c, var(--accent-soft)); }
[data-theme="dark"] .ranking-row.top2 { background: linear-gradient(90deg, #2a2a2d, var(--accent-soft)); }
[data-theme="dark"] .ranking-row.top3 { background: linear-gradient(90deg, #3a2410, var(--accent-soft)); }
.ranking-pos {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    text-align: center;
}
.ranking-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ranking-stats {
    font-size: 0.72rem;
    color: var(--text-3);
    text-align: right;
    line-height: 1.3;
}
.ranking-wins {
    background: var(--text);
    color: var(--bg);
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

/* =====================================================
   ONBOARDING (first-time modal)
===================================================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: overlayFade 0.3s ease;
}
.onboarding-modal {
    width: 100%;
    max-width: 340px;
    background: var(--surface);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    animation: modalPop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.onboarding-emoji {
    font-size: 3rem;
    margin-bottom: 10px;
}
.onboarding-modal h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 14px;
}
.onboarding-modal p {
    font-size: 0.88rem;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 10px;
}
.onboarding-modal ul,
.onboarding-steps {
    list-style: none;
    text-align: left;
    margin: 14px 0 14px;
    padding: 0;
    color: var(--text-2);
    font-size: 0.85rem;
}
.onboarding-modal li,
.onboarding-steps li {
    margin-bottom: 6px;
    padding: 6px 10px;
    background: var(--accent-soft);
    border-radius: 8px;
}
.onboarding-steps li strong { color: var(--text); margin-right: 6px; }
.onboarding-tip {
    font-size: 0.78rem !important;
    color: var(--text-3) !important;
    background: var(--accent-soft);
    padding: 10px 12px;
    border-radius: 10px;
    margin: 12px 0 !important;
    text-align: left;
}
.onboarding-modal button {
    width: 100%;
    padding: 14px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
}

/* =====================================================
   SHARED VIEW (incoming ?r= URL)
===================================================== */
.shared-view-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.shared-view-modal {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 18px;
    padding: 20px 18px;
    max-height: 92vh;
    overflow-y: auto;
    animation: modalPop 0.3s ease;
}
.shared-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}
.shared-team {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    color: #fff;
}
.shared-team h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.shared-team ol {
    margin-left: 20px;
    font-size: 0.82rem;
    line-height: 1.5;
}
.shared-sup {
    background: var(--accent-soft) !important;
    color: var(--text) !important;
    border: 1px dashed var(--border);
}
.shared-close-btn {
    width: 100%;
    margin-top: 12px;
}

/* =====================================================
   QR modal contents
===================================================== */
.qr-wrap {
    text-align: center;
    padding: 4px 0;
}
.qr-img {
    display: block;
    margin: 6px auto 12px;
    width: 240px;
    height: 240px;
    max-width: 80vw;
    max-height: 80vw;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    border: 1px solid var(--border);
}
.qr-hint {
    font-size: 0.82rem;
    color: var(--text-2);
    margin: 0 0 6px;
}
.qr-url {
    font-size: 0.7rem;
    color: var(--text-3);
    word-break: break-all;
    margin: 0 0 12px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
.qr-copy-btn {
    padding: 10px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

/* Hide share-img and qr button while in swap mode */
.swap-mode-active .btn-share-qr { display: none !important; }
