:root {
    --bg-color: #0a0a0a;
    --container-bg: #141414;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent: #ffffff;
    --danger: #ff3333;
    --success: #00ff88;
    --border: #333333;
    --btn-primary: #ffffff;
    --btn-primary-text: #000000;
    --btn-secondary: #222222;
    --btn-secondary-text: #ffffff;
}

::-webkit-scrollbar {
    display: none;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    z-index: 1;
}

.screen:not(#game-screen) {
    padding: 1rem;
}

.hidden {
    display: none !important;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}

h1.title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.main-logo {
    max-width: 300px;
    width: 80%;
    height: auto;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    h1.title {
        font-size: 3.5rem;
    }

    .main-logo {
        max-width: 400px;
    }
}

.btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
    text-transform: uppercase;
    border-radius: 8px;
    letter-spacing: 0.05em;
    min-width: 200px;
    font-family: 'Inter', sans-serif;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background-color: var(--btn-primary);
    color: var(--btn-primary-text);
}

.btn-secondary {
    background-color: var(--btn-secondary);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border);
}

.btn-row {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 280px;
}

.btn-row .btn {
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 280px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-field {
    background: var(--container-bg);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border-radius: 8px;
    outline: none;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    width: 210px;
    height: 70px;
}

.input-field::placeholder {
    color: var(--text-secondary);
    text-transform: none;
}

.input-field:focus {
    border-color: var(--accent);
}

.btn-clear {
    background: var(--danger);
    border: 2px solid var(--border);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.1s, background-color 0.2s;
    outline: none;
}

.btn-clear:hover {
    background: #ff5555;
}

.btn-clear:active {
    transform: scale(0.95);
}

.btn-clear:focus {
    border-color: var(--accent);
}

.code-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.code-char {
    width: 60px;
    height: 70px;
    background: var(--container-bg);
    border: 2px solid var(--border);
    color: var(--text-primary);
    font-size: 2rem;
    text-align: center;
    border-radius: 12px;
    outline: none;
    font-weight: 800;
    text-transform: uppercase;
    font-family: 'Inter', monospace;
}

.code-char:focus {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.error-text {
    color: var(--danger);
    margin-top: 1rem;
    font-weight: bold;
    text-align: center;
}

#screen-game {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    
}

#screen-game>* {
    pointer-events: auto;
}

#roomCodeDisplay {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #000;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    z-index: 100;
}

#roomCodeDisplay .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#roomCodeValue {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-btn {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 100;
    transition: transform 0.1s;
}

.start-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.start-btn.hidden {
    display: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}

#player-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#player-name-display {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: -0.05em;
    text-align: center;
    margin-bottom: 2rem;
}

#player-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 280px;
}

#player-status .btn {
    width: 100%;
}

#player-waiting-msg {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

#question-display,
#question-text,
.answer-grid,
.answer-btn {
    display: none;
    
}

.answer-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}


#screen-game-picker {
    z-index: 20;
    
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 350px);
    justify-content: center;
    gap: 30px;
    width: 90%;
    max-width: 1200px;
    margin-top: 2rem;
    overflow-y: auto;
    padding: 10px;
}

.game-card {
    background: var(--container-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:hover {
    border-color: var(--accent);
}

.game-card-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: #72c2d6;
}

.game-card-info {
    padding: 1rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.game-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    text-align: left;
    display: flex;
    align-items: center;
}

.game-card-players {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.game-card-title-img {
    max-width: 100%;
    height: auto;
    max-height: 36px;
    object-fit: contain;
    object-position: left;
}


#screen-loading {
    background: #000;
    z-index: 500;
    
    text-align: center;
}

.loading-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
    filter: invert(1);
    
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.loading-progress {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: monospace;
}


.search-container {
    position: relative;
    width: 90%;
    max-width: 500px;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1.2rem;
    background: var(--container-bg);
    border: 2px solid var(--border);
    color: var(--text-primary);
    border-radius: 50px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}
