* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at 50% 8%, #29477f 0%, #10172d 42%, #0c1020 75%);
    color: #fff;
    font-family: system-ui, "Noto Sans KR", sans-serif;
    min-height: 100vh;
}

button,
input,
select {
    font: inherit;
    border: 0;
    border-radius: 12px;
}

button {
    cursor: pointer;
    padding: 13px;
    background: #26314f;
    color: #fff;
    font-weight: 700;
}

button:hover {
    filter: brightness(1.15);
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    width: 100%;
}

/* =========================
   로그인 / 회원가입
   ========================= */

.auth-screen {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

/*
 * 로고를 로그인 Form과 같은 행에 놓지 않고
 * 화면 최상단 전체 너비를 사용하는 영역으로 배치
 */
.brand {
    width: 100%;
    flex: 0 0 auto;
    text-align: center;
    padding: 34px 20px 18px;
}

.brand h1 {
    margin: 0;
    color: #ffd33d;
    font-size: clamp(34px, 6vw, 52px);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -2px;
    text-shadow: 0 5px 20px rgba(0, 0, 0, .35);
}

.brand p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 5px;
}

.auth-content {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px 50px;
}

.panel {
    width: min(430px, 94vw);
    background: rgba(17, 24, 45, .92);
    border: 1px solid #526895;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel h2 {
    margin: 0 0 6px;
    text-align: center;
}

.auth-panel form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input,
select {
    background: #f4f7ff;
    color: #141a2d;
    padding: 13px;
    min-height: 48px;
}

.auth-panel input {
    width: 100%;
}

.primary {
    background: linear-gradient(135deg, #ffd33d, #ffad1f);
    color: #151a2c;
}

.message {
    margin: 0;
    color: #ff7b7b;
    font-size: 13px;
    line-height: 1.4;
}

/*
 * 메시지가 비어 있을 때는 아예 표시하지 않음.
 * 따라서 최초 로그인 화면에는 오류 문구가 나타나지 않음.
 */
#loginMsg:empty,
#suMsg:empty {
    display: none;
}

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.link-button {
    padding: 6px 4px;
    background: transparent;
    color: rgba(255, 255, 255, .82);
    font-size: 13px;
}

.link-button:hover {
    color: #ffd33d;
}

.divider {
    color: rgba(255, 255, 255, .3);
}

/* =========================
   로비
   ========================= */

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    font-size: 22px;
}

.lobby-logo {
    color: #ffd33d;
    font-weight: 900;
}

.lobby-menu {
    max-width: 900px;
    margin: 80px auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 18px;
}

.menu {
    min-height: 150px;
    font-size: 50px;
    background: linear-gradient(145deg, #202c55, #11172c);
    border: 1px solid #526da9;
}

.menu small {
    display: block;
    font-size: 18px;
    margin-top: 10px;
}

/* =========================
   설정 / 대기 / 게임 / 결과
   ========================= */

.wide {
    width: min(760px, 95vw);
    margin: 0 auto;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.big,
.count {
    text-align: center;
    font-size: 70px;
    font-weight: 900;
    color: #ffd33d;
}

.game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    min-height: 100vh;
    padding: 12px 14px 20px;
    overflow: hidden;
}

.gamebar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: min(900px, 94vw);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 14px;
}

.sentence {
    width: min(900px, 94vw);
    text-align: left;
    font-size: clamp(14px, 2.2vw, 19px);
    line-height: 1.4;
    margin: 6px 0 10px;
    word-break: keep-all;
    overflow-wrap: break-word;
}

#typingInput {
    width: min(900px, 94vw);
    font-size: 16px;
    min-height: 44px;
}

.stats {
    margin-top: 6px;
    font-size: 13px;
}

.stats b {
    font-size: 22px;
}

/* =========================
   모바일
   ========================= */

@media (max-width: 600px) {

    .game-screen {
        min-height: 100dvh;
        justify-content: flex-start;
        padding: 8px 10px 12px;
    }

    .gamebar {
        width: 100%;
        font-size: 12px;
        margin-bottom: 3px;
    }

    .count {
        font-size: 48px;
        line-height: 1;
        margin: 3px 0;
    }

    .sentence {
        width: 100%;
        font-size: 15px;
        line-height: 1.35;
        margin: 5px 0 8px;
    }

    #typingInput {
        width: 100%;
        font-size: 16px;
        min-height: 44px;
    }

    .stats {
        margin-top: 5px;
        font-size: 12px;
    }

    .stats b {
        font-size: 20px;
    }


    .brand {
        padding-top: 24px;
        padding-bottom: 10px;
    }

    .brand h1 {
        font-size: 36px;
    }

    .brand p {
        letter-spacing: 4px;
    }

    .auth-content {
        padding-top: 18px;
    }

    .panel {
        padding: 18px;
    }

    .lobby-menu {
        grid-template-columns: 1fr 1fr;
        margin: 30px auto;
        gap: 12px;
    }

    .menu {
        min-height: 120px;
        font-size: 40px;
    }

    .menu small {
        font-size: 15px;
    }

    .count {
        font-size: 90px;
    }

    .sentence {
        font-size: 20px;
        margin: 14px;
    }

    .row {
        flex-direction: column;
    }

    .results b {
        font-size: 30px;
    }
}
