/* Play view (spec §6, §9 placement, §11 look). Positions are % of the viewport, sizes in vh, so the
   board scales from 1280×720 to 1920×1080. */

.play {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(180deg, var(--sky2), var(--sky));
    font-family: var(--font);
    font-weight: 800;
    color: var(--ink);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.play.idle {
    cursor: none;
}

.board {
    position: absolute;
    inset: 0;
}

.board.fade-out {
    animation: fade-out 0.3s ease-in forwards;
}

/* Timer bar: 50 % wide, 4 % from the top. */
.timer {
    position: absolute;
    left: 25%;
    top: 4%;
    width: 50%;
    height: 2.6vh;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    border-radius: 999px;
    background: #e8402f;
    transition: width 60ms linear;
}

/* Task box: 50 % wide, 16 % tall, at 9 %. */
.task-box {
    position: absolute;
    left: 25%;
    top: 9%;
    width: 50%;
    height: 16%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 2.6vh;
    box-shadow: 0 1.2vh 3vh rgba(10, 60, 100, 0.18);
    font-size: min(9vh, 4.6vw);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    animation: task-in 0.4s ease-out;
}

/* Answer boxes: 32 % wide, 22 % tall, at 58 %, 4 % in from each edge. The inner end keeps a figure
   half-width (17.78 vh) plus 1 vw clear for the figure straddling it, on every aspect ratio. */
.answer {
    position: absolute;
    top: 58%;
    width: 32%;
    height: 22%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 2.6vh;
    border: 0.9vh solid #fff;
    box-shadow: 0 1.2vh 3vh rgba(10, 60, 100, 0.18);
    font-size: min(11vh, 5.4vw);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: border-color 0.3s;
}

.answer.long {
    font-size: min(8vh, 3.6vw);
}

.answer-left {
    left: 4%;
    padding-right: calc(1vw + 17.78vh);
}

.answer-right {
    right: 4%;
    padding-left: calc(1vw + 17.78vh);
}

.answer-text {
    animation: answer-in 0.3s ease-out;
}

.answer.mark-ok {
    border-color: var(--ok);
}

.answer.mark-x {
    border-color: var(--bad);
}

.answer.mark-x .answer-text {
    opacity: 0.45;
}

/* Check / X badge on the outer top corner, away from the figures. */
.mark {
    position: absolute;
    top: -6vh;
    width: 13vh;
    height: 13vh;
    animation: mark-in 0.3s cubic-bezier(0.3, 1.6, 0.6, 1) both;
}

.answer-left .mark {
    left: -3vh;
}

.answer-right .mark {
    right: -3vh;
}

.mark svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0.6vh 1vh rgba(0, 0, 0, 0.2));
}

.mark circle {
    stroke: #fff;
    stroke-width: 4;
}

.mark path {
    fill: none;
    stroke: #fff;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mark-ok .mark circle {
    fill: var(--ok);
}

.mark-x .mark circle {
    fill: var(--bad);
}

/* Figures: 48 vh tall (a pose must read from the back row), centred at 35 % / 65 %, so each straddles
   its box's inner end, the head stays below the task box and half a figure width of sky separates them. */
.figure.fig {
    position: absolute;
    bottom: 14%;
    height: 48vh;
    width: 35.56vh;
    margin-left: -17.78vh;
    transform-origin: 50% 100%;
}

.figure.fig svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.fig-left {
    left: 35%;
}

.fig-right {
    left: 65%;
}

.fig.pop-in {
    animation: pop-in 0.4s ease-out both;
}

.fig.roll-out-left,
.fig.roll-out-right {
    transform-origin: 50% 55%;
}

.fig.roll-out-left {
    animation: roll-out-left 0.8s ease-in forwards;
}

.fig.roll-out-right {
    animation: roll-out-right 0.8s ease-in forwards;
}

.paused-badge {
    position: absolute;
    top: 3%;
    right: 2.5%;
    padding: 0.6vh 2.2vh;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent);
    font-size: 3.2vh;
}

/* Toolbar: appears on pointer activity, hides after 4 s (the page decides). */
.play-toolbar {
    position: absolute;
    left: 50%;
    bottom: 2.5%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.play-toolbar.shown {
    opacity: 1;
    pointer-events: auto;
}

.tool {
    font: inherit;
    font-size: 20px;
    min-width: 72px;
    min-height: 64px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    box-shadow: inset 0 0 0 2px var(--line);
}

.tool:hover {
    background: #eef5fb;
}

.tool.exit {
    color: var(--bad);
}

/* In-page exit question (window.confirm would drop full screen). */
.confirm-backdrop {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 40, 70, 0.45);
}

.confirm {
    padding: 4vh 5vh 3vh;
    border-radius: 3vh;
    background: #fff;
    box-shadow: 0 1.2vh 3vh rgba(10, 60, 100, 0.25);
    text-align: center;
}

.confirm p {
    margin: 0 0 3vh;
    font-size: max(24px, 5vh);
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 2.5vh;
}

.confirm-buttons .btn {
    min-width: max(120px, 18vh);
    min-height: max(56px, 8vh);
    font-size: max(18px, 3vh);
}

/* summary: a large "Kész!", the tasks in two tables (three above 20 tasks) readable from the back of
   the room, the buttons bottom-right. All in vh, so 1280×720 and 1920×1080 look the same. */
.summary {
    position: absolute;
    inset: 3vh 0;
    margin: 0 auto;
    width: min(94vw, 130vh);
    display: flex;
    flex-direction: column;
    padding: 2.5vh 4vh;
    border-radius: 3vh;
    background: #fff;
    box-shadow: 0 1.2vh 3vh rgba(10, 60, 100, 0.18);
}

.summary h1 {
    margin: 0 0 1vh;
    font-size: 11vh;
    line-height: 1;
    color: var(--ok);
    text-align: center;
}

/* Centred between the title and the buttons; scrolls only if it ever outgrows the screen. */
.summary-tasks {
    flex: 0 1 auto;
    margin: auto 0;
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: safe center;
    align-items: flex-start;
    gap: 9vh;
    font-size: 4.2vh;
    font-variant-numeric: tabular-nums;
}

.summary table {
    border-collapse: collapse;
}

.summary td {
    padding: 0.25vh 0 0.25vh 1.2vh;
    line-height: 1.25;
    white-space: nowrap;
}

.summary .num {
    padding-left: 0;
    color: var(--muted);
    text-align: right;
}

.summary .prompt {
    padding-left: 2vh;
    text-align: right;
}

.summary .eq {
    color: var(--muted);
}

.summary .correct {
    color: var(--ok);
}

/* Up to 50 tasks still fit on one screen: three narrower columns, smaller type. */
.summary.long {
    width: min(96vw, 165vh);
}

.summary.long h1 {
    font-size: 8vh;
}

.summary.long .summary-tasks {
    gap: 6vh;
    font-size: 3vh;
}

.summary.long td {
    padding-top: 0.15vh;
    padding-bottom: 0.15vh;
}

.summary-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 2vh;
    margin-top: 1.5vh;
}

.summary-buttons .btn {
    min-height: max(48px, 7vh);
    padding: 0 3.5vh;
    font-size: max(16px, 2.8vh);
}

/* Phones held upright (touch screens only, so a narrow laptop window never sees it): the board does not
   fit, so a card covers the play view and asks to turn the phone. Only the display changes; the round
   keeps running. */
.rotate-hint {
    display: none;
}

@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
    .play .board {
        display: none;
    }

    .rotate-hint {
        position: absolute;
        inset: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px;
        background: linear-gradient(180deg, var(--sky2), var(--sky));
    }
}

.rotate-card {
    max-width: 320px;
    padding: 28px 28px 32px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(10, 60, 100, 0.18);
    text-align: center;
}

/* 200×270 figure box, as on the board. */
.figure.rotate-fig {
    width: 133px;
    height: 180px;
    margin: 0 auto 16px;
}

.figure.rotate-fig svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.rotate-card p {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

@keyframes task-in {
    from { opacity: 0; transform: translateY(-1.5vh); }
    to { opacity: 1; transform: none; }
}

@keyframes answer-in {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: none; }
}

@keyframes pop-in {
    0% { transform: scale(0); }
    70% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes roll-out-left {
    to { transform: translateX(calc(-35vw - 18vh)) rotate(-540deg); }
}

@keyframes roll-out-right {
    to { transform: translateX(calc(35vw + 18vh)) rotate(540deg); }
}

@keyframes mark-in {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes fade-out {
    to { opacity: 0; }
}
