/* =========================================================
   HISTORY SCREEN — V2
   ========================================================= */

.history-screen {
    position: fixed;
    inset: 0;
    z-index: 900;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 28% 0%, rgba(255,255,255,0.055), transparent 38%),
        radial-gradient(circle at 82% 55%, rgba(255,255,255,0.025), transparent 32%),
        #080909;
    color: #f5f5f5;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.history-layout {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.history-main-column {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 34px 7vw 28px;
}

.history-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding-bottom: 22px;
}

.history-number {
    margin: 0 0 5px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.42);
}

.history-header h1 {
    margin: 0;
    font-size: clamp(30px, 3.2vw, 48px);
    line-height: 0.95;
    font-weight: 850;
    letter-spacing: 4px;
}

.history-subtitle {
    margin: 10px 0 0;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.48);
}

.history-count {
    flex: 0 0 auto;
    padding: 9px 13px;
    border: 1px solid rgba(255,255,255,0.17);
    border-radius: 5px;
    background: rgba(255,255,255,0.035);
    color: rgba(255,255,255,0.72);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1.5px;
}

.history-content {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 10px 20px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.22) transparent;
}

.history-content::-webkit-scrollbar {
    width: 7px;
}

.history-content::-webkit-scrollbar-track {
    background: transparent;
}

.history-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.20);
    border-radius: 10px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-card {
    position: relative;
    padding: 18px 20px 19px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 9px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012)),
        rgba(8,9,10,0.86);
    box-shadow:
        0 14px 32px rgba(0,0,0,0.22),
        inset 0 1px 0 rgba(255,255,255,0.035);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.history-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.25);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)),
        rgba(8,9,10,0.9);
}

.history-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
}

.history-result {
    display: inline-block;
    margin-right: 10px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1.5px;
}

.history-win .history-result {
    color: #ffffff;
}

.history-loss .history-result {
    color: #ff5668;
}

.history-difficulty {
    display: inline-block;
    padding: 4px 7px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.58);
}

.history-card-top time {
    white-space: nowrap;
    font-size: 9px;
    letter-spacing: 0.9px;
    color: rgba(255,255,255,0.40);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 20px;
    padding-top: 15px;
}

.history-stats div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-stats span {
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.40);
}

.history-stats strong {
    font-size: 15px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.history-empty {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px dashed rgba(255,255,255,0.14);
    border-radius: 9px;
    color: rgba(255,255,255,0.50);
}

/* CSS display rules can override the browser's default [hidden] behavior. */
.history-empty[hidden] {
    display: none !important;
}

.history-empty strong {
    font-size: 14px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.76);
}

.history-empty span {
    font-size: 11px;
    letter-spacing: 0.7px;
}

.history-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding-top: 16px;
}

.history-action {
    min-height: 43px;
    padding: 0 17px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1.3px;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.history-action:hover {
    transform: translateY(-2px);
}

.history-clear {
    color: rgba(255,255,255,0.68);
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.16);
}

.history-clear:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.28);
}

.history-back {
    color: #080909;
    background: #f5f5f5;
    border: 1px solid #f5f5f5;
}


@media (max-width: 1000px) {
    .history-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .history-main-column {
        padding-left: 5vw;
        padding-right: 5vw;
    }
}

@media (max-width: 760px) {
    .history-screen {
        overflow-y: auto;
    }

    .history-layout {
        height: auto;
        min-height: 100%;
        display: block;
    }

    .history-main-column {
        min-height: 100vh;
        padding: 28px 5vw 22px;
    }

    .history-content {
        overflow: visible;
    }
}

@media (max-width: 520px) {
    .history-header {
        align-items: flex-start;
    }

    .history-count {
        display: none;
    }

    .history-card {
        padding: 14px;
    }

    .history-card-top {
        align-items: flex-start;
    }

    .history-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .history-actions {
        padding-top: 12px;
    }

    .history-action {
        min-height: 40px;
        font-size: 9px;
        padding: 0 12px;
    }
}
