/* =================================
   QUIZSTREAK
   ================================= */

:root {
    --bg: #080808;
    --surface: #111111;
    --surface-hover: #191919;
    --border: #292929;
    --text: #f4f4f4;
    --muted: #eeeeee;
    --accent: #00e599;
    --accent-dark: #003d2b;
    --purple: #9d00ff;
}

/* Global */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;

    background: var(--bg);
    color: var(--text);

    font-family: "Courier New", monospace;
    font-size: 18px;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 850px;
    margin: 20px auto;
    padding: 30px 0;
    text-align: center;
}

.home-container {
    width: 90%;
    max-width: 850px;
    margin: auto;
    padding: 30px 0;
    text-align: center;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -1px;
}

h2 {
    font-size: 28px;
    color: var(--accent);
}

h3 {
    font-size: 18px;
    margin-top: 40px;
}

p,
small {
    color: var(--muted);
}

.logout-form {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#register-fields {
    text-align: right;
    margin: auto;
    max-width: fit-content; 
}

.back-div {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.leaderboard-button-div {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

/* =================================
   CATEGORY AND DIFFICULTY SELECTION
   ================================= */

.selection-section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;

    margin: 20px 0 35px;
    width: 100%;
}

.selection-section label {
    display: block;
    position: relative;
    cursor: pointer;
    min-width: 0;
}

/* Hide native radio buttons */
.selection-section input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Selection buttons */
.selection-section label span {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 52px;
    padding: 10px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;

    color: var(--text);
    font-size: 14px;
    text-align: center;

    transition: 0.15s ease;
}

/* Hover state */
.selection-section label:hover span {
    background: var(--surface-hover);
    border-color: var(--accent);
}

/* Selected radio button */
.selection-section input[type="radio"]:checked+span {
    background: var(--accent-dark);
    border-color: var(--accent);
    color: var(--accent);
}

/* Keyboard accessibility */
.selection-section input[type="radio"]:focus-visible+span {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* =================================
   GENERAL BUTTONS
   ================================= */

button,
.button {
    padding: 12px 24px;

    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 0;

    color: #000;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;

    cursor: pointer;
    text-decoration: none;
    transition: 0.15s ease;

    min-width: 160px;
}

button:hover:not(:disabled),
.button:hover {
    background: transparent;
    color: var(--accent);
}

button.button-inverted,
.button-inverted {
    padding: 12px 24px;

    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 0;

    color: var(--accent);
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;

    cursor: pointer;
    text-decoration: none;
    transition: 0.15s ease;

    min-width: 160px;
}

button.button-inverted:hover:not(:disabled),
.button-inverted:hover {
    background: var(--accent);
    color: #000;
}

button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#lucky-button {
    margin-top: 10px;
    border: 1px solid var(--purple);
    background: var(--purple);
}

#lucky-button:hover {
    background: transparent;
    color: var(--purple);
}

#login-button {
    margin-top: 10px;
}

#register-button {
    margin-top: 10px;
}

/* Links styled as buttons need a box for padding and width */
a.button {
    display: inline-block;
}

.unstyled-link {
    text-decoration: none;
    overflow: hidden;
    max-width: 100%;
    display: inline-block;
}

.unstyled-link button {
    max-width: 100% !important;
    box-sizing: border-box;
}

/* =================================
   QUIZ ANSWER OPTIONS
   ================================= */

.answer-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;

    width: 100%;
    max-width: 650px;
    margin: 35px auto;
}

.answer-options button {
    width: 100%;
    min-height: 75px;
    padding: 15px;

    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;

    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: normal;

    transition: 0.15s ease;
}

.answer-options button:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

/* =================================
   QUIZ PROGRESS
   ================================= */

.progress {
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =================================
   LEADERBOARD
   ================================= */

.leaderboard-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 30px 0 25px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-tab {
    padding: 12px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    transition: 0.15s ease;
}

.leaderboard-tab:hover {
    color: var(--accent);
    background: var(--surface);
}

.leaderboard-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.leaderboard-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 25px;
    text-align: left;
}

.leaderboard-filters label span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.leaderboard-filters select {
    width: 100%;
    min-height: 46px;
    padding: 10px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;

    color: var(--text);
    font-family: inherit;
    font-size: 14px;

    cursor: pointer;
}

.leaderboard-filters select:hover,
.leaderboard-filters select:focus {
    border-color: var(--accent);
    outline: none;
}

.leaderboard-filters noscript {
    grid-column: 1 / -1;
}

.leaderboard-list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 650px;
    text-align: left;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 12px;
    align-items: center;

    padding: 12px 15px;
    margin-bottom: 6px;

    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 16px;
}

.leaderboard-head {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.leaderboard-rank {
    color: var(--accent);
}

.leaderboard-player {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.leaderboard-name,
.leaderboard-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-meta {
    color: var(--muted);
    font-size: 12px;
    opacity: 0.7;
}

.leaderboard-score {
    font-weight: bold;
    text-align: right;
}

.current-player {
    background: var(--accent-dark);
    border-color: var(--accent);
    border-left: 4px solid var(--accent);
    color: var(--accent);
}

.leaderboard-gap {
    padding: 2px 0 8px;
    color: var(--muted);
    text-align: center;
    letter-spacing: 4px;
}

.leaderboard-note {
    margin-top: 25px;
    font-size: 14px;
}

/* =================================
   FOOTER
   ================================= */

.site-footer {
    width: 100%;
    margin-top: auto;
    padding: 25px 15px;

    border-top: 1px solid var(--border);

    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.site-footer p {
    margin: 4px 0;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* =================================
   RESPONSIVE
   ================================= */

@media (max-width: 600px) {
    .container {
        width: 92%;
        padding: 35px 0;
    }

    .selection-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .answer-options {
        grid-template-columns: 1fr;
    }

    .leaderboard-filters {
        grid-template-columns: 1fr;
    }

    .leaderboard-row {
        grid-template-columns: 40px 1fr auto;
        font-size: 14px;
    }

    h2 {
        font-size: 23px;
    }
}
