/* Family Quiz Night: the hub, opening a room, and the room itself — big answer buttons, a calm lobby, a joyful finish. */

/* ---------- Hub ---------- */
.k-qn-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: center; margin: 8px 0 30px; }
.k-qn-hero .k-guide { align-items: flex-start; }
.k-join { display: flex; flex-direction: column; gap: 14px; padding: clamp(20px, 4vw, 34px); text-align: center; background: linear-gradient(160deg, var(--coral-soft), var(--paper) 60%); }
.k-join h1 { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: clamp(1.7rem, 3.5vw, 2.3rem); margin: 0; }
.k-code-input {
    width: 100%; min-height: 84px; padding: 10px 16px; border-radius: 22px; border: 3px dashed color-mix(in srgb, var(--coral) 55%, transparent);
    background: var(--paper); text-align: center; text-transform: uppercase; letter-spacing: .35em;
    font: 800 clamp(1.8rem, 6vw, 2.6rem) var(--font-display); color: var(--ink);
}
.k-code-input:focus { outline: none; border-style: solid; border-color: var(--coral); box-shadow: 0 0 0 5px color-mix(in srgb, var(--coral) 25%, transparent); }
.k-code-input::placeholder { color: color-mix(in srgb, var(--ink) 25%, transparent); }
.k-join-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; font-family: var(--font-read); color: var(--ink-soft); }
.k-join-note .k-avatar { width: 34px; height: 34px; }
.k-join-note a { font-weight: 800; color: var(--grape-deep); }
.k-qn-modes { margin-bottom: 28px; }
.k-qn-modes .k-chip { align-self: flex-start; margin-top: auto; }
.k-qn-modes .k-chip .k-ico { width: 16px; height: 16px; }
.k-tile--static { cursor: default; }
.k-tile--static:hover { transform: none; }
.k-qn-safe { padding: 22px 26px; margin-bottom: 30px; }
.k-qn-safe h2 { display: flex; align-items: center; gap: 8px; font-size: 1.3rem; }
.k-qn-safe ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-family: var(--font-read); color: var(--ink-soft); }

/* ---------- Opening a room ---------- */
.k-qn-form { padding: clamp(18px, 4vw, 32px); margin-bottom: 30px; }
.k-qn-lock > div:not(.k-form-actions) { flex: 1 1 260px; }
.k-qn-lock h2 { margin: 0 0 4px; }
.k-qn-lock p { margin: 0; font-family: var(--font-read); color: var(--ink-soft); }
.k-mode-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.k-mode input, .k-topic input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.k-mode > span { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: 22px; background: var(--ts); border: 3px solid transparent; cursor: pointer; transition: transform .2s var(--ease-bounce); }
.k-mode .k-tile-icon { width: 56px; height: 56px; }
.k-mode .k-tile-icon .k-ico { width: 34px; height: 34px; }
.k-mode small { color: var(--ink-soft); font-family: var(--font-read); }
.k-mode input:checked + span { border-color: var(--td); background: color-mix(in srgb, var(--ts) 60%, var(--paper)); transform: translateY(-3px); box-shadow: 0 6px 0 color-mix(in srgb, var(--td) 35%, transparent); }
.k-mode input:focus-visible + span, .k-topic input:focus-visible + span { outline: 4px solid var(--sun); outline-offset: 2px; }
.k-topic-row { display: flex; flex-wrap: wrap; gap: 8px; }
.k-topic > span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--cream); border: 3px solid transparent; font-weight: 800; cursor: pointer; }
.k-topic .k-ico { width: 22px; height: 22px; color: var(--coral-deep); }
.k-topic input:checked + span { background: var(--coral-soft); border-color: var(--coral); }
.k-qn-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 0 26px; }

/* ---------- The room ---------- */
.k-room-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.k-room-code { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 20px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow); }
.k-room-code small { font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.k-room-code b { font-size: 2rem; letter-spacing: .25em; line-height: 1; }
.k-room-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.k-room-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
.k-room-stage { min-height: 420px; padding: clamp(18px, 4vw, 34px); border-radius: var(--radius-l); background: var(--paper); box-shadow: var(--shadow); border: 1px solid var(--line); }
.k-room-side { display: grid; gap: 16px; }
.k-room-players, .k-room-host { padding: 18px; }
.k-room-players h2, .k-room-host h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.k-room-players ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.k-player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--cream); }
.k-player.is-me { box-shadow: 0 0 0 3px var(--sun) inset; }
.k-player .k-avatar { width: 40px; height: 40px; }
.k-player-name { display: flex; flex-direction: column; min-width: 0; }
.k-player-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-player-name small { color: var(--ink-soft); font-weight: 700; font-size: .78rem; }
.k-player-score { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; }
.k-place-no { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 800; flex: none; }
.k-answered { color: var(--mint-deep); }
.k-answered .k-ico { width: 24px; height: 24px; }
.k-thinking { display: inline-flex; gap: 3px; }
.k-thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: k-dot 1s infinite ease-in-out; }
.k-thinking i:nth-child(2) { animation-delay: .15s; }
.k-thinking i:nth-child(3) { animation-delay: .3s; }
.k-remove { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 1rem; padding: 4px 6px; border-radius: 8px; }
.k-remove:hover { color: var(--coral-deep); background: var(--coral-soft); }
.k-team-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; margin-bottom: 8px; border-radius: 16px; font-weight: 800; }
.k-team-total span { display: inline-flex; align-items: center; gap: 6px; }
.k-team-total .k-ico { width: 22px; height: 22px; }
.k-team-total b { font-size: 1.3rem; }
.team-sun.k-team-total, .k-player.team-sun { background: var(--sun-soft); }
.team-moon.k-team-total, .k-player.team-moon { background: var(--grape-soft); }
.team-grownups.k-team-total, .k-player.team-grownups { background: var(--sky-soft); }
.team-children.k-team-total, .k-player.team-children { background: var(--mint-soft); }
.k-room-host-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.k-room-safe { display: flex; align-items: center; gap: 6px; margin-top: 18px; }

.k-join-room { padding: 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: none; }
.k-join-room label { font-weight: 800; }
.k-join-room .k-input { max-width: 320px; text-align: center; }
.k-join-as { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin: 0; }
.k-join-as .k-avatar { width: 64px; height: 64px; }
.k-lobby { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0; }
.k-lobby-lantern { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, var(--sun-soft), transparent 70%); color: var(--coral-deep); }
.k-lobby-lantern .k-ico { width: 64px; height: 64px; }
@media (prefers-reduced-motion: no-preference) {
    .k-lobby-lantern { animation: k-qn-float 3s ease-in-out infinite; }
}
@keyframes k-qn-float { 50% { transform: translateY(-8px); } }
.k-inline-code { padding: 2px 10px; border-radius: 10px; background: var(--coral-soft); letter-spacing: .2em; }
.k-team-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.k-team-pick .k-btn[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 3px; }

.k-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.k-q-count { font-weight: 800; color: var(--ink-soft); }
.k-q-timer { margin-inline-start: auto; padding: 4px 14px; border-radius: 999px; background: var(--sky-soft); font-weight: 800; font-size: 1.2rem; }
.k-q-timer.is-low { background: var(--coral); color: #fff; }
.k-q-bar { height: 10px; border-radius: 999px; background: var(--sky-soft); overflow: hidden; margin-bottom: 14px; }
.k-q-bar i { display: block; height: 100%; inline-size: 100%; background: linear-gradient(90deg, var(--sky), var(--mint)); border-radius: inherit; transition: inline-size .25s linear; }
.k-q-prompt { font-size: clamp(1.5rem, 3.5vw, 2.2rem); line-height: 1.25; margin: 6px 0 20px; display: flex; gap: 10px; align-items: flex-start; }
.k-q-prompt .k-say { flex: none; }
.k-options { display: grid; gap: 12px; }
.k-option {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 12px 16px; text-align: start;
    border-radius: 20px; border: 3px solid var(--line); background: var(--cream); color: var(--ink);
    font: 700 1.2rem var(--font-display); cursor: pointer; transition: transform .15s var(--ease-bounce), border-color .2s, background .2s;
}
button.k-option:not([disabled]):hover { transform: translateY(-2px); border-color: var(--coral); }
.k-option[disabled] { cursor: default; }
.k-option-letter { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--paper); font-weight: 800; }
.k-option-letter .k-ico { width: 26px; height: 26px; }
.k-option.is-mine { border-color: var(--grape); background: var(--grape-soft); }
.k-option.is-correct { border-color: var(--mint); background: var(--mint-soft); }
.k-option.is-correct .k-option-letter { background: var(--mint); color: #fff; }
.k-option.is-wrong { border-color: var(--coral); background: var(--coral-soft); }
.k-q-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-weight: 800; color: var(--ink-soft); }
.k-q-wait .k-ico { width: 24px; height: 24px; color: var(--mint-deep); }
.k-reveal-line { margin: 16px 0 0; font-size: 1.3rem; font-weight: 800; text-align: center; }
.k-reveal-line.is-right { color: var(--mint-deep); }
.k-explain { margin-top: 16px; padding: 16px 18px; border-radius: 20px; background: var(--sun-soft); font-family: var(--font-read); }
.k-explain p { margin: 0 0 8px; }
.k-source { display: flex; gap: 6px; align-items: flex-start; font-size: .92rem; color: var(--ink-soft); }
.k-source .k-ico { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.k-final { text-align: center; }
.k-final h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.k-final-line { font-size: 1.25rem; font-weight: 800; }
.k-podium { list-style: none; padding: 0; margin: 20px auto; display: flex; justify-content: center; align-items: flex-end; gap: 12px; max-width: 520px; }
.k-podium li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 22px 22px 8px 8px; background: var(--grape-soft); min-width: 0; }
.k-podium li b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-podium .k-avatar { width: 56px; height: 56px; }
.k-podium-1 { order: 2; min-height: 200px; background: linear-gradient(180deg, #FFE27A, var(--sun)) !important; color: #2B2350; }
.k-podium-2 { order: 1; min-height: 160px; }
.k-podium-3 { order: 3; min-height: 130px; background: var(--coral-soft) !important; }
.k-podium .is-me { outline: 4px solid var(--ink); }
.k-final-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

@media (max-width: 900px) {
    .k-qn-hero, .k-room-main { grid-template-columns: 1fr; }
    .k-room-stage { min-height: 0; }
}

@media (max-width: 480px) {
    .k-room-code b { font-size: 1.5rem; letter-spacing: .15em; }
    .k-option { font-size: 1.05rem; min-height: 58px; }
}
