:root {
    --ink: #273432;
    --muted: #687773;
    --line: #dce9e4;
    --mint: #7ad0b3;
    --mint-dark: #2f8f70;
    --mint-soft: #eef9f5;
    --paper: #fffefb;
    --off-white: #fafbf7;
    --yellow: #f3cf6b;
    --coral: #ff9f8f;
    --blue: #4f8fc9;
    --red: #d95f57;
    --shadow: 0 18px 48px rgba(48, 91, 78, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    background: #fff;
}

body {
    margin: 0;
    color: var(--ink);
    background: #fbfdfb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.75;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.site-header,
.site-footer,
.motion-page {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-header {
    min-height: 70px;
}

.site-logo {
    color: var(--mint-dark);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 0.86rem;
}

.site-nav a,
.site-footer a {
    text-decoration: none;
}

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

.motion-page {
    margin-bottom: 64px;
}

.motion-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    min-height: 400px;
    padding: 34px 0 44px;
}

.series-label {
    margin: 0 0 12px;
    color: var(--mint-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.hero-copy h1 {
    margin: 0;
    font-size: 48px;
    line-height: 1.15;
    letter-spacing: 0;
}

.hero-title-line {
    display: block;
}

.hero-copy > p:last-child {
    max-width: 620px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 1.8vw, 1.12rem);
}

.motion-preview {
    position: relative;
    min-height: 260px;
    border: 1px solid #e3eee9;
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 16px 38px rgba(48, 91, 78, 0.09);
    overflow: hidden;
}

.preview-lane {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 56%;
    height: 5px;
    border-radius: 999px;
    background: #badace;
}

.preview-panel {
    position: absolute;
    left: 46%;
    top: 28%;
    display: grid;
    place-items: start center;
    width: 34%;
    height: 56%;
    border: 1px solid #abc1ba;
    border-radius: 8px;
    background:
        repeating-linear-gradient(135deg, rgba(102, 130, 121, 0.08) 0 2px, transparent 2px 14px),
        #e4eee9;
    color: #62766f;
    font-size: 0.78rem;
    font-weight: 800;
    padding-top: 15px;
}

.preview-ball {
    position: absolute;
    left: 20%;
    top: 56%;
    width: 34px;
    height: 34px;
    border: 2px solid #c66f61;
    border-radius: 50%;
    background: var(--coral);
    transform: translate(-50%, -50%);
    animation: preview-motion 3.1s linear infinite;
}

.preview-exit {
    position: absolute;
    left: 80%;
    top: 56%;
    width: 72px;
    height: 72px;
    border: 4px solid var(--mint-dark);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.76);
    transform: translate(-50%, -50%);
}

.preview-exit::after {
    position: absolute;
    inset: 11px;
    border: 1px dashed rgba(47, 143, 112, 0.48);
    border-radius: 50%;
    content: "";
}

@keyframes preview-motion {
    0% {
        left: 20%;
        opacity: 1;
    }
    42% {
        left: 44%;
        opacity: 1;
    }
    44%,
    92% {
        left: 78%;
        opacity: 0;
    }
    94% {
        left: 80%;
        opacity: 1;
    }
    100% {
        left: 80%;
        opacity: 0;
    }
}

.game-shell {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    padding: clamp(18px, 3vw, 32px);
}

.status-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.status-panel div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mint-soft);
    padding: 12px;
}

.status-panel span {
    display: block;
    color: var(--mint-dark);
    font-size: 0.7rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.status-panel strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(1.05rem, 2.4vw, 1.5rem);
    line-height: 1.2;
}

.motion-stage {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    padding: 16px;
    overflow: hidden;
}

.stage-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
    margin-bottom: 10px;
}

.stage-progress,
.stage-difficulty {
    margin: 0;
    font-weight: 900;
}

.stage-progress {
    color: var(--mint-dark);
}

.stage-difficulty {
    border: 1px solid rgba(47, 143, 112, 0.22);
    border-radius: 999px;
    background: #fff;
    color: #537069;
    padding: 3px 10px;
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

.prediction-surface {
    position: relative;
    display: block;
    width: 100%;
    min-height: 250px;
    border: 1px solid #dce9e4;
    border-radius: 8px;
    background: var(--paper);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
}

.prediction-surface:disabled {
    color: inherit;
    cursor: default;
    opacity: 1;
}

.prediction-surface:focus-visible,
.predict-button:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible {
    outline: 3px solid rgba(47, 143, 112, 0.32);
    outline-offset: 3px;
}

#motionCanvas {
    display: block;
    width: 100%;
    height: clamp(250px, 30vw, 360px);
}

.stage-announcement {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 254, 251, 0.8);
    color: var(--mint-dark);
    font-size: clamp(2rem, 8vw, 4.4rem);
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
}

.center-result {
    position: absolute;
    left: 50%;
    top: 50%;
    display: grid;
    gap: 7px;
    width: min(430px, calc(100% - 32px));
    border: 1px solid #9ed7c4;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 20px 48px rgba(44, 95, 79, 0.2);
    padding: 18px;
    transform: translate(-50%, -50%);
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
}

.center-result > strong {
    color: var(--mint-dark);
    font-size: 1.2rem;
}

.center-score {
    font-size: 1.1rem;
}

.center-score b {
    font-size: clamp(2rem, 7vw, 3.2rem);
}

.center-counts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
}

.center-counts > span {
    white-space: nowrap;
}

.judgement-area {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 7px 12px;
    min-height: 44px;
    padding-top: 10px;
    text-align: center;
}

.judgement-text {
    font-size: clamp(1.65rem, 5vw, 2.7rem);
    line-height: 1;
}

.judgement-detail .position-copy {
    display: inline-block;
    white-space: nowrap;
}

.judgement-text.is-perfect {
    color: #23935f;
}

.judgement-text.is-good {
    color: var(--blue);
}

.judgement-text.is-miss {
    color: var(--red);
}

#judgementDetail {
    color: #566762;
    font-weight: 800;
}

.stage-message {
    min-height: 28px;
    margin: 2px 0 12px;
    color: var(--muted);
    text-align: center;
}

.predict-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    border: 1px solid #239873;
    border-radius: 8px;
    background: #2f9678;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.predict-button span {
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 0.76rem;
}

.predict-button:disabled {
    border-color: #cad9d4;
    background: #dfe8e4;
    color: #7b8985;
    cursor: default;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 18px 0;
}

.primary-button,
.ghost-button {
    min-height: 46px;
    border-radius: 8px;
    padding: 0 22px;
    font-weight: 900;
    cursor: pointer;
}

.primary-button {
    border: 1px solid #278b6e;
    background: #2f9678;
    color: #fff;
}

.ghost-button {
    border: 1px solid var(--line);
    background: #fff;
    color: #556762;
}

.primary-button:disabled,
.ghost-button:disabled {
    cursor: default;
    opacity: 0.58;
}

.result-panel {
    border-top: 1px dashed #cfe0da;
    padding-top: 20px;
}

.result-panel h2,
.result-panel h3,
.result-panel p {
    margin-top: 0;
}

.result-panel h2 {
    margin-bottom: 6px;
    font-size: 1.35rem;
}

.result-panel p {
    color: var(--muted);
}

.log-title {
    margin: 20px 0 10px;
    font-size: 1.05rem;
}

.log-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.log-list li {
    display: grid;
    gap: 2px;
    min-width: 0;
    border-left: 4px solid #85bea9;
    background: #f7fbf9;
    padding: 10px 12px;
}

.log-list li.log-good {
    border-left-color: var(--blue);
}

.log-list li.log-miss {
    border-left-color: var(--red);
}

.log-list strong,
.log-list span {
    overflow-wrap: anywhere;
}

.log-list span {
    color: var(--muted);
    font-size: 0.88rem;
}

.info-section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.info-section article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 20px;
}

.info-section h2 {
    margin: 0 0 8px;
    font-size: 1.08rem;
}

.info-section p {
    margin: 0;
    color: var(--muted);
}

.info-section a {
    color: var(--mint-dark);
    font-weight: 800;
}

.comments-stub {
    margin-top: 30px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.comments-stub h2 {
    margin: 0 0 8px;
}

.comments-stub p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding: 36px 0 42px;
    color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
    .preview-ball {
        animation: none;
        left: 42%;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 820px) {
    .motion-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        gap: 26px;
        padding-top: 28px;
    }

    .motion-preview {
        min-height: 210px;
    }

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

    .info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .site-header,
    .site-footer,
    .motion-page {
        width: min(100% - 24px, 1120px);
    }

    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-copy h1 {
        font-size: 28px;
    }

    .hero-copy > p:last-child {
        margin-top: 16px;
    }

    .motion-preview {
        min-height: 180px;
    }

    .game-shell {
        padding: 15px;
    }

    .status-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .status-panel div:last-child {
        grid-column: 1 / -1;
    }

    .stage-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .stage-difficulty {
        max-width: 100%;
        white-space: normal;
    }

    .motion-stage {
        padding: 10px;
    }

    .prediction-surface {
        min-height: 220px;
    }

    #motionCanvas {
        height: 220px;
    }

    .judgement-area {
        min-height: 54px;
    }

    .center-counts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 8px;
    }

    .center-counts > span {
        display: flex;
        align-items: center;
        flex-direction: column;
        gap: 1px;
        font-size: 0.78rem;
        line-height: 1.15;
    }

    .center-counts > span > b {
        font-size: 0.95rem;
    }

    .predict-button {
        min-height: 50px;
    }

    .log-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .hero-copy h1 {
        font-size: 27px;
    }

    .site-nav {
        gap: 8px 12px;
    }

    .status-panel span {
        font-size: 0.66rem;
    }

    .center-result {
        padding: 14px 10px;
    }

}
