@font-face {
    font-family: "GakNumBold";
    src: url("../../assets/fonts/GakNumBold.otf") format("opentype");
    font-display: swap;
}

@font-face {
    font-family: "IBMPlexSansJP";
    src: url("../../assets/fonts/IBMPlexSansJP-Medium.ttf") format("truetype");
    font-display: swap;
}

:root {
    --quiz-teal: #08b3ad;
    --quiz-teal-dark: #058b86;
    --quiz-mint: #d8f4f1;
    --quiz-mint-soft: #eefbf9;
    --quiz-ink: #33413f;
    --quiz-muted: #7a8d89;
    --quiz-line: #d8e5e2;
    --quiz-red: #e91e63;
}

.quiz-container {
    max-width: 920px;
    font-family: "IBMPlexSansJP", "Noto Sans JP", sans-serif;
}

.quiz-view {
    display: none;
}

.quiz-view.is-active {
    display: block;
}

.menu-hero,
.quiz-shell,
.result-card {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 0;
    color: var(--quiz-ink);
    box-shadow: 0 18px 48px rgba(41, 76, 74, 0.16);
}

.menu-hero {
    --quiz-teal: #f59e0b;
    --quiz-teal-dark: #b45309;
    --quiz-mint: #fff3dd;
    --quiz-mint-soft: #fff8ed;
    overflow: hidden;
    min-height: 0;
    padding: 2rem clamp(1rem, 4vw, 2rem) 1.45rem;
    border-radius: 22px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)),
        url('./resource/Backgrand.png') center 0% / 100% 200% no-repeat;
}

.quiz-kicker {
    margin: 0 0 0.45rem;
    color: var(--quiz-teal);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu-hero h2,
.result-card h2 {
    margin: 0;
    color: var(--quiz-ink);
    font-size: 1.8rem;
    line-height: 1.25;
}

.menu-hero p,
.result-card p {
    color: var(--quiz-muted);
    margin: 0.55rem auto 0;
    max-width: 22em;
    line-height: 1.7;
}

.player-name-field {
    display: grid;
    gap: 0.35rem;
    width: min(100%, 360px);
    margin: 1.25rem auto 0;
    color: var(--quiz-muted);
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: center;
}

.player-name-field input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--quiz-line);
    border-radius: 14px;
    padding: 0.55rem 0.8rem;
    background: #ffffff;
    color: var(--quiz-ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(41, 76, 74, 0.08);
}

.player-name-field input:focus {
    outline: none;
    border-color: var(--quiz-teal);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14), 0 4px 12px rgba(41, 76, 74, 0.08);
}

.difficulty-label {
    margin: 1.2rem 0 0.75rem;
    color: var(--quiz-muted);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.difficulty-carousel {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 1rem;
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 0;
    position: relative;
    z-index: 2;
}

.difficulty-card-host {
    min-width: 0;
}

.difficulty-arrow {
    width: 48px;
    height: 48px;
    border: 2px solid var(--quiz-teal);
    border-radius: 50%;
    background: #ffffff;
    color: var(--quiz-teal);
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 8px 18px rgba(41, 76, 74, 0.12);
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.difficulty-arrow:hover {
    transform: translateY(-2px);
    background: var(--quiz-teal);
    color: #ffffff;
}

.difficulty-card {
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #ffffff;
    color: var(--quiz-ink);
    width: 100%;
    min-height: 76px;
    padding: 1rem 1.45rem;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(41, 76, 74, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.difficulty-card.is-selected {
    border: 2px solid #ffffff;
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: 0 8px 18px rgba(41, 76, 74, 0.12);
}

.difficulty-card span,
.difficulty-card strong,
.difficulty-card small,
.difficulty-card em {
    display: block;
}

.difficulty-card span {
    color: var(--quiz-teal);
    font-size: 1.25rem;
    font-weight: 900;
}

.custom-grid {
    display: grid;
    gap: 0.65rem;
}

.custom-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.custom-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.custom-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 26, 25, 0.42);
}

.custom-dialog {
    position: relative;
    width: min(560px, calc(100vw - 2rem));
    margin: max(7vh, 2rem) auto 0;
    padding: 1rem;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(0, 30, 35, 0.24);
    --quiz-teal: #f59e0b;
    --quiz-teal-dark: #b45309;
    --quiz-line: #e5e7eb;
}

.custom-dialog h3 {
    margin: 0 0 0.8rem;
    color: var(--quiz-ink);
}

.alert-dialog {
    text-align: center;
    max-width: 340px;
    --quiz-teal: #f59e0b;
    --quiz-teal-dark: #b45309;
}

.alert-dialog__icon {
    font-size: 2.6rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}

.alert-dialog__body {
    color: var(--quiz-muted);
    font-size: 0.92rem;
    line-height: 1.7;
    margin: 0 0 0.4rem;
}

.custom-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

.custom-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.custom-field__label {
    font-size: 0.82rem;
    font-weight: 900;
    color: var(--quiz-ink);
}

.toggle-group,
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.toggle-opt,
.check-opt {
    position: relative;
}

.toggle-opt input,
.check-opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle-opt span,
.check-opt span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38em 0.9em;
    border: 1.5px solid var(--quiz-line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--quiz-ink);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.toggle-opt input:checked + span,
.check-opt input:checked + span {
    background: var(--quiz-teal);
    border-color: var(--quiz-teal);
    color: #ffffff;
}

.toggle-opt span:hover,
.check-opt span:hover {
    border-color: var(--quiz-teal);
}

.input-area input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--quiz-line);
    border-radius: 14px;
    min-height: 44px;
    padding: 0.5rem 0.7rem;
    color: var(--quiz-ink);
    background: #ffffff;
    font: inherit;
}

.menu-actions {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding: 0;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: min(100%, 360px);
    margin: 1.25rem auto 0;
    padding: 0;
    align-items: center;
}

.result-actions__main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    width: 100%;
}

.result-actions .primary-button,
.result-actions .ghost-button {
    width: 100%;
}

.result-actions__review {
    width: min(100%, 200px);
}

.primary-button,
.ghost-button {
    border-radius: 12px;
    min-height: 48px;
    border: 1px solid var(--quiz-line);
    padding: 0.65rem 1rem;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.primary-button {
    background: var(--quiz-teal);
    border-color: var(--quiz-teal);
    color: #ffffff;
}

.ghost-button {
    background: #ffffff;
    color: var(--quiz-teal-dark);
}

.quiz-shell {
    overflow: hidden;
    min-height: 720px;
    --quiz-teal: #f59e0b;
    --quiz-teal-dark: #b45309;
    --quiz-mint: #fff3dd;
    --quiz-mint-soft: #fff8ed;
    background: #ffffff;
}

.quiz-hud {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem;
    align-items: center;
    padding: 0.85rem 0.9rem 0;
}

.quiz-hud .ghost-button {
    min-height: 34px;
    padding: 0.25rem 0.45rem;
    border: none;
    background: transparent;
}

.quiz-hud > div {
    justify-self: end;
    text-align: right;
}

.quiz-hud span {
    display: block;
    color: var(--quiz-muted);
    font-size: 0.68rem;
    font-weight: 900;
}

.quiz-hud strong {
    display: block;
    color: var(--quiz-ink);
    font-size: 0.95rem;
}

#roundLabel {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.08em;
    color: var(--quiz-teal-dark);
    line-height: 1;
    letter-spacing: 0;
}

#roundLabel span {
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    color: var(--quiz-teal);
    font-size: clamp(2rem, 6vw, 3.5rem);
}

#roundLabel small {
    font-family: "IBMPlexSansJP", "Noto Sans JP", sans-serif;
    font-size: clamp(0.82rem, 2.3vw, 1.05rem);
    font-weight: 900;
}

.timer-track {
    height: 18px;
    overflow: hidden;
    background: #d7dfdd;
    margin-top: 0.65rem;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #08a29d, #52ece5);
    transition: width 0.1s linear;
}

.timer-bar.is-danger {
    background: linear-gradient(90deg, #ff7a7a, var(--quiz-red));
}

.quiz-stage {
    display: block;
}

.card-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 1rem;
    border-radius: 0 0 54px 54px;
    background: #ffffff;
}

.question-image {
    width: min(70%, 240px);
    max-height: 280px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 12px 26px rgba(44, 60, 58, 0.18);
}

.question-image.is-hidden {
    filter: blur(8px) saturate(0.7) brightness(0.88);
}

.scanline {
    display: none;
}

.answer-stage {
    --choice-layer-height: calc((64px * 4) + (0.75rem * 3));
    position: relative;
    padding: 1.6rem 1rem 1.1rem;
}


.choice-area {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.75rem;
}

.judge-mark {
    position: absolute;
    top: 1.6rem;
    left: 1rem;
    right: 1rem;
    height: var(--choice-layer-height);
    z-index: 6;
    display: none;
    place-items: center;
    pointer-events: none;
    margin: 0;
    font-family: "Arial Black", "Noto Sans JP", sans-serif;
    font-size: min(calc(var(--choice-layer-height) * 1.35), 80vw);
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    transform: translateY(calc(-0.18em + 3mm)) scale(0.86);
}

.judge-mark.is-correct,
.judge-mark.is-wrong {
    display: grid;
    opacity: 1;
    transform: translateY(calc(-0.18em + 3mm)) scale(1);
    transition: opacity 0.12s ease, transform 0.16s ease;
}

.judge-mark.is-correct {
    color: #ef4444;
    -webkit-text-stroke: 0.075em currentColor;
    paint-order: stroke fill;
}

.judge-mark.is-wrong {
    color: #2563eb;
}

.choice-button {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 64px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: #ffffff;
    color: var(--quiz-ink);
    padding: 0.65rem 0.9rem;
    text-align: center;
    font: inherit;
    font-size: 1.02rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(41, 76, 74, 0.12);
}

.choice-button::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 55%;
    background: url('./resource/logo.png') no-repeat right 34%;
    background-size: auto 380%;
    opacity: 0.12;
    pointer-events: none;
}

.choice-button span {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--quiz-mint-soft);
    color: var(--quiz-teal);
    font-weight: 900;
}

.choice-button.is-correct {
    border-color: var(--quiz-teal);
    color: var(--quiz-teal-dark);
}

.choice-button.is-wrong {
    border-color: var(--quiz-red);
    color: var(--quiz-red);
    background: #fff0f5;
}

.choice-button.is-dimmed {
    opacity: 0.42;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-field-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}

.input-field-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 55%;
    background: url('./resource/logo.png') no-repeat right 34%;
    background-size: auto 380%;
    opacity: 0.12;
    pointer-events: none;
}

.input-row {
    display: flex;
    gap: 0.6rem;
}

.input-row .ghost-button {
    flex: 0 0 auto;
    min-width: 72px;
}

.input-row .primary-button {
    flex: 1;
}

.input-area[hidden],
.choice-area[hidden] {
    display: none;
}

.input-area input {
    text-align: center;
    font-size: 1.05rem;
}

#answerInput.is-showing-answer {
    color: #1e40af;
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.35);
    font-weight: 900;
}

.result-card {
    --quiz-teal: #f59e0b;
    --quiz-teal-dark: #b45309;
    --quiz-mint: #fff3dd;
    --quiz-mint-soft: #fff8ed;
    min-height: auto;
    padding: 4rem 1.2rem 1.5rem;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(20, 20, 20, 0.45), rgba(20, 20, 20, 0.45)),
        url('./resource/Backgrand.png') center 100% / auto 200% no-repeat;
    background-color: #141414;
    color: #ffffff;
}

.result-card h2 {
    color: #ffffff;
}

.result-rank {
    position: relative;
    display: grid;
    place-items: center;
    width: 190px;
    height: 190px;
    margin: 1.6rem auto 1.1rem;
    line-height: 1;
}

.rank-sprite,
.rank-gauge__label-sprite {
    display: block;
    background-image: var(--rank-sprite-image);
    background-repeat: no-repeat;
    background-size: 400% 200%;
    background-position: var(--rank-sprite-x, 0%) var(--rank-sprite-y, 0%);
}

.rank-sprite--result {
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.result-score {
    color: #ffffff;
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    font-size: 3.2rem;
    line-height: 1;
    font-weight: 900;
    margin-top: 1rem;
}

.rank-gauge {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 1.2rem;
    align-items: center;
    width: min(100%, 360px);
    margin: 1.2rem auto 3rem;
    color: #ffffff;
    font-weight: 900;
}

.rank-gauge__track {
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffffff, #00e5ff);
    overflow: hidden;
    position: relative;
}

.rank-gauge__fill {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: #090909;
}

#rankCurrentLabel {
    color: #f91880;
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    font-size: 1.9rem;
    text-shadow: 0 0 8px rgba(249, 24, 128, 0.4);
}

#rankNextLabel {
    color: #f4c542;
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    font-size: 1.9rem;
    text-shadow: 0 0 8px rgba(244, 197, 66, 0.4);
}

#rankCurrentLabel.rank-gauge__label-sprite,
#rankNextLabel.rank-gauge__label-sprite {
    width: 48px;
    height: 48px;
    justify-self: center;
    overflow: hidden;
    color: transparent;
    font-size: 0;
    text-shadow: none;
}

/* ── シェアボタン（吹き出しポップオーバー） ── */
.share-popover[hidden] {
    display: none;
}

.result-share {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 1rem auto 0;
}

.share-trigger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.14s;
}

.share-trigger-button:hover {
    background: rgba(255, 255, 255, 0.26);
}

.share-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    padding: 0.4rem 0.55rem;
    display: flex;
    flex-direction: row;
    gap: 0.45rem;
    z-index: 50;
}

.share-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #ffffff;
}

.share-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #1f2937;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.12s;
}

.share-icon-btn:hover {
    background: #e5e7eb;
}

.share-icon-btn--x {
    background: #000000;
    color: #ffffff;
}

.share-icon-btn--x:hover {
    background: #333333;
}

/* ── スタンドアロン ランキング（常時表示） ── */
.ranking-standalone {
    margin-top: 1rem;
    padding: 1rem 1rem 0.8rem;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(41, 76, 74, 0.12);
}

.ranking-standalone__title {
    margin: 0 0 0.7rem;
    color: var(--quiz-ink);
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
}

.ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.ranking-item {
    display: grid;
    grid-template-columns: 26px 1fr auto auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.82rem;
    color: var(--quiz-ink);
}

.ranking-item.is-mine {
    background: rgba(245, 158, 11, 0.1);
    outline: 1px solid rgba(245, 158, 11, 0.35);
}

.ranking-pos {
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    font-weight: 900;
    text-align: center;
    color: #9ca3af;
    font-size: 0.76rem;
}

.ranking-pos.is-top {
    color: #f59e0b;
}

.ranking-name {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ranking-name > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-diff {
    font-size: 0.68rem;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.rank-sprite--badge {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

.ranking-score {
    font-family: "GakNumBold", "IBMPlexSansJP", sans-serif;
    font-weight: 900;
    font-size: 0.86rem;
    text-align: right;
    white-space: nowrap;
    color: var(--quiz-ink);
}

.ranking-more-wrap {
    text-align: center;
    margin-top: 0.5rem;
    padding-bottom: 0.2rem;
}

.ranking-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.38em 1.2em;
    border-radius: 999px;
    border: 1.5px solid var(--quiz-line);
    background: #ffffff;
    color: var(--quiz-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}

.ranking-more-btn:hover {
    border-color: #f59e0b;
    color: var(--quiz-ink);
}

.ranking-msg {
    color: #9ca3af;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.4rem 0;
}

.quiz-disclaimer {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-light);
    font-size: 0.86rem;
    line-height: 1.6;
    text-align: center;
}

.load-error {
    color: var(--quiz-red);
    font-weight: 900;
}

.fly-text {
    position: fixed;
    z-index: 9999;
    font-family: "IBMPlexSansJP", "Noto Sans JP", sans-serif;
    font-weight: 900;
    font-size: 2rem;
    color: #1a1a1a;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -50%);
}

@keyframes fly-to-card {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(calc(-50% + var(--fly-x) * 0.9), calc(-50% + var(--fly-y) * 0.9)) scale(0.85);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--fly-x)), calc(-50% + var(--fly-y))) scale(0.65);
    }
}

.fly-text.is-flying {
    animation: fly-to-card 0.38s cubic-bezier(0.4, 0.2, 0.2, 1) forwards;
}

@keyframes image-shake {
    0%, 100% { transform: none; }
    14% { transform: translateX(-10px) rotate(-1.5deg); }
    30% { transform: translateX(10px) rotate(1.5deg); }
    48% { transform: translateX(-7px) rotate(-1deg); }
    65% { transform: translateX(7px) rotate(1deg); }
    82% { transform: translateX(-3px) rotate(-0.5deg); }
}

.question-image.is-shaking {
    animation: image-shake 0.52s ease;
}

@media (min-width: 900px) {
    .quiz-container {
        max-width: 900px;
    }

    .menu-hero {
        padding-top: 2rem;
    }

    .difficulty-carousel {
        max-width: 620px;
        margin-left: auto;
        margin-right: auto;
    }

    .menu-actions {
        max-width: 760px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 560px) {
    .quiz-container {
        max-width: 460px;
    }

    .difficulty-carousel {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        gap: 0.45rem;
        padding: 0 0.55rem;
    }

    .difficulty-arrow {
        width: 38px;
        height: 38px;
    }

    .difficulty-card {
        min-height: 68px;
        padding: 1rem;
    }

    .difficulty-card span {
        font-size: 1.15rem;
    }
}

/* ─── 成績確認モーダル ─── */
.review-dialog {
    max-width: 600px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.review-dialog-body {
    overflow-y: auto;
    flex: 1 1 auto;
}

/* ─── 成績表（画像保存対象） ─── */
.review-capture {
    background: #ffffff;
    border: 1.5px solid var(--quiz-line);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-capture__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    gap: 0.5rem;
}

.review-accuracy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.review-accuracy__label {
    font-size: 0.68rem;
    color: var(--quiz-muted);
    letter-spacing: 0.06em;
    margin-bottom: 0.1rem;
}

.review-accuracy__value {
    display: flex;
    align-items: baseline;
    gap: 0.05rem;
    line-height: 1;
}

.review-accuracy__num {
    font-family: "GakNumBold", "IBMPlexSansJP", monospace;
    font-size: 2.6rem;
    color: var(--quiz-teal);
    line-height: 1;
}

.review-accuracy__pct {
    font-family: "GakNumBold", "IBMPlexSansJP", monospace;
    font-size: 1.3rem;
    color: var(--quiz-teal);
}

.review-meta {
    text-align: right;
}

.review-meta__title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--quiz-ink);
    letter-spacing: 0.02em;
}

.review-rank-score {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.rank-sprite--review-badge {
    width: calc(1.4 * 0.85rem);
    height: calc(1.4 * 0.85rem);
    display: block;
    flex-shrink: 0;
}

.review-rank-score__pts {
    font-family: "GakNumBold", "IBMPlexSansJP", monospace;
    font-size: 0.85rem;
    color: var(--quiz-teal);
    letter-spacing: 0.04em;
}

.review-meta__diff,
.review-meta__name {
    font-size: 0.64rem;
    color: var(--quiz-muted);
}

/* ─── カードグリッド ─── */
.review-capture__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.45rem;
}

.review-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
    min-width: 0;
}

.review-cell__num {
    font-family: "GakNumBold", "IBMPlexSansJP", monospace;
    font-size: 0.65rem;
    color: var(--quiz-muted);
    line-height: 1;
}

.review-cell__img-wrap {
    position: relative;
    width: 100%;
}

.review-cell__img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    background: #f0f7f6;
}

.review-cell__mark {
    font-size: 0.8rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    width: 100%;
}

.review-cell.is-correct .review-cell__mark { color: #08b3ad; }
.review-cell.is-wrong   .review-cell__mark { color: var(--quiz-red); }

.review-cell__name {
    font-size: 0.55rem;
    text-align: center;
    line-height: 1.3;
    color: var(--quiz-ink);
    width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

.review-cell.is-wrong .review-cell__name {
    color: var(--quiz-red);
}

.review-cell__wrong {
    font-size: 0.5rem;
    color: var(--quiz-muted);
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-save-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
