.forehead-game-panel {
    --forehead-correct: #4ade80;
    --forehead-pass: #f4d35e;
    --forehead-purple: #8b7cf6;
}

.forehead-game-panel [hidden] {
    display: none !important;
}

.forehead-game-panel-heading {
    align-items: flex-start;
    width: 100%;
    margin-inline: 0;
    text-align: left;
}

.forehead-game-app {
    display: flow-root;
    min-width: 0;
}

#nebuu.tool-panel.active:has(.forehead-game-desktop:not([hidden])) {
    display: flex;
    flex-direction: column;
}

#nebuu.tool-panel.active:has(.forehead-game-desktop:not([hidden])) .forehead-game-panel-heading {
    flex: 0 0 auto;
}

#nebuu.tool-panel.active:has(.forehead-game-desktop:not([hidden])) .forehead-game-app {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    place-items: center;
}

#nebuu.tool-panel.active:has(.forehead-game-desktop:not([hidden])) .forehead-game-desktop {
    margin: 0 auto;
}

.forehead-game-eyebrow {
    display: block;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.forehead-game-desktop {
    display: grid;
    width: min(100%, 760px);
    min-height: 610px;
    margin: 12px auto 0;
    place-items: center;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 20%, rgba(24, 169, 153, 0.1), transparent 36%),
        var(--surface);
    padding: 42px;
    text-align: center;
}

.forehead-game-desktop h3 {
    margin: 10px 0 8px;
    font-size: clamp(24px, 4vw, 34px);
}

.forehead-game-desktop > p {
    max-width: 590px;
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.forehead-game-phone-illustration,
.forehead-game-tilt-demo {
    position: relative;
    display: grid;
    place-items: center;
    border: 2px solid var(--accent);
    background: var(--panel-2);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    color: var(--accent);
    font-weight: 900;
}

.forehead-game-phone-illustration {
    width: 82px;
    height: 128px;
    margin-bottom: 22px;
    border-radius: 18px;
    font-size: 42px;
}

.forehead-game-phone-illustration::before,
.forehead-game-tilt-demo::before {
    position: absolute;
    border-radius: 999px;
    background: var(--accent);
    content: "";
}

.forehead-game-phone-illustration::before {
    bottom: 8px;
    width: 24px;
    height: 3px;
}

.forehead-game-qr-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 22px;
    width: min(100%, 590px);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    padding: 16px;
    text-align: left;
}

.forehead-game-qr {
    display: grid;
    width: 224px;
    height: 224px;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    color: #111;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}

.forehead-game-qr img,
.forehead-game-qr canvas {
    display: block;
    width: 208px !important;
    height: 208px !important;
}

.forehead-game-qr-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

.forehead-game-qr-card p {
    max-height: 48px;
    margin: 0 0 14px;
    overflow: hidden;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.forehead-game-mobile {
    width: min(100%, 920px);
    margin: 0 auto;
}

.forehead-game-screen {
    min-width: 0;
}

.forehead-game-hero {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(24, 169, 153, 0.12), transparent 58%),
        var(--surface);
    padding: 18px;
}

.forehead-game-hero-mark {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--accent), #62d39c);
    box-shadow: 0 12px 32px rgba(24, 169, 153, 0.18);
    color: #06110f;
    font-size: 42px;
    font-weight: 900;
}

.forehead-game-hero h3,
.forehead-game-centered h3,
.forehead-game-result h3 {
    margin: 5px 0;
    font-size: clamp(24px, 6vw, 34px);
}

.forehead-game-hero p,
.forehead-game-centered > p,
.forehead-game-result > p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.forehead-game-menu-stats,
.forehead-game-result-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.forehead-game-menu-stats > div,
.forehead-game-result-stats > div {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    padding: 12px;
    text-align: center;
}

.forehead-game-menu-stats span,
.forehead-game-menu-stats strong,
.forehead-game-result-stats span,
.forehead-game-result-stats strong {
    display: block;
}

.forehead-game-menu-stats span,
.forehead-game-result-stats span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.forehead-game-menu-stats strong {
    font-size: 18px;
}

.forehead-game-setup-card,
.forehead-game-history-wrap {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 16px;
}

.forehead-game-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.forehead-game-section-heading > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.forehead-game-section-heading > div > span {
    display: grid;
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    background: rgba(24, 169, 153, 0.14);
    color: var(--accent);
    font-size: 11px;
    font-weight: 850;
}

.forehead-game-section-heading h4 {
    margin: 0;
    font-size: 14px;
}

.forehead-game-section-heading small {
    color: var(--muted);
    font-size: 10px;
}

.forehead-game-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.forehead-game-category {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-width: 0;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    background: var(--panel);
    color: var(--text);
    padding: 9px;
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.forehead-game-category:first-child {
    grid-column: 1 / -1;
}

.forehead-game-category:hover,
.forehead-game-category.active {
    border-color: rgba(24, 169, 153, 0.62);
    background: rgba(24, 169, 153, 0.08);
}

.forehead-game-category:hover {
    transform: translateY(-1px);
}

.forehead-game-category-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 9px;
    font-weight: 850;
}

.forehead-game-category.active .forehead-game-category-mark {
    border-color: var(--accent);
    background: var(--accent);
    color: #06110f;
}

.forehead-game-category strong,
.forehead-game-category small {
    display: block;
    overflow-wrap: anywhere;
}

.forehead-game-category strong {
    margin-bottom: 3px;
    font-size: 11px;
}

.forehead-game-category small {
    color: var(--muted);
    font-size: 8px;
}

.forehead-game-duration-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.forehead-game-duration-grid button {
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}

.forehead-game-duration-grid button.active {
    border-color: var(--accent);
    background: rgba(24, 169, 153, 0.12);
    box-shadow: inset 0 0 0 1px rgba(24, 169, 153, 0.2);
}

.forehead-game-duration-grid strong {
    margin-right: 3px;
    font-size: 18px;
}

.forehead-game-duration-grid span {
    color: var(--muted);
    font-size: 10px;
}

.forehead-game-menu-actions,
.forehead-game-preparing-actions,
.forehead-game-result-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
}

.forehead-game-start {
    justify-content: space-between;
    min-height: 50px;
    font-size: 14px;
}

.forehead-game-sound {
    gap: 7px;
    min-height: 50px;
}

.forehead-game-message {
    min-height: 18px;
    margin: 10px 0 0;
    color: #ff9ba6;
    font-size: 11px;
    text-align: center;
}

.forehead-game-centered,
.forehead-game-countdown,
.forehead-game-result {
    display: grid;
    min-height: 580px;
    place-items: center;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 25%, rgba(24, 169, 153, 0.12), transparent 36%),
        var(--surface);
    padding: 28px;
    text-align: center;
}

.forehead-game-tilt-demo {
    width: 132px;
    height: 76px;
    margin-bottom: 22px;
    border-radius: 17px;
    font-size: 38px;
    transform: rotate(-7deg);
    animation: forehead-tilt-demo 2.2s ease-in-out infinite;
}

.forehead-game-tilt-demo::before {
    right: 8px;
    width: 3px;
    height: 22px;
}

@keyframes forehead-tilt-demo {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

.forehead-game-centered > p {
    max-width: 560px;
}

.forehead-game-sensor-status {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 2px 10px;
    width: min(100%, 520px);
    margin: 22px 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    padding: 13px 14px;
    text-align: left;
}

.forehead-game-sensor-status > span {
    grid-row: 1 / 3;
    width: 10px;
    height: 10px;
    margin-top: 3px;
    border-radius: 50%;
    background: var(--forehead-pass);
    box-shadow: 0 0 0 4px rgba(244, 211, 94, 0.09);
}

.forehead-game-sensor-status[data-status="ready"] > span,
.forehead-game-sensor-status[data-status="manual"] > span {
    background: var(--forehead-correct);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.09);
}

.forehead-game-sensor-status[data-status="denied"] > span,
.forehead-game-sensor-status[data-status="fallback"] > span {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(255, 95, 109, 0.09);
}

.forehead-game-sensor-status strong {
    font-size: 12px;
}

.forehead-game-sensor-status small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.forehead-game-preparing-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
    width: min(100%, 520px);
}

.forehead-game-countdown {
    color: var(--text);
}

.forehead-game-countdown p,
.forehead-game-countdown span {
    margin: 0;
    color: var(--muted);
    font-size: clamp(13px, 3vw, 18px);
}

.forehead-game-countdown strong {
    display: grid;
    width: min(52vw, 260px);
    height: min(52vw, 260px);
    margin: 22px 0;
    place-items: center;
    border: 2px solid rgba(24, 169, 153, 0.42);
    border-radius: 50%;
    background: rgba(24, 169, 153, 0.08);
    color: var(--accent-strong);
    font-size: clamp(86px, 24vw, 160px);
    line-height: 1;
}

.forehead-game-countdown strong.is-start {
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--forehead-correct);
    font-size: clamp(54px, 15vw, 108px);
}

.forehead-game-play {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 46%, rgba(24, 169, 153, 0.12), transparent 42%),
        #0e1116;
}

.forehead-game-play-top {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    z-index: 3;
    border-bottom: 1px solid var(--line);
    background: rgba(14, 17, 22, 0.92);
    padding: 10px;
}

.forehead-game-icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 22px;
}

.forehead-game-live-score,
.forehead-game-live-category,
.forehead-game-timer {
    display: grid;
    min-width: 72px;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    padding: 6px 10px;
    text-align: center;
}

.forehead-game-live-score span,
.forehead-game-live-category span,
.forehead-game-timer span {
    color: var(--muted);
    font-size: 7px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.forehead-game-live-score strong,
.forehead-game-live-category strong,
.forehead-game-timer strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forehead-game-live-category {
    justify-self: center;
    width: min(100%, 220px);
}

.forehead-game-timer strong {
    font-variant-numeric: tabular-nums;
    font-size: 16px;
}

.forehead-game-timer.is-urgent {
    border-color: rgba(255, 95, 109, 0.75);
    background: rgba(255, 95, 109, 0.12);
    animation: forehead-timer-pulse 0.75s ease-in-out infinite alternate;
}

@keyframes forehead-timer-pulse {
    to { box-shadow: 0 0 0 4px rgba(255, 95, 109, 0.08); }
}

.forehead-game-word-stage {
    display: grid;
    min-width: 0;
    place-items: center;
    align-content: center;
    padding: 24px;
    text-align: center;
}

.forehead-game-word-stage > span {
    color: var(--accent);
    font-size: clamp(10px, 2vw, 15px);
    font-weight: 850;
    letter-spacing: 0.18em;
}

.forehead-game-word-stage h3 {
    max-width: 100%;
    margin: 10px 0;
    overflow-wrap: anywhere;
    color: #fff;
    font-family: Mukta, Inter, sans-serif;
    font-size: clamp(52px, 10vw, 118px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 0.92;
    text-wrap: balance;
}

.forehead-game-word-stage h3.is-entering {
    animation: forehead-word-enter 180ms ease-out;
}

@keyframes forehead-word-enter {
    from { opacity: 0; transform: scale(0.94); }
}

.forehead-game-word-stage p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: clamp(9px, 1.8vw, 12px);
}

.forehead-game-word-stage p strong:first-child {
    color: var(--forehead-correct);
}

.forehead-game-word-stage p strong:last-child {
    color: var(--forehead-pass);
}

.forehead-game-feedback {
    position: absolute;
    inset: 0;
    display: grid;
    z-index: 5;
    place-items: center;
    color: #07120e;
    font-size: clamp(56px, 13vw, 128px);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.forehead-game-feedback.is-correct {
    background: rgba(74, 222, 128, 0.96);
}

.forehead-game-feedback.is-pass {
    background: rgba(244, 211, 94, 0.96);
}

.forehead-game-touch-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    z-index: 3;
    border-top: 1px solid var(--line);
    background: rgba(14, 17, 22, 0.94);
    padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.forehead-game-touch-controls button {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}

.forehead-game-touch-controls button:first-child {
    border-color: rgba(244, 211, 94, 0.38);
    color: #ffe98c;
}

.forehead-game-touch-controls button:last-child {
    border-color: rgba(74, 222, 128, 0.38);
    color: #8bf1aa;
}

.forehead-game-touch-controls strong {
    font-size: 13px;
}

.forehead-game-result {
    align-content: start;
    min-height: 0;
    text-align: left;
}

.forehead-game-result > .forehead-game-eyebrow,
.forehead-game-result > h3,
.forehead-game-result > p {
    justify-self: center;
    text-align: center;
}

.forehead-game-result-emblem {
    display: grid;
    width: 66px;
    height: 66px;
    margin-bottom: 14px;
    place-items: center;
    border-radius: 50%;
    background: var(--forehead-correct);
    box-shadow: 0 14px 34px rgba(74, 222, 128, 0.18);
    color: #07120e;
    font-size: 32px;
    font-weight: 900;
}

.forehead-game-result-stats {
    width: min(100%, 620px);
    margin: 22px auto 14px;
}

.forehead-game-result-stats strong {
    font-size: 26px;
}

.forehead-game-result-stats [data-tone="correct"] {
    border-color: rgba(74, 222, 128, 0.4);
}

.forehead-game-result-stats [data-tone="pass"] {
    border-color: rgba(244, 211, 94, 0.4);
}

.forehead-game-history-wrap {
    width: min(100%, 620px);
    max-height: 330px;
    margin: 0 auto 14px;
    overflow: auto;
    text-align: left;
}

.forehead-game-history {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.forehead-game-history li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 7px 10px;
}

.forehead-game-history li > span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    font-weight: 900;
}

.forehead-game-history li[data-status="correct"] > span {
    background: rgba(74, 222, 128, 0.12);
    color: var(--forehead-correct);
}

.forehead-game-history li[data-status="pass"] > span {
    background: rgba(244, 211, 94, 0.12);
    color: var(--forehead-pass);
}

.forehead-game-history li.is-empty {
    display: block;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
}

.forehead-game-result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 620px);
    margin: 0 auto;
}

.forehead-game-orientation {
    position: fixed;
    inset: 0;
    display: grid;
    z-index: 70;
    place-items: center;
    align-content: center;
    background: rgba(10, 12, 16, 0.98);
    padding: 24px;
    text-align: center;
}

.forehead-game-orientation strong {
    margin-top: 20px;
    font-size: clamp(26px, 7vw, 46px);
}

.forehead-game-orientation p {
    margin: 7px 0 0;
    color: var(--muted);
}

.forehead-game-rotate-phone {
    display: grid;
    width: 138px;
    height: 78px;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: 17px;
    color: var(--accent);
    font-size: 38px;
    animation: forehead-rotate-phone 1.5s ease-in-out infinite;
}

@keyframes forehead-rotate-phone {
    50% { transform: rotate(90deg); }
}

.forehead-game-debug {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    z-index: 90;
    width: 210px;
    max-height: calc(100dvh - 16px);
    overflow: auto;
    border: 1px solid rgba(244, 211, 94, 0.52);
    border-radius: 9px;
    background: rgba(13, 15, 20, 0.94);
    padding: 10px;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 9px;
}

.forehead-game-debug > strong {
    display: block;
    margin-bottom: 7px;
    color: var(--forehead-pass);
}

.forehead-game-debug dl {
    display: grid;
    gap: 3px;
    margin: 0;
}

.forehead-game-debug dl > div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.forehead-game-debug dt {
    color: var(--muted);
}

.forehead-game-debug dd {
    margin: 0;
    text-align: right;
}

.forehead-game-category:focus-visible,
.forehead-game-duration-grid button:focus-visible,
.forehead-game-touch-controls button:focus-visible,
.forehead-game-icon-button:focus-visible,
.forehead-game-panel button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body.forehead-game-immersive {
    overflow: hidden;
    overscroll-behavior: none;
}

body.forehead-game-immersive .app-shell {
    display: block;
}

body.forehead-game-immersive .sidebar {
    display: none;
}

body.forehead-game-immersive .workspace {
    width: 100%;
    height: var(--forehead-game-viewport-height, 100dvh);
    overflow: hidden;
    padding: 0;
}

body.forehead-game-immersive #nebuu.tool-panel.active {
    width: 100%;
    height: var(--forehead-game-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #0e1116;
    padding: 0;
    animation: none;
}

body.forehead-game-immersive .forehead-game-panel-heading {
    display: none;
}

body.forehead-game-immersive .forehead-game-app,
body.forehead-game-immersive .forehead-game-mobile,
body.forehead-game-immersive .forehead-game-screen {
    width: 100%;
    max-width: none;
    height: var(--forehead-game-viewport-height, 100dvh);
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered {
    grid-template-columns: minmax(160px, 0.6fr) minmax(280px, 1.4fr);
    grid-template-rows: auto auto auto auto;
    column-gap: clamp(24px, 6vw, 72px);
    padding: max(18px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    text-align: left;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered .forehead-game-tilt-demo {
    grid-row: 1 / 5;
    width: clamp(150px, 24vw, 280px);
    height: clamp(90px, 14vw, 164px);
    margin: 0;
    justify-self: end;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered .forehead-game-eyebrow,
body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered h3,
body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered > p,
body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-sensor-status,
body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-preparing-actions {
    grid-column: 2;
    justify-self: stretch;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered h3 {
    font-size: clamp(24px, 4vw, 42px);
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-sensor-status {
    margin: 12px 0;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-countdown {
    grid-template-columns: 1fr auto 1fr;
    column-gap: 6vw;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-countdown strong {
    width: min(32vh, 230px);
    height: min(32vh, 230px);
    margin: 0;
    font-size: min(24vh, 150px);
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-countdown strong.is-start {
    width: auto;
    font-size: min(18vh, 106px);
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-play {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-play-top {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
}

body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-touch-controls {
    width: min(100%, 660px);
    justify-self: center;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
}

@media (max-width: 760px) {
    .forehead-game-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .forehead-game-desktop {
        padding: 28px 20px;
    }

    .forehead-game-qr-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}

@media (max-width: 460px) {
    .forehead-game-panel {
        padding: 12px;
    }

    .forehead-game-hero {
        grid-template-columns: 56px minmax(0, 1fr);
        padding: 14px;
    }

    .forehead-game-hero-mark {
        width: 56px;
        height: 56px;
        border-radius: 14px;
        font-size: 32px;
    }

    .forehead-game-hero h3 {
        font-size: 22px;
    }

    .forehead-game-hero p {
        font-size: 11px;
    }

    .forehead-game-setup-card,
    .forehead-game-history-wrap {
        padding: 12px;
    }

    .forehead-game-category-grid {
        gap: 7px;
    }

    .forehead-game-category {
        grid-template-columns: 32px minmax(0, 1fr);
        min-height: 58px;
        padding: 7px;
    }

    .forehead-game-category-mark {
        width: 32px;
        height: 32px;
    }

    .forehead-game-menu-actions,
    .forehead-game-preparing-actions,
    .forehead-game-result-actions {
        grid-template-columns: 1fr;
    }

    .forehead-game-centered,
    .forehead-game-countdown,
    .forehead-game-result {
        min-height: 520px;
        padding: 20px 14px;
    }

    .forehead-game-play-top {
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        gap: 5px;
        padding: 7px;
    }

    .forehead-game-live-score,
    .forehead-game-live-category,
    .forehead-game-timer {
        min-width: 0;
        padding: 5px 7px;
    }

    .forehead-game-live-category {
        width: auto;
    }

    .forehead-game-word-stage {
        padding: 16px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .forehead-game-category,
    .forehead-game-word-stage h3,
    .forehead-game-tilt-demo,
    .forehead-game-rotate-phone,
    .forehead-game-timer.is-urgent {
        animation: none;
        transition: none;
    }
}

.forehead-game-app.is-desktop .forehead-game-tilt-demo { animation: none; }

/* Clear setup hierarchy and comfortable controls across devices. */
.forehead-game-mobile { width: min(100%, 1120px); }
.forehead-game-menu { display: grid; gap: 20px; }
.forehead-game-hero { margin: 0; padding: 28px; border-radius: 20px; background: radial-gradient(ellipse at top right, #18a99920, transparent 65%), var(--surface); }
.forehead-game-hero h3 { font-size: clamp(24px, 3vw, 34px); line-height: 1.2; margin: 8px 0 12px; letter-spacing: -.03em; }
.forehead-game-hero p { font-size: 14px; line-height: 1.65; max-width: 650px; }
.forehead-game-hero-mark { border-radius: 22px 22px 22px 6px; transform: rotate(-5deg); }
.forehead-game-setup-card { margin: 0; padding: 20px; border-radius: 16px; }
.forehead-game-section-heading { margin-bottom: 18px; }
.forehead-game-section-heading h4 { font-size: 16px; }
.forehead-game-section-heading small { font-size: 11px; }
.forehead-game-category-grid { gap: 10px; }
.forehead-game-category { position: relative; min-height: 72px; border-radius: 12px; padding: 12px; }
.forehead-game-category strong { font-size: 13px; }
.forehead-game-category small { font-size: 11px; }
.forehead-game-category-mark { font-size: 12px; color: #94c8c2; border: 0; border-radius: 10px; }
.forehead-game-category.active { border-color: #41bfae; background: #18a99918; box-shadow: inset 0 0 0 1px #41bfae; }
.forehead-game-category:first-child.active::after { content: '✓'; position: absolute; right: 16px; color: #7ce1cd; font-weight: 800; }
.forehead-game-menu-stats { margin: 0; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.forehead-game-menu-stats > div { border: 0; border-radius: 0; padding: 18px 8px; }
.forehead-game-menu-stats > div + div { border-left: 1px solid var(--line); }
.forehead-game-menu-stats span { font-size: 11px; text-transform: none; letter-spacing: 0; }
.forehead-game-menu-stats strong { font-size: 24px; }
.forehead-game-duration-grid { gap: 6px; }
.forehead-game-duration-grid button { min-height: 60px; border-radius: 12px; }
.forehead-game-menu-actions { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); align-content: start; }
.forehead-game-selection { grid-column: 1 / -1; margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.forehead-game-start { border-radius: 12px; min-height: 52px; }
.forehead-game-sound { border-radius: 12px; }
.forehead-game-message:empty { display: none; }
.forehead-game-panel button:focus-visible { outline: 3px solid #86dece; outline-offset: 3px; }
.forehead-game-panel button { touch-action: manipulation; }
.forehead-game-app.is-desktop .forehead-game-tilt-demo { transform: none; border-radius: 14px; border-bottom-width: 8px; background: linear-gradient(150deg, #183b37, #152326); }
.forehead-game-app.is-desktop .forehead-game-tilt-demo::before { top: calc(100% + 8px); bottom: auto; width: 65%; height: 5px; }
.forehead-game-word-stage { background: radial-gradient(ellipse at center, #18a99912, transparent 65%); }
.forehead-game-word-stage > p { font-size: 14px; }
.forehead-game-play-top { gap: 14px; padding: 18px; }
.forehead-game-live-score, .forehead-game-live-category, .forehead-game-timer { padding: 10px 16px; border-radius: 12px; }
.forehead-game-live-score span, .forehead-game-live-category span, .forehead-game-timer span { font-size: 10px; }
.forehead-game-live-score strong, .forehead-game-live-category strong, .forehead-game-timer strong { font-size: 18px; }
.forehead-game-timer strong { font-variant-numeric: tabular-nums; }
.forehead-game-icon-button { width: 44px; height: 44px; }
.forehead-game-result { border-radius: 20px; gap: 12px; }
.forehead-game-result-actions button, .forehead-game-preparing-actions button { min-height: 48px; border-radius: 12px; }
@media (min-width: 1200px) {
 .forehead-game-menu { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
 .forehead-game-hero { grid-column: 1 / -1; }
 .forehead-game-category-card { grid-column: 1; grid-row: 2 / 5; }
 .forehead-game-duration-card { grid-column: 2; grid-row: 2; }
 .forehead-game-menu-actions { grid-column: 2; grid-row: 3; grid-template-columns: 1fr; }
 .forehead-game-start { grid-row: 2; }
 .forehead-game-message { grid-column: 2; }
}
@media (max-width: 600px) {
 .forehead-game-menu { gap: 14px; }
 .forehead-game-hero { padding: 18px; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
 .forehead-game-hero-mark { width: 44px; height: 52px; font-size: 30px; }
 .forehead-game-hero h3 { font-size: 22px; }
 .forehead-game-hero p { font-size: 13px; }
 .forehead-game-setup-card, .forehead-game-menu-actions { padding: 14px; }
 .forehead-game-category { grid-template-columns: 30px minmax(0, 1fr); gap: 7px; padding: 9px; min-height: 68px; }
 .forehead-game-category-mark { width: 30px; height: 34px; font-size: 10px; }
 .forehead-game-category strong { font-size: 12px; }
 .forehead-game-category small { font-size: 10px; }
 .forehead-game-play-top { gap: 6px; padding: 8px; }
 .forehead-game-live-score, .forehead-game-live-category, .forehead-game-timer { padding: 6px; min-width: 0; }
 .forehead-game-live-score strong, .forehead-game-live-category strong, .forehead-game-timer strong { font-size: 14px; }
 .forehead-game-word-stage > p { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
 .forehead-game-panel *, .forehead-game-panel *::before, .forehead-game-panel *::after { animation: none !important; transition: none !important; }
}

/* Short landscape screens must keep actions reachable. */
body.forehead-game-immersive .forehead-game-centered { overflow-y: auto; overscroll-behavior: contain; }
.forehead-game-orientation { overflow-y: auto; }
#forehead-game-orientation-back { min-height: 44px; margin-top: 20px; }
.forehead-game-recalibrate { min-height: 44px; margin-top: 8px; padding: 6px 12px; font-size: 12px; }
.forehead-game-word-stage { min-height: 0; overflow-y: auto; }
@media (orientation: landscape) and (max-height: 500px) {
 body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered { align-content: start; grid-template-columns: minmax(80px,.4fr) minmax(0,1fr); gap: 8px 20px; padding: 12px 20px; }
 body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered h3 { font-size: 24px; }
 body.forehead-game-immersive.forehead-game-is-landscape .forehead-game-centered .forehead-game-tilt-demo { width: 100px; height: 65px; }
 body.forehead-game-immersive .forehead-game-word-stage { padding: 6px 14px; }
 body.forehead-game-immersive .forehead-game-word-stage h3 { font-size: clamp(28px, 9vh, 48px); line-height: 1.05; margin: 4px 0; }
 body.forehead-game-immersive .forehead-game-word-stage > span { font-size: 10px; }
 body.forehead-game-immersive .forehead-game-play-top { padding: 6px 10px; gap: 6px; }
 body.forehead-game-immersive .forehead-game-live-score, body.forehead-game-immersive .forehead-game-live-category, body.forehead-game-immersive .forehead-game-timer { padding: 4px 8px; }
 body.forehead-game-immersive .forehead-game-touch-controls { padding-top: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
 body.forehead-game-immersive .forehead-game-touch-controls button { min-height: 44px; }
}

.forehead-game-last-round { min-width: 0; margin: 0; border-radius: 16px; }
.forehead-game-last-round summary { cursor: pointer; font-size: 14px; font-weight: 700; min-height: 44px; padding: 10px 0; }
.forehead-game-last-round summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 6px; }
.forehead-game-last-round > p { font-size: 12px; color: var(--muted); margin: 8px 0 12px; }
.forehead-game-last-round .forehead-game-history { max-height: 260px; overflow-y: auto; }
@media (min-width:1200px) { .forehead-game-last-round { grid-column: 2; grid-row: 4; } }

/* Keep the desktop countdown and round at the same panel height. */
.forehead-game-app.is-desktop .forehead-game-countdown,
.forehead-game-app.is-desktop .forehead-game-play {
    min-height: 580px;
}
