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

body,
html {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1b1b3a 0%, #080811 100%);
    color: #fff;
    font-family: "Fredoka", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #000;
}

#fs-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 24px;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#fs-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255);
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
}

canvas {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    aspect-ratio: 16/9;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 17, 0.85);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s;
}
.hidden {
    display: none !important;
    opacity: 0;
}

#main-title {
    position: absolute;
    top: 40px;
    width: 100%;
    text-align: center;
    font-size: 72px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    z-index: 20;
}
.highlight {
    color: #ff2a5f;
}

.lobby-panels {
    display: flex;
    gap: 40px;
    margin-top: 135px;
}

.glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    padding: 30px;
    width: 380px;
}

.glass h3 {
    margin-bottom: 25px;
    text-align: center;
    color: #00e5ff;
    font-size: 26px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.glass :last-child {
    margin: 0px;
}

.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 2px solid transparent;
}
.player-row span {
    font-weight: 600;
    font-size: 18px;
    text-shadow: 1px 1px 2px #000;
}

.controls-hint {
    font-size: 14px;
    color: #aaa;
    margin-top: 5px;
    line-height: 1.6;
}

select {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 14px;
    border-radius: 7px;
    cursor: pointer;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    transition: 0.2s;
}
select:hover {
    border-color: #00e5ff;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    font-weight: 600;
    font-size: 16px;
}
label select {
    width: 180px;
}

.glow-btn {
    margin-top: 25px;
    font-size: 20px;
    padding: 20px 60px;
    color: #fff;
    font-weight: 700;
    background: #ff2a5f;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.glow-btn:hover {
    background: #ff2a5f;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255);
}

#hud {
    background: transparent;
    pointer-events: none;
    justify-content: flex-start;
    backdrop-filter: none;
}

#fs-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 24px;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#fs-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255);
}

.pause-hud-btn {
    position: absolute;
    top: 15px;
    right: 70px;
    font-size: 20px;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    pointer-events: auto;
    transition: 0.2s;
    z-index: 20;
}
.pause-hud-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255);
}

#timer-display {
    font-size: 72px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.9);
    margin-top: 20px;
}
#mode-status {
    font-size: 19px;
    font-weight: 600;
    color: #00e5ff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 30px;
    border-radius: 20px;
    margin-top: 0px;
}

#countdown {
    position: absolute;
    font-size: 160px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

#end-screen {
    background: rgba(8, 8, 17, 0.9);
    backdrop-filter: blur(15px);
}
#winner-text {
    font-size: 64px;
    margin-bottom: 40px;
    text-shadow: 0 5px 20px rgba(0, 0, 0, 0.9);
    font-weight: 700;
}

.online-btns {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    justify-content: center;
}
.online-btn {
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 28px;
    border-radius: 10px;
    border: 2px solid #ffffff90;
    background: rgba(0, 230, 255, 0.4);
    color: #fff;
    cursor: pointer;
    transition: 0.1s;
    letter-spacing: 1px;
}
.online-btn:hover {
    background: rgba(0, 230, 255, 0.5);
    border-color: #00e5ff;
}
.overlay-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.online-modal-inner {
    width: 480px;
    max-width: 95vw;
    padding: 36px;
    position: relative;
    backdrop-filter: blur(2px);
}
.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 18px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}
.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.online-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    background: #ffffff15;
    border-radius: 8px;
    padding: 4px;
}
.tab-btn {
    flex: 1;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    letter-spacing: 1px;
    transition: 0.2s;
}
.tab-btn.active {
    background: rgba(0, 229, 255, 0.2);
    color: #00e5ff;
}

.online-hint {
    font-size: 14px;
    color: #aaa;
    text-align: center;
    margin-bottom: 18px;
}
.room-code-box {
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 234, 0, 0.4);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
}
.rc-label {
    font-size: 12px;
    letter-spacing: 3px;
    color: #aaa;
    margin-bottom: 8px;
}
.rc-code {
    font-size: 56px;
    font-weight: 700;
    color: #ffea00;
    letter-spacing: 12px;
    text-shadow: 0 0 20px rgba(255, 234, 0, 0.5);
}
.rc-sub {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
}
.online-status {
    text-align: center;
    font-size: 16px;
    color: #ccc;
    min-height: 20px;
    margin-bottom: 14px;
}
.player-slot-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
    max-height: 160px;
    overflow-y: auto;
}
.online-player-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 2px solid transparent;
    font-size: 15px;
    font-weight: 600;
}
.small-btn {
    font-size: 15px !important;
    padding: 12px 28px !important;
    margin-top: 0 !important;
}
#panel-join {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.join-row {
    display: flex;
    flex-direction: column;
    width: 30%;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}
.code-input {
    width: 140px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 28px;
    font-family: inherit;
    font-weight: 700;
    text-align: center;
    letter-spacing: 8px;
    text-indent: 8px;
    text-transform: uppercase;
    padding: 8px;
    outline: none;
}
.code-input:focus {
    border-color: #00e5ff;
}

.credits {
    margin-top: 20px;
    justify-content: center;
    text-align: center;
    font-size: 14px;
    color: #aaa;
    line-height: 1.6;
}
