@font-face {
    font-family: toodzFont;
    src: url(../assets/RifficFree-Bold.ttf);
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
    background-color: rgba(93, 17, 175, 255);
    color: white;
    font-family: 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 24px 0 48px;
}

canvas {
    border: 2px solid white;
    border-radius: 20px;
}

h1, h2 {
    font-family: toodzFont, 'Arial', sans-serif;
    margin: 0 0 8px 0;
}

button {
    min-width: 90%;
    background-color: rgba(93, 17, 175, 255);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, background-color 0.3s;
    outline: none;
}
button:hover { transform: scale(1.05); }
button:active { transform: scale(0.95); }
#resetBtn { background-color: rgba(255, 50, 0, 255); }

select {
    border-radius: 10px;
    background-color: rgba(93, 17, 175, 255);
    color: white;
    padding: 12px;
    width: 100%;
    border: none;
    font-size: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    -webkit-appearance: button;
    appearance: button;
    outline: none;
}

#searchInput {
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    border: none;
    padding: 10px 12px;
    background-color: rgba(93, 17, 175, 255);
    color: #fff;
    font-size: 16px;
    outline: none;
}
#searchInput::placeholder { color: #ffffff !important; opacity: 1; }
#searchInput::-webkit-input-placeholder { color: #ffffff !important; opacity: 1; }
#searchInput:-ms-input-placeholder { color: #ffffff !important; opacity: 1; }
#searchInput::-ms-input-placeholder { color: #ffffff !important; opacity: 1; }

.stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.topGrid,
.tableBox {
    width: 75%;
    margin: 0 auto;
}

.topGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
}

.controls,
.playerBox {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    padding: 20px;
    text-align: left;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.controls-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.player-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pv-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pv-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(93, 17, 175, 0.55);
    border-radius: 12px;
    padding: 12px 14px;
}

.pv-k {
    font-family: 'Arial', sans-serif;
    opacity: 0.95;
}

.pv-v { font-weight: 700; }
.pv-epenis .pv-v { font-family: 'Arial', sans-serif; }

.tableBox { text-align: center; }

.tableContainer {
    position: relative;
    max-height: 60vh;
    overflow: auto;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.niceTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    table-layout: auto;
}

.niceTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: rgb(55, 0, 120);
    color: #fff;
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 255, 255, 0.25);
    font-family: toodzFont, 'Arial', sans-serif;
    white-space: nowrap;
}

.niceTable th:first-child,
.niceTable td:first-child {
    width: 64px;
    white-space: nowrap;
}

.niceTable th:nth-child(2),
.niceTable td:nth-child(2) {
    min-width: 22ch;
    white-space: nowrap;
}

.niceTable th:nth-child(11),
.niceTable td:nth-child(11),
.niceTable th:nth-child(12),
.niceTable td:nth-child(12) {
    min-width: 14ch;
    white-space: nowrap;
}

.niceTable th,
.niceTable td {
    padding: 12px;
    border: none;
    vertical-align: top;
    text-align: left;
}

.niceTable tbody tr:nth-child(odd)  { background: rgba(255, 255, 255, 0.06); }
.niceTable tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.niceTable tbody tr:hover           { background: rgba(255, 255, 255, 0.12); cursor: pointer; }

.selectedRow { outline: 3px solid #fff; outline-offset: -3px; background: rgba(255,255,255,0.18) !important; }

.indexCell { font-weight: bold; }

::-webkit-scrollbar { width: 20px; }
::-webkit-scrollbar-track { background-color: transparent; }
::-webkit-scrollbar-thumb {
    background-color: #d6dee1;
    border-radius: 20px;
    border: 6px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #a8bbbf; }
::-webkit-scrollbar-corner { background: rgba(0,0,0,0); }

/* Responsive */
@media (max-width: 1024px) {
    .topGrid,
    .tableBox { width: 90%; }
    .pv-row { grid-template-columns: repeat(2, 1fr); }
    button { min-width: 100%; }
}

@media (max-width: 640px) {
    body { padding: 16px 0 32px; }
    .topGrid,
    .tableBox { width: 95%; }
    .topGrid { grid-template-columns: 1fr; }
    .pv-row { grid-template-columns: 1fr; }
    .controls-row { grid-template-columns: 1fr; }
    .niceTable { min-width: 720px; }
}