/* =============================================
   Playvora Arena — Global Styles
   Dark gaming theme: deep navy + electric purple
   ============================================= */

:root {
    color-scheme: dark;
    --pv-primary:       #6c63ff;
    --pv-primary-dark:  #4f46c8;
    --pv-primary-glow:  rgba(108, 99, 255, 0.25);
    --pv-accent:        #ff6b6b;
    --pv-success:       #51cf66;
    --pv-dark:          #0b0b1a;
    --pv-dark-2:        #10102a;
    --pv-card:          #16163a;
    --pv-card-border:   rgba(108, 99, 255, 0.2);
    --pv-text:          #e0e0f0;
    --pv-text-muted:    #7b7b9e;
    --pv-input-bg:      #0d0d24;
    --pv-input-border:  rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    background-color: var(--pv-dark);
    color: var(--pv-text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Navbar ---- */
.pv-nav {
    background: linear-gradient(135deg, #0d0d28 0%, #16163a 100%);
    border-bottom: 2px solid var(--pv-primary);
    padding: 0.75rem 0;
    --bs-navbar-active-color: var(--pv-text);
    --bs-navbar-color: var(--pv-text-muted);
}

.pv-nav .navbar-brand {
    color: var(--pv-primary);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

.pv-nav .navbar-brand:hover { color: var(--pv-primary); }

.pv-nav .nav-link {
    color: var(--pv-text-muted);
    transition: color 0.2s;
}

.pv-nav .nav-link:hover,
.pv-nav .nav-link.active {
    color: var(--pv-primary);
}

.pv-nav .dropdown-menu {
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
}

.pv-nav .dropdown-item {
    color: var(--pv-text);
}

.pv-nav .dropdown-item:hover {
    background: var(--pv-primary-glow);
    color: var(--pv-primary);
}

.pv-nav .navbar-toggler {
    border-color: var(--pv-card-border);
}

/* ---- Footer ---- */
.pv-footer {
    background: var(--pv-dark-2);
    border-top: 1px solid var(--pv-card-border);
    padding: 1.25rem 0;
    color: var(--pv-text-muted);
    margin-top: auto;
}

/* ---- Buttons ---- */
/* btn-pv-primary is an alias for btn-pv — keep both selectors so existing
   templates (sandbox tabs, battleship attack/defend, dicewars publish)
   render with the gradient instead of falling back to the unstyled
   Bootstrap default that looks like a text link. */
.btn-pv,
.btn-pv-primary {
    background: linear-gradient(135deg, var(--pv-primary) 0%, var(--pv-primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 15px var(--pv-primary-glow);
}

.btn-pv:hover,
.btn-pv-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--pv-primary-glow);
}

.btn-pv:active,
.btn-pv-primary:active { transform: translateY(0); }

.btn-pv-outline {
    background: transparent;
    color: var(--pv-primary);
    border: 1px solid var(--pv-primary);
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-pv-outline:hover {
    background: var(--pv-primary-glow);
    color: var(--pv-primary);
}

/* ---- Cards ---- */
.pv-card {
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pv-card.pv-card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--pv-primary-glow);
}

/* ---- Form inputs ---- */
.form-control, .form-select {
    background-color: var(--pv-input-bg);
    border: 1px solid var(--pv-input-border);
    color: var(--pv-text);
    border-radius: 8px;
}

.form-control:focus, .form-select:focus {
    background-color: var(--pv-input-bg);
    border-color: var(--pv-primary);
    color: var(--pv-text);
    box-shadow: 0 0 0 0.25rem var(--pv-primary-glow);
}

.form-control::placeholder { color: var(--pv-text-muted); }

.form-label {
    color: var(--pv-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

/* ---- Alerts ---- */
.alert-success {
    background: rgba(81, 207, 102, 0.1);
    border-color: rgba(81, 207, 102, 0.3);
    color: var(--pv-success);
}

.alert-danger {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--pv-accent);
}

.alert-info {
    background: rgba(108, 99, 255, 0.1);
    border-color: var(--pv-card-border);
    color: var(--pv-primary);
}

/* ---- Utilities ---- */
.text-pv-primary { color: var(--pv-primary); }
.text-pv-muted   { color: var(--pv-text-muted); }
.bg-pv-card      { background: var(--pv-card); }
.bg-pv-primary   { background: var(--pv-primary); color: #fff; }

/* ---- Brand icon (navbar, lobby heading, footer) ---- */
.pv-brand-icon {
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ---- Ticket drop-zone (drag/drop/paste image upload) ---- */
.pv-drop-zone {
    border: 2px dashed var(--pv-card-border);
    border-radius: 10px;
    padding: 0;
    background: rgba(108, 99, 255, 0.04);
    transition: background 0.15s, border-color 0.15s;
}
.pv-drop-zone--hover {
    border-color: var(--pv-primary);
    background: rgba(108, 99, 255, 0.12);
}
.pv-drop-zone__body {
    padding: 1.25rem;
    text-align: center;
    color: var(--pv-text-muted);
    cursor: pointer;
    user-select: none;
}
.pv-drop-zone__body i {
    font-size: 1.4rem;
    color: var(--pv-primary);
    vertical-align: middle;
    margin-right: 0.35rem;
}
.pv-drop-zone__hint {
    font-size: 0.9rem;
}
.pv-drop-zone__hint kbd {
    background: var(--pv-input-bg);
    border: 1px solid var(--pv-input-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.78rem;
    color: var(--pv-text);
}
.pv-drop-zone__subhint {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
}
.pv-drop-zone__items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 1rem 1rem;
}
.pv-drop-zone__items:empty {
    display: none;
}
.pv-drop-zone__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
    border-radius: 8px;
    width: calc(50% - 5px);
    min-width: 240px;
    position: relative;
}
.pv-drop-zone__item--done {
    border-color: rgba(81, 207, 102, 0.4);
}
.pv-drop-zone__item--error {
    border-color: rgba(255, 107, 107, 0.5);
    background: rgba(255, 107, 107, 0.08);
}
.pv-drop-zone__thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--pv-input-bg);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pv-drop-zone__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pv-drop-zone__placeholder {
    color: var(--pv-text-muted);
    font-size: 1.2rem;
}
.pv-drop-zone__meta {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
}
.pv-drop-zone__name {
    color: var(--pv-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-drop-zone__size {
    color: var(--pv-text-muted);
    font-size: 0.7rem;
    margin-bottom: 4px;
}
.pv-drop-zone__progress {
    height: 4px;
    background: var(--pv-input-bg);
    border-radius: 2px;
    overflow: hidden;
}
.pv-drop-zone__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pv-primary) 0%, var(--pv-primary-dark) 100%);
    transition: width 0.15s;
}
.pv-drop-zone__item--done .pv-drop-zone__progress-bar {
    background: var(--pv-success);
}
.pv-drop-zone__item--error .pv-drop-zone__progress-bar {
    background: var(--pv-accent);
}
.pv-drop-zone__item-error {
    color: var(--pv-accent);
    font-size: 0.7rem;
    margin-top: 2px;
}
.pv-drop-zone__remove {
    border: none;
    background: transparent;
    color: var(--pv-text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.pv-drop-zone__remove:hover {
    color: var(--pv-accent);
}
.pv-drop-zone__error {
    padding: 8px 1rem;
    color: var(--pv-accent);
    font-size: 0.8rem;
    background: rgba(255, 107, 107, 0.08);
    border-top: 1px solid rgba(255, 107, 107, 0.2);
}

/* ---- Players list ---- */
.pv-player-row {
    color: var(--pv-text);
    transition: background 0.15s;
}
.pv-player-row:hover {
    background: rgba(108, 99, 255, 0.08);
    color: var(--pv-text);
}

/* ---- Pagination ---- */
.pv-page-link {
    background: var(--pv-card);
    border-color: var(--pv-card-border);
    color: var(--pv-text-muted);
}
.pv-page-link:hover,
.pv-page-link:focus {
    background: rgba(108, 99, 255, 0.15);
    border-color: var(--pv-primary);
    color: var(--pv-primary);
}
.page-item.active .pv-page-link {
    background: var(--pv-primary);
    border-color: var(--pv-primary);
    color: #fff;
}
.page-item.disabled .pv-page-link {
    background: var(--pv-card);
    border-color: var(--pv-card-border);
    color: var(--pv-text-muted);
    opacity: 0.5;
}

/* ---- Custom Tooltips — Playvora gaming style ---- */
/* Rendered via tooltip.js into <body> to bypass overflow:hidden containers. */
#pv-tooltip {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    padding: 5px 12px;
    background: #0d0d24;
    color: #e0e0f0;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: 1px solid rgba(108, 99, 255, 0.55);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.2), 0 3px 10px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.1s ease;
    transform: translateY(4px);
}

#pv-tooltip.pv-tooltip--visible {
    opacity: 1;
    transform: translateY(0);
}

#pv-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(108, 99, 255, 0.55);
}

/* ---- Input group text (icon prefix) ---- */
.pv-input-group-text {
    background: var(--pv-input-bg);
    border-color: var(--pv-input-border);
    color: var(--pv-text-muted);
}

/* Lobby/modal variant — darker navy */
.pv-input-group-text--lobby {
    background: #16162a;
    border-color: #2d2b5a;
    color: #818cf8;
}

/* ---- Shared accent code/monospace ---- */
.pv-code-accent {
    color: #818cf8;
    font-size: .75rem;
}

/* ---- Shared empty-state icon ---- */
.pv-empty-icon {
    font-size: 2.5rem;
    opacity: 0.4;
}

/* ---- Room page ---- */
.pv-room-container {
    max-width: 640px;
    padding-bottom: 100px;
}

.pv-room-label {
    font-size: .7rem;
    letter-spacing: 1.2px;
}

/* Reconnect banner */
.pv-banner--warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.pv-banner--warning .spinner-border {
    color: #f59e0b;
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.pv-banner-text--warning {
    color: #f59e0b;
    font-size: .875rem;
    font-weight: 600;
}

/* Error banner */
.pv-banner--error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.pv-error-text {
    color: #ef4444;
    font-size: .875rem;
    margin: 0;
    text-align: center;
}

.pv-spinner-primary { color: #6366f1; }

/* ---- Action bar (fixed bottom) ---- */
.pv-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f0f23;
    border-top: 1px solid #2d2b5a;
    padding: 12px 20px 20px;
    z-index: 100;
}

.pv-action-bar-inner { max-width: 600px; }

/* ---- Countdown overlay ---- */
.pv-countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.pv-countdown-label {
    color: #818cf8;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .75rem;
}

.pv-countdown-number {
    color: #fff;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
}

/* ---- Game lobby ---- */
.pv-lobby-container { max-width: 640px; }

.pv-lobby-modal .modal-content {
    background: #16162a;
    border: 1px solid #2d2b5a;
}

.pv-lobby-modal .modal-header,
.pv-lobby-modal .modal-footer {
    border-color: #2d2b5a;
}

/* ---- Lobby index — game cards ---- */
.pv-lobby-game-icon { font-size: 3rem; }
.pv-lobby-game-cover { width: 80px; height: 80px; object-fit: cover; border-radius: 14px; }

/* ---- Rankings page ---- */
.pv-ranking-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pv-ranking-tab:hover { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.4); color: #ccd6f6; }
.pv-ranking-tab--active { background: rgba(99, 102, 241, 0.2); border-color: #6366f1; color: #fff; }
.pv-ranking-tab-cover { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }

.pv-ranking-table { font-size: 0.88rem; }
.pv-ranking-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.5rem 0.75rem; }
.pv-ranking-table td { padding: 0.6rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.04); }

.pv-lobby-card-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---- Room list status dot ---- */
.pv-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- Participant list (room.js generated HTML) ---- */
.pv-participant-row { border-radius: 12px; }

.pv-participant-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.pv-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.pv-avatar--player { width: 40px; height: 40px; }
.pv-avatar--spectator { width: 28px; height: 28px; }

.pv-avatar-fallback {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.pv-avatar-fallback--player {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    background: rgba(45, 43, 90, 1);
    color: #94a3b8;
}

.pv-avatar-fallback--spectator {
    width: 28px;
    height: 28px;
    font-size: .7rem;
    background: rgba(45, 43, 90, 1);
    color: #94a3b8;
}

.pv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.pv-avatar-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #1a1a2e;
}

.pv-seat-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(99, 102, 241, .15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pv-participant-name { font-size: .875rem; }

.pv-you-badge {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, .15);
    color: #818cf8;
    font-size: .625rem;
    font-weight: 600;
}

.pv-ready-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: .6875rem;
    font-weight: 600;
}

.pv-kick-btn {
    padding: 2px 8px;
    font-size: .6875rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, .1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .3);
}

.pv-hand-raised-icon {
    color: #f59e0b;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* ---- Reconnecting overlay (modal with backdrop blur) ---- */
.pv-reconnect-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.pv-reconnect-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 48px;
    background: #1a1a2e;
    border: 1px solid #2d2b5a;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.pv-reconnect-text {
    color: #e0e0f0;
    font-size: 15px;
    font-weight: 600;
}

/* Dicewars game-over banner — sits at the bottom of the board card,
   translucent so the final board state stays visible behind it. */
.pv-game-over-banner {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(26, 26, 46, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid #2d2b5a;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.pv-game-over-trophy { font-size: 22px; }
.pv-game-over-text { flex: 1; color: #e0e0f0; font-weight: 600; font-size: 14px; }
.pv-game-over-btn { white-space: nowrap; }

/* AFK overlay — sits on top of the board card while the server lists
   the viewer as away. Blurs and darkens the map so the user can't keep
   "playing" on autopilot, and surfaces a centered card with the
   "Ich bin wieder da"-CTA. Disappears the instant the server flips
   the status back to connected. */
.pv-afk-overlay {
    position: absolute;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 10, 26, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: inherit;
}
.pv-afk-modal {
    max-width: 360px;
    width: 100%;
    padding: 22px 20px;
    background: #1a1a2e;
    border: 1.5px solid #f59e0b;
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    text-align: center;
}
.pv-afk-modal__icon {
    font-size: 44px;
    line-height: 1;
    color: #f59e0b;
    margin-bottom: 10px;
}
.pv-afk-modal__text {
    color: #fde68a;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
}
.pv-afk-modal__btn {
    width: 100%;
    font-weight: 700;
}

/* Dicewars room preview — hug the map tightly, no inner padding, so
   the rounded card border sits directly around the canvas. */
.pv-dw-preview {
    padding: 0;
    overflow: hidden;
}
.pv-dw-preview canvas { display: block; }

/* ---- Vertical player cards ("trading-card" layout) ----
   Rendered in a flex-wrap container so many cards fit side-by-side.
   Fixed width keeps the grid tidy; leaves room below for the future
   turn-timer bar that will live at the bottom of each card. */
/* Rounded container around the player cards — mirrors the Flutter
   Container(borderRadius: 20, border: Color(0xFF2D2B5A)) */
.pv-players-frame {
    background: #0d0d1f;
    border: 1px solid #2d2b5a;
    border-radius: 20px;
    padding: 12px;
}
.pv-players-grid {
    align-items: stretch;
    gap: 8px;
}
/* 8-player compact mode — only triggers when the grid actually
   contains an 8th card. With ≤7 players the default 76/8/12 layout
   stays untouched; at 8 players the row would otherwise wrap, so
   we shrink card width, gap and frame padding just enough to fit
   8*70 + 7*6 + 12 = 614px on the typical lobby column. */
.pv-players-frame:has(.pv-players-grid > :nth-child(8)) {
    padding: 6px;
}
.pv-players-grid:has(> :nth-child(8)) {
    gap: 6px;
}
.pv-players-grid:has(> :nth-child(8)) > .pv-player-card {
    width: 70px;
}
.pv-player-card {
    width: 76px;
    padding: 0 0 10px;
    border-radius: 12px;
    background: #141428;
    border: 1.5px solid #2d2b5a;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.pv-player-color-bar {
    width: 100%;
    height: 5px;
    flex-shrink: 0;
}
.pv-player-card--me {
    background: #1e1b4b;
    border-color: #6366f1;
}
.pv-player-card--empty {
    background: #0a0a1a;
    border-color: #1e1b4b;
    cursor: default;
}
.pv-player-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    margin-top: 8px;
}
.pv-player-avatar {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    border: 2px solid #475569;
    overflow: hidden;
    background: #2d2b5a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 22px;
}
.pv-player-card--empty .pv-player-avatar {
    border-style: dashed;
    border-color: #2d2b5a;
    background: #1e1b4b;
    color: #4a4a6a;
}
.pv-player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pv-player-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
}
.pv-player-conn-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #0d0d1f;
}
.pv-player-kick-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    border: 1.5px solid #0d0d1f;
    border-radius: 50%;
    cursor: pointer;
}
.pv-player-name {
    margin-top: 6px;
    width: 100%;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-player-you {
    margin-top: 2px;
    color: #818cf8;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
}
.pv-player-name.pv-player-seat-label {
    color: #4a4a6a;
    font-style: italic;
}
.pv-player-card--forfeited .pv-player-name {
    color: #475569;
}
.pv-player-avatar-img--forfeited {
    filter: grayscale(1);
}
.pv-player-afk-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    padding: 1px 4px;
    background: #f59e0b;
    color: #1a1a2e;
    font-size: 9px;
    font-weight: 700;
    border: 1.5px solid #0d0d1f;
    border-radius: 4px;
}
/* Finishing rank badge — pill-shaped, attached to the top-right of the
   whole card. Top-3 show a medal/trophy icon next to the rank number;
   rank 4+ shows only the number on a neutral background. */
.pv-player-rank-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 22px;
    min-width: 22px;
    padding: 0 6px;
    z-index: 2;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    color: #0a0a1a;
    border-radius: 11px;
    border: 2px solid #0d0d1f;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.pv-player-rank-badge i {
    font-size: 12px;
    line-height: 1;
}
.pv-player-rank-num {
    font-variant-numeric: tabular-nums;
}
.pv-player-rank-badge--gold    { background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%); }
.pv-player-rank-badge--silver  { background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%); }
.pv-player-rank-badge--bronze  { background: linear-gradient(135deg, #fbbf9d 0%, #b45309 100%); color: #fff; }
.pv-player-rank-badge--other   { background: #64748b; color: #fff; padding: 0 8px; }

/* Live "in the lead" badge — shown while the game is being played
   on the player whose state metric (largest cluster, dice, sectors)
   is currently best. Reads "1st" so the meaning is unambiguous;
   sits TOP-LEFT so it never overlaps the rank pill in TOP-RIGHT. */
.pv-player-leader-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    z-index: 2;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: #1f1300;
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    border-radius: 11px;
    border: 2px solid #0d0d1f;
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7);
    animation: pvLeaderPulse 2.4s ease-in-out infinite;
}
@keyframes pvLeaderPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.6); }
    50%      { box-shadow: 0 0 0 6px rgba(250, 204, 21, 0); }
}

/* ---- Compact spectator card (flex-wrap layout) ---- */
.pv-spectator-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    min-height: 40px;
    cursor: pointer;
}
.pv-spectator-card .pv-spectator-name {
    font-size: .8125rem;
    font-weight: 600;
    color: #e0e7ff;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-spectator-card--raised {
    padding-right: 8px;
}
.pv-hand-queue-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    background: #f59e0b;
    color: #1a1a2e;
    font-size: .6875rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid #1a1a2e;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pv-spectator-card .pv-avatar-wrap {
    position: relative;
}

.pv-invite-seat-btn {
    padding: 2px 8px;
    font-size: .6875rem;
    border-radius: 8px;
    background: rgba(99, 102, 241, .1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, .3);
}

.pv-participant-empty {
    color: #475569;
    font-size: .875rem;
}

/* Ready-button active state (player is ready — button shows "Not ready") */
.pv-btn--ready {
    background: #1e1b4b;
    color: #818cf8;
    border: 1px solid #4338ca;
}
.pv-btn--ready:hover {
    background: #2e2754;
    border-color: #6366f1;
}

/* ---- Player profile (show page) ---- */
.pv-avatar-lg {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.pv-avatar-lg-placeholder {
    width: 80px;
    height: 80px;
}

.pv-avatar-lg-icon { font-size: 2.5rem; }

.pv-status-dot-icon {
    font-size: 0.55rem;
    vertical-align: middle;
}

/* ---- Players list (index page) ---- */
.pv-players-search { max-width: 420px; }
.pv-players-empty-icon { font-size: 3rem; }
.pv-player-list-wrap { overflow: hidden; }

.pv-player-avatar-sm {
    width: 42px;
    height: 42px;
    object-fit: cover;
}

.pv-player-avatar-sm-placeholder {
    width: 42px;
    height: 42px;
    background: var(--pv-dark-2);
}

.pv-player-avatar-sm-icon { font-size: 1.3rem; }

.pv-player-username {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pv-player-divider {
    border-top: 1px solid var(--pv-card-border);
    margin: 0;
}

.pv-player-meta {
    font-size: 0.72rem;
    color: var(--pv-text-muted);
    margin-top: 2px;
}

.pv-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.25);
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 0.7rem;
    color: var(--pv-text-muted);
    white-space: nowrap;
}

.pv-stat-badge .pv-stat-elo {
    color: var(--pv-primary);
    font-weight: 600;
}

/* ---- Profile / Avatar ---- */
.pv-member-since { font-size: .75rem; }

.pv-avatar-pending-badge {
    background: rgba(99, 102, 241, .2);
    color: #818cf8;
    font-size: .7rem;
}

#avatarWrap {
    width: 80px;
    height: 80px;
    cursor: pointer;
}

.pv-avatar-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 16px;
    border: 3px solid var(--pv-primary);
    display: block;
}

.pv-avatar-initials {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 3px solid #3730A3;
    background: linear-gradient(135deg, #6366F1, #4338CA);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
}

.pv-avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #6366F1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
    transition: background .15s;
}

.pv-avatar-wrap:hover .pv-avatar-overlay { background: #4338CA; }

.pv-lang-btn {
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
    color: #fff;
    text-align: left;
    justify-content: flex-start;
}

.pv-lang-btn:hover,
.pv-lang-btn:focus,
.pv-lang-btn:active,
.pv-lang-btn.show {
    background: var(--pv-card) !important;
    border-color: var(--pv-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
}

.pv-lang-btn::after { margin-left: auto; }

/* Dark-themed dropdown menus for profile settings dropdowns */
.pv-lang-btn + .dropdown-menu {
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
}

.pv-lang-btn + .dropdown-menu .dropdown-item {
    color: var(--pv-text);
}

.pv-lang-btn + .dropdown-menu .dropdown-item:hover {
    background: var(--pv-primary-glow);
    color: var(--pv-primary);
}

.pv-lang-btn + .dropdown-menu .dropdown-item.active {
    background: var(--pv-primary);
    color: #fff;
}

.pv-lang-btn + .dropdown-menu .dropdown-divider {
    border-color: var(--pv-card-border);
}

.pv-crop-modal .modal-content {
    background: var(--pv-card);
    border: 1px solid var(--pv-card-border);
}

.pv-crop-modal .modal-header,
.pv-crop-modal .modal-footer {
    border-color: var(--pv-card-border);
}

.pv-crop-area {
    max-height: 360px;
    overflow: hidden;
}

.pv-crop-area img {
    max-width: 100%;
    display: block;
}

/* ---- TicTacToe ---- */
.pv-ttt-container { max-width: 520px; }

.pv-ttt-status-text { color: #818cf8; }

.pv-ttt-player-card-x {
    flex: 1;
    margin-right: .5rem;
}

.pv-ttt-player-card-o {
    flex: 1;
    margin-left: .5rem;
}

.pv-ttt-progress {
    height: 6px;
    border-radius: 4px;
}

.pv-ttt-progress-bar {
    width: 100%;
    transition: width 0.1s linear;
}

.pv-ttt-countdown-text {
    color: #818cf8;
    opacity: .8;
}

.pv-game-you-label {
    font-size: .7rem;
    color: #818cf8;
}

.pv-game-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ttt-cell {
    aspect-ratio: 1;
    background: rgba(99, 102, 241, 0.08);
    border: 2px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}

.ttt-cell:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.6);
}

.ttt-cell:disabled { cursor: default; }
.ttt-cell.x { color: #818cf8; }
.ttt-cell.o { color: #f472b6; }

.ttt-cell.win-cell {
    background: rgba(99, 102, 241, 0.25);
    border-color: #818cf8;
}

/* Game-specific styles are in separate files (battleship.css, etc.) */

/* ── Player profile stat grid ─────────────────────────────────────────────── */
.pv-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.pv-stat-label {
    font-size: .7rem;
    color: var(--pv-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}

.pv-match-row-border {
    border-bottom: 1px solid #1e1b4b;
}

/* ── Achievement badges ───────────────────────────────────────────────────── */
.pv-achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #1e1b4b;
    border: 1px solid #3730a3;
    border-radius: 20px;
    cursor: default;
    transition: background .15s;
}

.pv-achievement-badge:hover {
    background: #2d2b5a;
}

.pv-achievement-emoji {
    font-size: 1rem;
    line-height: 1;
}

.pv-achievement-label {
    font-size: .78rem;
    color: #a5b4fc;
    font-weight: 500;
    white-space: nowrap;
}

/* ---- Player Profile ---- */
.pv-profile-avatar {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border: 3px solid #3730a3;
}

.pv-profile-avatar-placeholder {
    width: 88px;
    height: 88px;
    border: 3px solid #3730a3;
}

.pv-profile-avatar-icon {
    font-size: 2.5rem;
}

.pv-status-icon {
    font-size: .55rem;
}

.pv-text-subtle {
    color: #94a3b8;
}

.pv-section-heading {
    letter-spacing: .05em;
    font-size: .75rem;
}

.pv-profile-actions {
    border-top: 1px solid #2d2b5a;
}

.pv-btn-remove-friend {
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: transparent;
    font-size: .78rem;
}

.pv-btn-remove-friend:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.pv-match-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pv-match-icon i {
    font-size: .9rem;
}

.pv-match-meta {
    font-size: .75rem;
}

.pv-match-result-badge {
    font-size: .72rem;
}

.pv-card-overflow-hidden {
    overflow: hidden;
}

/* ---- Footer ---- */
.pv-footer-version {
    color: #64748b;
}

.pv-footer-link {
    color: #818cf8;
    text-decoration: none;
}

.pv-footer-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

/* ---- Legal pages (privacy, imprint) ---- */
.pv-legal {
    max-width: 860px;
    color: #cbd5e1;
    line-height: 1.7;
}

.pv-legal h1 {
    color: #e2e8f0;
    font-weight: 700;
}

.pv-legal h2 {
    color: #a5b4fc;
    margin-top: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.pv-legal a {
    color: #818cf8;
    text-decoration: none;
}

.pv-legal a:hover {
    text-decoration: underline;
}

/* While JS hasn't yet assembled the email, render the " [at] "
   placeholder slightly muted so the fallback reads naturally. */
.pv-email-at {
    color: #64748b;
    font-size: 0.95em;
}

.pv-legal address {
    font-style: normal;
    padding-left: 1rem;
    border-left: 3px solid #3730a3;
    color: #e2e8f0;
}

.pv-legal .text-muted {
    color: #94a3b8 !important;
}

.pv-legal code {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.92em;
}

.pv-legal-table {
    --bs-table-bg: rgba(30, 27, 75, 0.5);
    --bs-table-color: #cbd5e1;
    --bs-table-border-color: rgba(55, 48, 163, 0.35);
    --bs-table-striped-bg: rgba(55, 48, 163, 0.18);
    --bs-table-striped-color: #cbd5e1;
    --bs-table-hover-bg: rgba(99, 102, 241, 0.18);
    --bs-table-hover-color: #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.pv-legal-table > thead > tr > th {
    background: rgba(55, 48, 163, 0.55);
    color: #e2e8f0;
    border-color: rgba(55, 48, 163, 0.45);
}

.pv-legal-table > tbody > tr > td {
    vertical-align: top;
}

/* ---- Toast notifications ---- */
.pv-toast-container {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.pv-toast {
    background: #1a1a2e;
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    color: #ccd6f6;
    font-size: 0.82rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    animation: pvToastIn 0.25s ease-out;
    max-width: 320px;
}

.pv-toast--success { border-color: rgba(74, 222, 128, 0.4); }
.pv-toast--error   { border-color: rgba(248, 113, 113, 0.4); color: #f87171; }

@keyframes pvToastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Dicewars configure-screen slider ----
   Compact range input with 7 tick marks drawn on the track (one per
   stop value between min=2 and max=8) AND a Material-style filled
   left half / unfilled right half. Mirrors what Material's Slider
   draws in the Flutter app.

   Track layering (top to bottom):
     1. radial-gradient — 7 light-indigo dots positioned exactly at
        each stop. `circle at 0% 50%` aligns the dot to the LEFT edge
        of every tile and `background-position: 0.5rem 50%` shifts the
        first dot inward by half a thumb-width, so the outermost dots
        line up with the thumb's centre at min/max.
     2. linear-gradient — splits the track at --pv-fill (set by JS on
        every slider input) so the part the thumb has passed is
        accent-coloured and the rest stays in the dark track colour.
   Track height is 4px to match the thinner Material look. */
.pv-dwc-slider {
    flex: 0 1 140px;
    min-width: 110px;
    max-width: 160px;
    --pv-track: #2d2b5a;
    --pv-fill-color: #6366f1;
    --pv-tick: #c7d2fe;
    --pv-fill: 0%;
}
.pv-dwc-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background-image:
        radial-gradient(circle at 0% 50%, var(--pv-tick) 1.5px, transparent 1.7px),
        linear-gradient(to right, var(--pv-fill-color) var(--pv-fill), var(--pv-track) var(--pv-fill));
    background-position: 0.5rem 50%, 0 0;
    background-size: calc((100% - 1rem) / 6) 100%, 100% 100%;
    background-repeat: repeat-x, no-repeat;
}
.pv-dwc-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background-image:
        radial-gradient(circle at 0% 50%, var(--pv-tick) 1.5px, transparent 1.7px),
        linear-gradient(to right, var(--pv-fill-color) var(--pv-fill), var(--pv-track) var(--pv-fill));
    background-position: 0.5rem 50%, 0 0;
    background-size: calc((100% - 1rem) / 6) 100%, 100% 100%;
    background-repeat: repeat-x, no-repeat;
}
/* Nudge the thumb 2px upward — visual fine-tuning per user feedback. */
.pv-dwc-slider::-webkit-slider-thumb {
    margin-top: -6px;
}
.pv-dwc-slider::-moz-range-thumb {
    transform: translateY(-2px);
}
