:root {
    --ui-bg: #eef3f1;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f4f8f7;
    --ui-border: #c6d4cf;
    --ui-text: #16221d;
    --ui-text-subtle: #4a5e57;
    --ui-accent: #1e6a4f;
    --ui-accent-hover: #195740;
    --ui-danger: #b64040;
    --ui-danger-hover: #983434;
    --ui-muted: #6b7f78;
    --ui-radius: 12px;
    --ui-shadow: 0 10px 24px rgba(13, 35, 27, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: radial-gradient(circle at top right, #dcece4, var(--ui-bg) 45%);
    color: var(--ui-text);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    line-height: 1.55;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
}

.app-header {
    background: #12362a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 18px rgba(9, 26, 20, 0.25);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header__inner {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1100px;
    padding: 0.8rem 1rem;
}

.app-header__brand {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.app-main {
    padding: 1.4rem 1rem 2rem;
}

.app-container {
    margin: 0 auto;
    max-width: 1100px;
}

.app-container--fluid {
    max-width: none;
}

body.test-fullscreen .app-header {
    display: none;
}

body.test-fullscreen .app-main {
    min-height: 100dvh;
    padding: 0;
}

body.test-fullscreen .app-container {
    margin: 0;
    max-width: none;
    padding: 0;
}

.error-container {
    margin: 0 auto;
    max-width: 760px;
    padding: 3rem 1rem;
}

.card {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    padding: 1.4rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    letter-spacing: 0.01em;
    margin: 0;
}

p {
    margin: 0;
}

.message {
    background: #e7f6ef;
    border: 1px solid #9ac8b5;
    border-radius: 8px;
    color: #14553f;
    margin-bottom: 1rem;
    padding: 0.65rem 0.8rem;
}

.message.error {
    background: #fdecec;
    border-color: #e0abab;
    color: #9f2222;
}

.message.warning {
    background: #fff5db;
    border-color: #e7cb87;
    color: #805f10;
}

.message.success {
    background: #e7f6ef;
    border-color: #9ac8b5;
    color: #14553f;
}

.message.info {
    background: #e8f1fb;
    border-color: #9ebfdf;
    color: #204f7b;
}

button,
.button,
input[type='button'],
input[type='reset'],
input[type='submit'] {
    background: var(--ui-accent);
    border: 1px solid var(--ui-accent);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.62rem 1rem;
    text-decoration: none;
}

button:hover,
.button:hover,
input[type='button']:hover,
input[type='reset']:hover,
input[type='submit']:hover {
    background: var(--ui-accent-hover);
    border-color: var(--ui-accent-hover);
}

button:disabled,
input[type='submit']:disabled {
    background: #8da39b;
    border-color: #8da39b;
    cursor: wait;
}

.button.button-outline,
.button--secondary,
button.button--secondary {
    background: var(--ui-danger);
    border-color: var(--ui-danger);
    color: #fff;
}

.button.button-outline:hover,
.button--secondary:hover,
button.button--secondary:hover {
    background: var(--ui-danger-hover);
    border-color: var(--ui-danger-hover);
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

input[type='text'],
input[type='number'],
input[type='password'],
textarea,
select {
    background: #fff;
    border: 1px solid #b9c8c3;
    border-radius: 10px;
    color: var(--ui-text);
    font: inherit;
    min-height: 2.3rem;
    padding: 0.45rem 0.65rem;
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #2e7f61;
    box-shadow: 0 0 0 3px rgba(46, 127, 97, 0.15);
    outline: none;
}

form .input,
.subject-entry-form .input {
    margin-bottom: 1rem;
}

.subject-entry-form .error-message {
    color: #a72020;
    margin-top: 0.35rem;
}

.test-home {
    display: grid;
    gap: 1.1rem;
}

.test-home h1 {
    font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.test-home__hero,
.test-home__panel {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    padding: 1rem 1.1rem;
}

.test-home__hero {
    align-items: end;
    display: grid;
    gap: 0.7rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.test-home__title-wrap {
    display: grid;
    gap: 0.35rem;
}

.test-home__eyebrow {
    color: var(--ui-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0;
    text-transform: uppercase;
}

.test-home__lead {
    color: var(--ui-text-subtle);
    margin: 0;
}

/* 入場パネル: 左=フォーム / 右=スマホアクセス用QR */
.test-home__entry {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: space-between;
}

.test-home__entry-main {
    flex: 1 1 260px;
    min-width: 0;
}

.test-home__entry-qr {
    flex: 0 0 auto;
    text-align: center;
}

.test-home__qr-img {
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    box-sizing: border-box;
    display: block;
    height: 160px;
    padding: 6px;
    width: 160px;
}

.test-home__qr-img svg {
    display: block;
    height: 100%;
    width: 100%;
}

.test-home__qr-caption {
    color: var(--ui-text-subtle);
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0.45rem 0 0.1rem;
}

.test-home__qr-url {
    color: var(--ui-muted);
    font-size: 0.7rem;
    margin: 0 auto;
    max-width: 172px;
    word-break: break-all;
}

@media (max-width: 520px) {
    /* スマホ表示では QR は不要（既に端末でアクセス済み）なので非表示 */
    .test-home__entry-qr {
        display: none;
    }
}

.subject-chip {
    align-items: baseline;
    background: #e8f1ed;
    border: 1px solid #bad0c7;
    border-radius: 999px;
    display: inline-flex;
    gap: 0.5rem;
    margin: 0;
    padding: 0.38rem 0.75rem;
    white-space: nowrap;
}

.subject-chip--top {
    display: none;
    justify-self: end;
}

.subject-chip--inline {
    display: inline-flex;
}

.subject-chip span {
    color: var(--ui-text-subtle);
    font-size: 0.82rem;
    font-weight: 700;
}

.subject-chip strong {
    color: #0f4f3a;
    font-size: 1rem;
}

.subject-entry-form {
    max-width: 36rem;
}

.test-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.test-card {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: grid;
    gap: 0.8rem;
    padding: 1.2rem;
}

.test-card h2 {
    font-size: 1.2rem;
    line-height: 1.35;
}

.test-card p {
    color: var(--ui-text-subtle);
}

.test-start-form {
    margin: 0;
}

/* 受験済み試験のカード見出し行（タイトル＋受験済みバッジ） */
.test-card__head {
    align-items: flex-start;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

/* 受験済みバッジ（既定は非表示、受験済みカードでのみ表示） */
.test-card__badge {
    display: none;
}

.test-card--completed .test-card__badge {
    align-items: center;
    align-self: flex-start;
    background: rgba(30, 106, 79, 0.12);
    border-radius: 999px;
    color: var(--ui-accent);
    display: inline-flex;
    flex: none;
    font-size: 0.8rem;
    font-weight: 700;
    gap: 0.3rem;
    padding: 0.15rem 0.6rem;
    white-space: nowrap;
}

/* 受験済みは開始ボタンをグレーにする（押下は可能。disabled は付けない） */
.test-card--completed .test-start-form button,
.test-card--completed .test-start-form input[type='submit'] {
    background: var(--ui-muted);
    border-color: var(--ui-muted);
}

.test-card--completed .test-start-form button:hover,
.test-card--completed .test-start-form input[type='submit']:hover {
    background: #5d716a;
    border-color: #5d716a;
}

/* 受験状態の取得が終わるまで一覧を覆う全画面オーバーレイ */
.status-overlay {
    align-items: center;
    background: var(--ui-bg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 1000;
}

.status-overlay[hidden] {
    display: none;
}

.status-overlay__spinner {
    animation: status-overlay-spin 0.8s linear infinite;
    border: 4px solid var(--ui-border);
    border-radius: 50%;
    border-top-color: var(--ui-accent);
    height: 3rem;
    width: 3rem;
}

@keyframes status-overlay-spin {
    to {
        transform: rotate(360deg);
    }
}

.status-overlay__box {
    display: grid;
    gap: 1rem;
    justify-items: center;
    text-align: center;
}

.visually-hidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.subject-change {
    background: var(--ui-surface-soft);
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    display: grid;
    gap: 0.55rem;
    padding: 0.9rem;
}

.subject-entry-form--compact {
    margin-top: 0;
}

.subject-entry-form--compact button {
    width: fit-content;
}

.test-run {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: grid;
    gap: 0.95rem;
    padding: 1.2rem;
}

.test-screen {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
}

.test-screen__hero {
    display: grid;
    gap: 0.55rem;
}

.test-screen__eyebrow {
    color: var(--ui-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.test-screen__title {
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    margin: 0;
}

.test-screen__desc {
    color: var(--ui-text-subtle);
}

.test-screen__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.test-screen__status {
    margin: 0;
}

.test-screen__result {
    background: #f4f8f7;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    margin: 0;
    max-height: 18rem;
    overflow: auto;
    padding: 0.8rem;
    white-space: pre-wrap;
}

.run-meta {
    display: grid;
    gap: 0.35rem 0.9rem;
    grid-template-columns: max-content 1fr;
}

.run-meta dt {
    color: var(--ui-muted);
    font-weight: 700;
}

.run-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

#resultOutput {
    background: #f4f8f7;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    margin: 0;
    min-height: 8rem;
    padding: 0.8rem;
    white-space: pre-wrap;
}

.hp-run {
    display: grid;
    gap: 1.2rem;
    justify-items: center;
    margin: 0 auto;
    min-height: 72vh;
    width: 100%;
}

.hp-run__intro {
    align-items: center;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin: 0;
    max-width: 560px;
    padding: 2rem 1.6rem;
    text-align: center;
    width: 100%;
}

.hp-run__eyebrow,
.hp-run__copy,
.hp-run__status {
    letter-spacing: 0;
    margin: 0;
}

.hp-run__eyebrow {
    color: #4d6f62;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hp-run__intro h1 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
}

.hp-run__copy {
    color: var(--ui-text-subtle);
    font-size: 1rem;
}

.hp-run__status {
    color: var(--ui-muted);
    font-size: 0.9rem;
}

.hp-run__primary,
.hp-run__secondary {
    border-radius: 10px;
    letter-spacing: 0;
}

.hp-run__primary {
    background: #1d7f5f;
    border-color: #1d7f5f;
    color: #fff;
    min-width: 14rem;
}

.hp-run__primary:disabled {
    background: #8c9a94;
    border-color: #8c9a94;
    cursor: wait;
}

.hp-run__secondary {
    background: #c93232;
    border-color: #c93232;
    color: #fff;
}

.hp-run__secondary--back {
    background: #2f6eb0;
    border-color: #2f6eb0;
    margin-bottom: 0;
}

.hp-run__stage {
    background: #111;
    border-radius: 10px;
    height: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.hp-run__stage.is-active {
    border-radius: 0;
    bottom: 0;
    height: 100dvh;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
}

.hp-run__results {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: grid;
    gap: 1rem;
    justify-items: center;
    margin: 0 auto;
    max-width: 560px;
    padding: 1.4rem 1.2rem;
    width: 100%;
}

.hp-run__chart-wrap {
    min-height: 300px;
    position: relative;
    width: 100%;
}

.hp-run__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    width: 100%;
}

@media (max-width: 720px) {
    .hp-run {
        gap: 0.9rem;
        min-height: auto;
    }

    .hp-run__intro {
        gap: 0.75rem;
        padding: 1.4rem 1rem;
    }

    .hp-run__intro h1 {
        font-size: clamp(1.4rem, 5.5vw, 1.8rem);
    }

    .hp-run__copy {
        font-size: 0.95rem;
    }

    .hp-run__primary,
    .hp-run__secondary {
        font-size: 1rem;
        min-height: 3rem;
        min-width: 0;
        padding: 0.8rem 1rem;
        width: 100%;
    }

    .hp-run__chart-wrap {
        min-height: 240px;
    }

    .hp-run__results {
        padding: 1rem 0.9rem;
    }
}

.hp-run__save {
    align-self: start;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    padding: 1rem;
}

.hp-run__detail {
    background: #f6f8fa;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 1rem;
    max-height: 16rem;
    overflow: auto;
    padding: 1rem;
    white-space: pre-wrap;
}

.ufov-config {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    margin: 0 auto;
    max-width: 820px;
    padding: 1rem;
}

.ufov-exam {
    background: #fff;
    border-radius: 10px;
    min-height: calc(100vh - 160px);
    overflow: hidden;
    position: relative;
}

.ufov-config h1 {
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    line-height: 1.3;
    margin-bottom: 0.8rem;
    text-align: center;
}

.ufov-config__subject {
    color: #4d5965;
    margin-bottom: 0.9rem;
    text-align: center;
}

.ufov-param {
    border-bottom: 1px solid #dce3ea;
    padding: 0.8rem 0;
}

.ufov-param__label {
    font-size: clamp(1.08rem, 2.4vw, 1.3rem);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.ufov-param__value {
    display: inline-block;
    font-weight: 700;
    min-width: 4rem;
    text-align: right;
}

.ufov-param__unit {
    color: #55616c;
}

.ufov-radio-row {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr 1fr;
}

.ufov-radio {
    background: #e8eef5;
    border: 1px solid #9badbf;
    border-radius: 8px;
    color: #17212b;
    cursor: pointer;
    display: block;
    font-size: 1.05rem;
    line-height: 1.2;
    padding: 0.8rem 0.5rem;
    text-align: center;
}

.ufov-radio.is-active {
    background: #0b6bcb;
    border-color: #0b6bcb;
    color: #fff;
}

.ufov-radio input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.ufov-param input[type="range"] {
    cursor: pointer;
    display: block;
    height: 2.2rem;
    width: 100%;
}

.ufov-actions {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr 1fr;
    margin-top: 1rem;
}

.ufov-button {
    border-radius: 8px;
    display: inline-block;
    font: inherit;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.75rem 0.7rem;
    text-align: center;
    text-decoration: none;
}

.ufov-button--secondary {
    background: #697783;
    border: 1px solid #697783;
    color: #fff;
}

.ufov-button--primary {
    background: #0b6bcb;
    border: 1px solid #0b6bcb;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 520px) {
    .ufov-radio-row,
    .ufov-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 932px) and (max-height: 430px) and (orientation: landscape) {
    .app-header__inner {
        padding: 0.42rem 0.7rem;
    }

    .app-header__brand {
        font-size: 0.92rem;
    }

    .app-main {
        padding: 0.58rem 0.65rem 0.9rem;
    }

    button,
    .button,
    input[type='button'],
    input[type='reset'],
    input[type='submit'] {
        font-size: 0.93rem;
        min-height: 2rem;
        padding: 0.4rem 0.72rem;
    }

    input[type='text'],
    input[type='number'],
    input[type='password'],
    textarea,
    select {
        min-height: 2rem;
        padding: 0.34rem 0.5rem;
    }

    .test-home {
        gap: 0.62rem;
    }

    .test-home h1 {
        font-size: 1.22rem;
    }

    .test-home__hero,
    .test-home__panel {
        border-radius: 10px;
        gap: 0.42rem;
        padding: 0.68rem;
    }

    .test-home__eyebrow {
        font-size: 0.72rem;
    }

    .test-home__lead {
        font-size: 0.82rem;
    }

    .subject-chip {
        font-size: 0.8rem;
        gap: 0.4rem;
        justify-self: end;
        padding: 0.26rem 0.56rem;
    }

    .subject-chip strong {
        font-size: 0.9rem;
    }

    .subject-entry-form {
        max-width: 100%;
    }

    .subject-entry-form .input {
        margin-bottom: 0.58rem;
    }

    .test-grid {
        gap: 0.58rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .test-card {
        gap: 0.42rem;
        padding: 0.68rem;
    }

    .test-card h2 {
        font-size: 0.97rem;
    }

    .test-card p {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .test-start-form button {
        width: 100%;
    }

    .subject-change {
        padding: 0.62rem;
    }

    .subject-entry-form--compact {
        margin-top: 0;
    }

    .subject-entry-form--compact button {
        width: 100%;
    }

    .ufov-config {
        border-radius: 10px;
        max-width: 100%;
        padding: 0.62rem;
    }

    .ufov-config h1 {
        font-size: 1.14rem;
        margin-bottom: 0.32rem;
    }

    .ufov-config__subject {
        font-size: 0.83rem;
        margin-bottom: 0.42rem;
    }

    .ufov-config > form {
        column-gap: 0.58rem;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 0.46rem;
    }

    .ufov-param {
        background: #f8fbfa;
        border: 1px solid #d8e3df;
        border-radius: 8px;
        padding: 0.42rem 0.5rem;
    }

    .ufov-param:first-child,
    .ufov-actions {
        grid-column: 1 / -1;
    }

    .ufov-param__label {
        font-size: 0.83rem;
        line-height: 1.25;
        margin-bottom: 0.24rem;
    }

    .ufov-param__value {
        min-width: 2.8rem;
    }

    .ufov-param__unit {
        font-size: 0.76rem;
    }

    .ufov-radio-row {
        gap: 0.42rem;
    }

    .ufov-radio {
        font-size: 0.88rem;
        padding: 0.44rem 0.3rem;
    }

    .ufov-param input[type="range"] {
        height: 1.7rem;
    }

    .ufov-actions {
        margin-top: 0.1rem;
    }

    .ufov-button {
        font-size: 0.95rem;
        padding: 0.55rem 0.5rem;
    }
}

/* ============================================================
   動体視力検査（DVA）設定画面
   独立した dva- 名前空間（ufov-* は流用しない）
   ============================================================ */
.dva-config {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    margin: 0 auto;
    max-width: 820px;
    padding: 1rem;
}

.dva-config h1 {
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    line-height: 1.3;
    margin-bottom: 0.8rem;
    text-align: center;
}

.dva-config__subject {
    color: #4d5965;
    margin-bottom: 0.9rem;
    text-align: center;
}

.dva-section-title {
    color: #0b6bcb;
    font-size: 1rem;
    font-weight: 700;
    margin: 0.6rem 0 0.2rem;
    padding-top: 0.4rem;
}

.dva-param {
    border-bottom: 1px solid #dce3ea;
    padding: 0.8rem 0;
}

.dva-param__label {
    font-size: clamp(1.08rem, 2.4vw, 1.3rem);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.dva-param__value {
    display: inline-block;
    font-weight: 700;
    min-width: 4rem;
    text-align: right;
}

.dva-param__unit {
    color: #55616c;
}

.dva-radio-row {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr 1fr;
}

.dva-radio {
    background: #e8eef5;
    border: 1px solid #9badbf;
    border-radius: 8px;
    color: #17212b;
    cursor: pointer;
    display: block;
    font-size: 1.05rem;
    line-height: 1.2;
    padding: 0.8rem 0.5rem;
    text-align: center;
}

.dva-radio.is-active {
    background: #0b6bcb;
    border-color: #0b6bcb;
    color: #fff;
}

.dva-radio input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.dva-param input[type="range"] {
    cursor: pointer;
    display: block;
    height: 2.2rem;
    width: 100%;
}

.dva-mode-section[hidden] {
    display: none;
}

.dva-actions {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr 1fr;
    margin-top: 1rem;
}

.dva-button {
    border-radius: 8px;
    display: inline-block;
    font: inherit;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.75rem 0.7rem;
    text-align: center;
    text-decoration: none;
}

.dva-button--secondary {
    background: #697783;
    border: 1px solid #697783;
    color: #fff;
}

.dva-button--primary {
    background: #0b6bcb;
    border: 1px solid #0b6bcb;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 520px) {
    .dva-radio-row,
    .dva-actions {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   動体視力検査（DVA）試験画面
   ============================================================ */
.dva-exam {
    height: 100dvh;
    overflow: hidden;
    position: relative;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.dva-canvas {
    display: block;
    height: 100%;
    width: 100%;
}

/* 十字配置の矢印PAD（Canvas の上に固定配置） */
.dva-pad {
    display: grid;
    gap: 0.35rem;
    grid-template-areas:
        ".    up    ."
        "left .     right"
        ".    down  .";
    grid-template-columns: repeat(3, 3.25rem);
    grid-template-rows: repeat(3, 3.25rem);
    position: fixed;
    bottom: 16px;
    z-index: 10;
}

.dva-pad--bottom-right {
    right: 16px;
}

.dva-pad--bottom-left {
    left: 16px;
}

.dva-pad__button {
    align-items: center;
    background: rgba(127, 127, 127, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 1.5rem;
    justify-content: center;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
    padding: 0;
    touch-action: manipulation;
}

.dva-pad__button:active {
    background: rgba(127, 127, 127, 0.6);
}

.dva-pad__button--up {
    grid-area: up;
}

.dva-pad__button--right {
    grid-area: right;
}

.dva-pad__button--down {
    grid-area: down;
}

.dva-pad__button--left {
    grid-area: left;
}

/* 白地モードでは PAD のコントラストを反転 */
.dva-exam--light .dva-pad__button {
    border-color: rgba(0, 0, 0, 0.55);
    color: #000;
}

.dva-status {
    align-items: center;
    background: rgba(0, 0, 0, 0.72);
    border-radius: 8px;
    color: #fff;
    display: flex;
    font-size: 0.95rem;
    gap: 0.7rem;
    left: 50%;
    max-width: 92vw;
    padding: 0.6rem 0.9rem;
    position: fixed;
    top: 16px;
    transform: translateX(-50%);
    z-index: 11;
}

/* display: flex は UA の [hidden]{display:none} を上書きするため、hidden 時は明示的に隠す */
.dva-status[hidden] {
    display: none;
}

.dva-status__retry {
    background: #0b6bcb;
    border: 1px solid #0b6bcb;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    flex: none;
    font: inherit;
    padding: 0.35rem 0.7rem;
}

.dva-status__retry[hidden] {
    display: none;
}
