:root {
    color-scheme: dark;
    --background: #100d22;
    --panel: #211734;
    --line: #49325c;
    --ink: #fcf8ff;
    --muted: #c0b6d4;
    --pink: #ff8ba3;
    --orange: #ffd273;
    --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: radial-gradient(ellipse at 50% 20%, #2a1844 0%, var(--background) 66%);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
    line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
.shell { width: min(1060px, calc(100% - 56px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #35324b; }
.header-inner { min-height: 70px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-size: 16px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
    display: grid; place-items: center; color: #26182e; background: var(--pink);
    border-radius: 9px; width: 33px; height: 33px; font-size: 23px; line-height: 1;
}
.nav-link { color: var(--muted); font-size: 14px; font-weight: 700; padding: 8px 0; }
.nav-link:hover { color: var(--ink); }
.eyebrow {
    font: 700 13px/1.5 var(--mono); letter-spacing: .18em; color: var(--pink);
    display: flex; gap: 9px; align-items: center; margin: 0;
}
.eyebrow span { width: 8px; height: 8px; border: 1px solid currentColor; transform: rotate(45deg); }
.game {
    display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(265px, 1fr); gap: clamp(24px, 5vw, 72px);
    align-items: center; margin: 24px auto 0; max-width: 1010px;
}
.game:not(.is-result) {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 8px;
}
.game:not(.is-result) .stage { max-width: clamp(320px, 73svh, 580px); }
.game > .error { grid-column: 1 / -1; text-align: center; }
.stage {
    display: grid; place-items: center; min-width: 0; width: 100%; aspect-ratio: 882 / 1024;
    background: #10091d; border-radius: 3px; overflow: hidden;
}
.stage:has([data-phase="win"]) { background: radial-gradient(ellipse,#602155,#170f29 75%); }
.slot-cabinet {
    --reel-x: 16.45%; --reel-y: 27.05%; --reel-w: 70.05%; --reel-h: 26.65%;
    --meter-x: 23.5%; --meter-y: 62.65%; --meter-w: 56%; --meter-h: 8.45%;
    --button-x: 33.2%; --button-y: 75.3%; --button-w: 35.5%; --button-h: 15.2%;
    position: relative; isolation: isolate; container-type: inline-size;
    width: 100%; aspect-ratio: 882 / 1024;
    background: #100a20 url('cabinet-play.webp') center / 100% 100% no-repeat;
    border-radius: 3px; overflow: hidden; box-shadow: 0 18px 70px #0009;
}
.slot-cabinet[data-phase="win"] {
    aspect-ratio: 524 / 542; background-image: url('cabinet-win.webp');
    --reel-x: 17.5%; --reel-y: 35.65%; --reel-w: 68.3%; --reel-h: 18.35%;
    --meter-x: 25%; --meter-y: 62.6%; --meter-w: 52%; --meter-h: 7.9%;
    --button-x: 34%; --button-y: 75.5%; --button-w: 32%; --button-h: 15.5%;
}
.slot-reels {
    position: absolute; left: var(--reel-x); top: var(--reel-y); width: var(--reel-w); height: var(--reel-h);
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden;
    background: #031410; --filament: #1a8c5c; --bloom: #13543d;
}
[data-phase="win"] .slot-reels {
    --filament: #9c641c; --bloom: #423010; background: #100c06;
}
.reel-window {
    min-width: 0; min-height: 0; position: relative; overflow: hidden;
    background: linear-gradient(90deg,#000a,transparent 10%,#fff1 14%,transparent 18% 80%,#fff1 90%,#000b),
                linear-gradient(0deg,#020806,var(--bloom) 38%,#111d15 55%,var(--bloom) 70%,#020806);
}
[data-phase="spinning"] .slot-reels { --filament: #38fbb5; --bloom: #115b43; }
.reel-window::after {
    content: ''; position: absolute; z-index: 2; inset: 0; pointer-events: none;
    background: linear-gradient(90deg,#f7c25b 0 1.5%,#342013 1.5% 3%,var(--filament) 4%,transparent 8% 93%,#000a 95%,#86602a 98%),
                repeating-linear-gradient(0deg,transparent 0 3px,#0001 3px 4px);
    box-shadow: inset 0 3px 6px #0009,inset 0 -3px 6px #0009;
}
[data-phase="reach"] .slot-reels {
    --filament: #ffcb65; --bloom: #725021; background: #231904;
    filter: brightness(1.18);
}
[data-phase="reach"] .reel-window:last-of-type::after {
    box-shadow: inset 0 0 0 2px #ffdf80, inset 0 0 9px 2px #ffb624;
}
.slot-reels canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.slot-gpu { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.slot-reels[data-renderer="webgl"] .reel-window canvas { visibility: hidden; }
.coin-meter {
    position: absolute; left: var(--meter-x); top: var(--meter-y); width: var(--meter-w); height: var(--meter-h);
    display: grid; place-items: center; color: #89ff8b;
    background: repeating-linear-gradient(0deg,transparent 0 3px,#0002 3px 4px),
                repeating-linear-gradient(90deg,transparent 0 11px,#38ff7008 11px 12px),
                radial-gradient(ellipse,#073619,#01180c 76%); overflow: hidden;
}
.coin-meter strong {
    font: 900 var(--meter-font,7.9cqw)/1 var(--mono); letter-spacing: -.055em; font-variant-numeric: tabular-nums;
    text-shadow: 0 0 2px #b0ffa7,0 0 9px #40ec3c,0 2px #19853e;
}
.coin-meter canvas { display: none; }
.coin-meter.lit strong { position: absolute; clip-path: inset(50%); }
.coin-meter.lit canvas {
    display: block; width: 96%; height: 87%; object-fit: contain; image-rendering: pixelated;
    filter: drop-shadow(0 0 2px #5ffd4c96);
}
.spin-button {
    position: absolute; left: var(--button-x); top: var(--button-y); width: var(--button-w); height: var(--button-h);
    border: 0; border-radius: 50%; padding: 0; background: transparent; -webkit-tap-highlight-color: transparent;
}
.spin-button:enabled::before {
    content: ""; position: absolute; inset: -2%; border: 2px solid #fff0a1; border-radius: inherit;
    box-shadow: 0 0 10px #ffb137, inset 0 0 8px #ffd65a;
    animation: spin-invite-ring 1.8s ease-out infinite; pointer-events: none;
}
.spin-cue {
    position: absolute; top: 102%; left: 50%; transform: translateX(-50%);
    padding: .18em .85em; white-space: nowrap; border-radius: 4px;
    border: 1px solid #ffdb76; background: #291529; color: #fff6c8;
    font-size: clamp(12px, 3.05cqw, 17px); font-weight: 800; line-height: 1.4;
    box-shadow: 0 2px 0 #10091c; animation: spin-invite-nudge 1.8s ease-in-out infinite;
}
.spin-cue::before {
    content: ""; position: absolute; left: calc(50% - 5px); top: -5px;
    width: 8px; height: 8px; border: solid #ffdb76; border-width: 1px 0 0 1px;
    background: #291529; transform: rotate(45deg);
}
.spin-button:disabled .spin-cue, .tap-cue { display: none; }
@media (pointer: coarse) {
    .click-cue { display: none; }
    .tap-cue { display: inline; }
}
@keyframes spin-invite-ring {
    from { transform: scale(.97); opacity: .9; }
    80%, to { transform: scale(1.16); opacity: 0; }
}
@keyframes spin-invite-nudge {
    0%, 65%, 100% { transform: translate(-50%, 0); }
    32% { transform: translate(-50%, -3px); }
}

.spin-button:hover:not(:disabled) { background: #fff1; box-shadow: 0 0 20px #ffae2766; }
.spin-button:active, :is([data-phase="spinning"],[data-phase="reach"]) .spin-button { background: #4a071629; box-shadow: inset 0 4px 12px #4a100a77; }
.slot-effects { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.slot-effects canvas { width: 100%; height: 100%; display: block; }
.sr-only { position: absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.console { display: flex; flex-direction: column; padding: 16px 0; min-width: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -.06em; margin: 0; line-height: 1.32; }
.status { font-size: 14px; color: var(--muted); margin: 7px 0 19px; min-height: 1.55em; }
.actions { display: grid; gap: 9px; }
.primary, .secondary {
    min-height: 48px; border-radius: 3px; border: 1px solid transparent;
    padding: 9px 13px; text-align: center; font-size: 15px; font-weight: 800;
}
.primary { color: #25192b; background: #ffd273; box-shadow: inset 0 -4px #c88f4e, 0 3px #130d25; }
.primary:hover:not(:disabled) { filter: brightness(1.09); }
.secondary { color: var(--ink); background: #35254f; border-color: #725397; box-shadow: inset 0 -3px #241a38; }
.secondary:hover:not(:disabled) { background: #383450; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; }
.form-row input {
    min-width: 0; flex: 1 1 155px; background: var(--background); color: var(--ink);
    border: 1px solid #615778; padding: 9px 12px; border-radius: 11px; min-height: 48px;
}
.form-row input::placeholder { color: #a69bb9; }
#register label { display: block; margin-bottom: 6px; font-size: 14px; }
.error { color: #ffb2c0; margin: 12px 0 0; font-size: 14px; }
.ranking { padding: 40px 0; }
.ranking-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 6px 20px; margin-bottom: 16px; }
h2 { font-size: clamp(24px, 3.5vw, 31px); line-height: 1.25; margin: 4px 0 0; }
.ranking-header > p { margin: 0; color: var(--muted); font-size: 14px; }
.ranking-card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.empty { padding: 20px 23px; display: flex; align-items: center; gap: 14px; }
.empty span { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; background: #3c304b; color: var(--pink); font-size: 25px; }
.empty p { margin: 1px 0 0; color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { text-align: left; padding: 12px 18px; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 14px; }
th:first-child { width: 15%; }
th:last-child { width: 37%; }
td { border-top: 1px solid var(--line); }
td:first-child, td:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td:first-child { font-weight: bold; }
td:last-child, th:last-child { text-align: right; }
tbody tr:first-child td:first-child { color: var(--orange); }
footer { color: var(--muted); border-top: 1px solid var(--line); padding: 17px 0 25px; font-size: 13px; }
@media (max-width: 740px) {
    .shell { width: calc(100% - 32px); }
    .header-inner { min-height: 58px; }
    .game { grid-template-columns: 1fr; gap: 5px; margin-top: 12px; }
    .stage { max-width: 520px; margin-inline: auto; }
    .console { padding: 16px 0; }
    .ranking { padding-top: 30px; }
    th, td { padding: 10px 9px; }
    th:first-child { width: 18%; }
    th:last-child { width: 40%; }
}

#register:not([hidden]) + #reset { margin-top: 9px; }

#result-title {
    grid-column: 1 / -1; justify-self: center; color: #ffe4a3; text-align: center;
    padding: .12em 1.2em .18em; font-size: clamp(24px, 3vw, 36px); letter-spacing: .065em;
    border-block: 2px solid #a5773c; background: linear-gradient(90deg, transparent,#33203a 30% 70%,transparent);
}
.game.is-result { row-gap: 20px; }
.result-figure { min-width: 0; width: 100%; margin: 0; text-align: center; }
.result-figure img { display: block; width: 100%; height: auto; border-radius: 5px; }
.result-grade { color: #ffda86; font-weight: 900; font-size: clamp(20px,2.4vw,32px); margin: 0; }
#result-detail { margin: 6px 0 22px; }
.result-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.result-actions a { display: grid; place-items: center; }
.result-actions .result-share {
    grid-column: 1 / -1; grid-row: 1; min-height: 56px; color: #37200c; font-weight: 900;
    background: linear-gradient(#fff2ac,#ffca4d 50%,#ffa719);
    border: 3px double #fff0a9; box-shadow: inset 0 -4px #c88018,0 3px #663a16;
}
.result-actions #result-save { grid-column: 1 / -1; justify-self: center; width: min(100%, 16rem); }
.result-feedback { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.result-feedback:empty { display: none; }
.result-rank {
    display: grid; justify-items: center; gap: 2px; margin: 0 0 16px; padding: 12px;
    color: #ffe6b4; background: radial-gradient(ellipse at center, #532847, #25152e 76%);
    border: 1px solid #bd8b47; border-radius: 8px; text-align: center;
}
.result-rank span { font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.result-rank strong {
    font-size: clamp(32px, 5vw, 48px); line-height: 1.15; color: #ffdc76;
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 100%;
}
@media (max-width: 740px) {
    .game.is-result { row-gap: 9px; }
    .is-result .console { padding-top: 6px; }
    .result-figure { max-width: 520px; margin-inline: auto; }
}
.result-actions .secondary:not(.result-share) {
    border: solid transparent; border-width: 7px 12px;
    border-image: url('result-violet-trim.webp') 13 24 13 24 stretch;
    background: linear-gradient(#3b174c,#251232); box-shadow: none;
}
.result-actions .result-share {
    border: solid transparent; border-width: 9px 19px;
    border-image: url('result-gold-trim.webp') 25 42 26 42 stretch;
    background: linear-gradient(#ffdf68,#ffbf39 65%,#ffae18);
    box-shadow: none; font-size: 18px; letter-spacing: .03em;
}

.is-result:has(#result-image:not([hidden])) :is(.result-grade, #result-detail) { display: none; }
.is-result #register, .is-result #reset { margin-top: 16px; }

.milestone-rails {
    position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
    fill: none; stroke: #bafff4; stroke-width: 5; stroke-linecap: round;
    stroke-dasharray: 24 120; opacity: 0;
    filter: drop-shadow(0 0 2px #12fff0) drop-shadow(0 0 5px #06dbef);
}
.slot-cabinet:not([data-phase="spinning"]) .milestone-rails { visibility: hidden; }
.coin-meter.lit canvas { width: 85%; height: 83%; }
.coin-meter:not(.lit) strong { font-size: min(5cqw, var(--meter-font, 5cqw)); }

.milestone-spark {
    position: absolute; top: 66%; width: 1.8%; aspect-ratio: 1; opacity: 0;
    pointer-events: none; background: #ffed78;
    clip-path: polygon(50% 0,62% 35%,100% 50%,62% 63%,50% 100%,37% 62%,0 50%,36% 37%);
}
.milestone-spark:nth-child(even) { background: #98ffed; width: 1.25%; }
.slot-cabinet:not([data-phase="spinning"]) .milestone-spark { visibility: hidden; }

.billion-effect {
    position: absolute; inset: 0; z-index: 3; pointer-events: none;
    display: grid; justify-items: center; align-items: start;
}
.billion-effect i {
    position: absolute; width: 94%; height: 35%; top: calc(var(--meter-y) - 13%);
    border: .65cqw solid #fff5bc; border-radius: 50%; opacity: 0;
    box-shadow: 0 0 2cqw #ffab16, inset 0 0 1.4cqw #ffbd37;
}
.billion-effect strong {
    position: absolute; bottom: calc(100% - var(--meter-y) + .6%);
    padding: .06em .7em .13em; opacity: 0; font-size: 5.2cqw;
    font-weight: 950; color: #fff6bd; border-block: .35cqw solid #ffc44f;
    background: linear-gradient(90deg, transparent, #45200ff2 16% 84%, transparent);
    text-shadow: 0 .09em #823518, 0 0 .35em #ffbd36;
}

.coin-intake {
    position: absolute; left: 72%; top: calc(var(--button-y) + 6%); width: 13%; height: 5%;
    isolation: isolate; pointer-events: none;
    background: linear-gradient(165deg,#eed08a,#805226 18%,#34253f 24%,#20162c 70%,#825a3b);
    border: .32cqw solid #bd8d56; border-radius: .7cqw;
    box-shadow: inset 0 .3cqw #ffdfa466, 0 .55cqw .15cqw #120b1b;
}
.intake-mouth, .intake-lip {
    position: absolute; left: 10%; width: 80%; top: 37%; height: 28%;
    border-radius: 1cqw; background: #100b16; box-shadow: inset 0 .3cqw .2cqw #000;
}
.intake-lip {
    top: 60%; height: 12%; background: linear-gradient(#ffde8d,#8c582c);
    box-shadow: 0 .2cqw #160d0b;
}
.intake-stream {
    position: absolute; left: -65%; bottom: 38%; width: 350%; height: 560%;
    pointer-events: none; visibility: hidden;
}
.slot-cabinet:is([data-phase="spinning"],[data-phase="reach"],[data-phase="near"]) .intake-stream { visibility: visible; }

.play-odds { margin: 0; color: #ffe5a5; font-size: .9rem; font-weight: 700; text-align: center; }
.is-result .play-odds { display: none; }

#language { margin-left: auto; padding: .4em .6em; border: 1px solid #765b85; border-radius: 5px; color: #ffedc7; background: #2b1934; font: inherit; font-size: .85rem; }
.header-inner:has(#language) .nav-link { margin-left: 0; }
@media(max-width:560px) { .header-inner { flex-wrap:wrap; padding-block:6px; gap:6px; } }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.social-links { display: flex; gap: 4px; }
.social-links a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: #e5d5e9; }
.social-links a:is(:hover,:focus-visible) { color: #ffda85; background: #362540; }
.social-links svg { width: 21px; height: 21px; }

#ranking-pager:not([hidden]) { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; }
