* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-primary: #0a0a0f; --bg-secondary: #12121a; --bg-tertiary: #1a1a25; --bg-card: #151520;
    --accent-primary: #6366f1; --accent-secondary: #8b5cf6; --accent-success: #10b981;
    --accent-danger: #ef4444; --accent-warning: #f59e0b; --text-primary: #f8fafc;
    --text-secondary: #94a3b8; --text-muted: #64748b; --border: #27273a;
    --accent-gold: #ffd700; --accent-gold-dark: #b8860b; --accent-gold-light: #fff8a8;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
header {
    padding: 10px 0 14px; margin-bottom: 0; position: relative;
}
.header-banners { margin-top: 10px; }
.auth-area-standalone { display: flex; flex-direction: column; align-items: flex-end; margin-bottom: 8px; }
.header-bar {
    display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px 16px;
}
/* Override playgroup-area when used as header-bar: left=campaign, right=user */
.header-bar.playgroup-area {
    flex-direction: row; align-items: center; justify-content: space-between;
}
.header-left {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.header-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; flex-shrink: 0;
}
.campaign-wrap { display: flex; align-items: center; gap: 6px; }
.campaign-wrap .playgroup-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.campaign-select-compact {
    min-width: 140px; padding: 6px 10px; font-size: 0.8rem; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); cursor: pointer;
}
.campaign-select-compact:focus { outline: none; border-color: var(--accent-primary); }
.header-actions-inline { display: flex; align-items: center; gap: 4px; }
.btn-compact {
    padding: 5px 10px; font-size: 0.72rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: all 0.2s;
    background: var(--bg-card); border: 1px solid var(--border);
}
.btn-compact.invite-playgroup { color: var(--accent-primary); }
.btn-compact.invite-playgroup:hover { border-color: var(--accent-primary); background: var(--bg-secondary); }
.btn-compact.create-playgroup { color: var(--accent-success); }
.btn-compact.create-playgroup:hover { border-color: var(--accent-success); background: var(--bg-secondary); }
.btn-compact.leave-playgroup { color: var(--accent-danger); }
.btn-compact.leave-playgroup:hover { border-color: var(--accent-danger); background: var(--bg-secondary); }
.pills-inline {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0;
}
.pills-inline.plan-summary { gap: 0 8px; }
.pill-with-desc {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.pill-desc {
    font-size: 0.58rem; font-weight: 400; color: var(--text-muted); line-height: 1.2; white-space: nowrap; opacity: 0.85;
}
.pills-inline .plan-pill { padding: 2px 6px; font-size: 0.7rem; }
.auth-inline { display: flex; align-items: center; gap: 0; }
.auth-inline .auth-email { max-width: 160px; font-size: 0.78rem; }
.btn-logout-compact {
    padding: 2px 6px; font-size: 0.72rem; font-weight: 600; border-radius: 6px;
    border: 1px solid var(--text-muted); background: transparent; color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.btn-logout-compact:hover { border-color: var(--accent-danger); color: var(--accent-danger); }
.header-summary-wrap { margin-top: 6px; }
.header-summary-wrap .playgroup-meeples-row {
    margin-top: 0; font-size: 0.72rem; color: var(--text-muted); line-height: 1.5;
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
}
.header-summary-wrap .playgroup-meeples-line1,
.header-summary-wrap .playgroup-meeples-line2 { margin-top: 0; }
.gold-divider {
    height: 2px; margin: 44px 5% 44px; flex-shrink: 0;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}
.header-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px; }
.header-row > div:first-child { text-align: left; flex: 1; min-width: 0; }
.header-actions { display: flex; flex-wrap: wrap; flex-direction: column; align-items: flex-end; gap: 12px; }
.auth-area { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.auth-user { display: flex; align-items: center; gap: 12px; }
.auth-email { font-size: 0.85rem; color: var(--text-secondary); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-auth {
    padding: 10px 18px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-primary);
    transition: all 0.2s ease;
}
.btn-auth.login { border-color: var(--accent-primary); color: var(--accent-primary); background: rgba(99, 102, 241, 0.1); }
.btn-auth.login:hover { background: var(--accent-primary); color: white; }
/* Google Sign-In white variant — high contrast on dark background */
.btn-auth.btn-google-black {
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    background: #fff; color: #1f2937; border: 1px solid rgba(0,0,0,0.12); padding: 10px 20px; font-weight: 700;
}
.btn-auth.btn-google-black:hover { background: #f3f4f6; color: #1f2937; border-color: rgba(0,0,0,0.2); }
.btn-auth.btn-google-black .google-g { flex-shrink: 0; }
.btn-auth.logout { border-color: var(--text-muted); color: var(--text-secondary); }
.btn-auth.logout:hover { border-color: var(--accent-danger); color: var(--accent-danger); background: rgba(239, 68, 68, 0.1); }
.btn-auth.invite-playgroup { border-color: var(--accent-primary); color: var(--accent-primary); background: rgba(99, 102, 241, 0.1); }
.btn-auth.invite-playgroup:hover { background: var(--accent-primary); color: white; }
.btn-auth.create-playgroup { border-color: var(--accent-success); color: var(--accent-success); background: rgba(16, 185, 129, 0.1); }
.btn-auth.create-playgroup:hover { background: var(--accent-success); color: white; }
.btn-auth.leave-playgroup { border-color: var(--accent-danger); color: var(--accent-danger); background: rgba(239, 68, 68, 0.08); }
.btn-auth.leave-playgroup:hover { background: var(--accent-danger); color: white; }
/* Compact buttons: unified dark background, light border, colored text only (no tinted fills) */
.btn-compact.invite-playgroup,
.btn-compact.create-playgroup,
.btn-compact.leave-playgroup {
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.btn-compact.invite-playgroup:hover,
.btn-compact.create-playgroup:hover,
.btn-compact.leave-playgroup:hover {
    background: var(--bg-secondary);
}
.invite-modal { max-width: 480px; }
.playgroup-area:not(.header-bar) { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.playgroup-select-row { display: flex; align-items: center; gap: 10px; }
.playgroup-meta-row { align-self: flex-end; font-size: 0.8rem; color: var(--text-muted); margin-top: -2px; }
.plan-summary {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px;
}
.plan-pill {
    display: inline-flex; align-items: center; padding: 4px 12px;
    font-size: 0.78rem; font-weight: 500; border-radius: 999px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
    color: var(--text-secondary); white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}
.plan-pill-tier { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.35); color: var(--accent-secondary); }
.plan-pill-tier.plan-pill-tier-royal { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: var(--accent-gold); }
.plan-pill-campaigns { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.3); color: var(--accent-primary); }
.plan-pill-party-permit { background: rgba(99, 102, 241, 0.08); border-color: rgba(99, 102, 241, 0.25); color: var(--text-secondary); }
/* Tier-based pill colors (follow user class) */
.plan-summary-tier-commoner .plan-pill-tier,
.plan-summary-tier-commoner .plan-pill-campaigns,
.plan-summary-tier-commoner .plan-pill-party-permit {
    background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.35); color: var(--text-secondary);
}
.plan-summary-tier-noble .plan-pill-tier,
.plan-summary-tier-noble .plan-pill-campaigns,
.plan-summary-tier-noble .plan-pill-party-permit {
    background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.4); color: var(--accent-secondary);
}
.plan-summary-tier-royal .plan-pill-tier,
.plan-summary-tier-royal .plan-pill-campaigns,
.plan-summary-tier-royal .plan-pill-party-permit {
    background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: var(--accent-gold);
}
.playgroup-meeples-row {
    font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; line-height: 1.6;
}
.playgroup-meeples-line1 {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.playgroup-meeples-line2 {
    margin-top: 4px;
}
.playgroup-change-btn {
    display: inline-flex; align-items: center; padding: 2px 8px;
    font-size: 0.72rem; font-weight: 600; border-radius: 6px;
    background: rgba(148, 163, 184, 0.15); border: 1px solid rgba(148, 163, 184, 0.5);
    color: var(--text-secondary); cursor: pointer; white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.playgroup-change-btn:hover {
    background: rgba(148, 163, 184, 0.25); color: var(--text-primary); border-color: rgba(148, 163, 184, 0.7);
}
.playgroup-actions-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.playgroup-actions-row .btn-auth { font-size: 0.73rem; }
.playgroup-label { font-size: 0.85rem; color: var(--text-secondary); }
.playgroup-count { font-size: 0.8rem; color: inherit; margin-left: 0; }
.playgroup-select {
    min-width: 180px; padding: 10px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary);
    font-size: 0.9rem; cursor: pointer;
}
.playgroup-select:focus { outline: none; border-color: var(--accent-primary); }
/* Logo — victory, royalty, grand ambitions */
.logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-header-group {
    position: relative;
    padding: 10px 14px;
    border-radius: 16px;
}
.beta-badge {
    font-size: 0.58rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
    background: rgba(245, 158, 11, 0.14); color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.45);
    padding: 3px 8px; border-radius: 20px;
    user-select: none; white-space: nowrap; flex-shrink: 0;
    position: relative;
    top: -6px;
}

h1.logo {
    font-family: 'Cinzel Decorative', serif; font-size: 2.4rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: 4px; margin-bottom: 12px;
    background: linear-gradient(90deg, var(--accent-gold-dark), var(--accent-gold), var(--accent-gold-light), var(--accent-gold), var(--accent-gold-dark));
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: goldShimmer 4s linear infinite;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.35));
}
h1.logo .logo-img {
    display: block; width: 250px; max-width: 100%; height: auto; vertical-align: middle;
    -webkit-background-clip: unset; background-clip: unset; -webkit-text-fill-color: unset; background: none;
    animation: none; filter: none;
}
@keyframes goldShimmer { to { background-position: 200% center; } }

.subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #a8b4c4; font-size: 0.8rem; font-weight: 400;
}
/* Page header tagline: neon purple-blue, 30% smaller */
header .subtitle {
    font-size: 0.56rem;
    background: linear-gradient(90deg, #06b6d4, #8b5cf6, #3b82f6, #a78bfa);
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: aboutNeonShimmer 5s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5)) drop-shadow(0 0 16px rgba(6, 182, 212, 0.35));
}
.subtitle .strikethrough { text-decoration: line-through; text-decoration-color: var(--accent-danger); text-decoration-thickness: 2px; }
.nav-tabs {
    display: flex; gap: 10px; margin-bottom: 5px; background: var(--bg-secondary);
    padding: 6px; border-radius: 12px; border: 1px solid var(--border);
}
.nav-tab {
    flex: 1; padding: 12px 20px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; border-radius: 8px; transition: all 0.3s ease;
}
.nav-tab.active { background: var(--accent-primary); color: white; }
.nav-tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-tertiary); }
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Player Cards Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

/* Celebration pills — at base of leaderboard, before gold divider */
.celebration-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 28px;
}
.celebration-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.15));
}
.celebration-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}
.celebration-pill:active {
    transform: scale(0.98);
}

/* Screen shake (tremor) — applied to body by JS */
body.screen-shake {
    animation: screenShake 0.15s ease-in-out infinite;
}
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-3px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(3px, 1px); }
}
.players-grid .player-card:first-child {
    grid-column: 1 / -1;
    max-width: 460px;
    margin: 0 auto;
    position: relative;
    overflow: visible;
}
.players-grid .player-card:first-child::after {
    content: ''; position: absolute; inset: -4px; border-radius: 14px; pointer-events: none;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.3), 0 0 48px rgba(255, 215, 0, 0.15);
    animation: top-player-shimmer 2.5s ease-in-out infinite;
    z-index: -1;
}
@keyframes top-player-shimmer {
    0%, 100% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.3), 0 0 48px rgba(255, 215, 0, 0.15); opacity: 1; }
    50% { box-shadow: 0 0 36px rgba(255, 215, 0, 0.5), 0 0 72px rgba(255, 215, 0, 0.25); opacity: 0.9; }
}
/* Champion card: always golden tile for #1 (overrides custom player color) */
.players-grid .player-card:first-child {
    border: 2px solid rgba(255, 215, 0, 0.5) !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(184, 134, 11, 0.12), rgba(255, 248, 168, 0.08)) !important;
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.2) !important;
}
.players-grid .player-card:first-child:hover {
    border-color: rgba(255, 215, 0, 0.7) !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.26), rgba(184, 134, 11, 0.16), rgba(255, 248, 168, 0.1)) !important;
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.25) !important;
}
.players-grid .player-card:first-child::before {
    background: linear-gradient(180deg, var(--accent-gold), var(--accent-gold-dark)) !important;
    display: block !important;
}
.players-grid .player-card:first-child .victory-roster-wins {
    color: var(--accent-gold);
    font-size: 1.25rem;
}
.players-grid .player-card:first-child .player-crown {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    z-index: 10;
}
.player-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px 20px; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.player-card:hover { border-color: var(--accent-primary); background: var(--bg-secondary); }
.player-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0; transition: opacity 0.3s ease;
}
.player-card:hover::before { opacity: 1; }
.player-card.has-player-color {
    border: 2px solid var(--player-card-color);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--player-card-color) 45%, transparent),
        0 10px 30px color-mix(in srgb, var(--player-card-color) 22%, transparent);
}
.player-card.has-player-color::before {
    display: none;
}
/* Linked account — "You" badge indicates the player; no extra card styling */
.player-you-badge {
    display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 8px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    color: #0a0a0f; border-radius: 10px;
}
.player-card.has-player-color:hover {
    border-color: var(--player-card-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--player-card-color) 60%, transparent),
        0 14px 34px color-mix(in srgb, var(--player-card-color) 30%, transparent);
    transform: translateY(-2px);
}
/* Soft gradient: dark → player colour at end of card (from 4/5 mark), slight diagonal */
.player-card.has-player-color:not(:first-child)::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(135deg,
        transparent 0%,
        transparent 75%,
        color-mix(in srgb, var(--player-card-color) 18%, transparent) 90%,
        color-mix(in srgb, var(--player-card-color) 35%, transparent) 100%);
    z-index: 0;
}
.player-card > * { position: relative; z-index: 1; }
.player-card-image-container {
    position: relative;
    display: inline-block;
}
.player-card-image {
    width: 95px; height: 95px; border-radius: 50%; object-fit: cover;
    background: var(--bg-secondary); border: 2px solid var(--border); flex-shrink: 0;
}
.player-card-image-placeholder {
    width: 95px; height: 95px; border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}
.player-card-image,
.player-card-image-placeholder {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.player-card-image:hover,
.player-card-image-placeholder:hover {
    transform: translateY(-1px);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 55%, transparent);
}
.player-color-indicator {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
    margin-left: 8px; border: 2px solid var(--border);
}
.player-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.player-info-section { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.player-name-section { flex: 1; min-width: 0; }
.player-name { font-size: 1.43rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; }
.meeple-unclaimed-badge,
.meeple-traveller-badge {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.player-tier-pill {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.player-tier-commoner { background: rgba(148, 163, 184, 0.12); border: 1px solid rgba(148, 163, 184, 0.35); color: var(--text-secondary); }
.player-tier-noble { background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.4); color: var(--accent-secondary); }
.player-tier-royal { background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.4); color: var(--accent-gold); }
.player-tier-pill:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 0 0 1px rgba(148,163,184,0.5);
    filter: brightness(1.05);
}
.meeple-traveller-badge {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.meeple-traveller-badge:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 0 0 1px rgba(148,163,184,0.5);
    filter: brightness(1.05);
}
.campaign-creator-pill {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: var(--accent-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.campaign-edit-requirements-btn {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.campaign-edit-requirements-btn:hover {
    background: var(--accent-primary);
    color: white;
}
.campaign-settings-tier-checks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.campaign-settings-tier-checks label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}
.campaign-settings-tier-checks input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}
.player-card-quote {
    font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; font-style: italic;
    line-height: 1.3;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.player-card-quote.quote-just-updated {
    animation: quoteRollIn 0.3s ease;
}
@keyframes quoteRollIn {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.win-count-section { text-align: right; margin-right: 12px; }
.win-count { font-size: 1.5rem; font-weight: 700; color: var(--accent-success); }
.win-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.delete-player-btn, .edit-player-btn {
    background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); border: 1px solid var(--accent-danger);
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;
    opacity: 0; transform: translateX(10px);
}
.edit-player-btn { background: rgba(99, 102, 241, 0.1); color: var(--accent-primary); border-color: var(--accent-primary); }
.player-card:hover .delete-player-btn, .player-card:hover .edit-player-btn { opacity: 1; transform: translateX(0); }
.delete-player-btn:hover { background: var(--accent-danger); color: white; }
.edit-player-btn:hover { background: var(--accent-primary); color: white; }
@media (max-width: 640px) {
    .delete-player-btn, .edit-player-btn { opacity: 1; transform: translateX(0); width: 32px; height: 32px; }
    .players-grid { grid-template-columns: 1fr; }
    .players-grid .player-card:first-child { grid-column: 1; max-width: 100%; }
}

/* Victory Roster */
.victory-roster-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
    cursor: pointer; user-select: none; transition: opacity 0.2s ease;
}
.victory-roster-header:hover { opacity: 0.8; }
.victory-roster-wins {
    font-size: 0.95rem; font-weight: 700; color: var(--accent-success);
    text-align: left;
}
.players-grid .player-card:not(:first-child) .victory-roster-wins {
    color: var(--text-muted);
}
.victory-roster-title { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.victory-roster-toggle-group {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.75rem; color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 6px 12px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.victory-roster-header:hover .victory-roster-toggle-group {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}
.victory-roster-label { text-transform: none; font-weight: 600; }
.victory-roster-toggle { font-size: 0.75rem; color: inherit; transition: transform 0.3s ease; display: inline-block; width: 12px; text-align: center; }
.victory-roster-toggle.expanded { transform: rotate(180deg); }
.player-game-stats { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; opacity: 0; }
.player-game-stats.expanded { max-height: 500px; opacity: 1; }
.player-games-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.player-game-tag { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 4px 10px; font-size: 0.8rem; display: flex; align-items: center; gap: 4px; transition: all 0.2s ease; }
.player-game-tag:hover { border-color: var(--accent-primary); background: var(--bg-tertiary); }
.player-game-name { color: var(--text-secondary); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-game-count { background: var(--accent-primary); color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; min-width: 20px; text-align: center; }
.player-game-tag.top-game { border-color: var(--accent-success); background: rgba(16, 185, 129, 0.1); }
.player-game-tag.top-game .player-game-count { background: var(--accent-success); }
.no-games-msg { color: var(--text-muted); font-size: 0.9rem; font-style: italic; }

/* Games Grid - 2 COLUMN LAYOUT */
.games-section-header { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 20px; }
.games-section-title { font-size: 1.2rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
    align-items: stretch; /* ensure both columns fill full height/width */
}
@media (max-width: 640px) {
    .games-grid { grid-template-columns: 1fr; }
}
.game-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px 20px; display: flex; align-items: center; gap: 18px;
    transition: all 0.3s ease; position: relative; overflow: hidden;
}
.game-card:hover { border-color: var(--accent-secondary); background: var(--bg-secondary); transform: translateY(-2px); }
.game-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0; transition: opacity 0.3s ease;
}
.game-card:hover::before { opacity: 1; }
.game-card-image {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.game-card-image-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}
.game-card-info { flex: 1; min-width: 0; }
.game-card-info h3 { font-size: 1.1rem; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card-meta { color: var(--text-muted); font-size: 0.8rem; }
.game-card-stats { text-align: right; margin-right: 12px; }
.game-card-number { font-size: 1.5rem; font-weight: 700; color: var(--accent-primary); }
.game-card-number.win-count-highlight {
    animation: winCountHighlight 2s ease-out forwards;
}
@keyframes winCountHighlight {
    0% { color: #fbbf24; }
    100% { color: var(--accent-primary); }
}
.game-card-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.game-card-actions {
    display: flex;
    gap: 8px;
    opacity: 1;
    transform: none;
    transition: all 0.3s ease;
}
.edit-game-btn, .toggle-history-btn, .delete-game-btn {
    background: rgba(99, 102, 241, 0.1); color: var(--accent-primary); border: 1px solid var(--accent-primary);
    width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;
}
.edit-game-btn:hover { background: var(--accent-primary); color: white; }
.toggle-history-btn { 
    background: rgba(99, 102, 241, 0.1); 
    color: var(--accent-primary); 
    border-color: var(--accent-primary); 
}
.toggle-history-btn:hover, .toggle-history-btn.active { 
    background: var(--accent-primary); 
    color: white; 
}
.delete-game-btn { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); border-color: var(--accent-danger); }
.delete-game-btn:hover { background: var(--accent-danger); color: white; }
@media (max-width: 640px) {
    .game-card-actions { opacity: 1; transform: translateX(0); }
    .edit-game-btn, .toggle-history-btn, .delete-game-btn { width: 28px; height: 28px; font-size: 0.9rem; }
}

/* Game History Panel */
.game-history-panel {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    margin-top: 12px; overflow: hidden; max-height: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease; opacity: 0;
    grid-column: 1 / -1;
}
.game-history-panel.expanded { max-height: 400px; opacity: 1; }
.game-history-list { max-height: 350px; overflow-y: auto; padding: 12px; }
.game-history-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--bg-secondary); border-radius: 8px; margin-bottom: 8px; font-size: 0.9rem; }
.game-history-item:last-child { margin-bottom: 0; }
.game-history-winner { color: var(--accent-success); font-weight: 600; }
.game-history-date { color: var(--text-muted); font-size: 0.8rem; }

.games-toggle-btn {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
    padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
    transition: all 0.3s ease; display: flex; align-items: center; gap: 6px;
}
.games-toggle-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.games-toggle-icon { font-size: 0.8rem; transition: transform 0.3s ease; display: inline-block; width: 12px; text-align: center; }
.games-toggle-icon.expanded { transform: rotate(180deg); }

/* Data Management */
.data-management { background: var(--bg-card); border: 2px solid var(--border); border-radius: 16px; padding: 24px; margin-top: 40px; }
.data-management h2 { font-size: 1.2rem; margin-bottom: 4px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; }
.data-management-coming-soon { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 16px 0; font-style: italic; }
.data-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.data-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 20px;
    border: 2px solid var(--border); border-radius: 12px; background: var(--bg-secondary);
    color: var(--text-primary); font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; min-height: 56px;
}
.data-btn:hover { border-color: var(--accent-primary); background: var(--bg-tertiary); transform: translateY(-2px); }
.data-btn.export { border-color: var(--accent-success); color: var(--accent-success); background: rgba(16, 185, 129, 0.05); }
.data-btn.export:hover { background: rgba(16, 185, 129, 0.15); }
.data-btn.import { border-color: var(--accent-warning); color: var(--accent-warning); background: rgba(245, 158, 11, 0.05); }
.data-btn.import:hover { background: rgba(245, 158, 11, 0.15); }
.data-btn.clear { border-color: var(--accent-danger); color: var(--accent-danger); background: rgba(239, 68, 68, 0.05); }
.data-btn.clear:hover { background: rgba(239, 68, 68, 0.15); }
.data-btn.airtable { border-color: #18bfff; color: #18bfff; background: rgba(24, 191, 255, 0.05); }
.data-btn.airtable:hover { background: rgba(24, 191, 255, 0.15); }
#importFileInput { display: none; }

/* Read-only mode: hide edit/delete, disable Add Win and Tally Scores */
body.read-only .edit-player-btn, body.read-only .delete-player-btn,
body.read-only .edit-game-btn, body.read-only .delete-game-btn,
body.read-only .history-edit-btn, body.read-only .history-delete-btn { display: none !important; }
body.read-only .nav-tab[data-section="add"], body.read-only .nav-tab-tally { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
body.read-only .data-management .data-btn { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
body.read-only .add-new-btn { pointer-events: none; opacity: 0.5; }
.read-only-banner {
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
    color: var(--text-secondary); padding: 6px 12px; border-radius: 6px;
    margin-top: 8px; margin-bottom: 0; text-align: center; font-size: 0.78rem;
}
.read-only-banner .strikethrough {
    text-decoration: line-through;
    text-decoration-color: var(--accent-danger);
    text-decoration-thickness: 2px;
}
.read-only-banner.guest-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text-primary);
}
.share-leaderboard { background: rgba(245, 158, 11, 0.1); border-color: var(--accent-gold); color: var(--accent-gold); }
.share-leaderboard:hover { background: rgba(245, 158, 11, 0.22); }
.invite-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(99, 102, 241, 0.15));
    border: 2px solid var(--accent-success);
    color: var(--text-primary); padding: 24px 28px; border-radius: 14px;
    margin-bottom: 20px; text-align: center; font-size: 1rem; font-weight: 500;
}
.invite-banner-text { display: block; font-size: 1.15rem; margin-bottom: 6px; }
.invite-banner-sub { color: var(--text-secondary); font-size: 0.95rem; font-weight: 400; margin: 0 0 20px; }
.btn-accept-invite {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 28px; font-size: 1.05rem; font-weight: 600;
    background: var(--accent-success); color: white; border: none; border-radius: 12px;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-accept-invite:hover {
    background: #059669; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}
.btn-accept-invite:disabled {
    opacity: 0.7; cursor: not-allowed; transform: none;
}

/* Entry Flow */
.entry-flow { max-width: 600px; margin: 0 auto; }
#add .entry-flow { max-width: 1000px; }
.step { display: none; animation: slideIn 0.3s ease; }
.step.active { display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.step-header { text-align: center; margin-bottom: 30px; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--accent-primary); color: white; border-radius: 50%; font-weight: 700; margin-bottom: 12px; }
.step h2 { font-size: 1.3rem; margin-bottom: 8px; }
.step p { color: var(--text-secondary); font-size: 0.9rem; }

/* Game Selection Grid */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.selection-grid-add-game {
    grid-template-columns: repeat(7, 1fr);
}
@media (max-width: 1100px) {
    .selection-grid-add-game { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 800px) {
    .selection-grid-add-game { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
    .selection-grid-add-game { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 450px) {
    .selection-grid-add-game { grid-template-columns: repeat(2, 1fr); }
}
.selection-item {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: 12px;
    padding: 20px; cursor: pointer; transition: all 0.2s ease; text-align: center;
    user-select: none; min-height: 80px; display: flex; align-items: center; justify-content: center; font-weight: 500;
}
.selection-item:hover { border-color: var(--accent-primary); background: var(--bg-secondary); }
.selection-item.selected { border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.1); }
.add-new-btn {
    border-style: dashed; color: var(--text-secondary); grid-column: 1 / -1;
    order: -1; margin-bottom: 8px;
}
.selection-grid-add-game .add-new-btn {
    grid-column: auto; order: 0; margin-bottom: 0;
}
.add-new-btn:hover { border-color: var(--accent-success); color: var(--accent-success); background: rgba(16, 185, 129, 0.05); }

/* Meeple selection grid — 7 columns, dynamic/responsive, Add Meeple first */
.selection-grid-meeple {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: auto;
}
@media (max-width: 1100px) {
    .selection-grid-meeple { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .selection-grid-meeple { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .selection-grid-meeple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
    .selection-grid-meeple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.selection-grid-meeple .add-new-btn {
    grid-column: auto; order: -1; margin-bottom: 0;
}
/* Meeple card: image on top, name below */
.selection-item-meeple {
    flex-direction: column;
    padding: 12px;
    min-height: 100px;
}
.selection-item-meeple-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    max-width: 64px;
    margin: 0 auto 8px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
}
.selection-item-meeple-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.selection-item-meeple-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.selection-item-meeple-name {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.selection-winner-badge {
    display: inline-block;
    margin-left: 2px;
    font-size: 0.7rem;
}
.selection-item-meeple.is-winner {
    border-color: var(--accent-primary);
    background: rgba(99,102,241,0.08);
}
/* Tally meeple chips as cards — reuse meeple styling */
.tally-meeple-grid .tally-chip {
    border: 2px solid var(--border);
    background: var(--bg-card);
}
.tally-meeple-grid .tally-chip.selected {
    background: rgba(99,102,241,0.18);
    border-color: var(--accent-primary);
}
.tally-add-meeple-btn {
    cursor: pointer;
    font-family: inherit;
}
.tally-meeple-grid .tally-chip {
    font-family: inherit;
    text-align: center;
}

/* Edit Win Record modal: larger avatars and readable names */
.edit-entry-meeple-grid.selection-grid-meeple {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
}
.edit-entry-meeple-grid .selection-item-meeple {
    min-height: 110px;
}
.edit-entry-meeple-grid .selection-item-meeple-img-wrap {
    max-width: 56px;
    min-width: 48px;
}
.edit-entry-meeple-grid .selection-item-meeple-placeholder {
    font-size: 1.75rem;
}
.edit-entry-meeple-grid .selection-item-meeple-name {
    font-size: 0.9rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.selection-item-game {
    padding: 0; min-height: 0; aspect-ratio: 3 / 4; overflow: hidden;
}
.selection-item-game img.selection-item-game-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.selection-item-game .selection-item-game-fallback {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    padding: 12px; font-size: 0.85rem; font-weight: 500; word-break: break-word; text-align: center;
}
.selection-item-game { position: relative; }
.selection-item-game .selection-item-game-tooltip {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 0;
    font-size: clamp(0.55rem, 2vw, 0.8rem);
    font-weight: 500;
    color: white;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 0;
    white-space: normal;
    width: 100%;
    text-align: center;
    word-break: break-word;
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.selection-item-game:hover .selection-item-game-tooltip {
    opacity: 1;
}
.game-selection-area { width: 100%; }
.game-selection-other-wrap { margin-top: 20px; }
.game-selection-divider {
    height: 1px; background: var(--border); margin: 20px 0 16px; border: none;
}
.game-selection-other-title {
    font-size: 0.95rem; color: var(--text-secondary); margin: 0 0 12px;
}
.selection-item-show-all {
    border-style: dashed; color: var(--text-muted); font-size: 0.9rem;
}
.selection-item-show-all:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.input-field {
    width: 100%; padding: 16px; background: var(--bg-secondary); border: 2px solid var(--border);
    border-radius: 12px; color: var(--text-primary); font-size: 1rem; margin-bottom: 12px;
    transition: border-color 0.3s ease;
}
.input-field:focus { outline: none; border-color: var(--accent-primary); }
.date-input { font-family: inherit; }
.btn-group { display: flex; gap: 12px; margin-top: 24px; }
.btn { flex: 1; padding: 16px 24px; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: #5558e3; transform: translateY(-2px); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
.btn-success { background: var(--accent-success); color: white; }
.btn-success:hover { background: #059669; }

/* History Grid */
.history-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.history-title { font-size: 1.2rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 640px) {
    .history-grid { grid-template-columns: 1fr; }
}
.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.history-card:hover { border-color: var(--accent-secondary); background: var(--bg-secondary); transform: translateY(-2px); }
.history-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--accent-success), var(--accent-primary));
    opacity: 0; transition: opacity 0.3s ease;
}
.history-card:hover::before { opacity: 1; }
.history-card-info { flex: 1; min-width: 0; }
.history-card-game {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 12px;
}
.history-card-game-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.history-card-details { color: var(--text-secondary); font-size: 0.85rem; }
.history-card-actions {
    display: flex;
    gap: 6px;
    opacity: 1;
    transform: none;
    transition: all 0.3s ease;
}
.history-edit-btn, .history-delete-btn {
    width: 32px; height: 32px; border-radius: 6px; border: 1px solid;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem; transition: all 0.2s ease;
    background: rgba(99, 102, 241, 0.1); color: var(--accent-primary); border-color: var(--accent-primary);
}
.history-edit-btn:hover { background: var(--accent-primary); color: white; }
.history-delete-btn { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); border-color: var(--accent-danger); }
.history-delete-btn:hover { background: var(--accent-danger); color: white; }
@media (max-width: 640px) {
    .history-card-actions { opacity: 1; transform: translateX(0); }
}
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }

/* New Item Input */
.new-item-input { background: var(--bg-secondary); border: 2px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 12px; display: none; }
.new-item-input.active { display: block; animation: slideIn 0.3s ease; }

/* Focused add-game flow when launched from Tally Scores */
body.tally-add-game-mode #gameSelection {
    display: none;
}
body.tally-add-game-mode #step2,
body.tally-add-game-mode #step3 {
    display: none;
}

/* Image Upload */
.image-upload-section { margin-top: 16px; padding: 16px; background: var(--bg-tertiary); border-radius: 8px; border: 1px solid var(--border); }
.image-upload-label { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 0.9rem; }
.image-preview { width: 100px; height: 100px; border-radius: 8px; object-fit: cover; margin-top: 8px; border: 2px solid var(--border); display: none; }
.image-preview.active { display: block; }
.image-source-row { display: flex; align-items: center; gap: 10px; }
.image-source-row .file-input-wrapper { flex-shrink: 0; width: auto; min-width: 140px; }
.image-or-sep { flex-shrink: 0; color: var(--text-muted); font-size: 0.8rem; }
.image-url-input { flex: 1; margin: 0 !important; padding: 12px 14px !important; font-size: 0.88rem !important; }
.file-input-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; }
.file-input-wrapper input[type=file] { position: absolute; left: -9999px; }
.file-input-label { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: var(--bg-card); border: 2px dashed var(--border); border-radius: 8px; cursor: pointer; transition: all 0.3s ease; color: var(--text-secondary); white-space: nowrap; }
.file-input-label:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.btn-remove-image { background: none; border: none; color: var(--accent-danger); font-size: 0.9rem; cursor: pointer; padding: 4px 0; text-decoration: underline; }
.btn-remove-image:hover { color: #f87171; }

/* Preset avatar picker */
.preset-avatar-section { margin-top: 12px; }
.preset-avatar-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 10px; max-height: 180px; overflow-y: auto;
}
.preset-avatar-option {
    aspect-ratio: 1; border-radius: 8px; overflow: hidden;
    border: 2px solid var(--border); cursor: pointer; transition: border-color 0.2s, transform 0.2s;
    padding: 0; background: var(--bg-secondary);
}
.preset-avatar-option:hover { border-color: var(--accent-primary); transform: scale(1.05); }
.preset-avatar-option.selected { border-color: var(--accent-primary); box-shadow: 0 0 0 2px var(--accent-primary); }
.preset-avatar-option img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.8); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.active { display: flex; animation: fadeIn 0.3s ease; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 400px; width: 100%; animation: slideUp 0.3s ease; }
.modal h3 { margin-bottom: 16px; font-size: 1.2rem; }
.modal p { color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.modal-buttons { display: flex; gap: 12px; }
.modal-btn { flex: 1; padding: 12px 20px; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.modal-btn:disabled { opacity: 0.8; cursor: not-allowed; }
.modal-btn.confirm { background: var(--accent-danger); color: white; }
.modal-btn.confirm:hover { background: #dc2626; }
.modal-btn.btn-progress { background: var(--accent-success); color: white; }
.modal-btn.btn-progress:hover { background: #059669; }
.modal-btn.cancel { background: var(--bg-tertiary); color: var(--text-secondary); }
.modal-btn.cancel:hover { background: var(--border); color: var(--text-primary); }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal close icon (shared) */
.modal-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: rgba(0,0,0,0.35);
    color: #f9fafb;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.modal-lightbox-close:hover {
    background: rgba(0,0,0,0.6);
    transform: translateY(-1px);
}

/* Player image lightbox */
.modal-player-lightbox {
    max-width: min(720px, 100%);
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    position: relative;
}
.modal-player-lightbox-inner {
    background: linear-gradient(145deg, rgba(15,23,42,0.98), rgba(17,24,39,0.98));
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,0.3);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.modal-player-lightbox-img {
    max-width: 100%;
    max-height: min(70vh, 520px);
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}
.modal-player-lightbox-caption {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.modal-player-lightbox-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-player-lightbox-customize {
    padding-inline: 14px;
    font-size: 0.9rem;
}

/* Tier info modal */
.modal-tier-info {
    max-width: 540px;
    width: 100%;
    position: relative;
}
.tier-info-intro {
    margin-top: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.tier-info-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.tier-info-pill {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.tier-info-pill:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
}
.tier-info-pill.tier-info-pill-active {
    background: var(--accent-primary);
    border-color: transparent;
    color: #fff;
}
.tier-info-body {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tier-info-section {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid rgba(148,163,184,0.35);
}
.tier-info-section-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.tier-info-copy {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .modal-player-lightbox-inner {
        padding: 16px;
    }
    .modal-player-lightbox-img {
        max-height: min(60vh, 420px);
    }
}

/* Player Image Modal */
.modal-player { max-width: 500px; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.color-option { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: all 0.2s ease; }
.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: white; box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent-primary); }

/* Footer */
.app-footer {
    margin-top: 48px; padding-top: 32px;
    font-size: 0.85rem; color: var(--text-muted);
}
.app-footer strong { color: var(--text-secondary); font-weight: 600; }

.footer-faq {
    margin-bottom: 40px;
}
.footer-faq-title {
    font-size: 1.25rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}
.footer-accordion {
    display: flex; flex-direction: column; gap: 0;
    border-top: 1px solid var(--border);
}
.footer-accordion-item {
    border-bottom: 1px solid var(--border); list-style: none;
}
.footer-accordion-item summary {
    padding: 14px 1.5rem 14px 0; cursor: pointer; font-weight: 500; color: var(--text-primary);
    display: flex; justify-content: center; align-items: center; position: relative;
    list-style: none; text-align: center;
}
.footer-accordion-item summary::-webkit-details-marker { display: none; }
.footer-accordion-item summary::after {
    content: '∨'; font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s;
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
}
.footer-accordion-item[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.footer-accordion-item p {
    padding: 0 0 16px 0; margin: 0; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5;
}

.footer-main {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px;
    padding-bottom: 24px; border-bottom: 1px solid var(--border);
}
.footer-brand { display: flex; flex-direction: column; gap: 4px; }
.footer-logo { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.footer-tagline { font-size: 0.85rem; color: var(--text-secondary); }
.footer-links { display: flex; flex-wrap: wrap; gap: 40px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin: 0 0 4px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-col a {
    color: var(--text-secondary); text-decoration: none; font-size: 0.9rem;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-primary); }
.footer-col a.footer-link-external {
    color: var(--accent-gold);
    font-weight: 500;
}
.footer-col a.footer-link-external:hover { color: var(--accent-gold-light, #fde68a); }

.footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
    padding-top: 20px;
}
.footer-copy { font-size: 0.8rem; color: var(--text-muted); }
.footer-version { color: rgba(245, 158, 11, 0.7); font-size: 0.78rem; }
.footer-social { display: flex; gap: 12px; }
.footer-social-link {
    color: var(--text-secondary); text-decoration: none;
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: color 0.2s, background 0.2s;
}
.footer-social-link:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.footer-social-link svg { width: 18px; height: 18px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Mobile / iPhone fixes ──────────────────────────────────────────────── */
html { overflow-x: hidden; }

/* Medium & mobile: user info on top row, campaign info below */
@media (max-width: 1024px) {
    .header-bar { flex-direction: column-reverse; align-items: stretch; }
    .header-right { margin-left: 0; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .container { padding: 14px; }
    header { padding: 12px 0 14px; margin-bottom: 12px; }

    /* Logo — scale down on small screens */
    h1.logo { font-size: 1.6rem; letter-spacing: 2px; }
    h1.logo .logo-img { max-width: 100%; }
    .subtitle { font-size: 0.75rem; }
    header .subtitle { font-size: 0.525rem; }
    .beta-badge { font-size: 0.52rem; padding: 2px 6px; top: -4px; }

    /* Compact header — stack on mobile (user on top, campaign below) */
    .header-bar { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
    .header-left { flex-direction: column; gap: 8px; }
    .header-right { margin-left: 0; flex-direction: column; align-items: flex-start; gap: 8px; }
    .pills-inline { gap: 8px 6px; }
    .auth-inline { gap: 8px; }
    .auth-area-standalone { align-items: stretch; }
    .auth-area-standalone .btn-google-black { justify-content: center; }
    .campaign-select-compact { flex: 1; min-width: 0; }
    .header-actions-inline { flex-wrap: wrap; }
    .header-actions-inline .btn-compact { flex: 1; min-width: 60px; }
    .header-summary-wrap .playgroup-meeples-row { font-size: 0.65rem; word-break: break-word; }

    /* Nav tabs — horizontal scroll on mobile */
    .nav-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-tab { flex: 0 0 auto; padding: 10px 12px; font-size: 0.78rem; white-space: nowrap; }

    /* Legacy playgroup fallbacks (if any) */
    .header-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .playgroup-select-row { justify-content: space-between; }

    /* Game cards — tighter so action buttons don't overflow */
    .game-card { padding: 10px 12px; gap: 10px; }
    .game-card-image,
    .game-card-image-placeholder { width: 40px; height: 40px; font-size: 1.2rem; }
    .game-card-info h3 { font-size: 0.95rem; }
    .game-card-meta { font-size: 0.75rem; }
    .game-card-stats { margin-right: 4px; }
    .game-card-number { font-size: 1.2rem; }
    .game-card-label { font-size: 0.65rem; }

    /* History cards */
    .history-card { padding: 10px 12px; gap: 10px; }

    /* Section spacing */
    .games-section-header { margin: 18px 0 14px; }
    .games-section-title { font-size: 1.05rem; }

    /* Footer */
    .footer-main { flex-direction: column; align-items: flex-start; }
    .footer-links { gap: 24px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ── About Tab — de-emphasised style ────────────────────────────────────────── */
.nav-tab-about,
.nav-tab-data {
    flex: 0 0 auto;
    padding-left: 14px;
    padding-right: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.nav-tab-about {
    border-right: 1px solid var(--border);
    margin-right: 4px;
}
.nav-tab-data {
    border-left: 1px solid var(--border);
    margin-left: 4px;
}
.nav-tab-about.active,
.nav-tab-data.active { background: var(--bg-tertiary); color: var(--accent-gold); }
.nav-tab-about:hover:not(.active),
.nav-tab-data:hover:not(.active) { color: var(--accent-gold); background: transparent; }

/* ── About Page ──────────────────────────────────────────────────────────────── */
.about-hero {
    text-align: center;
    padding: 48px 20px 36px;
    position: relative;
    overflow: hidden;
}
/* Dashboard ambient wrapper reusing About stars */
.dashboard-guest-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    text-align: center;
}
.dashboard-guest-logo {
    height: 250px;
    width: auto;
    display: block;
    border-radius: 8px;
}

.dashboard-ambient {
    position: relative;
    overflow: hidden;
}
.dashboard-ambient-inner {
    position: relative;
    z-index: 1;
}
.about-beta-pill {
    display: inline-block;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em;
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 5px 14px; border-radius: 30px;
    margin-bottom: 18px;
}
.about-hero-logo {
    margin-bottom: 16px;
}
.about-hero-logo img,
.about-hero-logo video {
    width: 399px; /* 350px + 14% */
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
}
/* Soft glitter behind About hero logo */
.about-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.about-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--accent-gold);
    border-radius: 50%;
    opacity: 0;
    animation: aboutTwinkle var(--d, 3s) ease-in-out infinite var(--delay, 0s);
}
.about-star--primary {
    background: var(--accent-primary);
}
.about-star--secondary {
    background: var(--accent-secondary);
}
.about-hero-content {
    position: relative;
    z-index: 1;
}
@keyframes aboutNeonShimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
.about-hero-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.7;
}
.about-cta-btn,
.about-logged-in-btns {
    position: relative;
    z-index: 1;
}
@keyframes aboutTwinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}
.about-cta-btn {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    color: #1a1000;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    letter-spacing: 0.02em;
}
.about-cta-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.about-cta-btn--ghost {
    background: transparent;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
}
.about-cta-btn--ghost:hover { background: rgba(212,175,55,0.08); opacity: 1; }
.about-cta-btn--small {
    padding: 9px 18px;
    font-size: 0.85rem;
    border-radius: 999px;
}
.about-logged-in-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.about-section { margin-bottom: 8px; }
.about-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

/* How it works — 3 columns */
.about-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.about-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 22px;
    text-align: center;
}
.about-step-icon {
    font-size: 2.4rem;
    margin-bottom: 14px;
    line-height: 1;
}
.about-step h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.about-step p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* Features — 2-column grid */
.about-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.about-feature-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s;
}
.about-feature-card:hover { border-color: var(--accent-gold-dark); }
.about-feature-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}
.about-feature-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.about-feature-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}
.about-feature-coming-soon {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent-gold);
    opacity: 0.9;
}

/* FAQ inside about */
.about-faq { margin-top: 0; }

/* Bottom CTA */
.about-bottom-cta {
    text-align: center;
    padding: 20px 20px 0;
}
.about-bottom-cta p {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* 404 / Not-found section */
.section-404,
.not-found-hero {
    text-align: center;
    padding: 56px 20px 40px;
    position: relative;
    overflow: hidden;
}
.not-found-inner {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
}
.not-found-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.not-found-title {
    font-size: 1.6rem;
    margin-bottom: 10px;
}
.not-found-copy {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0 auto 22px;
}
.not-found-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

@media (max-width: 640px) {
    .nav-tab-about { border-right: none; margin-right: 0; padding: 10px 6px; font-size: 0.72rem; }
    .nav-tab-data  { border-left: none;  margin-left: 0;  padding: 10px 6px; font-size: 0.72rem; }
    .about-hero { padding: 32px 12px 24px; }
    .about-hero-logo img,
    .about-hero-logo video { max-width: 100%; }
    .about-hero-sub { font-size: 0.95rem; }
    .about-steps { grid-template-columns: 1fr; }
    .about-features { grid-template-columns: 1fr; }
    .about-section-title { font-size: 1.05rem; }
}

/* ── History Card Audit Trail ───────────────────────────────────────────────── */
.history-card-audit {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    letter-spacing: 0.01em;
}

/* ── Player Profile Hint on card ────────────────────────────────────────────── */
.player-profile-hint {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: var(--accent-gold);
    opacity: 1;
    transition: opacity 0.2s;
}
.player-profile-hint svg {
    width: 22px;
    height: 22px;
}
.player-info-section.player-profile-trigger:hover .player-profile-hint { opacity: 0.9; }
.player-info-section.player-profile-trigger:hover { opacity: 0.9; }

/* ── Player Profile Modal (full-screen slide-in panel) ──────────────────────── */
.player-profile-overlay {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0;
    z-index: 900;
}
.player-profile-overlay.active { display: flex; }

.player-profile-panel {
    width: 100%;
    max-width: 520px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* Header */
.player-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.player-profile-avatar-wrap {
    width: min(160px, 28vmin);
    height: min(160px, 28vmin);
    min-width: 128px;
    min-height: 128px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--border);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: box-shadow 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
}
.player-profile-avatar-wrap.has-color {
    border-color: var(--profile-color, var(--accent-primary));
    box-shadow: 0 0 12px color-mix(in srgb, var(--profile-color, var(--accent-primary)) 40%, transparent);
}
.player-profile-avatar-wrap:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--profile-color, var(--accent-primary)) 40%, transparent), 0 18px 40px rgba(0,0,0,0.65);
    border-color: var(--profile-color, var(--accent-primary));
}
.player-profile-avatar-img {
    width: 100%; height: 100%; object-fit: cover;
}
.player-profile-avatar-placeholder {
    font-size: min(4rem, 12vmin);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.player-profile-title-area {
    flex: 1;
    min-width: 0;
}
.player-profile-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-profile-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.player-profile-plan-info.profile-plan-pills {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.profile-plan-pill {
    display: inline-flex; align-items: center; padding: 4px 10px;
    font-size: 0.75rem; font-weight: 500; border-radius: 999px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
    color: var(--text-secondary); white-space: nowrap;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}
.profile-plan-pill-commoner { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.35); color: var(--text-secondary); }
.profile-plan-pill-noble { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.4); color: var(--accent-secondary); }
.profile-plan-pill-royal { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: var(--accent-gold); }
.profile-plan-pill-meeples { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.35); color: var(--accent-success); }
.profile-plan-pill-accepts { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.35); color: var(--accent-primary); }
.profile-plan-pill-limit { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); color: var(--accent-warning); }
.profile-plan-pill-muted { color: var(--text-muted); }
.profile-plan-pill-traveller { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.35); color: var(--text-muted); }
.profile-plan-pill:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 0 0 1px rgba(148,163,184,0.5);
    filter: brightness(1.05);
}
.plan-pill.plan-pill-tier:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 0 0 1px rgba(245,158,11,0.5);
    filter: brightness(1.05);
    border-color: rgba(245,158,11,0.8);
}
.player-profile-claim-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    transition: all 0.2s;
    white-space: nowrap;
}
.player-profile-claim-btn:hover:not(:disabled) { background: var(--accent-primary); color: white; }
.player-profile-claim-btn:disabled { opacity: 0.6; cursor: not-allowed; font-size: 0.74rem; }
.player-profile-unlink-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.08);
    transition: all 0.2s;
    white-space: nowrap;
}
.player-profile-unlink-btn:hover:not(:disabled) { background: var(--accent-danger); color: white; }
.player-profile-unlink-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.player-profile-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.player-profile-delete-remark {
    flex-basis: 100%;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: -2px;
}
.player-profile-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.player-profile-action-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}
.player-profile-action-danger {
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.08);
}
.player-profile-action-danger:hover {
    background: var(--accent-danger);
    color: white;
}
.player-profile-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}
.player-profile-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* Scrollable body */
.player-profile-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats summary row: row1 = Favourite Game (full width); row2+ = Total Wins, Campaigns, Games Played, Win Rate */
.profile-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}
.profile-fave-game-card-row {
    grid-column: 1 / -1;
}
.profile-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
}
.profile-stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-gold);
    line-height: 1;
    margin-bottom: 4px;
}
.profile-stat-game {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#profileFaveGameCard {
    position: relative;
    overflow: hidden;
}
.profile-fave-game-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}
.profile-fave-game-thumb-wrap {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-fave-game-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-fave-game-placeholder {
    font-size: 1.5rem;
    line-height: 1;
}
.profile-fave-game-text {
    min-width: 0;
    flex: 1;
}
.profile-fave-game-text .profile-stat-game {
    text-align: left;
}
.profile-fave-game-text .profile-stat-label {
    text-align: left;
}
.profile-meta-muted {
    color: var(--text-muted);
}
.profile-fave-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.profile-fave-edit-btn:hover {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.15);
}

.profile-stat-quote-card {
    text-align: left;
}
.profile-stat-quote-card .profile-stat-label {
    margin-bottom: 8px;
    display: block;
}
.profile-fave-quote-select {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.profile-fave-quote-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}
.profile-fave-quote-save {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Achievements teaser (full-width row below stats) */
.profile-achievements-teaser {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
}
.profile-achievements-teaser-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.profile-achievements-icon {
    font-size: 2rem;
    opacity: 0.7;
    line-height: 1;
}
.profile-achievements-coming {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Section titles */
.profile-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Campaign breakdown */
.profile-campaign-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.profile-campaign-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}
.profile-campaign-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-campaign-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.profile-campaign-detail strong { color: var(--text-secondary); }

/* Game breakdown with bar chart */
.profile-game-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.profile-game-row {
    display: grid;
    grid-template-columns: 200px 1fr 36px;
    align-items: center;
    gap: 10px;
}
.profile-game-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-game-bar-wrap {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}
.profile-game-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold-dark), var(--accent-gold));
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 4px;
}
.profile-game-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
}

/* Recent history */
.profile-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.profile-history-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}
.profile-history-game {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-history-campaign {
    font-size: 0.75rem;
    color: var(--accent-primary);
    background: rgba(99,102,241,0.12);
    border-radius: 4px;
    padding: 2px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.profile-history-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.profile-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 16px 0;
}

@media (max-width: 640px) {
    .player-profile-panel { max-width: 100%; border-left: none; border-top: 1px solid var(--border); height: 90vh; }
    .player-profile-overlay { align-items: flex-end; justify-content: stretch; }
    .profile-stats-row { grid-template-columns: repeat(2, 1fr); }
    .profile-game-row { grid-template-columns: 140px 1fr 30px; }
}

/* ── Score Tabulator launch button ────────────────────────────────────────── */
/* ── Tally Scores grid button (sits inside the game selection grid) ─────────── */
.tally-grid-btn {
    border-style: dashed;
    border-color: var(--accent-gold-dark);
    color: var(--accent-gold);
    font-weight: 600;
    grid-column: 1 / -1;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}
.tally-grid-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.12);
}

/* ── Fanfare pop-in when tally modal opens ──────────────────────────────────── */
@keyframes tallyGrandOpen {
    0%   { box-shadow: 0 0 0 0 rgba(245,158,11,0.75), 0 20px 60px rgba(0,0,0,0.5); transform: scale(0.91); }
    45%  { box-shadow: 0 0 0 28px rgba(245,158,11,0.14), 0 20px 60px rgba(0,0,0,0.5); transform: scale(1.025); }
    100% { box-shadow: 0 0 0 54px rgba(245,158,11,0), 0 20px 60px rgba(0,0,0,0.5); transform: scale(1); }
}
.tally-modal.tally-grand-open {
    animation: tallyGrandOpen 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ── Tally modal shell ─────────────────────────────────────────────────────── */
.tally-overlay { align-items: center; justify-content: center; }
.tally-modal {
    width: 100%;
    max-width: min(860px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.tally-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tally-header-left { display: flex; align-items: center; gap: 12px; }
.tally-header-icon { font-size: 1.6rem; }
.tally-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.tally-subtitle { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 0; }
.tally-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem; padding: 6px 8px;
    border-radius: 6px; transition: color 0.2s, background 0.2s;
}
.tally-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* ── Stages ────────────────────────────────────────────────────────────────── */
.tally-stage { display: none; padding: 20px 24px 24px; flex-direction: column; gap: 20px; }
.tally-stage.active { display: flex; }
.tally-field { display: flex; flex-direction: column; gap: 8px; }
.tally-label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.tally-label-hint { font-weight: 400; color: var(--text-muted); }
.tally-select { width: 100%; padding: 12px; }
.tally-game-select-wrap { display: flex; flex-direction: column; gap: 8px; }
/* Dim unselected games when one is selected; they remain selectable */
#tallyGameSelection:has(.selection-item-game.selected) .selection-item-game:not(.selected) {
    opacity: 0.2;
}
#tallyGameSelection:has(.selection-item-game.selected) .selection-item-game:not(.selected):hover {
    opacity: 0.85;
}
.tally-add-new-game-link {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 0.85rem; color: var(--accent-primary); text-align: left;
    transition: color 0.15s, opacity 0.15s;
}
.tally-add-new-game-link:hover { color: var(--accent-gold); opacity: 0.9; }
.tally-empty-state {
    display: flex; flex-direction: column; gap: 12px; padding: 16px;
    background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px;
    text-align: center;
}
.tally-empty-state[hidden] { display: none !important; }
.tally-empty-state-text { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.4; }
.tally-add-first-game-btn { align-self: center; }
.tally-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ── Meeple chips ──────────────────────────────────────────────────────────── */
.tally-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tally-chip {
    padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-secondary); color: var(--text-secondary);
    font-size: 0.85rem; cursor: pointer; transition: all 0.15s;
}
.tally-chip:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.tally-chip.selected {
    background: rgba(99,102,241,0.18); border-color: var(--accent-primary);
    color: var(--accent-primary); font-weight: 600;
}

/* ── Temp meeple add ───────────────────────────────────────────────────────── */
.tally-temp-add { display: flex; gap: 8px; align-items: center; }
.tally-temp-add .input-field { flex: 1; padding: 10px 12px; }
.tally-add-temp-btn { flex-shrink: 0; padding: 10px 14px; white-space: nowrap; }
.tally-temp-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tally-temp-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 16px;
    background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3);
    color: var(--accent-warning); font-size: 0.82rem;
}
.tally-temp-remove {
    background: none; border: none; cursor: pointer;
    color: var(--accent-warning); font-size: 1rem; padding: 0; line-height: 1;
    opacity: 0.7;
}
.tally-temp-remove:hover { opacity: 1; }
.tally-guest-badge {
    display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 0.7rem;
    background: rgba(245,158,11,0.15); color: var(--accent-warning);
    border: 1px solid rgba(245,158,11,0.25); vertical-align: middle; margin-left: 4px;
}

/* ── Start button ──────────────────────────────────────────────────────────── */
.tally-start-btn {
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    color: #000; font-weight: 700; padding: 10px 22px; border-radius: 8px;
    border: none; cursor: pointer; transition: opacity 0.2s, transform 0.15s;
}
.tally-start-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.tally-start-btn:not(:disabled):hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Score table ───────────────────────────────────────────────────────────── */
.tally-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.score-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 320px; }
.score-table th, .score-table td { padding: 8px 10px; text-align: center; }
.score-th-round { text-align: left; font-size: 0.75rem; color: var(--text-muted); min-width: 100px; width: 110px; }
.score-th-player {
    font-size: 0.82rem; color: var(--text-secondary); font-weight: 600;
    border-bottom: 2px solid var(--border); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.score-th-player.is-temp { color: var(--accent-warning); }
.score-td-round { font-size: 0.75rem; color: var(--text-muted); text-align: left; overflow: visible; }
.score-round-name {
    min-width: 80px; width: 100%; max-width: 140px; background: transparent; border: none;
    border-bottom: 1px dashed rgba(255,255,255,0.15);
    color: var(--text-muted); font-size: 0.74rem; text-align: left;
    padding: 2px 3px; outline: none; cursor: text; transition: border-color 0.2s, color 0.2s;
}
.score-round-name:focus { border-bottom-color: var(--accent-gold); color: var(--text-primary); }
.score-round-cell {
    display: inline-flex; align-items: center; gap: 4px;
}
.score-round-remove {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1rem; padding: 0; line-height: 1;
    opacity: 0.6; flex-shrink: 0;
}
.score-round-remove:hover { opacity: 1; color: var(--accent-warning); }
.score-td { border-top: 1px solid rgba(255,255,255,0.04); }
.score-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.score-empty-state {
    padding: 28px 16px !important; text-align: center;
    color: var(--text-muted); font-size: 0.92rem; font-weight: 500;
    border-top: 1px solid rgba(255,255,255,0.04);
    background: rgba(255,255,255,0.02);
}
.score-input {
    width: 100%; max-width: 90px; padding: 6px 8px; text-align: center; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg-tertiary);
    color: var(--text-primary); font-size: 0.9rem;
    transition: border-color 0.15s;
}
.score-input:focus { outline: none; border-color: var(--accent-primary); }
.score-total-label { font-weight: 700; font-size: 0.8rem; color: var(--text-secondary); }
.score-total {
    font-weight: 700; font-size: 0.95rem; color: var(--text-primary);
    border-top: 2px solid var(--border);
}
.score-winner { color: var(--accent-gold) !important; }
.score-table tfoot tr { background: var(--bg-secondary); }

/* ── Add round / record buttons ────────────────────────────────────────────── */
/* ── Round-type picker (always visible on Stage 2) ─────────────────────────── */
.tally-round-picker {
    margin: 8px 0 4px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex; flex-direction: column; gap: 10px;
}
.tally-round-picker-title {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; margin: 0;
}
.tally-round-picker-options {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.tally-round-others-row {
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.tally-round-opt {
    padding: 7px 14px; border-radius: 20px; font-size: 0.86rem; font-weight: 500;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-primary); cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.tally-round-opt:hover { border-color: var(--accent-gold); background: rgba(245,158,11,0.08); transform: translateY(-1px); }
.tally-round-opt--others { color: var(--text-muted); font-size: 0.82rem; }
.tally-round-custom {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.tally-round-custom .input-field { margin: 0; flex: 1; min-width: 120px; padding: 10px 14px; font-size: 0.9rem; }
.tally-round-confirm-btn {
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    color: #000; font-weight: 600; font-size: 0.82rem; padding: 6px 12px; border-radius: 6px;
    border: none; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.tally-round-cancel-btn { font-size: 0.82rem; padding: 6px 12px; flex-shrink: 0; }

/* ── Stage 3: Celebration ──────────────────────────────────────────────────── */
.tally-celebrate {
    text-align: center; padding: 24px 16px 20px;
}
.tally-celebrate-crown {
    font-size: 3rem; line-height: 1; margin-bottom: 10px;
    animation: celebCrown 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.tally-celebrate-name {
    font-size: 2rem; font-weight: 800; color: var(--accent-gold);
    animation: celebName 0.5s 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.tally-celebrate-sub {
    font-size: 0.95rem; color: var(--text-secondary); margin-top: 6px;
    animation: celebName 0.5s 0.25s ease both;
}
@keyframes celebCrown {
    0%   { transform: scale(0.3) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(6deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes celebName {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tally-record-btn {
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold));
    color: #000; font-weight: 700; padding: 10px 22px; border-radius: 8px;
    border: none; cursor: pointer; transition: opacity 0.2s, transform 0.15s;
}
.tally-record-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.tally-record-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Winner bar ────────────────────────────────────────────────────────────── */
.tally-winner-bar { display: flex; flex-direction: column; gap: 6px; }
.tally-winner-info {
    padding: 10px 14px; border-radius: 10px; font-size: 0.9rem;
    background: rgba(255,215,0,0.08); border: 1px solid rgba(255,215,0,0.2);
    color: var(--text-primary);
}
.tally-winner-info.tally-tied {
    background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.2);
}
.tally-winner-info.tally-guest-win {
    background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.25);
}
.tally-temp-warning {
    padding: 8px 14px; border-radius: 8px; font-size: 0.82rem;
    background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2);
    color: var(--accent-warning);
}

@media (max-width: 500px) {
    .tally-modal { max-height: 95vh; border-radius: 12px 12px 0 0; }
    .tally-overlay { align-items: flex-end; }
    .score-input { max-width: 60px; }
    .score-round-name { min-width: 70px; max-width: 120px; }
}

/* ── Admin mode ──────────────────────────────────────────────────────────────── */

/* Admin button in the auth area */
.btn-admin-mode {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-admin-mode:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
    color: #fca5a5;
}
/* Active admin mode — glowing red badge */
.btn-admin-mode.admin-mode-active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fca5a5;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
    animation: admin-pulse 2.5s ease-in-out infinite;
}
@keyframes admin-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.3); }
    50%       { box-shadow: 0 0 14px rgba(239, 68, 68, 0.6); }
}

/* Admin passphrase modal */
.admin-passphrase-modal {
    max-width: 380px;
    text-align: center;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.admin-passphrase-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 4px;
}
.admin-passphrase-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.admin-passphrase-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.admin-passphrase-input {
    width: 100%;
    text-align: center;
    letter-spacing: 0.08em;
    font-size: 1rem;
}
.admin-passphrase-error {
    color: #f87171;
    font-size: 0.82rem;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    padding: 6px 12px;
    width: 100%;
}
.admin-passphrase-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}
.admin-passphrase-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.admin-passphrase-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.admin-passphrase-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.admin-passphrase-btn.admin-action-success {
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: #fff;
    border: none;
}
.admin-passphrase-btn.admin-action-success:hover { opacity: 0.9; }

/* ── Admin Dashboard ────────────────────────────────────────────────────── */

.admin-gate {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 40vh; text-align: center;
}
.admin-gate-icon { font-size: 3rem; margin-bottom: 16px; }
.admin-gate-text { font-size: 1.1rem; color: var(--text-secondary); }

.admin-tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 24px;
    background: var(--bg-secondary); padding: 4px; border-radius: 10px; border: 1px solid var(--border);
}
.admin-tab {
    padding: 10px 14px; border: none; background: transparent; text-align: center;
    color: var(--text-secondary); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; border-radius: 7px; transition: all 0.2s;
}
.admin-tab.active { background: var(--accent-primary); color: white; }
.admin-tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-tertiary); }

.admin-panel { display: none; animation: fadeIn 0.25s ease; }
.admin-panel.active { display: block; }
.admin-panel-title { font-size: 1.2rem; color: var(--text-primary); margin-bottom: 16px; }
.admin-section-subtitle { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 12px; }

.admin-sub-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-sub-tab {
    padding: 8px 18px; border: 1px solid var(--border); background: var(--bg-secondary);
    color: var(--text-secondary); border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.admin-sub-tab.active { border-color: var(--accent-primary); color: var(--accent-primary); background: rgba(99,102,241,0.1); }
.admin-sub-panel { display: none; }
.admin-sub-panel.active { display: block; }

/* Stats grid */
.admin-stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.admin-stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 16px; text-align: center;
}
.admin-stat-number { font-size: 1.8rem; font-weight: 700; color: var(--accent-primary); }
.admin-stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Bar charts */
.admin-bar-chart { display: flex; flex-direction: column; gap: 8px; }
.admin-bar-row { display: flex; align-items: center; gap: 10px; }
.admin-bar-label { width: 140px; font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.admin-bar-track { flex: 1; height: 20px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.admin-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); border-radius: 4px; transition: width 0.4s ease; }
.admin-bar-value { width: 36px; text-align: right; font-size: 0.85rem; font-weight: 700; color: var(--text-primary); flex-shrink: 0; }

/* Activity sparkline */
.admin-activity-chart {
    display: flex; align-items: flex-end; gap: 2px; height: 80px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px;
}
.admin-activity-bar {
    flex: 1; background: var(--accent-primary); border-radius: 2px 2px 0 0;
    min-height: 2px; transition: height 0.3s ease;
}

/* Tables */
/* Bulk action bar */
.admin-bulk-bar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
    padding: 10px 14px; background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.25); border-radius: 8px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.admin-bulk-bar span { font-weight: 600; color: var(--accent-primary); }
.admin-table th input[type="checkbox"],
.admin-table td input[type="checkbox"] {
    width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent-primary);
}

.admin-search {
    width: 100%; padding: 10px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary);
    font-size: 0.9rem; margin-bottom: 12px;
}
.admin-search:focus { outline: none; border-color: var(--accent-primary); }
.admin-filter-row { margin-bottom: 12px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.admin-table th {
    text-align: left; padding: 10px 12px; background: var(--bg-secondary);
    color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border); white-space: nowrap;
}
.admin-table th.admin-sortable { cursor: pointer; user-select: none; }
.admin-table th.admin-sortable:hover { color: var(--text-secondary); }
.admin-table th.admin-sortable .sort-icon { margin-left: 4px; }
.admin-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary);
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-table tr:hover td { background: var(--bg-tertiary); }
.admin-row-expired td { opacity: 0.5; }

.admin-action-btn {
    padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary);
    transition: all 0.2s;
}
.admin-action-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.admin-action-success { border-color: rgba(16,185,129,0.5); color: var(--accent-success); }
.admin-action-success:hover { background: rgba(16,185,129,0.15); border-color: var(--accent-success); }
.admin-action-danger { border-color: rgba(239,68,68,0.4); color: #f87171; }
.admin-action-danger:hover { background: rgba(239,68,68,0.15); border-color: #ef4444; }

.admin-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}
.admin-badge-ok { background: rgba(16,185,129,0.15); color: var(--accent-success); }
.admin-badge-warn { background: rgba(245,158,11,0.12); color: var(--accent-warning); }

/* BGG Linking */
.admin-linking-progress { margin-bottom: 20px; }
.admin-linking-progress span { font-size: 0.9rem; color: var(--text-secondary); }
.admin-progress-bar {
    height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; margin-top: 6px;
}
.admin-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    border-radius: 4px; transition: width 0.4s ease;
}
.admin-linking-list { display: flex; flex-direction: column; gap: 12px; }
.admin-link-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.admin-link-info { flex-shrink: 0; }
.admin-link-info strong { display: block; color: var(--text-primary); }
.admin-link-campaign { font-size: 0.8rem; color: var(--text-muted); }
.admin-link-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.admin-link-search {
    flex: 1; min-width: 160px; padding: 8px 10px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: 0.85rem;
}
.admin-link-search:focus { outline: none; border-color: var(--accent-primary); }
.admin-link-results { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.admin-bgg-result {
    padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-secondary); color: var(--text-secondary); font-size: 0.8rem;
    cursor: pointer; transition: all 0.2s;
}
.admin-bgg-result:hover { border-color: var(--accent-success); color: var(--accent-success); background: rgba(16,185,129,0.08); }
.admin-bgg-result.selected { border-color: var(--accent-success); color: var(--accent-success); background: rgba(16,185,129,0.15); }

/* Config */
.admin-config-form { max-width: 400px; }
.admin-config-field { margin-bottom: 16px; }
.admin-config-field label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.9rem; }
.admin-config-input {
    width: 100%; padding: 10px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 1rem;
}
.admin-config-input:focus { outline: none; border-color: var(--accent-primary); }
.admin-config-hint { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--text-muted); }
.admin-config-checkbox label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.admin-config-checkbox input[type="checkbox"] { width: auto; }
.admin-config-toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-config-toggle-row .admin-config-toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 0; flex-shrink: 0; }
.admin-config-toggle-row .admin-config-input-inline { width: 100px; flex-shrink: 0; }
.admin-config-toggle-row .admin-config-hint { flex-basis: 100%; margin-top: 4px; }
.admin-config-status { margin-left: 12px; font-size: 0.85rem; }

/* Tier definitions */
.admin-tier-definitions-form { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 16px; }
.admin-tier-def-card {
    min-width: 260px; padding: 16px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: 10px;
}
.admin-tier-def-fields { display: flex; flex-direction: column; gap: 12px; }
.admin-tier-def-fields .admin-config-field { margin-bottom: 0; }

/* Preset avatars */
.admin-preset-avatars-list { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 16px; }
.admin-preset-avatar-card {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 16px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: 10px; min-width: 320px;
}
.admin-preset-avatar-thumb {
    width: 80px; height: 80px; border-radius: 8px; overflow: hidden;
    background: var(--bg-secondary); flex-shrink: 0;
}
.admin-preset-avatar-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-preset-avatar-fields { flex: 1; min-width: 0; }
.admin-preset-avatar-fields .admin-config-field { margin-bottom: 10px; }
.admin-preset-avatar-fields input[type="text"] {
    width: 100%; padding: 8px 12px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary);
}
.admin-preset-avatar-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Leaderboard quotes */
.admin-quotes-list { max-width: 560px; }
.admin-quote-row {
    display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
}
.admin-quote-input {
    flex: 1; padding: 10px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 1rem;
}
.admin-quote-input:focus { outline: none; border-color: var(--accent-primary); }

/* Announcements */
.admin-announce-form { max-width: 600px; }
.admin-announce-input {
    width: 100%; padding: 12px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary);
    font-size: 0.95rem; resize: vertical; font-family: inherit;
}
.admin-announce-input:focus { outline: none; border-color: var(--accent-primary); }
.admin-announce-actions { display: flex; gap: 10px; margin-top: 12px; }
.admin-active-announce {
    padding: 12px 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-muted); font-size: 0.9rem;
}
.admin-active-announce-live { border-color: var(--accent-success); color: var(--text-primary); }

/* Announcement banner (shown on index.html) */
.announcement-banner {
    background: linear-gradient(90deg, rgba(99,102,241,0.12), rgba(139,92,246,0.12));
    border: 1px solid rgba(99,102,241,0.3); border-radius: 10px;
    padding: 12px 40px 12px 16px; margin-bottom: 12px; position: relative;
    color: var(--text-primary); font-size: 0.9rem; line-height: 1.5;
}
.announcement-banner-close {
    position: absolute; top: 8px; right: 10px; background: none; border: none;
    color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 4px;
}
.announcement-banner-close:hover { color: var(--text-primary); }

/* Personal message banner (orange theme, above nav) */
.personal-message-banner {
    background: linear-gradient(90deg, rgba(234,88,12,0.15), rgba(249,115,22,0.12));
    border: 1px solid rgba(234,88,12,0.4);
    border-radius: 10px;
    padding: 12px 40px 12px 16px;
    margin-bottom: 12px;
    position: relative;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.personal-message-banner-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}
.personal-message-banner-close:hover { color: var(--text-primary); }

/* BGG Typeahead dropdown */
.bgg-suggestions {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 0 0 8px 8px;
    max-height: 220px; overflow-y: auto; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.bgg-suggestion {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border);
    color: var(--text-secondary); font-size: 0.88rem;
}
.bgg-suggestion:last-child { border-bottom: none; }
.bgg-suggestion:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.bgg-suggestion-thumb {
    width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
    background: var(--bg-tertiary);
}
.bgg-suggestion-name { flex: 1; }
.bgg-suggestion-year { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }

@media (max-width: 640px) {
    .admin-tabs { grid-template-columns: repeat(2, 1fr); gap: 2px; padding: 3px; }
    .admin-tab { padding: 8px 8px; font-size: 0.72rem; }
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-link-row { flex-direction: column; }
    .admin-bar-label { width: 100px; }
}
