:root {
    --ink: #16252d;
    --muted: #647780;
    --paper: #f3f6f5;
    --panel: #10191d;
    --panel-soft: #17262b;
    --line: #31505a;
    --cyan: #52d6dc;
    --yellow: #ffd34a;
    --red: #ff6b62;
    --green: #79dc9b;
    --white: #f5fbfb;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    line-height: 1.7;
}

body {
    margin: 0;
    min-width: 0;
    background:
        linear-gradient(rgba(35, 76, 83, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(35, 76, 83, 0.045) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
}

button,
input {
    font: inherit;
}

button,
a,
label {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible + span {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px max(24px, calc((100vw - 1180px) / 2));
    background: #0a1114;
    color: var(--white);
}

.site-logo {
    color: var(--cyan);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.site-nav,
.site-footer {
    flex-wrap: wrap;
}

.site-nav {
    display: flex;
    gap: 18px;
}

.site-nav a,
.site-footer a {
    color: var(--white);
    font-size: 13px;
    text-decoration: none;
}

.site-nav a:hover,
.site-footer a:hover {
    color: var(--cyan);
}

.mole-page {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 18px 0 64px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 12px;
}

.breadcrumb a {
    color: #315d68;
}

.mole-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    align-items: center;
    gap: 48px;
    min-height: 250px;
    padding: 30px 0 36px;
}

.series-label,
.instrument-label,
.instrument-readout,
.stage-heading span,
.status-panel span,
.result-label {
    letter-spacing: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 800;
}

.series-label {
    margin: 0 0 8px;
    color: #197783;
    font-size: 13px;
}

h1 {
    margin: 0;
    font-size: clamp(30px, 3.4vw, 40px);
    line-height: 1.25;
    letter-spacing: 0;
}

h1 span {
    display: inline-block;
}

h1 span + span {
    margin-left: 0.22em;
}

.hero-copy > p:last-child {
    max-width: 670px;
    margin: 18px 0 0;
    color: #4a6068;
    font-size: 16px;
}

.hero-instrument {
    display: grid;
    gap: 13px;
    padding: 22px;
    border: 1px solid #28454d;
    border-radius: 6px;
    background: #10191d;
    box-shadow: 0 12px 34px rgba(13, 35, 42, 0.14);
    color: var(--white);
}

.instrument-label {
    color: var(--cyan);
    font-size: 13px;
}

.instrument-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.instrument-grid i {
    height: 26px;
    border: 1px solid #52737c;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 62%, #070a0c 0 32%, #24363b 34% 58%, #0b1114 60%);
}

.instrument-readout {
    color: var(--yellow);
    font-size: 12px;
}

.game-shell {
    position: relative;
    padding: 22px;
    border: 1px solid #2f4b53;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 50px rgba(5, 23, 29, 0.18);
    color: var(--white);
}

.game-fullscreen-open,
.game-fullscreen-close {
    position: absolute;
    z-index: 8;
    top: 14px;
    right: 14px;
    min-height: 40px;
    padding: 7px 13px;
    border: 1px solid #47646c;
    border-radius: 4px;
    background: #16262b;
    color: var(--white);
    cursor: pointer;
}

.difficulty-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 112px 18px 0;
    padding: 0;
    border: 0;
}

.difficulty-picker legend {
    grid-column: 1 / -1;
    margin-bottom: 4px;
    color: #a9c0c7;
    font-size: 12px;
    font-weight: 700;
}

.difficulty-picker label {
    min-width: 0;
}

.difficulty-picker input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.difficulty-picker span {
    display: grid;
    min-height: 44px;
    place-items: center;
    padding: 8px 10px;
    border: 1px solid #3a5961;
    border-radius: 4px;
    background: #17262b;
    color: #d7e5e8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.difficulty-picker input:checked + span {
    border-color: var(--yellow);
    background: #3a3319;
    color: #fff4b8;
}

.status-panel {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 5px;
    overflow: hidden;
    background: #0b1316;
}

.status-panel div {
    display: grid;
    min-width: 0;
    min-height: 64px;
    align-content: center;
    padding: 8px 12px;
    border-right: 1px solid var(--line);
}

.status-panel div:last-child {
    border-right: 0;
}

.status-panel span {
    color: #91abb2;
    font-size: 10px;
}

.status-panel strong {
    overflow: hidden;
    color: var(--white);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 22px;
    line-height: 1.2;
    text-overflow: ellipsis;
}

.game-stage {
    position: relative;
    margin-top: 16px;
}

.stage-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 48px;
    margin-bottom: 10px;
}

.stage-heading div {
    display: grid;
}

.stage-heading span {
    color: #8ca7ae;
    font-size: 9px;
}

.stage-heading strong {
    color: var(--yellow);
    font-size: 14px;
}

.stage-heading p {
    margin: 0;
    color: #c9d9dc;
    font-size: 13px;
    text-align: right;
}

.mole-board {
    --time-ratio: 1;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(60px, 1fr));
    gap: clamp(8px, 1.8vw, 18px);
    width: 100%;
    min-height: 420px;
    padding: clamp(18px, 3vw, 38px);
    overflow: hidden;
    border: 1px solid #41616a;
    border-radius: 5px;
    background:
        linear-gradient(180deg, rgba(65, 157, 160, 0.13), transparent 42%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 38px),
        #14252a;
    touch-action: none;
    user-select: none;
}

.mole-board.holes-6,
.mole-board.holes-9 {
    grid-template-columns: repeat(3, minmax(60px, 1fr));
}

.mole-board.holes-12 {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
}

.mole-board::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: calc(var(--time-ratio) * 100%);
    height: 5px;
    background: var(--cyan);
    content: "";
    transition: width 80ms linear;
}

.mole-hole {
    position: relative;
    min-width: 44px;
    min-height: 74px;
    overflow: hidden;
    border: 0;
    border-radius: 5px;
    background: transparent;
    cursor: crosshair;
    isolation: isolate;
}

.mole-hole::before {
    position: absolute;
    z-index: 1;
    right: 7%;
    bottom: 7%;
    left: 7%;
    height: 31%;
    border: 2px solid #4d6666;
    border-radius: 50%;
    background: #050808;
    box-shadow: inset 0 8px 12px #000, 0 5px 0 #253c3c;
    content: "";
}

.hole-rim {
    position: absolute;
    z-index: 4;
    right: 4%;
    bottom: 4%;
    left: 4%;
    height: 26%;
    border-top: 5px solid #3f5752;
    border-radius: 50%;
    pointer-events: none;
}

.mole-character {
    position: absolute;
    z-index: 3;
    bottom: 13%;
    left: 50%;
    width: clamp(44px, 78%, 132px);
    height: auto;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 72%);
    transition: transform 90ms ease-out, opacity 60ms linear;
}

.mole-hole.is-active .mole-character {
    opacity: 1;
    transform: translate(-50%, 4%);
}

.mole-hole.is-active:hover .mole-character {
    filter: brightness(1.08);
}

.mole-hole:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: -3px;
}

.hit-feedback {
    position: absolute;
    z-index: 7;
    top: 52%;
    left: 50%;
    display: grid;
    min-width: 150px;
    justify-items: center;
    padding: 10px 18px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: rgba(6, 13, 16, 0.9);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -42%);
    transition: opacity 110ms linear, transform 160ms ease-out;
}

.hit-feedback.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.hit-feedback strong {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 25px;
}

.hit-feedback span {
    font-size: 12px;
}

.hit-feedback.is-miss {
    color: var(--red);
}

.mole-hit-feedback {
    position: absolute;
    z-index: 6;
    top: 34%;
    left: 50%;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: var(--yellow);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0);
    animation: mole-hit-float 500ms ease-out forwards;
    text-shadow: 0 1px 3px #050808, 0 0 8px rgba(255, 213, 74, 0.45);
}

.mole-hit-feedback strong {
    font-size: 15px;
}

@keyframes mole-hit-float {
    0% {
        opacity: 0;
        transform: translate(-50%, 0);
    }

    12%, 68% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -16px);
    }
}

@keyframes mole-hit-fade {
    0% {
        opacity: 0;
    }

    12%, 68% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.result-curtain,
.result-panel {
    position: absolute;
    z-index: 9;
    inset: 58px 0 0;
    border: 1px solid #4c727a;
    border-radius: 5px;
    background: rgba(7, 14, 17, 0.96);
}

.result-curtain {
    display: grid;
    place-items: center;
    color: var(--yellow);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: clamp(28px, 5vw, 54px);
    font-weight: 900;
}

.result-panel {
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 20px;
    text-align: center;
}

.result-label {
    margin: 0;
    color: var(--cyan);
    font-size: 11px;
}

.result-panel h2 {
    margin: 3px 0 6px;
    font-size: 22px;
}

.result-score {
    color: var(--yellow);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: clamp(26px, 4vw, 42px);
}

.result-panel dl {
    display: grid;
    grid-template-columns: repeat(5, minmax(80px, 1fr));
    width: min(720px, 100%);
    margin: 14px 0 8px;
    padding: 0;
}

.result-panel dl div {
    padding: 8px;
    border-left: 1px solid #35535a;
}

.result-panel dl div:last-child {
    border-right: 1px solid #35535a;
}

.result-panel dt {
    color: #96b1b7;
    font-size: 10px;
}

.result-panel dd {
    margin: 2px 0 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 20px;
    font-weight: 800;
}

.result-panel > p:not(.result-label) {
    margin: 4px 0 14px;
    color: #bdced2;
    font-size: 13px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.primary-button,
.ghost-button {
    min-height: 46px;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    border: 1px solid #ffe382;
    background: var(--yellow);
    color: #1f1a08;
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.ghost-button {
    border: 1px solid #53717a;
    background: #18282d;
    color: var(--white);
}

.info-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 42px;
    padding: 54px 0 22px;
}

.info-section article {
    min-width: 0;
    border-top: 1px solid #9db1b5;
    padding-top: 14px;
}

.info-section article:last-child {
    grid-column: 1 / -1;
}

.info-section h2 {
    margin: 0 0 7px;
    font-size: 20px;
}

.info-section p {
    margin: 0;
    color: #4c6269;
}

.info-section a {
    color: #176f7c;
    font-weight: 700;
}

.app-comments,
.app-comment-form-section {
    color: var(--ink);
}

.site-footer {
    justify-content: center;
}

@media (max-width: 760px) {
    .site-header {
        align-items: flex-start;
        padding: 13px 20px;
    }

    .site-nav {
        justify-content: flex-end;
        gap: 10px;
    }

    .mole-page {
        width: min(100% - 24px, 620px);
        padding-top: 12px;
    }

    .mole-hero {
        grid-template-columns: 1fr;
        gap: 20px;
        min-height: 0;
        padding: 18px 0 28px;
    }

    h1 {
        font-size: 28px;
    }

    h1 span + span {
        margin-left: 0;
    }

    .hero-copy > p:last-child {
        font-size: 14px;
    }

    .hero-instrument {
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
        padding: 14px;
    }

    .instrument-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .instrument-grid i {
        height: 18px;
    }

    .game-shell {
        padding: 14px;
    }

    .game-fullscreen-open,
    .game-fullscreen-close {
        position: static;
        float: right;
        margin-bottom: 10px;
    }

    .difficulty-picker {
        clear: both;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0 0 12px;
    }

    .status-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .status-panel div {
        min-height: 54px;
        padding: 7px 9px;
        border-bottom: 1px solid var(--line);
    }

    .status-panel div:nth-child(3) {
        border-right: 0;
    }

    .status-panel div:nth-child(n + 4) {
        border-bottom: 0;
    }

    .status-panel strong {
        font-size: 18px;
    }

    .stage-heading {
        grid-template-columns: 1fr;
        gap: 4px;
        min-height: 64px;
    }

    .stage-heading p {
        min-height: 23px;
        text-align: left;
    }

    .mole-board {
        min-height: 300px;
        padding: 14px 10px 18px;
        gap: 8px;
    }

    .mole-board.holes-12 {
        grid-template-columns: repeat(4, minmax(44px, 1fr));
    }

    .mole-hole {
        min-height: 70px;
    }

    .result-curtain,
    .result-panel {
        inset: 74px 0 0;
    }

    .result-panel {
        padding: 12px 8px;
    }

    .result-panel h2 {
        font-size: 18px;
    }

    .result-panel dl {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        margin-top: 9px;
    }

    .result-panel dl div {
        min-width: 0;
        padding: 5px 2px;
    }

    .result-panel dt {
        overflow-wrap: anywhere;
        font-size: 8px;
    }

    .result-panel dd {
        font-size: 15px;
    }

    .result-panel > p:not(.result-label) {
        margin-bottom: 8px;
        font-size: 11px;
    }

    .control-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .info-section {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 38px;
    }

    .info-section article:last-child {
        grid-column: auto;
    }
}

@media (max-width: 350px) {
    .site-header {
        gap: 12px;
        padding-inline: 12px;
    }

    .site-nav a {
        font-size: 11px;
    }

    .mole-page {
        width: calc(100% - 16px);
    }

    h1 {
        font-size: 27px;
    }

    .hero-instrument {
        grid-template-columns: 1fr auto;
    }

    .instrument-grid {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .game-shell {
        padding: 10px;
    }

    .mole-board {
        min-height: 284px;
        padding-inline: 7px;
        gap: 5px;
    }

    .mole-hole {
        min-height: 66px;
    }

    .result-score {
        font-size: 24px;
    }

    .result-panel .primary-button {
        min-height: 42px;
        padding: 7px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mole-character,
    .hit-feedback,
    .mole-board::after {
        transition-duration: 0.01ms;
    }

    .mole-hit-feedback {
        animation-name: mole-hit-fade;
    }
}
