@font-face {
    font-family: "Noto Sans JP";
    src: url("/bingo/noto-sans-jp-ui-black.woff2") format("woff2");
    font-weight: 900;
    font-display: swap;
}
@font-face {
    font-family: "Noto Sans JP";
    src: url("/bingo/noto-sans-jp-ui-regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: #f8f2e4;
    color: #153d52;
    font:
        16px/1.8 "Noto Sans JP",
        system-ui,
        sans-serif;
}
main {
    padding: 0 4px;
}
.machine {
    position: relative;
    width: min(100%, 74svh);
    margin: 0 auto;
    aspect-ratio: 1086/1448;
    container-type: inline-size;
}
.art {
    width: 100%;
    height: 100%;
    display: block;
}
.machine header {
    position: absolute;
    left: 10%;
    top: 7%;
    width: 80%;
}
.machine h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.machine header > span {
    display: none;
}
button,
select {
    font:
        900 16px/1.2 "Noto Sans JP",
        system-ui;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    color: #153d52;
    touch-action: manipulation;
}
button:disabled {
    cursor: default;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible,
select:focus-visible {
    outline: 3px solid #075bab;
    outline-offset: 3px;
}
[hidden] {
    display: none !important;
}
.screen {
    position: absolute;
    left: 12.8%;
    top: 23.4%;
    width: 74.5%;
    height: 29.65%;
    overflow: hidden;
    border-radius: 1%;
    background: #d6eff5;
}
.screen canvas {
    width: 100%;
    height: 100%;
    display: block;
}
#round-meter {
    position: absolute;
    left: 3%;
    top: 1.5%;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 900;
    color: #153f54;
    border-radius: 20px;
    padding: 3px 9px;
    background: linear-gradient(#fffef3, #f5deb0);
    border: 1px solid #b69b58;
    box-shadow: 0 2px 2px #65786533;
}
#round-meter b {
    font-size: 18px;
    color: #bd341e;
}
#card-label {
    position: absolute;
    right: 4%;
    top: 2%;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.3;
}
#status {
    position: absolute;
    bottom: 1.5%;
    left: 3%;
    right: 3%;
    text-align: center;
    border: 1px solid #bb9150;
    background: linear-gradient(#fffff8, #fff0c9);
    border-radius: 20px;
    padding: 4px 7px;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.3;
    box-shadow: 0 2px 3px #68582425;
}
#hint {
    position: absolute;
    left: 50%;
    right: 2%;
    top: 1%;
    padding: 3px;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.25;
    background: #fff3d7;
    color: #934017;
    border-radius: 10px;
}
body.choosing #card-label {
    visibility: hidden;
}
#row-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px;
    background: linear-gradient(#fff9e7, #f8dfaa);
    border-top: 2px solid #b58744;
    box-shadow: 0 -4px 12px #6c594428;
}
#row-controls > div {
    display: flex;
    gap: 4px;
}
select {
    width: 92px;
    border: 2px solid #a28a5d;
    border-radius: 9px;
    background: #fffdf5;
}
#row-controls button {
    width: 46px;
    border-radius: 9px;
    border: 2px solid #956a34;
    background: linear-gradient(#ffffff, #edd6a6);
    box-shadow: 0 2px 0 #8c6133;
    font-size: 23px;
}
#row-controls button:active {
    transform: translateY(2px);
    box-shadow: none;
}
#connection {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: #fff8e9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    overflow: auto;
}
#connection p {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}
#connection button {
    min-height: 44px;
    padding: 8px 12px;
    background: #ffedba;
    border: 2px solid #80551b;
    border-radius: 9px;
}
#lamps {
    position: absolute;
    left: 39.05%;
    top: 58.3%;
    width: 21.65%;
    height: 2.6%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}
#lamps i {
    width: 13.5%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #947237, #2c1b09 73%);
    border: 1px solid #715522;
    box-shadow: inset 0 1px 2px #fff3b13b;
}
#lamps i.on {
    background: radial-gradient(
        circle at 35% 30%,
        #fffef7,
        #ffeb83 45%,
        #e28c10
    );
    border-color: #fff7c6;
    box-shadow:
        0 0 6px 3px #ffb61799,
        inset 0 0 3px #fff;
}
.insert {
    position: absolute;
    left: 18.5%;
    top: 55.8%;
    width: 8%;
    height: 10.8%;
    border: 0;
    background: transparent;
}
.insert span {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 91%;
    white-space: nowrap;
    border: 1px solid #826b43;
    border-radius: 5px;
    padding: 4px 7px;
    background: linear-gradient(#fffdf1, #f2db9f);
    box-shadow: 0 2px 2px #63573140;
    font-size: 16px;
}
.insert:hover:not(:disabled) {
    filter: drop-shadow(0 0 4px #ffe084);
}
.insert:disabled span {
    opacity: 0.7;
}
.action {
    position: absolute;
    left: 70.5%;
    top: 56.8%;
    width: 13.4%;
    height: 8.5%;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff8e4;
    padding: 0 4px;
    text-shadow: 0 2px 1px #510d08;
    font-size: clamp(16px, 2.2vw, 20px);
    line-height: 1.1;
}
.action:active:not(:disabled) {
    transform: translateY(2px);
    background: #4e04052c;
    box-shadow: inset 0 5px 8px #55000070;
}
.action:hover:not(:disabled) {
    box-shadow: 0 0 8px #ffd88a70;
}
.action:disabled {
    color: #fbd6c8;
}
.action:disabled:not(:active) {
    opacity: 0.7;
}
#cancel {
    position: absolute;
    left: 45%;
    top: 63.5%;
    border: 3px solid #88775b;
    border-radius: 50%;
    padding: 3px 7px;
    background: radial-gradient(
        ellipse at 35% 20%,
        #fffefa 5%,
        #f0e7ce 35%,
        #b6a487 78%,
        #77644b 100%
    );
    box-shadow:
        inset 0 2px 1px #fff,
        0 3px 0 #6f5c42,
        0 5px 4px #33250b50;
    text-shadow: 0 1px #fff;
    font-size: 16px;
}
#cancel:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: none;
}
#cancel:disabled {
    color: #596064;
    filter: saturate(0.4);
}
.collect {
    position: absolute;
    left: 30%;
    top: 77.1%;
    width: 39%;
    height: 9.1%;
    background: transparent;
    border: 0;
    color: #fff;
}
.collect > span {
    position: absolute;
    top: -34%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.4;
    padding: 3px 8px;
    border-radius: 6px;
    border: 2px solid #fff4c2;
    background: linear-gradient(#245970, #123847);
    box-shadow: 0 2px 3px #66462d60;
}
.collect.ready {
    box-shadow: inset 0 0 14px 4px #ffe79a;
    border-radius: 6px;
}
.collect.ready > span {
    background: linear-gradient(#ab4a0b, #75320b);
}
#coins {
    position: absolute;
    inset: 15% 8% 5%;
    pointer-events: none;
}
#coins img {
    position: absolute;
    width: 22%;
    filter: drop-shadow(1px 2px 1px #0009);
}
.inserting {
    position: absolute;
    width: clamp(40px, 10%, 54px);
    left: 22.45%;
    top: 53%;
    pointer-events: none;
    animation: insert 0.9s ease-in forwards;
    transform-origin: center;
}
@keyframes insert {
    0% {
        top: 53%;
        transform: translate(-50%, -50%) rotateY(0);
        opacity: 1;
    }
    65% {
        top: 58%;
        transform: translate(-50%, -50%) rotateY(80deg) scale(0.85);
        opacity: 1;
    }
    100% {
        top: 61%;
        transform: translate(-50%, -50%) rotateY(85deg) scale(0.7);
        opacity: 0;
    }
}
.guide {
    max-width: 800px;
    margin: 24px auto;
    padding: 24px;
    background: #fffdf5;
    border: 1px solid #b59b6b;
    border-top: 5px solid #bc3826;
    border-radius: 10px;
    box-shadow: 0 8px 24px #76613412;
}
.guide h2 {
    font-size: 24px;
}
.guide p {
    margin: 12px 0;
}
.guide a {
    color: #005584;
}
.development {
    font-size: 14px;
}
.guide button {
    background: linear-gradient(#fffbee, #eddbaf);
    border: 2px solid #8f7953;
    padding: 8px 12px;
    border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
    .inserting {
        animation-duration: 0.15s;
    }
}
/* Compact manufactured cabinet: screen first, controls registered to hardware. */
.screen {
    left: 12%;
    top: 15.65%;
    width: 76%;
    height: 51.6%;
    border-radius: 1%;
}
#status {
    bottom: 1.5%;
    left: 3%;
    right: 3%;
    border-radius: 7px;
    border: 2px solid #9b671c;
    box-shadow: 0 2px 0 #57432d;
    padding: 5px 7px;
}
#lamps {
    left: 37.2%;
    top: 72.15%;
    width: 24.5%;
    height: 2.8%;
}
#lamps i {
    width: 14%;
    border: 2px solid #6e501d;
}
.insert {
    left: 15%;
    top: 72%;
    width: 12%;
    height: 10%;
    border-radius: 8%;
    padding: 0;
}
.insert span {
    top: 96%;
    left: 50%;
    background: none;
    border: 0;
    box-shadow: none;
    color: #173951;
    padding: 0;
    text-shadow: 0 1px #fff8dd;
}
#cancel {
    left: 29%;
    top: 75%;
    width: 12%;
    height: 7%;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    color: #173951;
    text-shadow: 0 1px #fff8dd;
    white-space: nowrap;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
#cancel:active:not(:disabled) {
    transform: translateY(3px);
    filter: brightness(0.85);
}
#cancel:disabled {
    color: #344e5b;
    filter: none;
}
.action {
    left: 68.7%;
    top: 72.7%;
    width: 18%;
    height: 11%;
    border-radius: 50%;
    font-size: clamp(16px, 4.5cqw, 26px);
    text-shadow:
        0 2px 1px #6f0603,
        1px 0 #6f0603,
        -1px 0 #6f0603;
    font-weight: 900;
    padding: 0;
    line-height: 1.2;
    white-space: pre-line;
}
.action:disabled:not(:active) {
    opacity: 1;
    color: #ffdac5;
}
.action:active:not(:disabled) {
    transform: translateY(3px) scale(0.98);
    background: #45040326;
    box-shadow: inset 0 7px 7px #43000350;
}
.collect {
    left: 33%;
    top: 87.5%;
    width: 33.5%;
    height: 6.5%;
}
.collect > span {
    top: -29%;
    font-size: 16px;
    padding: 2px 7px;
    border-radius: 3px;
    background: #163f61;
    border: 2px solid #ffdf7d;
    box-shadow: 0 2px 1px #533011;
}
.inserting {
    left: 21%;
    top: 71%;
}
@keyframes insert {
    0% {
        top: 71%;
        transform: translate(-50%, -50%) rotateY(0);
        opacity: 1;
    }
    65% {
        top: 76%;
        transform: translate(-50%, -50%) rotateY(80deg) scale(0.85);
        opacity: 1;
    }
    100% {
        top: 80%;
        transform: translate(-50%, -50%) rotateY(85deg) scale(0.7);
        opacity: 0;
    }
}
body.compact .machine {
    width: 100%;
    max-width: 580px;
    aspect-ratio: auto;
    padding: 8px;
    border: 3px solid #bd3022;
    background: #fff7da;
    border-radius: 10px;
}
body.compact .art {
    display: none;
}
body.compact .machine header {
    position: static;
    width: auto;
}
body.compact .machine h1 {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    margin: 0 0 8px;
    white-space: normal;
    font-size: 24px;
    color: #a52e1b;
}
body.compact .screen {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    overflow: visible;
}
body.compact .screen canvas {
    aspect-ratio: 1000/900;
}
body.compact #status,
body.compact #hint,
body.compact #hint {
    top: auto;
    bottom: auto;
}
body.compact #cancel {
    display: inline-flex;
    background: linear-gradient(#ffffff, #d5d7ce);
    border: 2px solid #65757b;
    border-radius: 5px;
    align-items: center;
}
body.compact #row-controls {
    position: static;
    width: auto;
    margin-top: 6px;
}
body.compact #row-controls {
    flex-wrap: wrap;
}
body.compact #round-meter,
body.compact #card-label {
    position: static;
    display: inline-block;
}
body.compact .machine button {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    margin: 5px;
    padding: 8px;
    font-size: 16px;
}
body.compact .insert span {
    position: static;
    transform: none;
}
body.compact #lamps {
    position: static;
    width: 180px;
    height: 36px;
    max-width: 100%;
}
body.compact .action {
    background: linear-gradient(#e64a2c, #a01e15);
    border: 3px solid #701c13;
    min-width: 70px;
}
body.compact .collect {
    display: block;
    width: 100%;
    height: 88px;
    background: #284d59;
}
body.compact .collect > span {
    position: static;
    transform: none;
    white-space: normal;
}
body.compact .guide {
    margin-top: 20px;
}
body.compact .inserting {
    display: none;
} /* During the one decision, the left half becomes physical selector controls.
   Keep the full card exposed; never lay a toolbar across its bottom row. */
#row-controls {
    left: 2%;
    right: auto;
    top: 14%;
    bottom: auto;
    width: 43%;
    flex-wrap: wrap;
    padding: 3px;
    border: 2px solid #b58744;
    border-radius: 10px;
    gap: 2px;
    box-shadow: 0 3px 8px #6c594428;
}
#row-controls .decision-title {
    width: 100%;
    text-align: center;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 900;
}
#row-controls select {
    width: 100%;
    max-width: 180px;
}
#row-controls > div {
    justify-content: center;
    width: 100%;
}
#hint {
    font-size: 16px;
    left: 3%;
    right: 3%;
    top: auto;
    bottom: 1.5%;
    border: 2px solid #9b671c;
    border-radius: 7px;
}
body.choosing #round-meter {
    visibility: hidden;
}
body.compact #hint {
    top: auto;
    bottom: auto;
}
body.compact #cancel {
    display: inline-flex;
    background: linear-gradient(#ffffff, #d5d7ce);
    border: 2px solid #65757b;
    border-radius: 5px;
    align-items: center;
}
body.compact #row-controls {
    position: static;
    width: 100%;
}
body.compact.choosing #round-meter {
    visibility: visible;
}

/* The ring already shows the current draw; keep its accessible counter out of the numbered pockets. */
#round-meter,
#card-label {
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
}
body.compact #round-meter,
body.compact #card-label {
    width: auto;
    height: auto;
    padding: 3px 9px;
    clip-path: none;
}

/* Live ball numerals stay readable independently of canvas scale. */
#ball-history {
    position: absolute;
    left: 5.1%;
    width: 89.8%;
    top: 75.55%;
    height: 10%;
    display: flex;
    pointer-events: none;
}
#ball-history span {
    width: 20%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(16px, 3.3cqw, 24px);
    font-weight: 900;
    color: #123e5a;
    text-shadow: 0 1px #fff;
}
#ball-history span:not(:empty)::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff9df;
    box-shadow: 0 1px 2px #14374d55;
    z-index: -1;
}
#ball-history span {
    isolation: isolate;
    position: relative;
}
#ball-history .gold {
    color: #784000;
}
body.compact #ball-history {
    top: 75.55%;
    height: 10%;
}

.playfield {
    position: relative;
    width: 100%;
    height: 100%;
}
body.compact .playfield {
    height: auto;
    aspect-ratio: 1000/900;
}
