/* ============================================ */
/* HIGHSCORE.CSS - Leaderboard Dialog          */
/* ============================================ */

#highscore-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    z-index: 99999;
    pointer-events: none;
}

.highscore-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 20, 0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    pointer-events: auto;
}

.highscore-overlay * {
    pointer-events: auto;
}

.highscore-dialog {
    width: 600px;
    height: 660px;
    background: linear-gradient(180deg, rgba(10, 30, 50, 0.98) 0%, rgba(5, 15, 30, 0.98) 100%);
    border: 2px solid #00aaff;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0, 170, 255, 0.3),
                inset 0 0 40px rgba(0, 170, 255, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.highscore-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 170, 255, 0.6), transparent);
    animation: hsScan 3s linear infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes hsScan {
    0% { top: 0; }
    100% { top: 100%; }
}

.highscore-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid rgba(0, 170, 255, 0.3);
    background: linear-gradient(180deg, rgba(0, 170, 255, 0.12) 0%, transparent 100%);
}

.highscore-title {
    color: #00ddff;
    font-size: 22px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 221, 255, 0.8);
    text-align: center;
}

.highscore-body {
    flex: 1;
    overflow: hidden;
    padding: 12px 16px 12px 20px;
    min-height: 0;
    cursor: grab;
    user-select: none;
}

.highscore-body:active {
    cursor: grabbing;
}

/* Custom scrollbar track */
.hs-scrolltrack {
    position: absolute;
    right: 0;
    top: 58px;
    bottom: 52px;
    width: 12px;
    background: rgba(0, 20, 40, 0.6);
    border-radius: 6px;
    z-index: 20;
    cursor: pointer;
    touch-action: none;
}

/* Custom scrollbar thumb */
.hs-scrollthumb {
    position: absolute;
    top: 0;
    width: 100%;
    min-height: 30px;
    background: rgba(0, 170, 255, 0.4);
    border-radius: 7px;
    border: 1px solid rgba(0, 170, 255, 0.2);
    cursor: pointer;
    transition: background 0.15s;
    touch-action: none;
}

.hs-scrollthumb:hover,
.hs-scrollthumb.active {
    background: rgba(0, 170, 255, 0.7);
    border-color: rgba(0, 170, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.4);
}

.highscore-loading,
.highscore-empty {
    color: #668899;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 60px 0;
}

.highscore-list-header {
    display: flex;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 170, 255, 0.2);
    margin-bottom: 4px;
}

.highscore-list-header span {
    color: #4499aa;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.highscore-row {
    display: flex;
    padding: 8px 12px;
    border-radius: 3px;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.highscore-row:nth-child(even) {
    background: rgba(0, 170, 255, 0.03);
}

.highscore-row span {
    color: #aaccdd;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.highscore-separator {
    text-align: center;
    color: #335566;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    padding: 6px 0;
    letter-spacing: 6px;
}

/* Column widths */
.hs-rank {
    width: 60px;
    flex-shrink: 0;
}

.hs-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hs-wave {
    width: 70px;
    text-align: center;
    flex-shrink: 0;
}

.hs-score {
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

.hs-medal {
    margin-right: 4px;
}

/* Top 3 styling */
.highscore-row.top1 {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
}

.highscore-row.top1 span {
    color: #ffd700;
}

.highscore-row.top2 {
    border-left-color: #c0c0c0;
    background: rgba(192, 192, 192, 0.05);
}

.highscore-row.top2 span {
    color: #d0d0d0;
}

.highscore-row.top3 {
    border-left-color: #cd7f32;
    background: rgba(205, 127, 50, 0.05);
}

.highscore-row.top3 span {
    color: #cd9f62;
}

/* Self highlight */
.highscore-row.self {
    border-left-color: #44ff88;
    background: rgba(68, 255, 136, 0.08);
    box-shadow: inset 0 0 20px rgba(68, 255, 136, 0.05);
}

.highscore-row.self span {
    color: #66ffaa;
    font-weight: bold;
}

/* Self + top3 combo - self border takes priority */
.highscore-row.self.top1,
.highscore-row.self.top2,
.highscore-row.self.top3 {
    border-left-color: #44ff88;
}

.highscore-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(0, 170, 255, 0.2);
    display: flex;
    justify-content: center;
}

.highscore-close-btn {
    padding: 10px 36px;
    background: rgba(0, 100, 150, 0.4);
    border: 1px solid #00aaff;
    border-radius: 4px;
    color: #00ddff;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.highscore-close-btn:hover {
    background: rgba(0, 150, 200, 0.5);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.4);
}

/* ============================================ */
/* NAME INPUT DIALOG                           */
/* ============================================ */

.highscore-name-dialog {
    background: linear-gradient(180deg, rgba(10, 30, 50, 0.98) 0%, rgba(5, 15, 30, 0.98) 100%);
    border: 2px solid #00aaff;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0, 170, 255, 0.3);
    padding: 30px 40px;
    text-align: center;
    width: 400px;
}

.highscore-name-title {
    color: #00ddff;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 221, 255, 0.8);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.highscore-name-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 30, 50, 0.8);
    border: 1px solid #00aaff;
    border-radius: 3px;
    color: #00ddff;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    -webkit-user-select: text;
    user-select: text;
}

.highscore-name-input:focus {
    border-color: #44ddff;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.3);
}

.highscore-name-input::placeholder {
    color: #335566;
}

.highscore-privacy-notice {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(0, 170, 255, 0.08);
    border: 1px solid rgba(0, 170, 255, 0.15);
    border-radius: 3px;
    color: #668899;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
    text-align: center;
}

.highscore-name-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.highscore-name-submit,
.highscore-name-cancel {
    padding: 10px 28px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.highscore-name-submit {
    background: rgba(0, 150, 100, 0.4);
    border: 1px solid #44ff88;
    color: #44ff88;
}

.highscore-name-submit:hover {
    background: rgba(0, 200, 130, 0.5);
    box-shadow: 0 0 20px rgba(68, 255, 136, 0.4);
}

.highscore-name-cancel {
    background: rgba(100, 100, 120, 0.3);
    border: 1px solid #666677;
    color: #8888aa;
}

.highscore-name-cancel:hover {
    background: rgba(100, 100, 120, 0.5);
    border-color: #8888aa;
}

/* Mobile overrides */
.mobile .highscore-title { font-size: 26px; }
.mobile .highscore-list-header span { font-size: 13px; }
.mobile .highscore-row span { font-size: 16px; }
.mobile .highscore-close-btn { font-size: 15px; padding: 12px 42px; }
.mobile .highscore-name-title { font-size: 22px; }
.mobile .highscore-name-input { font-size: 22px; }
