* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

body {
    overflow: hidden;
    background: #15255a;
    background-image: linear-gradient(145deg, #15255a 0%, #2458a5 48%, #f45b69 100%);
    color: #fff9e9;
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.spark {
    position: fixed;
    z-index: 0;
    width: 2.2vh;
    height: 2.2vh;
    border: 0.55vh solid #ffd95a;
    transform: rotate(22deg);
    opacity: 0.65;
    pointer-events: none;
}

.spark-one {
    top: 5vh;
    left: 44vw;
}

.spark-two {
    right: 3vw;
    bottom: 4vh;
    border-color: #68efe1;
    transform: rotate(44deg);
}

.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    height: 100%;
    padding: 1.4vh;
    flex-direction: column;
}

.topbar,
.game-card,
.join-card,
.score-card {
    border: 0.18vh solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 1.2vh 2.8vh rgba(5, 16, 48, 0.3);
}

.topbar {
    display: flex;
    height: 10vh;
    min-height: 68px;
    padding: 1.1vh 1.5vh;
    border-radius: 2vh;
    background: rgba(13, 32, 82, 0.9);
    flex: 0 0 auto;
    align-items: center;
}

.brand-mark {
    display: flex;
    width: 7vh;
    height: 7vh;
    min-width: 50px;
    min-height: 50px;
    margin-right: 1.3vh;
    padding: 1vh;
    border: 0.4vh solid #fff9e9;
    border-radius: 1.7vh;
    background: #ff6d6a;
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-around;
    transform: rotate(-4deg);
}

.brand-dot {
    width: 1.45vh;
    height: 1.45vh;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    background: #fff9e9;
}

.brand-dot.is-odd {
    background: #ffd95a;
    transform: translateY(-0.75vh);
}

.brand-copy {
    min-width: 0;
}

.eyebrow,
.caption-kicker,
.timer-card span,
.overlay-kicker {
    margin: 0;
    color: #ffd95a;
    font-size: 1.15vh;
    font-weight: 900;
    letter-spacing: 0.16em;
    line-height: 1.1;
    text-transform: uppercase;
}

.brand-copy h1 {
    margin: 0.35vh 0 0;
    font-size: 4vh;
    line-height: 0.95;
    text-shadow: 0 0.32vh 0 #9d285d;
}

.round-meta {
    margin-left: auto;
    padding: 0 2vh;
    text-align: right;
}

.round-meta strong {
    display: block;
    margin-top: 0.5vh;
    font-size: 1.55vh;
}

.phase-badge,
.answer-progress,
.player-count {
    display: inline-block;
    padding: 0.5vh 0.9vh;
    border-radius: 2vh;
    background: #68efe1;
    color: #182157;
    font-size: 1.15vh;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.timer-card {
    width: 8.3vh;
    min-width: 60px;
    padding: 0.8vh;
    border-radius: 1.4vh;
    background: #fff9e9;
    color: #29155f;
    text-align: center;
}

.timer-card span,
.timer-card strong {
    display: block;
}

.timer-card span {
    color: #b12868;
}

.timer-card strong {
    margin-top: 0.2vh;
    font-size: 3vh;
    line-height: 1;
}

.game-layout {
    display: flex;
    min-height: 0;
    padding-top: 1.2vh;
    flex: 1 1 auto;
}

.game-card {
    display: flex;
    min-width: 0;
    padding: 1.5vh;
    border-radius: 2.2vh;
    background: rgba(23, 30, 79, 0.88);
    flex: 1 1 auto;
    flex-direction: column;
}

.game-heading,
.side-heading {
    display: flex;
    align-items: center;
}

.game-heading h2,
.side-heading h2 {
    margin: 0.3vh 0 0;
    color: #fff;
    font-size: 2.15vh;
    line-height: 1.05;
}

.heading-meta {
    display: flex;
    margin-left: auto;
    align-items: center;
}

.points-legend {
    margin-right: 1.4vh;
    color: #dfe5ff;
    font-size: 1.1vh;
    line-height: 1.4;
    text-align: right;
}

.points-legend span {
    display: block;
}

.points-legend strong {
    color: #ffd95a;
}

.board-wrap {
    position: relative;
    min-height: 0;
    margin-top: 1.1vh;
    flex: 1 1 auto;
}

.tile-board {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex-wrap: wrap;
    align-content: space-between;
    justify-content: space-between;
}

.picture-tile {
    position: relative;
    display: flex;
    width: 32.65%;
    height: 49.2%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0.38vh solid #fff9e9;
    border-radius: 1.7vh;
    background: #fff4d8;
    box-shadow: 0 0.65vh 0 #6b3f9b;
    color: #182157;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.picture-tile:disabled {
    cursor: default;
}

.picture-tile:hover:not(:disabled),
.picture-tile:focus:not(:disabled) {
    border-color: #ffd95a;
    outline: none;
}

.picture-tile.is-entering {
    animation: picture-tile-in 420ms ease-out both;
}

@keyframes picture-tile-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.tile-board.is-fading-out .picture-tile {
    animation: picture-tile-out 500ms ease-in both;
}

@keyframes picture-tile-out {
    to {
        opacity: 0;
    }
}

.tile-board.is-faded-out .picture-tile {
    animation: none;
    opacity: 0;
}

.picture-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.tile-letter {
    position: absolute;
    top: 0.75vh;
    left: 0.75vh;
    width: 3.1vh;
    height: 3.1vh;
    min-width: 24px;
    min-height: 24px;
    border: 0.22vh solid #fff9e9;
    border-radius: 50%;
    background: #2b236d;
    color: #fff9e9;
    font-size: 1.45vh;
    font-weight: 900;
    line-height: 2.7vh;
    text-align: center;
}

.tile-board.is-reveal .picture-tile {
    opacity: 0.48;
}

.tile-board.is-reveal .picture-tile.is-odd {
    border-color: #68efe1;
    background: #c8fff4;
    box-shadow: 0 0 0 0.5vh #ffd95a;
    opacity: 1;
}

.tile-board.is-reveal .picture-tile.is-odd:after {
    position: absolute;
    right: 0.8vh;
    bottom: 0.8vh;
    padding: 0.55vh 0.8vh;
    border-radius: 1.2vh;
    background: #ff5d79;
    color: #fff;
    content: "ODD!";
    font-size: 1.25vh;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.picture-tile.is-selected {
    border-color: #ffd95a;
    box-shadow: 0 0 0 0.42vh #ffd95a;
}

.picture-tile.is-wrong {
    border-color: #ff7095;
    box-shadow: 0 0 0 0.42vh #ff7095;
}

.stage-overlay {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    width: 48%;
    min-width: 300px;
    padding: 2.1vh;
    border: 0.3vh solid rgba(255, 255, 255, 0.78);
    border-radius: 2vh;
    background: rgba(36, 19, 91, 0.95);
    box-shadow: 0 1vh 3vh rgba(8, 4, 32, 0.52);
    text-align: center;
    transform: translate(-50%, -50%);
}

.stage-overlay h2 {
    margin: 0.65vh 0 0.75vh;
    font-size: 3vh;
    line-height: 1.02;
}

.stage-overlay p:not(.overlay-kicker) {
    max-width: 48vh;
    margin: 0 auto;
    color: #e4e7ff;
    font-size: 1.55vh;
    line-height: 1.35;
}

.primary-button {
    min-height: 5vh;
    margin-top: 1.6vh;
    padding: 0.9vh 2.1vh;
    border: 0;
    border-radius: 2.6vh;
    background: #ffd95a;
    color: #28135e;
    box-shadow: 0 0.55vh 0 #e9862d;
    cursor: pointer;
    font-size: 1.55vh;
    font-weight: 900;
}

.primary-button:active {
    box-shadow: none;
    transform: translateY(0.45vh);
}

.game-status {
    height: 3.1vh;
    margin: 0.8vh 0 0;
    padding: 0 1vh;
    border-radius: 1vh;
    background: #26356f;
    color: #cbd5ff;
    font-size: 1.2vh;
    line-height: 3.1vh;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 0 3.1vh;
}

.side-rail {
    display: flex;
    width: 30vh;
    min-width: 220px;
    max-width: 330px;
    margin-left: 1.2vh;
    flex: 0 0 auto;
    flex-direction: column;
}

.join-card,
.score-card {
    padding: 1.25vh;
    overflow: hidden;
    border-radius: 2vh;
    background: rgba(29, 20, 76, 0.9);
}

.join-card {
    flex: 0 0 auto;
}

.score-card {
    min-height: 0;
    margin-top: 1.1vh;
    flex: 1 1 auto;
}

.network-dot {
    width: 1.2vh;
    height: 1.2vh;
    margin-left: auto;
    border-radius: 50%;
    background: #ffd95a;
    box-shadow: 0 0 1vh #ffd95a;
}

.network-dot.is-online {
    background: #68efe1;
    box-shadow: 0 0 1vh #68efe1;
}

.qr-panel {
    position: relative;
    height: 192px;
    margin-top: 0.9vh;
    overflow: hidden;
    text-align: center;
}

.qr-placeholder {
    margin: 5vh 1vh 0;
    color: #cbd5ff;
    font-size: 1.2vh;
}

.qr-modal-button {
    display: none;
}

.rcRoomQrCodeLink,
.rcRoomQrCodeLink * {
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin: 0.5vh auto 0;
    overflow: hidden;
    border: solid 8px #fff;
    border-radius: 8px;
    background: #fff;
    color: #fff;
    text-align: center;
    text-decoration: none;
    transform: scale(0.72);
    transform-origin: top center;
}

.rcTechLabel {
    margin: 0 0 8px;
    padding: 4px;
    background: #000;
    color: #fff;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.2em;
}

.rcRoomQrCode {
    width: 150px;
    height: 150px;
    overflow: hidden;
}

.rcRoomQrCode img,
.rcRoomQrCode canvas {
    display: block;
    width: 150px !important;
    height: 150px !important;
}

.rcRoomId {
    margin: 8px 0 0;
    padding: 4px;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 0.25em;
    text-overflow: clip;
    white-space: nowrap;
}

.player-count {
    margin-left: auto;
    padding-right: 0.7vh;
    padding-left: 0.7vh;
    font-size: 1vh;
}

.score-list {
    margin: 1vh 0 0;
    padding: 0;
    list-style: none;
}

.score-row {
    display: flex;
    min-height: 5.4vh;
    padding: 0.8vh 0.9vh;
    border-radius: 1.1vh;
    background: rgba(255, 255, 255, 0.09);
    align-items: center;
}

.score-row + .score-row {
    margin-top: 0.6vh;
}

.score-rank {
    width: 2.5vh;
    color: #ffd95a;
    font-size: 1.4vh;
    font-weight: 900;
}

.score-name {
    min-width: 0;
    overflow: hidden;
    font-size: 1.35vh;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
}

.score-points {
    margin-left: 0.7vh;
    color: #68efe1;
    font-size: 1.35vh;
    font-weight: 900;
    white-space: nowrap;
}

.score-row.is-fastest {
    background: #684491;
}

.score-row.is-fastest .score-name:after {
    color: #ffd95a;
    content: " \26A1";
}

.qr-modal {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.qr-modal-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(8, 4, 32, 0.86);
}

.qr-modal-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 310px;
    max-width: 88vw;
    padding: 24px 20px 20px;
    border: 3px solid #fff9e9;
    border-radius: 22px;
    background: #2d1a72;
    box-shadow: 0 18px 50px rgba(8, 2, 26, 0.62);
    text-align: center;
    transform: translate(-50%, -50%);
}

.qr-modal-card h2 {
    margin: 7px 0 5px;
    font-size: 27px;
}

.qr-modal-card > p:not(.overlay-kicker) {
    margin: 0;
    color: #e4e7ff;
    font-size: 14px;
    line-height: 1.35;
}

.qr-modal-close {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ff5d79;
    color: #fff;
    cursor: pointer;
    font-size: 30px;
    font-weight: 900;
    line-height: 38px;
}

.qr-modal-panel {
    height: 244px;
    margin-top: 12px;
    overflow: hidden;
}

.qr-modal-panel .rcRoomQrCodeLink {
    margin-top: 0;
    transform: scale(1);
}

.lean-paint body,
body.lean-paint {
    background: #18366f;
    background-image: none;
}

.lean-paint .spark {
    display: none;
}

.lean-paint .topbar,
.lean-paint .game-card,
.lean-paint .join-card,
.lean-paint .score-card,
.lean-paint .picture-tile,
.lean-paint .stage-overlay,
.lean-paint .primary-button,
.lean-paint .network-dot,
.lean-paint .qr-modal-card {
    box-shadow: none;
}

.lean-paint .picture-tile.is-entering {
    animation: none;
}

.lean-paint .tile-board.is-fading-out .picture-tile,
.lean-paint .tile-board.is-faded-out .picture-tile {
    animation: none;
    opacity: 0;
}

@media (orientation: landscape) and (max-height: 620px) {
    .app-shell {
        padding: 7px;
    }

    .topbar {
        height: 62px;
        min-height: 62px;
        padding: 7px 10px;
        border-radius: 14px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        margin-right: 9px;
        padding: 6px;
        border-width: 2px;
        border-radius: 11px;
    }

    .brand-dot {
        width: 8px;
        height: 8px;
        min-width: 8px;
        min-height: 8px;
    }

    .brand-copy h1 {
        font-size: 27px;
    }

    .eyebrow {
        font-size: 8px;
    }

    .round-meta strong {
        font-size: 10px;
    }

    .phase-badge {
        padding: 3px 6px;
        font-size: 8px;
    }

    .timer-card {
        width: 47px;
        min-width: 47px;
        padding: 5px;
        border-radius: 9px;
    }

    .timer-card span {
        font-size: 8px;
    }

    .timer-card strong {
        font-size: 21px;
    }

    .game-layout {
        padding-top: 7px;
    }

    .game-card,
    .join-card,
    .score-card {
        border-radius: 14px;
    }

    .game-card {
        padding: 9px;
    }

    .game-heading h2,
    .side-heading h2 {
        font-size: 14px;
    }

    .caption-kicker,
    .points-legend,
    .answer-progress,
    .player-count {
        font-size: 8px;
    }

    .board-wrap {
        margin-top: 7px;
    }

    .picture-tile {
        border-width: 2px;
        border-radius: 10px;
        box-shadow: 0 4px 0 #6b3f9b;
    }

    .tile-letter {
        top: 5px;
        left: 5px;
        width: 23px;
        height: 23px;
        min-width: 23px;
        min-height: 23px;
        font-size: 10px;
        line-height: 20px;
    }

    .stage-overlay {
        width: 54%;
        min-width: 260px;
        padding: 12px;
        border-width: 2px;
        border-radius: 13px;
    }

    .stage-overlay h2 {
        margin: 4px 0 5px;
        font-size: 20px;
    }

    .stage-overlay p:not(.overlay-kicker) {
        font-size: 10px;
    }

    .primary-button {
        min-height: 34px;
        margin-top: 9px;
        padding: 6px 11px;
        font-size: 11px;
    }

    .game-status {
        height: 17px;
        margin-top: 5px;
        font-size: 8px;
        line-height: 17px;
        flex-basis: 17px;
    }

    .side-rail {
        width: 215px;
        min-width: 215px;
        margin-left: 7px;
    }

    .join-card,
    .score-card {
        padding: 8px;
    }

    .qr-panel {
        height: 148px;
        margin-top: 5px;
    }

    .qr-panel .rcRoomQrCodeLink {
        position: absolute;
        top: 0;
        left: 50%;
        margin-left: -83px;
        transform: scale(0.56);
    }

    .score-row {
        min-height: 0;
        padding: 5px 6px;
        border-radius: 7px;
    }

    .score-row + .score-row {
        margin-top: 4px;
    }

    .score-rank,
    .score-name,
    .score-points {
        font-size: 10px;
    }
}

@media (orientation: portrait) {
    .app-shell {
        padding: 1vh;
    }

    .topbar {
        height: 8.8vh;
        min-height: 66px;
        padding: 1vh;
    }

    .brand-mark {
        width: 6.2vh;
        height: 6.2vh;
        min-width: 46px;
        min-height: 46px;
        margin-right: 0.9vh;
    }

    .brand-copy h1 {
        font-size: 3vh;
    }

    .eyebrow {
        font-size: 0.8vh;
    }

    .round-meta {
        display: none;
    }

    .timer-card {
        width: 6.8vh;
        min-width: 52px;
        margin-left: auto;
    }

    .game-layout {
        display: block;
        height: 89.2vh;
        padding-top: 0.8vh;
    }

    .game-card {
        height: 43.5vh;
        padding: 1vh;
    }

    .board-wrap {
        height: 64vw;
        max-height: 36vh;
        flex: 0 0 64vw;
    }

    .game-heading h2 {
        font-size: 1.65vh;
    }

    .caption-kicker {
        font-size: 0.85vh;
    }

    .points-legend {
        display: none;
    }

    .answer-progress {
        font-size: 0.82vh;
    }

    .picture-tile {
        width: 32.7%;
        border-width: 2px;
        border-radius: 1.1vh;
    }

    .tile-letter {
        top: 0.45vh;
        left: 0.45vh;
        width: 2.6vh;
        height: 2.6vh;
        min-width: 22px;
        min-height: 22px;
        font-size: 1.05vh;
        line-height: 2.3vh;
    }

    .stage-overlay {
        width: 82%;
        min-width: 0;
        padding: 1.5vh;
    }

    .stage-overlay h2 {
        font-size: 2.3vh;
    }

    .stage-overlay p:not(.overlay-kicker) {
        font-size: 1.2vh;
    }

    .primary-button {
        min-height: 4.5vh;
        font-size: 1.25vh;
    }

    .game-status {
        height: 2.2vh;
        margin-top: 0.5vh;
        font-size: 0.85vh;
        line-height: 2.2vh;
        flex-basis: 2.2vh;
    }

    .side-rail {
        display: flex;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 44.1vh;
        margin: 0.7vh 0 0;
        flex-direction: row;
    }

    .join-card,
    .score-card {
        height: 100%;
        padding: 0.9vh;
    }

    .join-card {
        position: relative;
        width: 34%;
    }

    .score-card {
        width: calc(66% - 0.8vh);
        margin: 0 0 0 0.8vh;
    }

    .side-heading h2 {
        font-size: 1.2vh;
    }

    .join-card .caption-kicker,
    .join-card .side-heading h2,
    .join-card .network-dot {
        display: none;
    }

    .join-card .qr-panel {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        display: block;
        height: auto;
        margin: 0;
    }

    .join-card .rcRoomQrCodeLink {
        position: absolute;
        top: 2vh;
        left: 50%;
        margin: 0;
        transform: translateX(-50%) scale(0.9);
        transform-origin: top left;
    }

    .player-count {
        font-size: 0.72vh;
    }

    .score-list {
        margin-top: 0.45vh;
    }

    .score-row {
        width: 100%;
        min-height: 5vh;
        padding: 0.55vh 0.7vh;
    }

    .score-row + .score-row {
        margin-top: 0.45vh;
    }

    .score-rank,
    .score-name,
    .score-points {
        font-size: 1.05vh;
    }

    .score-rank {
        width: 2vh;
    }

    .qr-modal-panel .rcRoomQrCodeLink {
        position: static;
        margin: 0 auto;
        transform: none;
    }
}

@media (orientation: portrait) and (max-width: 540px) {
    .brand-copy h1 {
        font-size: 2.6vh;
    }

    .brand-copy .eyebrow {
        font-size: 0.72vh;
        letter-spacing: 0.11em;
    }

    .stage-overlay {
        width: 90%;
    }

    .join-card .qr-panel {
        display: none;
    }

    .qr-modal-button {
        position: absolute;
        top: 50%;
        left: 50%;
        display: block;
        width: 86%;
        min-height: 7vh;
        padding: 0.7vh;
        border: 0.25vh solid #fff9e9;
        border-radius: 1.4vh;
        background: #ffd95a;
        color: #28135e;
        font-size: 1.2vh;
        font-weight: 900;
        transform: translate(-50%, -50%);
    }

    .picture-tile {
        width: 32.4%;
    }

    .tile-board.is-reveal .picture-tile.is-odd:after {
        right: 0.4vh;
        bottom: 0.4vh;
        font-size: 0.8vh;
    }
}
