/* 클래스벨 — 화면 공통 스타일
   흰 바탕. 하늘색은 방 코드, 고른 보기, 1위, 주요 버튼에만 쓰고 정답·오답에만 빨강을 쓴다.
   띠·막대·알약·그림자 없이 글자 크기, 굵기, 정렬, 가는 선으로 위계를 만든다. 모서리 4px. 간격 8px 단위. */

:root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #1f2326;
    --muted: #6a6f73;
    --line: #e3e6e8;
    --line-strong: #c9cdd0;
    --sky: #bfe3f5;
    --sky-hover: #a9d7ee;
    --sky-ink: #1d6a8c;
    --red: #c5302b;
    --red-soft: #fbeceb;
    --disabled: #eff0f1;
    --disabled-text: #a1a5a8;
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font, "Pretendard GOV", "Pretendard", "Malgun Gothic", system-ui, sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

main {
    width: min(560px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 96px;
}

body.host main {
    width: min(1440px, calc(100% - 48px));
}

h1,
h2,
p {
    margin: 0;
}

/* 머리말: 이름표와 가는 선 */
.eyebrow {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.bell {
    display: none;
}

h1 {
    margin-top: 40px;
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    margin-top: 48px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

#status,
.hint {
    margin-top: 16px;
    color: var(--muted);
    font-size: 15px;
}

#status.error,
.hint.error {
    color: var(--red);
    font-weight: 600;
}

/* 버튼 */
button,
.entry-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 24px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:focus-visible,
.entry-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--sky-ink);
    outline-offset: 2px;
}

button.primary {
    margin-top: 24px;
    background: var(--sky);
    color: var(--text);
}

button.primary:hover {
    background: var(--sky-hover);
}

button.secondary,
.entry-link {
    margin-top: 16px;
    border-color: var(--line-strong);
    background: transparent;
    color: var(--text);
}

.entry {
    display: grid;
    gap: 12px;
    max-width: 360px;
    margin-top: 24px;
}

.entry .entry-link {
    margin-top: 0;
}

button.secondary:hover,
.entry-link:hover {
    background: #f4f5f6;
}

button.secondary + button.secondary {
    margin-left: 8px;
}

button:disabled {
    border-color: transparent;
    background: var(--disabled);
    color: var(--disabled-text);
    cursor: not-allowed;
}

.entry-link {
    width: 100%;
}

/* 작은 구역 이름 */
.code-label {
    margin-top: 40px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.code,
.timer {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--text);
}

/* 방 코드는 하늘색 바탕 위에 */
.code {
    display: block;
    width: fit-content;
    margin-top: 8px;
    padding: 12px 32px 8px;
    background: var(--sky);
    font-size: clamp(4rem, 15vw, 7rem);
    letter-spacing: 0.1em;
}

.timer {
    margin-top: 24px;
    font-size: clamp(3.5rem, 12vw, 6rem);
}

.answer-count {
    margin-top: 8px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.answer-count strong {
    color: var(--text);
    font-size: 1.5em;
}

#timer::after {
    content: "초";
    margin-left: 4px;
    color: var(--muted);
    font-size: 0.35em;
    font-weight: 500;
}

/* 문제 문장: 글자만 크게 */
.prompt {
    margin-top: 24px;
    font-size: clamp(1.5rem, 4.6vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.45;
    word-break: keep-all;
}

.answer-reveal {
    margin-top: 24px;
    padding: 16px 24px;
    border-radius: var(--radius);
    background: var(--red-soft);
    color: var(--red);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.4;
}

#explanation {
    margin-top: 16px;
    color: var(--muted);
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    font-weight: 400;
    line-height: 1.6;
}

#assignment-text,
#join-mission,
#join-wheel,
#roulette-mission,
#roulette-wheel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.roulette-wheel {
    min-height: 4.5em;
}

/* 참가자 목록 */
#players {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

#players li,
.empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
    line-height: 1.5;
}

.empty {
    color: var(--muted);
}

.player-state {
    color: var(--muted);
    font-size: 15px;
}

#players li button {
    min-height: 40px;
    margin-top: 0;
    padding: 0 16px;
}

/* 입력 */
label {
    display: block;
    margin-top: 24px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 8px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--sky-ink);
}

input[type="file"] {
    padding: 12px 16px;
    font-size: 15px;
}

#code-input {
    max-width: 12rem;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* 구역은 여백으로 나눈다 */
.waiting,
#question,
#board,
#roulette,
#coop,
#ranking,
#answer,
#join-form,
#assign,
#ranking-view {
    margin-top: 32px;
}

.waiting strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
}

#short-form,
#number-form,
#slider-form {
    margin-top: 8px;
}

#answer-status:empty {
    display: none;
}

#answer-status {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.4;
}

#answer-status[data-tone="result"] {
    color: var(--red);
}

.reveal {
    margin-top: 16px;
    white-space: pre-line;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.7;
}

/* 모드·묶음 고르기 */
.modes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.modes button,
.numbers button {
    border-color: var(--line-strong);
    background: transparent;
    color: var(--text);
}

.modes button {
    margin: 0;
    min-height: 48px;
}

.modes button:hover {
    background: #f4f5f6;
}

.modes button[aria-pressed="true"] {
    border-color: var(--sky);
    background: var(--sky);
}

#file-box {
    margin-top: 8px;
}

#team-tools {
    display: grid;
    grid-template-columns: auto 200px auto;
    justify-content: start;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

#team-tools label,
#team-tools select,
#team-tools button {
    margin-top: 0;
}

/* 번호판 */
#board-title {
    display: flex;
    align-items: center;
    height: 96px;
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2;
}

.numbers {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 72px));
    gap: 8px;
    width: min(100%, calc(10 * 72px + 9 * 8px));
}

.numbers button {
    width: 100%;
    min-height: 64px;
    padding: 0;
    border: 0;
    background: var(--sky);
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.numbers button:hover {
    background: var(--sky-hover);
}

.numbers button:disabled,
.numbers button:disabled:hover {
    background: var(--disabled);
    color: var(--disabled-text);
}

/* 보기: 번호 칸과 글 칸으로 나눈 목록 */
.choices,
.choice-buttons {
    display: block;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.choices li,
.choice-buttons button {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    align-items: baseline;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 16px 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: clamp(1.125rem, 3.4vw, 1.5rem);
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
}

.choices li:last-child,
.choice-buttons button:last-child {
    border-bottom: 1px solid var(--line);
}

.num {
    color: var(--sky-ink);
    font-size: 0.85em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.choice-buttons button {
    justify-content: start;
    padding: 18px 8px;
    transition: background-color 0.15s ease;
}

.choice-buttons button:hover {
    background: #f4f5f6;
}

/* 보기를 고른 상태. 확정 버튼을 눌러야 제출된다. */
.choice-buttons button.picked {
    border-top-color: var(--sky);
    background: var(--sky);
}

.choice-buttons button.picked + button {
    border-top-color: var(--sky);
}

.choice-buttons button.picked .num {
    color: var(--text);
}

.ox {
    display: flex;
    gap: 8px;
}

.ox button {
    flex: 1;
    margin-top: 24px;
    min-height: 128px;
    border-color: var(--line-strong);
    background: transparent;
    color: var(--text);
    font-size: 3rem;
    font-weight: 600;
}

.ox button:hover {
    background: #f4f5f6;
}

.ox button.picked {
    border-color: var(--sky);
    background: var(--sky);
}

.ox button:disabled {
    border-color: transparent;
    background: var(--disabled);
    color: var(--disabled-text);
}

#confirm-answer {
    width: 100%;
}

#choice-step {
    margin-top: 24px;
}

#slider-input {
    min-height: 48px;
    padding: 0;
    border: 0;
}

#slider-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* 순위 */
#ranking-list,
.team-list,
.fastest,
.assign-list,
.review-list {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

#ranking-list,
.team-list,
.fastest,
.assign-list {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
}

#ranking-list li,
.team-list li,
.fastest li,
.assign-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 16px 12px;
    border-bottom: 1px solid var(--line);
}

#ranking-list li:first-child,
.team-list li:first-child,
.fastest li:first-child {
    border-bottom-color: transparent;
    border-radius: var(--radius);
    background: var(--sky);
}

.assign-list .assign-team {
    margin-top: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.04em;
}

.assign-list button {
    margin-top: 0;
}

.review-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
}

.review-list label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
}

.review-list input[type="checkbox"] {
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 0;
    margin: 0;
    padding: 0;
}

#my-rank {
    margin-top: 24px;
    color: var(--text);
    font-size: 1.25rem;
}

#published {
    white-space: pre-line;
}

#qr {
    display: block;
    width: 160px;
    height: 160px;
    margin-top: 16px;
    background: #fff;
}

#coop-tap {
    width: 100%;
    min-height: 120px;
    margin-top: 16px;
    font-size: 2rem;
}

/* 문항 그림 */
.question-image,
.image-preview {
    display: block;
    width: 100%;
    max-height: 36vh;
    margin: 24px auto 0;
    border-radius: 2px;
    object-fit: contain;
}

/* ───── 교사 큰 화면 ───── */
body.host .stage > :first-child {
    margin-top: 0;
}

body.host #room {
    margin-top: 40px;
}

/* 방 코드 아래 보조 버튼: 한 줄에 같은 높이·같은 간격으로 놓는다. */
body.host .room-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

body.host .room-actions > button.secondary,
body.host .room-actions > button.secondary + button.secondary {
    margin: 0;
}

body.host #start {
    margin-top: 24px;
}

@media (min-width: 1024px) {
    body.host main {
        width: min(1440px, calc(100% - 96px));
    }

    body.host #room {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        column-gap: 80px;
        align-items: start;
    }

    body.host #roster {
        position: sticky;
        top: 24px;
        padding-left: 32px;
        border-left: 1px solid var(--line);
    }

    body.host #roster h2 {
        margin-top: 0;
        font-size: 1.125rem;
    }

    body.host #question {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        column-gap: 64px;
        align-items: start;
    }

    body.host #question > * {
        grid-column: 1 / -1;
    }

    body.host #clock {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        display: flex;
        flex-direction: row-reverse;
        align-items: baseline;
        gap: 40px;
    }

    body.host #clock .answer-count {
        margin-top: 0;
    }

    body.host #timer {
        margin-top: 0;
    }

    body.host #prompt {
        grid-column: 1;
        grid-row: 1;
        margin-top: 0;
    }

    body.host #choices {
        grid-column: 1;
        grid-row: 2;
    }

    body.host #question-image {
        grid-column: 2;
        grid-row: 2;
        max-height: 44vh;
        margin-top: 24px;
    }
}

/* ───── 발표 모드: 프로젝터 1920×1080 기준 ───── */
body.presenting main {
    width: calc(100% - 128px);
    padding-top: 24px;
}

body.presenting .eyebrow,
body.presenting h1,
body.presenting #status {
    display: none;
}

body.presenting .code {
    font-size: clamp(8rem, 11vw, 13rem);
}

body.presenting .code-label {
    font-size: 22px;
}

/* 문제가 나오는 동안에는 방 코드를 줄이고 버튼 줄을 숨겨 한 화면에 담는다. 발표 끄기는 Esc로도 된다. */
body.presenting .stage:has(#question:not([hidden])) .code {
    margin-top: 0;
    padding: 4px 20px 0;
    font-size: 3.5rem;
}

body.presenting .stage:has(#question:not([hidden])) .code-label,
body.presenting .stage:has(#question:not([hidden])) .secondary:not(.control) {
    display: none;
}

body.presenting #question {
    margin-top: 16px;
}

body.presenting .answer-count {
    margin-top: 12px;
    font-size: clamp(1.5rem, 1.7vw, 2.25rem);
}

body.presenting .timer {
    font-size: clamp(5rem, 7.5vw, 9rem);
}

body.presenting #timer {
    font-size: clamp(4rem, 6vw, 7rem);
}

body.presenting .prompt {
    font-size: clamp(2.25rem, 3vw, 4rem);
}

body.presenting .answer-reveal {
    margin-top: 12px;
    padding: 8px 28px;
    font-size: clamp(2rem, 2.6vw, 3.25rem);
}

body.presenting #explanation {
    font-size: clamp(1.75rem, 1.9vw, 2.5rem);
}

body.presenting .choices {
    margin-top: 16px;
}

body.presenting .choices li {
    padding: 8px 0;
    grid-template-columns: 3rem minmax(0, 1fr);
    font-size: clamp(1.5rem, 1.9vw, 2.5rem);
}

body.presenting #ranking-list,
body.presenting .team-list,
body.presenting .fastest,
body.presenting .assign-list {
    font-size: clamp(1.75rem, 2.3vw, 3rem);
}

body.presenting .fastest {
    margin-top: 8px;
    font-size: clamp(1.25rem, 1.5vw, 2rem);
}

body.presenting .fastest li {
    padding: 8px 12px;
}

body.presenting .prompt {
    font-size: clamp(2.25rem, 2.7vw, 3.75rem);
}

body.presenting #players li {
    font-size: 24px;
}

body.presenting .player-state {
    font-size: 20px;
}

body.presenting .question-image {
    max-height: 40vh;
}

body.presenting .numbers {
    grid-template-columns: repeat(10, minmax(0, 104px));
    width: min(100%, calc(10 * 104px + 9 * 8px));
}

body.presenting .numbers button {
    min-height: 88px;
    font-size: 32px;
}

body.presenting #board-title {
    font-size: 2.5rem;
}

@media (min-width: 1024px) {
    body.presenting #room {
        grid-template-columns: minmax(0, 1fr) 400px;
    }

    body.presenting #question {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
        column-gap: 48px;
    }
}

@media (max-width: 480px) {
    main {
        width: calc(100% - 32px);
        padding-top: 16px;
    }

    .numbers {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
    }

    #team-tools {
        grid-template-columns: 1fr;
    }

    #team-tools select {
        width: 100%;
    }
}

/* 교사가 마지막에만 여는 문항별 결과표 */
.review-table {
    margin-top: 16px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.review-table th,
.review-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.review-table th:first-child {
    text-align: left;
}

.review-table td.wrong {
    color: var(--red);
    font-weight: 700;
}

/* 순위 발표: 화면을 통째로 쓰고 5위부터 한 줄씩 나온다 */
.announce {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 4vh 8vw 2vh;
    background: #fff;
    overflow: auto;
}

.announce[hidden] {
    display: none;
}

.announce h2 {
    margin: 0 0 4vh;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--text);
    font-size: clamp(1.5rem, 2vw, 2.5rem);
}

.announce-list {
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}

.announce-list li {
    display: grid;
    grid-template-columns: 12vw minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 24px;
    padding: 1.1vh 16px;
    border-bottom: 1px solid var(--line);
    font-size: clamp(1.5rem, 2.6vw, 3.25rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.announce-list li.first {
    background: var(--sky);
    font-size: clamp(2rem, 3.6vw, 4.5rem);
    font-weight: 700;
}

.announce-list .rank {
    color: var(--sky-ink);
}

.announce-list li.first .rank {
    color: var(--text);
}

.announce-list .pts {
    font-weight: 500;
}

.announce-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 12px;
    margin-top: 2vh;
    padding: 12px 0;
    background: #fff;
}

.announce-actions button {
    margin-top: 0;
}

/* 진행 도구 */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.controls button {
    margin-top: 0;
}

.controls button.armed {
    border-color: var(--red);
    color: var(--red);
}

.auto-close {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 15px;
}

.kick {
    min-height: 32px;
    margin: 0 0 0 12px;
    padding: 0 10px;
    font-size: 13px;
}

body.presenting .kick,
body.presenting .controls .auto-close {
    display: none;
}

#export-csv {
    margin-right: 8px;
}

/* 사용 안내 페이지 */
.guide {
    max-width: 720px;
}

.guide-title {
    margin: 48px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 20px;
    font-weight: 700;
}

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    color: var(--sky-ink);
    font-weight: 700;
}

.steps strong {
    font-size: 16px;
}

.steps span {
    grid-column: 2;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.mode-list {
    margin: 0;
}

.mode-list div {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.mode-list dt {
    font-weight: 700;
}

.mode-list dd {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.guide a {
    color: var(--sky-ink);
}

@media (max-width: 480px) {
    .mode-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* 안내 페이지: 설명 목록과 섹션 구분 */
.guide .lead {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.7;
}

.guide-section {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.guide-section h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.guide-section p {
    margin: 0;
    line-height: 1.7;
}

.examples {
    margin: 0;
}

.examples .row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.examples dt {
    font-weight: 700;
}

.examples dd {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

@media (max-width: 480px) {
    .examples .row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* 안내 페이지: 단계별 화면 */
.step {
    margin-top: 32px;
}

.step:first-of-type {
    margin-top: 0;
}

.step h3 {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 8px;
    font-size: 18px;
}

.step .no {
    color: var(--sky-ink);
    font-weight: 700;
}

.step p {
    margin: 0 0 16px;
    line-height: 1.7;
}

.step p.note {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.step figure {
    margin: 0;
}

.step figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line-strong);
}

.step figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.phones {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 260px));
    gap: 24px;
    align-items: start;
}

@media (max-width: 480px) {
    .phones {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* 안내 페이지의 시작하기 버튼: 내용 폭만큼, 한 줄로 */
.guide .entry {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: none;
    margin-top: 0;
}

.guide .entry .entry-link {
    width: auto;
    min-width: 9rem;
    color: var(--text);
}

.guide .entry .entry-link:first-child {
    border-color: transparent;
    background: var(--sky);
}

.guide .entry .entry-link:first-child:hover {
    background: var(--sky-hover);
}

@media (max-width: 480px) {
    .guide .entry {
        flex-direction: column;
    }

    .guide .entry .entry-link {
        width: 100%;
    }
}

/* 머리말 로고: 누르면 안내 페이지로 */
.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: 100%;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand-link img {
    display: block;
    width: 32px;
    height: 32px;
}

.brand-link:hover span {
    color: var(--sky-ink);
}

.brand-link:focus-visible {
    outline: 2px solid var(--sky-ink);
    outline-offset: 4px;
}

@media (max-width: 480px) {
    .brand-link {
        font-size: 22px;
    }
}

.hint a {
    color: var(--sky-ink);
}

.room-title { margin: 0 0 12px; font-size: 1.1rem; font-weight: 600; color: var(--sky-ink); overflow-wrap: anywhere; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.swatch { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); background: var(--swatch); color: #1f2326; border-radius: var(--radius); cursor: pointer; }
.swatch[aria-pressed="true"] { border: 2px solid #1f2326; font-weight: 600; }
.room-head { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.room-head .room-title { margin: 0; }
.room-logo { height: 48px; width: auto; max-width: 120px; object-fit: contain; }
.font-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.font-row button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); background: #fff; border-radius: var(--radius); cursor: pointer; }
.font-row button[aria-pressed="true"] { border: 2px solid #1f2326; font-weight: 600; background: var(--sky); }
.logo-row { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
#players li select { width: auto; max-width: 150px; min-height: 40px; margin: 6px 8px 0 0; padding: 0 10px; font-size: 14px; }

.choose { max-width: 640px; margin-top: 24px; border-top: 2px solid var(--text); }
.choose-row { display: grid; grid-template-columns: 56px 1fr; column-gap: 16px; row-gap: 2px; align-items: baseline; padding: 20px 8px 20px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.choose-row:hover { background: #f4f8fa; }
.choose-row:focus-visible { outline: 2px solid var(--sky-ink); outline-offset: -2px; }
.choose-who { grid-row: 1 / span 2; align-self: start; padding-top: 4px; font-size: 14px; font-weight: 700; color: var(--sky-ink); }
.choose-row strong { font-size: 20px; }
.choose-desc { color: var(--muted); font-size: 15px; line-height: 1.5; }
.choose-guide { margin-top: 20px; }
@media (max-width: 480px) {
  .choose-row { grid-template-columns: 1fr; padding: 18px 0; }
  .choose-who { grid-row: auto; padding: 0; }
}

/* 방 만들기: 체크 한 줄 */
.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 15px;
    cursor: pointer;
}

.check-row input[type="checkbox"],
.auto-close input[type="checkbox"] {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 0;
    margin: 0;
    padding: 0;
}

/* 결과 분포: 글자 · 가는 선 위의 막대 · 인원. 정답 막대만 빨강, 가장 많은 쪽은 하늘색 진하게. */
.distribution {
    margin-top: 24px;
}

.dist-list {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dist-row {
    display: grid;
    grid-template-columns: minmax(6em, 28%) 1fr auto;
    align-items: center;
    gap: 16px;
    font-size: clamp(1rem, 2.4vw, 1.25rem);
}

.dist-label {
    overflow-wrap: anywhere;
}

.dist-track {
    display: block;
    height: 20px;
    border-bottom: 1px solid var(--line-strong);
}

.dist-bar {
    display: block;
    height: 100%;
    background: var(--sky);
    border-radius: var(--radius) var(--radius) 0 0;
}

.dist-row.top .dist-bar {
    background: var(--sky-ink);
}

.dist-row.correct .dist-bar {
    background: var(--red);
}

.dist-row.correct .dist-label {
    color: var(--red);
    font-weight: 700;
}

.dist-count {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .dist-row {
        grid-template-columns: 1fr auto;
    }

    .dist-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/* 모둠 이름 입력 */
.team-names {
    margin: 16px 0;
}

.team-name-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11em, 1fr));
    gap: 8px 16px;
    margin-bottom: 8px;
}

.team-name-list label {
    display: grid;
    grid-template-columns: 1.5em 1fr;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}
