:root {
    /* Giusti Palette */
    --bg: #F2F0E9;
    /* Cream / Off-white */
    --primary: #D93025;
    /* Deep Red */
    --secondary: #1A1A1A;
    /* Stark Black */
    --accent: #D4AF37;
    /* Muted Gold */
    --text: #1A1A1A;
    --text-light: #F2F0E9;

    --font-heading: 'Abril Fatface', cursive;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('paper-texture.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100%;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.view.active {
    display: flex;
    opacity: 1;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    line-height: 0.9;
}

.title {
    font-size: 5rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 4px 4px 0px var(--secondary);
    letter-spacing: -2px;
}

/* Inputs */
.input-group {
    width: 100%;
    margin-bottom: 20px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-family: var(--font-body);
    font-weight: bold;
    background: transparent;
    border: 3px solid var(--secondary);
    color: var(--secondary);
    border-radius: 0;
    /* Sharp edges */
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    background: var(--secondary);
    color: var(--bg);
}

/* Buttons */
button {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-family: var(--font-body);
    font-weight: 900;
    text-transform: uppercase;
    background: var(--secondary);
    color: var(--bg);
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

button:hover {
    transform: translate(-4px, -4px);
    box-shadow: 4px 4px 0px var(--primary);
}

button:active {
    transform: translate(0, 0);
    box-shadow: none;
}

button.secondary {
    background: transparent;
    border: 3px solid var(--secondary);
    color: var(--secondary);
}

button.secondary:hover {
    background: var(--secondary);
    color: var(--bg);
    box-shadow: 4px 4px 0px var(--primary);
}

/* Lobby */
.room-info {
    margin-bottom: 40px;
    text-align: center;
    border: 3px solid var(--secondary);
    padding: 20px;
    width: 100%;
    background: var(--bg);
    position: relative;
}

.room-info::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: -1;
    border: 3px solid var(--secondary);
}

.room-info p {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.room-info h1 {
    font-size: 4rem;
    color: var(--secondary);
    margin: 0;
}

#player-list {
    width: 100%;
    margin-bottom: 30px;
}

.player-item {
    padding: 10px;
    border-bottom: 2px solid var(--secondary);
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
}

/* Question View */
#question-text {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
    color: var(--secondary);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.range-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.range-inputs input {
    width: 50%;
}

/* Reveal View */
.correct-answer {
    text-align: center;
    margin-bottom: 30px;
    background: var(--primary);
    color: var(--bg);
    padding: 20px;
    width: 100%;
    border: 3px solid var(--secondary);
    position: relative;
    overflow: hidden;
}

.correct-answer span {
    font-weight: bold;
    letter-spacing: 2px;
}

.correct-answer h1 {
    font-size: 4rem;
    margin: 10px 0 0 0;
    color: var(--bg);
}

.results-container {
    width: 100%;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid var(--secondary);
    background: #696773;
    /* Incorrect Color */
    font-weight: bold;
    color: var(--bg);
}

.result-item.correct {
    background: #0F7173;
    /* Correct Color */
    color: var(--bg);
    border-color: var(--secondary);
}

.result-item.correct .points {
    color: var(--bg);
    text-shadow: none;
}

/* Exact Answer Animation */
.result-item.exact {
    background: linear-gradient(45deg, #8e44ad, #9b59b6, #e056fd, #8e44ad);
    background-size: 400% 400%;
    animation: shimmer 3s ease infinite;
    border-color: #8e44ad;
    color: #fff;
}

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.result-item.exact .points {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Accent Lines Animation */
.accent-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    pointer-events: none;
    z-index: 0;
}

.accent-line {
    position: absolute;
    background: var(--bg);
    border-radius: 2px;
    opacity: 0.8;
}

/* Top Left */
.line-1 {
    top: 20%;
    left: 20%;
    width: 30px;
    height: 4px;
    transform: rotate(-45deg);
    animation: shake 0.5s infinite alternate;
}

/* Top Right */
.line-2 {
    top: 20%;
    right: 20%;
    width: 30px;
    height: 4px;
    transform: rotate(45deg);
    animation: shake 0.6s infinite alternate-reverse;
}

/* Bottom Left */
.line-3 {
    bottom: 20%;
    left: 20%;
    width: 30px;
    height: 4px;
    transform: rotate(45deg);
    animation: shake 0.7s infinite alternate;
}

/* Bottom Right */
.line-4 {
    bottom: 20%;
    right: 20%;
    width: 30px;
    height: 4px;
    transform: rotate(-45deg);
    animation: shake 0.5s infinite alternate-reverse;
}

/* Sides */
.line-5 {
    top: 50%;
    left: 10%;
    width: 20px;
    height: 4px;
    animation: wiggle 0.4s infinite;
}

.line-6 {
    top: 50%;
    right: 10%;
    width: 20px;
    height: 4px;
    animation: wiggle 0.4s infinite reverse;
}

@keyframes shake {
    0% {
        transform: translate(0, 0) rotate(var(--r, 0deg));
    }

    25% {
        transform: translate(2px, 2px) rotate(var(--r, 0deg));
    }

    50% {
        transform: translate(-2px, 1px) rotate(var(--r, 0deg));
    }

    75% {
        transform: translate(1px, -2px) rotate(var(--r, 0deg));
    }

    100% {
        transform: translate(-1px, -1px) rotate(var(--r, 0deg));
    }
}

@keyframes wiggle {
    0% {
        transform: scaleX(1);
    }

    50% {
        transform: scaleX(1.2);
    }

    100% {
        transform: scaleX(1);
    }
}

.correct-answer h1,
.correct-answer span {
    position: relative;
    z-index: 1;
}

/* Leaderboard */
.leaderboard-container {
    width: 100%;
    margin-top: 20px;
    border-top: 4px solid var(--secondary);
    padding-top: 20px;
}

.leaderboard-container h3 {
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 1.5rem;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--secondary);
    font-size: 1rem;
}

.leaderboard-item .rank {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    width: 40px;
}

.leaderboard-item .score {
    font-weight: 900;
}

/* End View */
#winner-display {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
    text-align: center;
    font-family: var(--font-heading);
}

/* Utilities */
.hidden {
    display: none !important;
}


.action-buttons {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
}

.join-inputs {
    width: 100%;
    display: flex;
    gap: 10px;
}

.join-inputs input {
    width: 50%;
}

.join-inputs button {
    width: 50%;
    margin-bottom: 0;
}