/**
 * DS-Kentei Dojo - Minimal Modern UI
 * Version: 1.0.0
 *
 * G検定版(v5.3.0)のスタイルを土台に、クラス接頭辞を ds- へ移し、
 * 末尾に数式・コード表示用のルールを追加している。
 */

/* =========================================================
   Design tokens
   ========================================================= */
:root {
    /* Base: #46757e on white */
    --ds-brand: #46757e;
    --ds-brand-hover: #375f67;
    --ds-brand-deep: #2f5158;
    --ds-primary: #1b2426;
    --ds-primary-hover: #2a3639;
    --ds-accent: #46757e;
    --ds-accent-hover: #375f67;
    --ds-accent-soft: #eef4f5;
    --ds-bg: #ffffff;
    --ds-surface: #ffffff;
    --ds-surface-muted: #f7f9fa;
    --ds-text: #1b2426;
    --ds-text-soft: #4a565a;
    --ds-text-muted: #6d7a7e;
    --ds-border: #e4eaeb;
    --ds-border-strong: #cbd5d7;
    --ds-success: #2f7d6a;
    --ds-success-soft: #eef6f3;
    --ds-warning: #9a6b1f;
    --ds-warning-soft: #fbf6ec;
    --ds-danger: #b04a44;
    --ds-danger-soft: #faf1f0;
    --ds-radius-sm: 8px;
    --ds-radius: 10px;
    --ds-radius-lg: 12px;
    --ds-shadow-sm: none;
    --ds-shadow: 0 1px 2px rgba(27, 36, 38, 0.04);
    --ds-focus: 0 0 0 3px rgba(70, 117, 126, 0.2);
    --ds-container: 890px;
    --ds-font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Backward-compatible variable aliases */
:root {
    --primary: var(--ds-primary);
    --primary-light: var(--ds-primary-hover);
    --accent: var(--ds-accent);
    --accent-soft: var(--ds-accent-soft);
    --bg-body: var(--ds-bg);
    --bg-card: var(--ds-surface);
    --text-main: var(--ds-text);
    --text-muted: var(--ds-text-muted);
    --success: var(--ds-success);
    --success-soft: var(--ds-success-soft);
    --warning: var(--ds-warning);
    --warning-soft: var(--ds-warning-soft);
    --error: var(--ds-danger);
    --error-soft: var(--ds-danger-soft);
    --border: var(--ds-border);
    --radius: var(--ds-radius);
}

/* =========================================================
   Base
   ========================================================= */
#ds-kentei-app,
#ds-kentei-app *,
#ds-kentei-app *::before,
#ds-kentei-app *::after,
.ds-seo-shell,
.ds-seo-shell *,
.ds-seo-shell *::before,
.ds-seo-shell *::after {
    box-sizing: border-box;
}

#ds-kentei-app {
    width: min(100%, var(--ds-container));
    min-height: 540px;
    margin: 36px auto;
    color: var(--ds-text);
    font-family: var(--ds-font);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#ds-kentei-app button,
#ds-kentei-app select,
#ds-kentei-app textarea,
#ds-kentei-app input {
    font: inherit;
}

#ds-kentei-app button,
#ds-kentei-app select,
#ds-kentei-app input[type="checkbox"],
#ds-kentei-app input[type="radio"] {
    touch-action: manipulation;
}

.ds-card {
    overflow: hidden;
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    box-shadow: var(--ds-shadow);
    animation: ds-enter 0.25s ease-out;
}

@keyframes ds-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Headings and start screen
   ========================================================= */
.start-header {
    max-width: 620px;
    margin: 0 auto 28px;
    text-align: center;
}

.start-header h1,
.start-header h2,
.finish-card h2 {
    margin: 0 0 8px;
    color: var(--ds-primary);
    font-size: clamp(1.5rem, 3.6vw, 2rem);
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.025em;
}

.start-header p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.94rem;
}

.compact-header {
    margin-bottom: 22px;
}

.resume-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #cfdee1;
    border-radius: var(--ds-radius);
    background: var(--ds-accent-soft);
}

.resume-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    background: var(--ds-surface);
    font-size: 1.25rem;
    box-shadow: var(--ds-shadow-sm);
}

.resume-content h2 {
    margin: 0 0 4px;
    color: #26454b;
    font-size: 1rem;
    font-weight: 800;
}

.resume-content p {
    margin: 0;
    color: #4a565a;
    font-size: 0.8rem;
}

/* =========================================================
   Dashboard and settings
   ========================================================= */
.learning-dashboard,
.history-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.dashboard-stat {
    min-width: 0;
    min-height: 82px;
    padding: 14px 8px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-muted);
    color: var(--ds-primary);
    text-align: center;
}

.dashboard-stat strong {
    display: block;
    overflow: hidden;
    color: var(--ds-primary);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.dashboard-stat span {
    display: block;
    margin-top: 3px;
    color: var(--ds-text-muted);
    font-size: 0.69rem;
    white-space: nowrap;
}

.dashboard-stat-button {
    cursor: pointer;
    appearance: none;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dashboard-stat-button:hover {
    border-color: #b3cbd0;
    background: var(--ds-accent-soft);
    transform: translateY(-1px);
}

.dashboard-stat-button:focus-visible,
.history-link-button:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
}

.history-link-button {
    display: block;
    margin: 0 auto 26px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ds-accent);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.history-link-button:hover {
    background: var(--ds-accent-soft);
}

.learning-settings {
    padding: clamp(18px, 3vw, 24px);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-muted);
}

.filter-group {
    margin: 0 0 20px;
    padding: 0;
    border: 0;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label,
.filter-label-row .filter-label {
    display: block;
    margin: 0 0 7px;
    color: var(--ds-text-soft);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.025em;
}

.filter-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.available-count {
    color: var(--ds-accent);
    font-size: 0.76rem;
    font-weight: 700;
}

.range-item,
.report-textarea {
    width: 100%;
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface);
    color: var(--ds-text);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.range-item {
    min-height: 48px;
    padding: 10px 40px 10px 13px;
    font-size: 0.94rem;
    cursor: pointer;
}

.range-item:hover {
    border-color: #97a3a6;
}

.range-item:focus-visible,
.report-textarea:focus-visible {
    border-color: var(--ds-accent);
    outline: none;
    box-shadow: var(--ds-focus);
}

.range-item option:disabled {
    color: #97a3a6;
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-item,
.toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.check-item {
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--ds-border);
    border-radius: 999px;
    background: var(--ds-surface);
    color: var(--ds-text-soft);
    font-size: 0.84rem;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.check-item:hover {
    border-color: #b3cbd0;
}

.check-item:has(input:checked) {
    border-color: #b3cbd0;
    background: var(--ds-accent-soft);
    color: #2f5158;
    font-weight: 700;
}

.check-item input,
.toggle-item input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--ds-accent);
}

.toggle-list {
    display: grid;
    gap: 11px;
    margin-top: 4px;
}

.toggle-item {
    color: var(--ds-text-soft);
    font-size: 0.88rem;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn-primary,
.btn-secondary,
.btn-danger-outline,
.btn-exam {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 13px 18px;
    border-radius: var(--ds-radius-sm);
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary,
.btn-exam {
    margin-top: 22px;
    border: 1px solid var(--ds-primary);
    background: var(--ds-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-exam:hover {
    background: var(--ds-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(27, 36, 38, 0.14);
}

.btn-primary:focus-visible,
.btn-exam:focus-visible,
.btn-secondary:focus-visible,
.btn-danger-outline:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
}

.btn-primary:disabled,
.btn-exam:disabled,
.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    border: 1px solid var(--ds-border-strong);
    background: var(--ds-surface);
    color: var(--ds-primary);
}

.btn-secondary:hover {
    border-color: #97a3a6;
    background: var(--ds-surface-muted);
}

.btn-danger-outline {
    border: 1px solid #ecd0ce;
    background: var(--ds-surface);
    color: #9e433d;
}

.btn-danger-outline:hover {
    border-color: var(--ds-danger);
    background: var(--ds-danger-soft);
}

.btn-compact {
    width: auto;
    min-height: 38px;
    margin-top: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}

.stack-actions {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.stack-actions .btn-primary,
.stack-actions .btn-secondary,
.stack-actions .btn-danger-outline,
.stack-actions .btn-exam {
    margin-top: 0;
}

.start-disclaimer {
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px solid var(--ds-border);
}

.start-disclaimer p {
    margin: 0 0 6px;
    color: var(--ds-text-muted);
    font-size: 0.7rem;
    line-height: 1.7;
}

/* =========================================================
   Question screen
   ========================================================= */
.ds-card.question-card {
    scroll-margin-top: 24px;
}

.progress-container {
    width: 100%;
    height: 6px;
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4eaeb;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--ds-accent);
    transition: width 0.25s ease;
}

.question-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.live-stats {
    color: var(--ds-text-muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.favorite-button,
.exam-flag-button,
.report-button,
.history-detail-button {
    border: 1px solid var(--ds-border);
    background: var(--ds-surface);
    color: var(--ds-text-muted);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.favorite-button {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.favorite-button:hover,
.favorite-button:focus-visible,
.favorite-button.is-favorite {
    border-color: #c69a3a;
    outline: none;
    background: var(--ds-warning-soft);
    color: #7a5518;
}

.quiz-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.015em;
}

.badge-blue {
    background: var(--ds-accent-soft);
    color: var(--ds-brand-hover);
}

.badge-gray {
    background: #f1f4f5;
    color: #4a565a;
}

.question-category,
.category-label {
    margin-bottom: 7px;
    color: var(--ds-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.question-text {
    margin: 0 0 26px;
    color: var(--ds-primary);
    font-size: clamp(1.08rem, 2.5vw, 1.28rem);
    font-weight: 760;
    line-height: 1.72;
    letter-spacing: -0.012em;
    white-space: pre-wrap;
}

.options-list {
    display: grid;
    gap: 10px;
}

.option-btn {
    display: flex;
    align-items: flex-start;
    width: 100%;
    min-height: 58px;
    padding: 15px 17px;
    border: 1px solid var(--ds-border);
    border-radius: 13px;
    background: var(--ds-surface);
    color: var(--ds-text);
    font-size: 0.94rem;
    line-height: 1.6;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--ds-shadow-sm);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.option-btn:hover:not(:disabled) {
    border-color: #b3cbd0;
    background: #f8fbfb;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(27, 36, 38, 0.06);
}

.option-btn:focus-visible:not(:disabled) {
    border-color: var(--ds-accent);
    outline: none;
    box-shadow: var(--ds-focus);
}

.option-btn:disabled {
    cursor: default;
    opacity: 1;
}

.opt-num {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    margin: 0 11px 0 0;
    place-items: center;
    border-radius: 8px;
    background: #f1f4f5;
    color: var(--ds-text-soft);
    font-size: 0.8rem;
    font-weight: 900;
}

.option-btn.correct {
    border-color: #a6cfc3 !important;
    background: var(--ds-success-soft) !important;
    color: #2b6a5b !important;
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.08);
}

.option-btn.correct .opt-num {
    background: #e6f2ee;
    color: #2f7d6a;
}

.option-btn.wrong {
    border-color: #dcaeab !important;
    background: var(--ds-danger-soft) !important;
    color: #8b3a35 !important;
}

.option-btn.wrong .opt-num {
    background: #f6e3e2;
    color: #9e433d;
}

.feedback-area {
    display: none;
}

.feedback-area.is-visible {
    display: block;
}

.feedback-box {
    margin-top: 22px;
    padding: 21px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-muted);
    animation: ds-enter 0.22s ease-out;
}

.feedback-box h3 {
    margin: 0 0 9px;
    color: var(--ds-primary);
    font-size: 1rem;
    font-weight: 800;
}

.correct-answer {
    margin-bottom: 12px;
    color: var(--ds-primary);
    font-size: 0.96rem;
    font-weight: 800;
}

.explanation-text {
    color: var(--ds-text-soft);
    font-size: 0.9rem;
    line-height: 1.82;
    white-space: pre-wrap;
}

.self-rating {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    background: var(--ds-surface);
}

.self-rating p {
    margin: 0 0 10px;
    color: var(--ds-primary);
    font-size: 0.84rem;
    font-weight: 800;
}

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

.rating-button {
    min-height: 42px;
    padding: 8px;
    border: 1px solid var(--ds-border);
    border-radius: 9px;
    background: var(--ds-surface);
    color: var(--ds-text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.rating-button:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
}

.rating-good:hover:not(:disabled),
.rating-good.is-selected {
    border-color: #a6cfc3;
    background: var(--ds-success-soft);
    color: #2b6a5b;
}

.rating-mid:hover:not(:disabled),
.rating-mid.is-selected {
    border-color: #d9b264;
    background: var(--ds-warning-soft);
    color: #7a5518;
}

.rating-bad:hover:not(:disabled),
.rating-bad.is-selected {
    border-color: #dcaeab;
    background: var(--ds-danger-soft);
    color: #8b3a35;
}

.rating-button:disabled {
    cursor: default;
}

/* =========================================================
   Results and history
   ========================================================= */
.finish-card {
    text-align: center;
}

.finish-icon {
    margin-bottom: 8px;
    font-size: 2.6rem;
    line-height: 1;
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0;
}

.stat-card {
    min-width: 0;
    padding: 16px 10px;
    border: 1px solid var(--ds-border);
    border-radius: 13px;
    background: var(--ds-surface-muted);
    text-align: center;
}

.stat-value {
    display: block;
    overflow-wrap: anywhere;
    color: var(--ds-primary);
    font-size: 1.35rem;
    font-weight: 850;
}

.stat-label {
    display: block;
    color: var(--ds-text-muted);
    font-size: 0.7rem;
}

.result-analysis,
.history-section {
    margin-top: 25px;
    text-align: left;
}

.result-analysis h3,
.history-section h2 {
    margin: 0 0 11px;
    color: var(--ds-primary);
    font-size: 1rem;
    font-weight: 800;
}

.analysis-row,
.history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ds-border);
    font-size: 0.84rem;
}

.analysis-row span,
.history-row span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--ds-text-soft);
}

.analysis-row strong,
.history-row strong {
    flex: 0 0 auto;
    color: var(--ds-primary);
    font-size: 0.82rem;
}

.history-list {
    border-top: 1px solid var(--ds-border);
}

.recent-session-list {
    display: grid;
    gap: 10px;
}

.recent-session {
    padding: 14px;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    background: var(--ds-surface-muted);
}

.recent-session-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.recent-session-title strong {
    color: var(--ds-primary);
    font-size: 0.86rem;
}

.recent-session-title time {
    color: var(--ds-text-muted);
    font-size: 0.68rem;
}

.recent-session p,
.empty-message {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.76rem;
}

.history-note {
    margin: 24px 0 0;
    padding: 12px;
    border: 1px solid #cfdee1;
    border-radius: 10px;
    background: var(--ds-accent-soft);
    color: #2f5158;
    font-size: 0.76rem;
    text-align: center;
}

.history-detail-button {
    margin-top: 8px;
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 0.69rem;
    font-weight: 800;
}

.history-detail-button:hover,
.history-detail-button:focus-visible {
    border-color: #b3cbd0;
    outline: none;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-hover);
}

/* =========================================================
   Exam mode
   ========================================================= */
.exam-start-panel {
    margin: 0 0 28px;
    padding: 22px;
    border: 1px solid #cfdee1;
    border-radius: var(--ds-radius);
    background: var(--ds-accent-soft);
}

.exam-start-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.exam-start-icon {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: var(--ds-surface);
    font-size: 1.35rem;
}

.exam-start-copy h2 {
    margin: 0 0 5px;
    color: #26454b;
    font-size: 1.08rem;
    font-weight: 800;
}

.exam-start-copy p {
    margin: 0;
    color: #4a565a;
    font-size: 0.82rem;
}

.exam-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
    margin: 17px 0;
    color: #2f5158;
    font-size: 0.76rem;
    font-weight: 700;
}

.btn-exam {
    margin-top: 0;
    border-color: var(--ds-accent);
    background: var(--ds-accent);
}

.btn-exam:hover {
    background: var(--ds-accent-hover);
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 20px;
    color: var(--ds-text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-divider::before,
.section-divider::after {
    height: 1px;
    flex: 1;
    background: var(--ds-border);
    content: "";
}

.exam-card {
    overflow: visible;
}

.exam-sticky-header {
    position: sticky;
    z-index: 20;
    top: 8px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: -16px -16px 22px;
    padding: 11px 14px;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(27, 36, 38, 0.08);
    backdrop-filter: blur(12px);
}

.exam-timer-box {
    display: flex;
    flex-direction: column;
    min-width: 102px;
}

.exam-timer-box span {
    color: var(--ds-text-muted);
    font-size: 0.64rem;
    font-weight: 700;
}

.exam-timer-box strong,
.exam-review-timer {
    color: var(--ds-accent);
    font-variant-numeric: tabular-nums;
    font-size: 1.12rem;
    font-weight: 850;
    letter-spacing: 0.04em;
}

[data-exam-timer].is-warning {
    color: var(--ds-warning);
}

[data-exam-timer].is-danger {
    color: var(--ds-danger);
    animation: ds-timer 1s infinite;
}

@keyframes ds-timer {
    50% { opacity: 0.55; }
}

.exam-live-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    color: var(--ds-text-soft);
    font-size: 0.76rem;
    font-weight: 800;
}

.exam-flag-button {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.exam-flag-button:hover,
.exam-flag-button:focus-visible,
.exam-flag-button.is-flagged {
    border-color: #c69a3a;
    outline: none;
    background: var(--ds-warning-soft);
    color: #7a5518;
}

.exam-options .option-btn.is-selected {
    border-color: #7ea6ad;
    background: var(--ds-accent-soft);
    box-shadow: 0 0 0 2px rgba(70, 117, 126, 0.10);
}

.exam-options .option-btn.is-selected .opt-num {
    background: #dfeaec;
    color: var(--ds-brand-hover);
}

.exam-navigation {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: 10px;
    margin-top: 28px;
}

.exam-navigation .btn-primary,
.exam-navigation .btn-secondary {
    margin-top: 0;
}

.exam-review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.exam-review-header .start-header {
    flex: 1;
    margin-left: 0;
    text-align: left;
}

.exam-review-timer {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #cfdee1;
    border-radius: 10px;
    background: var(--ds-accent-soft);
}

.exam-review-stats,
.exam-result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exam-grid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0 10px;
    color: var(--ds-text-muted);
    font-size: 0.7rem;
}

.legend-item::before {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    content: "";
    vertical-align: -1px;
}

.legend-1::before { border-color: #7ea6ad; background: var(--ds-accent-soft); }
.legend-2::before { background: var(--ds-surface); }
.legend-3::before { border-color: #c69a3a; background: var(--ds-warning-soft); }

.exam-question-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 7px;
    margin: 0 0 22px;
}

.exam-number-button {
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid var(--ds-border);
    border-radius: 8px;
    background: var(--ds-surface);
    color: var(--ds-primary);
    font-size: 0.71rem;
    font-weight: 800;
    cursor: pointer;
}

.exam-number-button:hover,
.exam-number-button:focus-visible {
    border-color: var(--ds-accent);
    outline: none;
    box-shadow: var(--ds-focus);
}

.exam-number-button.is-answered {
    border-color: #7ea6ad;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-hover);
}

.exam-number-button.is-flagged {
    box-shadow: inset 0 -3px 0 #b3862f;
}

.exam-submit-warning {
    margin: 0 0 15px;
    padding: 12px;
    border: 1px solid #cbe4dc;
    border-radius: 10px;
    background: var(--ds-success-soft);
    color: #2f7d6a;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.exam-submit-warning.has-unanswered {
    border-color: #ead9b4;
    background: var(--ds-warning-soft);
    color: #7a5518;
}

.exam-score-display {
    margin: 8px auto 18px;
}

.exam-score-display strong {
    display: block;
    color: var(--ds-accent);
    font-size: clamp(3rem, 12vw, 5.2rem);
    font-weight: 900;
    line-height: 1;
}

.exam-score-display span {
    display: block;
    margin-top: 8px;
    color: var(--ds-text-muted);
    font-weight: 800;
}

.exam-result-note {
    margin: 22px 0 0;
    padding: 11px;
    border: 1px solid var(--ds-border);
    border-radius: 9px;
    background: var(--ds-surface-muted);
    color: var(--ds-text-muted);
    font-size: 0.72rem;
}

.exam-answer-review-list {
    display: grid;
    gap: 16px;
    margin: 22px 0;
}

.exam-answer-review-item {
    padding: 20px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-muted);
    text-align: left;
}

.exam-answer-review-item h2 {
    margin: 5px 0 14px;
    color: var(--ds-primary);
    font-size: 1rem;
    line-height: 1.65;
}

.review-item-number {
    color: var(--ds-text-muted);
    font-size: 0.68rem;
    font-weight: 800;
}

.review-selected-answer,
.review-correct-answer {
    margin: 7px 0;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.review-selected-answer {
    background: var(--ds-danger-soft);
    color: #8b3a35;
}

.review-correct-answer {
    background: var(--ds-success-soft);
    color: #2b6a5b;
}

.review-explanation {
    margin: 14px 0 2px;
    padding: 13px;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface);
}

/* =========================================================
   Report modal
   ========================================================= */
.report-button {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 0.7rem;
}

.report-button:hover,
.report-button:focus-visible {
    border-color: #b3cbd0;
    outline: none;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-hover);
}

.report-modal-backdrop {
    position: fixed;
    z-index: 99999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(27, 36, 38, 0.58);
    backdrop-filter: blur(3px);
}

.report-modal {
    position: relative;
    width: min(540px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 25px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    box-shadow: 0 28px 80px rgba(27, 36, 38, 0.25);
}

.report-modal h2 {
    margin: 0 40px 10px 0;
    color: var(--ds-primary);
    font-size: 1.2rem;
}

.report-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f1f4f5;
    color: var(--ds-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.report-modal-close:hover,
.report-modal-close:focus-visible {
    outline: none;
    background: #e4eaeb;
    box-shadow: var(--ds-focus);
}

.report-question-preview {
    margin: 0 0 18px;
    padding: 11px;
    border: 1px solid var(--ds-border);
    border-radius: 9px;
    background: var(--ds-surface-muted);
    color: var(--ds-text-soft);
    font-size: 0.78rem;
}

.report-textarea {
    min-height: 125px;
    margin-bottom: 4px;
    padding: 11px;
    resize: vertical;
}

.report-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.report-status {
    min-height: 1.5em;
    margin: 8px 0;
    color: var(--ds-accent);
    font-size: 0.78rem;
}

/* =========================================================
   Page shell (server-rendered layout)
   ========================================================= */
body.ds-quiz-page {
    background: var(--ds-bg);
}

.ds-quiz-page .entry-title:empty,
.ds-quiz-page .page-title:empty,
.ds-quiz-page .wp-block-post-title:empty {
    display: none;
}

.ds-seo-shell {
    width: min(100%, var(--ds-container));
    margin: 24px auto 64px;
    padding: 0 16px;
    color: var(--ds-text);
    font-family: var(--ds-font);
    line-height: 1.8;
}

/* ---- Hero: sits directly on the page background, no card ---- */
.ds-seo-hero {
    padding: 12px 0 0;
}

.ds-seo-eyebrow {
    margin: 0 0 6px;
    color: var(--ds-brand);
    font-size: 0.8rem;
    font-weight: 700;
}

.ds-seo-hero h1 {
    margin: 0;
    text-align: center;
    color: var(--ds-text);
    font-size: clamp(1.6rem, 4.2vw, 2.1rem);
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.ds-seo-lead {
    max-width: 640px;
    margin: 12px auto 0;
    text-align: center;
    color: var(--ds-text-soft);
    font-size: 0.94rem;
    line-height: 1.85;
}

.ds-hero-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin: 22px auto 0;
    padding: 13px 20px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-brand);
    color: #fff;
    font-size: 0.93rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.16s ease;
}

.ds-hero-cta:hover,
.ds-hero-cta:focus {
    background: var(--ds-brand-hover);
    color: #fff;
}

.ds-hero-cta:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
}

.ds-hero-cta svg {
    width: 15px;
    height: 15px;
}

.ds-seo-note {
    margin: 14px 0 0;
    text-align: center;
    color: var(--ds-text-muted);
    font-size: 0.78rem;
}

/* ---- Mode cards ---- */
.ds-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.ds-mode-card {
    display: block;
    padding: 20px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.16s ease, transform 0.16s ease;
}

a.ds-mode-card:hover {
    border-color: var(--ds-brand);
    transform: translateY(-1px);
}

a.ds-mode-card:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
}

.ds-mode-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 9px;
    background: var(--ds-accent-soft);
    color: var(--ds-brand);
}

.ds-mode-icon svg {
    width: 19px;
    height: 19px;
}

.ds-mode-card h3 {
    margin: 0 0 6px;
    color: var(--ds-text);
    font-size: 1rem;
    font-weight: 700;
}

.ds-mode-card p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.83rem;
    line-height: 1.7;
}

/* ---- Stat row ---- */
.ds-stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.ds-stat {
    padding: 18px 14px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    text-align: center;
}

.ds-stat span {
    display: block;
    color: var(--ds-text-muted);
    font-size: 0.79rem;
}

.ds-stat strong {
    display: block;
    margin-top: 2px;
    color: var(--ds-text);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.ds-stat strong small {
    margin-left: 3px;
    font-size: 0.84rem;
    font-weight: 700;
}

.ds-stat strong.is-text {
    font-size: 1.02rem;
    letter-spacing: 0;
}

/* ---- The quiz app sits in the same rhythm as the cards ---- */
.ds-seo-shell #ds-kentei-app {
    width: 100%;
    min-height: 540px;
    margin: 16px 0 0;
}

/* ---- Long-form sections ---- */
.ds-seo-content {
    width: 100%;
    margin: 44px auto 0;
}

.ds-seo-section {
    padding: 34px 0 0;
    border-bottom: 0;
}

.ds-seo-section h2,
.ds-section-title {
    margin: 0 0 14px;
    color: var(--ds-text);
    font-size: clamp(1.18rem, 2.6vw, 1.32rem);
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.ds-seo-section h3 {
    margin: 0 0 7px;
    color: var(--ds-text);
    font-size: 0.98rem;
    font-weight: 700;
}

.ds-seo-section p,
.ds-seo-section li {
    color: var(--ds-text-soft);
    font-size: 0.9rem;
    line-height: 1.85;
}

.ds-seo-section a,
.ds-faq a {
    color: var(--ds-brand);
    font-weight: 700;
    text-underline-offset: 3px;
}

.ds-seo-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ds-seo-feature-grid article {
    padding: 20px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
}

.ds-seo-feature-grid p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.83rem;
}

.ds-seo-mode-list,
.ds-seo-section ul {
    margin: 0;
    padding-left: 1.35em;
}

.ds-seo-mode-list li + li,
.ds-seo-section ul li + li {
    margin-top: 8px;
}

.ds-seo-mode-list strong,
.ds-seo-steps strong {
    color: var(--ds-text);
}

.ds-seo-steps {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-seo-steps li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 18px 20px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
}

.ds-seo-steps li > span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    background: var(--ds-accent-soft);
    color: var(--ds-brand);
    font-size: 0.85rem;
    font-weight: 800;
}

.ds-seo-steps p {
    margin: 3px 0 0;
    color: var(--ds-text-muted);
    font-size: 0.83rem;
}

/* ---- Spec table ---- */
.ds-spec-table {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    border-collapse: separate;
    border-spacing: 0;
    background: var(--ds-surface);
    font-size: 0.89rem;
}

.ds-spec-table th,
.ds-spec-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--ds-border);
    text-align: left;
    vertical-align: top;
    line-height: 1.75;
}

.ds-spec-table tr:last-child th,
.ds-spec-table tr:last-child td {
    border-bottom: 0;
}

.ds-spec-table th {
    width: 30%;
    border-right: 1px solid var(--ds-border);
    background: var(--ds-surface-muted);
    color: var(--ds-text);
    font-weight: 700;
    white-space: nowrap;
}

.ds-spec-table td {
    color: var(--ds-text-soft);
}

.ds-spec-note {
    margin: 12px 0 0;
    color: var(--ds-text-muted);
    font-size: 0.77rem;
}

/* ---- FAQ ---- */
.ds-faq {
    padding: 4px 24px 26px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
}

.ds-faq-item {
    padding-top: 26px;
}

.ds-faq-item h3 {
    margin: 0 0 8px;
    color: var(--ds-text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.6;
}

.ds-faq-item p {
    margin: 0;
    color: var(--ds-text-soft);
    font-size: 0.88rem;
    line-height: 1.85;
}

.ds-faq-link {
    display: inline-block;
    margin-top: 26px;
    font-size: 0.88rem;
}

/* ---- Notes and disclaimer ---- */
.ds-seo-updated {
    color: var(--ds-text-muted);
    font-size: 0.8rem;
}

.ds-seo-disclaimer {
    margin-top: 26px;
    padding: 22px 24px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
}

.ds-seo-disclaimer h2 {
    font-size: 1rem;
}

.ds-seo-disclaimer p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.83rem;
}

.ds-site-note {
    margin: 34px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--ds-border);
    color: var(--ds-text-muted);
    font-size: 0.76rem;
    line-height: 1.8;
}

@media (max-width: 860px) {
    .ds-mode-grid,
    .ds-seo-feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .ds-seo-shell {
        padding: 0 12px;
    }

    .ds-stat-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ds-hero-cta {
        width: 100%;
        justify-content: center;
    }

    .ds-spec-table th,
    .ds-spec-table td {
        display: block;
        width: auto;
        border-right: 0;
        white-space: normal;
    }

    .ds-spec-table th {
        border-bottom: 0;
        padding-bottom: 4px;
    }

    .ds-faq,
    .ds-seo-disclaimer {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 782px) {
    .ds-card.question-card {
        scroll-margin-top: 56px;
    }
}

@media (max-width: 720px) {
    .ds-seo-shell {
        margin-top: 16px;
    }

    .ds-seo-hero {
        border-radius: var(--ds-radius);
    }

    .ds-seo-feature-grid {
        grid-template-columns: 1fr;
    }

    .ds-seo-content {
        margin-top: 34px;
    }

    .ds-seo-section {
        padding: 24px 4px;
    }

    .ds-seo-shell #ds-kentei-app {
        min-height: 460px;
        margin-top: 24px;
        margin-bottom: 24px;
    }
}

@media (max-width: 640px) {
    #ds-kentei-app {
        width: auto;
        margin: 18px 10px;
    }

    .ds-card {
        padding: 22px 16px;
        border-radius: var(--ds-radius);
    }

    .learning-dashboard,
    .history-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .learning-settings {
        padding: 17px;
    }

    .question-top-row {
        align-items: flex-start;
    }

    .option-btn {
        padding: 14px;
        font-size: 0.9rem;
    }

    .rating-buttons {
        grid-template-columns: 1fr;
    }

    .score-stats {
        grid-template-columns: 1fr 1fr;
    }

    .recent-session-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .exam-feature-grid {
        grid-template-columns: 1fr;
    }

    .exam-sticky-header {
        top: 4px;
        grid-template-columns: 1fr auto;
        margin: -10px -8px 18px;
        padding: 10px;
    }

    .exam-live-summary {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }

    .exam-question-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .exam-review-header {
        align-items: stretch;
        flex-direction: column;
    }

    .exam-review-timer {
        align-self: flex-start;
    }

    .exam-navigation {
        grid-template-columns: 1fr;
    }

    .exam-review-stats,
    .exam-result-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 390px) {
    .score-stats,
    .exam-review-stats,
    .exam-result-stats {
        grid-template-columns: 1fr;
    }

    .question-top-row {
        flex-direction: column;
    }

    .exam-question-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .exam-start-panel,
    .report-modal {
        padding: 18px;
    }
}

/* =========================================================
   Accessibility
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .ds-card,
    .feedback-box,
    .progress-bar,
    .option-btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger-outline,
    .btn-exam,
    .dashboard-stat-button,
    [data-exam-timer].is-danger {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Keep the learning UI intentionally light for maximum readability. */
}

/* Semantic card variants share the base card design. */
.history-card,
.exam-review-card,
.exam-result-card,
.exam-detail-card {
    position: relative;
}

.count-filter,
.difficulty-filter {
    min-width: 0;
}

.exam-next-button {
    margin-top: 0;
}

/* =========================================================
   v6 Layer: レイアウト / デザイン / モーション リフレッシュ
   ---------------------------------------------------------
   ・配色トークン（--ds-brand 系）は既存のまま据え置き。
   ・レイアウトの階層、余白のリズム、選択時の遷移のみを刷新。
   ========================================================= */

:root {
    --ds-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ds-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ds-dur-fast: 0.16s;
    --ds-dur: 0.26s;
    --ds-dur-slow: 0.42s;
    --ds-space: clamp(18px, 3vw, 26px);
    --ds-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

/* ---------------------------------------------------------
   Keyframes
   --------------------------------------------------------- */
@keyframes ds-view-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ds-option-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ds-reveal-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ds-mark-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

@keyframes ds-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

/* ---------------------------------------------------------
   App shell
   --------------------------------------------------------- */
#ds-kentei-app {
    font-family: var(--ds-font);
    margin: 28px auto 40px;
}

#ds-kentei-app > * {
    animation: ds-view-in var(--ds-dur-slow) var(--ds-ease-out) both;
}

.ds-card {
    padding: clamp(20px, 3.4vw, 30px);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    box-shadow: none;
    animation: none;
}

/* ---------------------------------------------------------
   Start screen
   --------------------------------------------------------- */
.start-header {
    max-width: none;
    margin: 0 0 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ds-border);
    text-align: left;
}

.start-header h1,
.start-header h2,
.finish-card h2 {
    margin: 0 0 6px;
    color: var(--ds-text);
    font-size: clamp(1.22rem, 3vw, 1.46rem);
    font-weight: 800;
    letter-spacing: -0.015em;
}

.start-header p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 0.88rem;
}

/* 再開パネル：ブランド色の細い左罫で「続き」を示す */
.resume-panel {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 16px 18px;
    border: 1px solid var(--ds-border);
    border-left: 3px solid var(--ds-brand);
    border-radius: var(--ds-radius);
    background: var(--ds-accent-soft);
}

.resume-icon {
    flex: 0 0 auto;
    font-size: 1.15rem;
    line-height: 1.6;
}

.resume-content h2 {
    margin: 0 0 4px;
    font-size: 0.98rem;
    font-weight: 800;
}

.resume-content p {
    margin: 0 0 12px;
    color: var(--ds-text-soft);
    font-size: 0.82rem;
    line-height: 1.7;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ダッシュボード：4カラム固定のタイル */
.learning-dashboard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
}

.dashboard-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    padding: 13px 14px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    text-align: left;
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease);
}

.dashboard-stat strong {
    font-family: var(--ds-mono);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ds-text);
}

.dashboard-stat span {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ds-text-muted);
}

.dashboard-stat-button {
    cursor: pointer;
}

.dashboard-stat-button:hover,
.dashboard-stat-button:focus-visible {
    border-color: var(--ds-brand);
    outline: none;
    background: var(--ds-accent-soft);
}

.dashboard-stat-button:hover strong,
.dashboard-stat-button:focus-visible strong {
    color: var(--ds-brand-deep);
}

.history-link-button {
    display: inline-flex;
    align-items: center;
    margin: 0 0 22px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ds-brand);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.history-link-button:hover {
    color: var(--ds-brand-deep);
}

/* 模擬試験パネル */
.exam-start-panel {
    margin: 0 0 26px;
    padding: 20px;
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-muted);
    box-shadow: none;
}

.exam-start-heading {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.exam-start-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
    font-size: 1rem;
}

.exam-start-copy h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 800;
}

.exam-start-copy p {
    margin: 0;
    color: var(--ds-text-soft);
    font-size: 0.84rem;
    line-height: 1.7;
}

.exam-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
    margin-bottom: 16px;
}

.exam-feature-grid span {
    color: var(--ds-text-muted);
    font-size: 0.79rem;
    font-weight: 600;
}

/* 見出し付きの区切り線 */
.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--ds-text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.section-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--ds-border);
}

/* 条件設定：広い画面では2カラムに整列 */
.learning-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 20px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-muted);
}

.learning-settings > .difficulty-filter,
.learning-settings > .toggle-list {
    grid-column: 1 / -1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.filter-label {
    color: var(--ds-text-soft);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.filter-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.available-count {
    color: var(--ds-brand);
    font-family: var(--ds-mono);
    font-size: 0.76rem;
    font-weight: 700;
}

.range-item {
    width: 100%;
    min-height: 44px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface);
    color: var(--ds-text);
    font-size: 0.9rem;
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                box-shadow var(--ds-dur-fast) var(--ds-ease);
}

.range-item:focus-visible {
    border-color: var(--ds-brand);
    outline: none;
    box-shadow: var(--ds-focus);
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border: 1px solid var(--ds-border-strong);
    border-radius: 999px;
    background: var(--ds-surface);
    color: var(--ds-text-soft);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.check-item:hover {
    border-color: var(--ds-brand);
    color: var(--ds-brand-deep);
}

.check-item:has(input:checked) {
    border-color: var(--ds-brand);
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
}

.toggle-list {
    display: grid;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--ds-border);
}

.toggle-item {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding-top: 8px;
    color: var(--ds-text-soft);
    font-size: 0.85rem;
    cursor: pointer;
}

.start-disclaimer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--ds-border);
}

.start-disclaimer p {
    margin: 0 0 6px;
    color: var(--ds-text-muted);
    font-size: 0.74rem;
    line-height: 1.75;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn-primary,
.btn-secondary,
.btn-danger-outline,
.btn-exam {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    border-radius: var(--ds-radius-sm);
    font-size: 0.94rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: none;
    transition: background var(--ds-dur-fast) var(--ds-ease),
                border-color var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.btn-primary,
.btn-exam {
    width: 100%;
    border: 1px solid var(--ds-brand);
    background: var(--ds-brand);
    color: #fff;
}

.btn-primary:hover,
.btn-exam:hover {
    border-color: var(--ds-brand-hover);
    background: var(--ds-brand-hover);
    transform: none;
    box-shadow: none;
}

.btn-primary:active,
.btn-exam:active {
    background: var(--ds-brand-deep);
}

.btn-secondary {
    border: 1px solid var(--ds-border-strong);
    background: var(--ds-surface);
    color: var(--ds-text-soft);
}

.btn-secondary:hover,
.btn-danger-outline:hover {
    border-color: var(--ds-brand);
    color: var(--ds-brand-deep);
    transform: none;
    box-shadow: none;
}

.btn-compact {
    width: auto;
    min-height: 40px;
    padding: 0 16px;
    font-size: 0.82rem;
}

/* ---------------------------------------------------------
   Question screen
   --------------------------------------------------------- */
.ds-card.question-card {
    position: relative;
    padding-top: clamp(26px, 4vw, 34px);
    scroll-margin-top: 20px;
}

/* 進捗バーはカード上端のヘアラインとして全幅に置く */
.question-card > .progress-container {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    width: auto;
    height: 3px;
    margin: 0;
    border-radius: 0;
    background: #eaeef0;
}

.progress-bar {
    background: var(--ds-brand);
    transition: width var(--ds-dur-slow) var(--ds-ease-out);
}

/* ヘッダー行：モードとカウンタ／お気に入りと中断 */
.question-card > .question-top-row {
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ds-border);
}

.quiz-head-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.quiz-mode-label {
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.quiz-counter {
    font-family: var(--ds-mono);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ds-text-soft);
}

.quiz-counter b {
    color: var(--ds-text);
    font-size: 1.02rem;
}

.quiz-head-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.quiz-quit-button {
    padding: 7px 12px;
    border: 1px solid var(--ds-border);
    border-radius: 999px;
    background: var(--ds-surface);
    color: var(--ds-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.quiz-quit-button:hover {
    border-color: var(--ds-border-strong);
    color: var(--ds-text-soft);
}

/* タグ行：カテゴリ・難易度・進捗を同じ高さで並べる */
.quiz-meta {
    gap: 6px;
    margin-bottom: 14px;
}

.badge {
    min-height: 24px;
    padding: 3px 11px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
}

.badge-blue {
    border-color: var(--ds-brand);
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
}

.badge-gray {
    border-color: var(--ds-border-strong);
    background: var(--ds-surface);
    color: var(--ds-text-muted);
}

.badge-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--ds-text-muted);
    font-family: var(--ds-mono);
    font-weight: 600;
}

.question-card .question-category {
    display: none;
}

.question-text {
    margin: 0 0 22px;
    color: var(--ds-text);
    font-size: clamp(1.04rem, 2.4vw, 1.18rem);
    font-weight: 700;
    line-height: 1.85;
    letter-spacing: -0.005em;
}

/* 選択肢 */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.option-btn {
    position: relative;
    align-items: center;
    min-height: 56px;
    padding: 14px 16px;
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    box-shadow: none;
    font-size: 0.94rem;
    line-height: 1.7;
    animation: ds-option-in var(--ds-dur) var(--ds-ease-out) both;
    animation-delay: calc(var(--ds-i, 0) * 55ms);
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                opacity var(--ds-dur) var(--ds-ease),
                transform var(--ds-dur-fast) var(--ds-ease);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--ds-brand);
    background: var(--ds-accent-soft);
    transform: none;
    box-shadow: none;
}

.option-btn:active:not(:disabled) {
    transform: scale(0.988);
}

/* 選択肢テキストは可変幅にして、右端のバッジを押し出す */
.option-btn > span:not(.opt-num) {
    flex: 1 1 auto;
    min-width: 0;
}

.opt-num {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    margin-right: 12px;
    border: 1px solid var(--ds-border-strong);
    border-radius: 50%;
    background: var(--ds-surface);
    color: var(--ds-text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    transition: background var(--ds-dur-fast) var(--ds-ease),
                border-color var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.option-btn:hover:not(:disabled) .opt-num {
    border-color: var(--ds-brand);
    color: var(--ds-brand);
}

/* 選択直後の状態（採点前のワンクッション） */
.option-btn.is-picked {
    border-color: var(--ds-brand);
    background: var(--ds-accent-soft);
}

.option-btn.is-picked .opt-num {
    border-color: var(--ds-brand);
    background: var(--ds-brand);
    color: #fff;
    animation: ds-mark-pop var(--ds-dur) var(--ds-ease-out);
}

/* 採点後：正解／誤答以外はトーンを落として視線を集める */
.options-list.is-revealed .option-btn:not(.correct):not(.wrong) {
    opacity: 0.5;
}

.option-btn.correct {
    border-color: var(--ds-success) !important;
    background: var(--ds-success-soft) !important;
    color: var(--ds-text) !important;
}

.option-btn.correct .opt-num {
    border-color: var(--ds-success);
    background: var(--ds-success);
    color: #fff;
    animation: ds-mark-pop var(--ds-dur-slow) var(--ds-ease-out);
}

.option-btn.wrong {
    border-color: var(--ds-danger) !important;
    background: var(--ds-danger-soft) !important;
    color: var(--ds-text) !important;
    animation: ds-shake var(--ds-dur) var(--ds-ease) both;
}

.option-btn.wrong .opt-num {
    border-color: var(--ds-danger);
    background: var(--ds-danger);
    color: #fff;
}

/* あなたの解答バッジ */
.option-btn.is-picked.wrong::after,
.option-btn.is-picked.correct::after {
    content: "あなたの解答";
    flex: 0 0 auto;
    margin-left: 10px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(27, 36, 38, 0.08);
    color: var(--ds-text-soft);
    font-size: 0.66rem;
    font-weight: 700;
    white-space: nowrap;
}

.option-btn.is-selected {
    border-color: var(--ds-brand);
    background: var(--ds-accent-soft);
}

.option-btn.is-selected .opt-num {
    border-color: var(--ds-brand);
    background: var(--ds-brand);
    color: #fff;
}

/* 判定と解説：塗りのボックスではなく破線の区切りで続ける */
.feedback-area.is-visible {
    display: block;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px dashed var(--ds-border-strong);
    animation: ds-reveal-in var(--ds-dur) var(--ds-ease-out) both;
}

.feedback-box {
    margin-top: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    animation: none;
}

.feedback-box h3 {
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px;
    padding: 5px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    background: var(--ds-surface-muted);
    color: var(--ds-text-soft);
    box-shadow: inset 0 0 0 1.5px var(--ds-border-strong);
}

.feedback-area.is-correct .feedback-box h3 {
    background: var(--ds-success-soft);
    color: var(--ds-success);
    box-shadow: inset 0 0 0 1.5px var(--ds-success);
}

.feedback-area.is-wrong .feedback-box h3 {
    background: var(--ds-danger-soft);
    color: var(--ds-danger);
    box-shadow: inset 0 0 0 1.5px var(--ds-danger);
}

.correct-answer {
    margin-bottom: 12px;
    color: var(--ds-text);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.75;
}

.explanation-text {
    padding: 15px 17px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-muted);
    color: var(--ds-text-soft);
    font-size: 0.89rem;
    line-height: 1.85;
}

.report-button {
    margin-top: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.self-rating {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
}

.rating-button {
    min-height: 44px;
    border-radius: var(--ds-radius-sm);
    transition: border-color var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

#next-btn {
    margin-top: 18px;
}

/* ---------------------------------------------------------
   Exam screen
   --------------------------------------------------------- */
.exam-sticky-header {
    border-radius: var(--ds-radius);
    box-shadow: none;
}

.exam-card .progress-container {
    height: 3px;
    background: #eaeef0;
}

.exam-card .question-top-row {
    margin-bottom: 12px;
}

.exam-card .category-label {
    margin-bottom: 8px;
    color: var(--ds-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.exam-options .option-btn {
    animation-delay: calc(var(--ds-i, 0) * 40ms);
}

.exam-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--ds-border);
}

.exam-navigation .btn-secondary,
.exam-navigation .btn-primary {
    width: 100%;
    margin-top: 0;
}

/* ---------------------------------------------------------
   Results / history
   --------------------------------------------------------- */
.finish-card,
.history-card,
.exam-result-card,
.exam-review-card,
.exam-detail-card {
    box-shadow: none;
}

.score-stats,
.exam-result-stats {
    gap: 10px;
}

.stat-card {
    padding: 15px 14px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    box-shadow: none;
}

.stat-value {
    font-family: var(--ds-mono);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.result-analysis,
.history-row,
.recent-session {
    border-radius: var(--ds-radius);
    box-shadow: none;
}

.stack-actions {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.stack-actions .btn-primary,
.stack-actions .btn-secondary,
.stack-actions .btn-danger-outline {
    width: 100%;
    margin-top: 0;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 782px) {
    .ds-seo-section {
        padding: 28px 0 0;
    }

    .ds-seo-shell #ds-kentei-app {
        margin: 16px 0 0;
    }

    .ds-card.question-card {
        scroll-margin-top: 56px;
    }

    .learning-settings {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .learning-dashboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #ds-kentei-app {
        width: auto;
        margin: 18px 10px;
    }

    .ds-seo-shell #ds-kentei-app {
        width: 100%;
        margin: 16px 0 0;
    }

    .ds-card {
        padding: 18px 15px;
        border-radius: var(--ds-radius);
    }

    .ds-card.question-card {
        padding-top: 24px;
    }

    .question-card > .question-top-row {
        flex-wrap: wrap;
    }

    .exam-feature-grid {
        grid-template-columns: 1fr;
    }

    .exam-navigation {
        grid-template-columns: 1fr;
    }

    .option-btn {
        min-height: 52px;
        padding: 13px 14px;
        font-size: 0.9rem;
    }

    .option-btn.is-picked.wrong::after,
    .option-btn.is-picked.correct::after {
        content: none;
    }

    .rating-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 390px) {
    .exam-start-panel {
        padding: 18px;
    }

    .quiz-head-main {
        gap: 8px;
    }
}

/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    #ds-kentei-app *,
    #ds-kentei-app *::before,
    #ds-kentei-app *::after,
    .ds-seo-shell *,
    .ds-seo-shell *::before,
    .ds-seo-shell *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}
/* =========================================================
   v7.0 Landing / Start UX refinement (5.3.0)
   - PC幅の最適化
   - ヒーロー訴求の強化
   - 学習条件を主役化
   - FAQアコーディオン
   - 長文セクションのリズム改善
   ========================================================= */

:root {
    --ds-container: 960px;
    --ds-reading: 800px;
    --ds-panel: #f5f9f9;
    --ds-panel-strong: #edf5f6;
    --ds-shadow-cta: 0 10px 26px rgba(47, 81, 88, 0.18);
}

/* ---------------------------------------------------------
   WordPressテーマ側の狭い本文幅を、このページだけ解除
   --------------------------------------------------------- */
body.ds-quiz-page .entry-content,
body.ds-quiz-page .wp-block-post-content,
body.ds-quiz-page .post-content,
body.ds-quiz-page main article {
    max-width: none;
}

.ds-seo-shell {
    width: min(94vw, var(--ds-container));
    max-width: none;
}

.ds-seo-content {
    max-width: var(--ds-reading);
}

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.ds-seo-hero {
    padding-top: 22px;
}

.ds-seo-eyebrow {
    text-align: center;
    letter-spacing: 0.08em;
}

.ds-seo-hero h1 {
    max-width: 820px;
    margin-inline: auto;
    font-size: clamp(1.72rem, 3.2vw, 2.35rem);
}

.ds-seo-lead {
    max-width: 720px;
    color: #536166;
    font-size: 0.96rem;
}

.ds-hero-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 18px auto 0;
}

.ds-hero-pill {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 5px 11px;
    border: 1px solid #cddbdd;
    border-radius: 999px;
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.ds-hero-cta {
    min-height: 48px;
    padding-inline: 22px;
    transition: transform var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                box-shadow var(--ds-dur-fast) var(--ds-ease);
}

.ds-hero-cta:hover {
    transform: translateY(-1px);
    box-shadow: var(--ds-shadow-cta);
}

.ds-hero-cta:active {
    transform: translateY(0) scale(0.99);
}

/* 3つの機能カードはPCで安定した密度に */
.ds-mode-grid {
    gap: 18px;
    margin-top: 30px;
}

.ds-mode-card {
    min-height: 164px;
    padding: 22px;
    border-radius: 14px;
}

.ds-mode-icon {
    margin-bottom: 16px;
}

/* 725問 / 5セット / 更新日を1本のステータスバーに集約 */
.ds-stat-row {
    display: flex;
    gap: 0;
    overflow: hidden;
    margin-top: 14px;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    background: var(--ds-surface);
}

.ds-stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 13px 18px;
    border: 0;
    border-right: 1px solid var(--ds-border);
    border-radius: 0;
    background: transparent;
}

.ds-stat:last-child {
    border-right: 0;
}

.ds-stat span {
    font-size: 0.72rem;
}

.ds-stat strong {
    margin-top: 0;
    font-size: 1.18rem;
}

.ds-stat strong.is-text {
    font-size: 0.88rem;
}

/* ---------------------------------------------------------
   Start screen / learning dashboard
   --------------------------------------------------------- */
.ds-seo-shell #ds-kentei-app {
    margin-top: 22px;
}

#ds-kentei-app > .ds-card:not(.question-card):not(.finish-card):not(.history-card):not(.exam-card) {
    padding: clamp(24px, 3.2vw, 34px);
}

.start-header {
    margin-bottom: 18px;
    padding-bottom: 16px;
}

.resume-panel {
    align-items: center;
    margin-bottom: 16px;
    padding: 13px 15px;
    border-left-width: 2px;
}

.resume-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: #fff;
    font-size: 0.95rem;
}

.resume-content {
    flex: 1 1 auto;
    min-width: 0;
}

.resume-content p {
    margin-bottom: 8px;
}

.learning-summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-bottom: 10px;
    padding: 10px 13px;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: #fbfcfc;
    color: var(--ds-text-muted);
    font-family: var(--ds-mono);
    font-size: 0.76rem;
}

.learning-summary-strip strong {
    color: var(--ds-brand-deep);
    font-weight: 850;
}

.learning-dashboard {
    gap: 10px;
}

.dashboard-stat {
    min-height: 72px;
    justify-content: center;
    padding: 11px 13px;
}

.dashboard-stat strong {
    font-size: 1.32rem;
}

.dashboard-stat span {
    white-space: normal;
    line-height: 1.35;
}

/* 学習条件ブロックをページの主役にする */
.study-start-panel {
    margin-top: 2px;
    padding: 20px;
    border: 1px solid #bfd2d5;
    border-radius: 15px;
    background: linear-gradient(180deg, #f5f9fa 0%, #f9fbfb 100%);
    box-shadow: 0 8px 24px rgba(47, 81, 88, 0.06);
}

.study-start-panel .learning-settings {
    padding: 0;
    border: 0;
    background: transparent;
}

.range-item {
    min-height: 48px;
    background-color: #fff;
}

.range-item:hover {
    border-color: #9fb6ba;
}

.check-item {
    min-height: 38px;
    background: #fff;
    transform: translateZ(0);
    transition: transform var(--ds-dur-fast) var(--ds-ease),
                border-color var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.check-item:hover {
    transform: translateY(-1px);
}

.check-item:has(input:checked) {
    box-shadow: inset 0 0 0 1px rgba(70, 117, 126, 0.06);
}

.check-item:has(input:checked):active {
    transform: scale(0.98);
}

.session-preview {
    min-height: 20px;
    margin-top: 2px;
    color: var(--ds-brand-deep);
    font-size: 0.76rem;
    font-weight: 750;
}

@keyframes ds-preview-flash {
    from { opacity: 0.35; transform: translateY(2px); }
    to { opacity: 1; transform: none; }
}

.session-preview.is-updating {
    animation: ds-preview-flash 180ms var(--ds-ease-out) both;
}

/* CTA：高く・濃く・矢印で行き先を明確に */
#start-btn {
    min-height: 56px;
    margin-top: 18px;
    padding: 0 18px;
    border-radius: 10px;
    box-shadow: var(--ds-shadow-cta);
    transition: transform var(--ds-dur-fast) var(--ds-ease),
                background var(--ds-dur-fast) var(--ds-ease),
                box-shadow var(--ds-dur-fast) var(--ds-ease);
}

#start-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 13px 30px rgba(47, 81, 88, 0.22);
}

#start-btn:active:not(:disabled) {
    transform: scale(0.99);
    box-shadow: 0 5px 14px rgba(47, 81, 88, 0.18);
}

.start-btn-label {
    margin-left: auto;
}

.start-btn-key {
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid rgba(255,255,255,0.32);
    border-radius: 6px;
    color: rgba(255,255,255,0.82);
    font-family: var(--ds-mono);
    font-size: 0.68rem;
    font-weight: 700;
}

.start-btn-arrow {
    margin-left: auto;
    font-size: 1.08rem;
    transition: transform var(--ds-dur-fast) var(--ds-ease);
}

#start-btn:hover .start-btn-arrow {
    transform: translateX(3px);
}

/* ---------------------------------------------------------
   Long-form content rhythm
   --------------------------------------------------------- */
.ds-seo-section {
    padding-top: 38px;
}

.ds-seo-content > .ds-seo-section:nth-of-type(even) {
    margin-top: 34px;
    padding: 28px;
    border: 1px solid #edf1f2;
    border-radius: 16px;
    background: #fafcfc;
}

.ds-seo-feature-grid {
    gap: 14px;
}

.ds-seo-feature-grid article {
    position: relative;
    min-height: 138px;
    padding: 21px 20px 19px;
    border-radius: 14px;
}

.ds-feature-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    margin-bottom: 13px;
    border-radius: 9px;
    background: var(--ds-accent-soft);
    color: var(--ds-brand);
    font-size: 0.92rem;
    font-weight: 900;
}

/* 使い方はPCで3ステップ横並び */
.ds-seo-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ds-seo-steps li {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: 160px;
    padding: 20px;
}

.ds-seo-steps li > span {
    margin-bottom: 4px;
}

/* 試験概要：項目名の視認性を上げる */
.ds-spec-table th {
    width: 26%;
    color: #25373b;
    font-size: 0.84rem;
    font-weight: 800;
}

.ds-spec-table td {
    font-size: 0.88rem;
}

/* ---------------------------------------------------------
   FAQ accordion
   --------------------------------------------------------- */
.ds-faq {
    overflow: hidden;
    padding: 0;
    border-radius: 14px;
}

.ds-faq-item {
    padding: 0;
    border-bottom: 1px solid var(--ds-border);
}

.ds-faq-item:last-of-type {
    border-bottom: 0;
}

.ds-faq-question {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 58px;
    padding: 15px 18px;
    border: 0;
    background: #fff;
    color: var(--ds-text);
    font-family: inherit;
    font-size: 0.91rem;
    font-weight: 800;
    line-height: 1.55;
    text-align: left;
    cursor: pointer;
    transition: background var(--ds-dur-fast) var(--ds-ease),
                color var(--ds-dur-fast) var(--ds-ease);
}

.ds-faq-question:hover,
.ds-faq-question[aria-expanded="true"] {
    background: var(--ds-accent-soft);
    color: var(--ds-brand-deep);
}

.ds-faq-question:focus-visible {
    position: relative;
    z-index: 1;
    outline: none;
    box-shadow: inset var(--ds-focus);
}

.ds-faq-mark {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid #cad8da;
    border-radius: 50%;
    background: #fff;
    color: var(--ds-brand);
    font-size: 1rem;
    font-weight: 500;
}

.ds-faq-answer {
    margin: 0;
    padding: 0 18px 18px;
    background: var(--ds-accent-soft);
    color: var(--ds-text-soft);
    font-size: 0.87rem;
    line-height: 1.9;
    animation: ds-reveal-in 180ms var(--ds-ease-out) both;
}

.ds-faq-link {
    margin: 18px;
}

/* ---------------------------------------------------------
   Related services: 外部プラグインの代表的なラッパーにも余白を合わせる
   --------------------------------------------------------- */
.boochi-related-services,
.related-services,
.brs-related-services {
    width: min(94vw, var(--ds-container));
    max-width: var(--ds-container);
    margin-inline: auto;
}

.boochi-related-services a,
.related-services a,
.brs-related-services a {
    border-radius: 14px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 860px) {
    .ds-seo-content {
        max-width: 100%;
    }

    .ds-seo-steps {
        grid-template-columns: 1fr;
    }

    .ds-seo-steps li {
        min-height: 0;
        grid-template-columns: 32px minmax(0, 1fr);
    }
}

@media (max-width: 782px) {
    .ds-seo-shell {
        width: min(100%, 720px);
    }

    .study-start-panel {
        padding: 16px;
    }

    .learning-summary-strip {
        gap: 6px 12px;
    }

    .ds-seo-content > .ds-seo-section:nth-of-type(even) {
        margin-top: 24px;
        padding: 22px 18px;
    }
}

@media (max-width: 640px) {
    .ds-seo-hero {
        padding-top: 10px;
    }

    .ds-hero-pills {
        gap: 6px;
    }

    .ds-hero-pill {
        font-size: 0.72rem;
    }

    .ds-stat-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ds-stat {
        padding: 11px 7px;
    }

    .ds-stat strong {
        font-size: 1rem;
    }

    .learning-summary-strip {
        justify-content: space-between;
    }

    .study-start-panel {
        margin-inline: -1px;
        padding: 15px;
    }

    .start-btn-key {
        display: none;
    }

    .ds-faq-question {
        padding-inline: 15px;
    }

    .ds-faq-answer {
        padding-inline: 15px;
    }
}

@media (max-width: 430px) {
    .ds-stat-row {
        grid-template-columns: 1fr;
    }

    .ds-stat {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        border-right: 0;
        border-bottom: 1px solid var(--ds-border);
        text-align: left;
    }

    .ds-stat:last-child {
        border-bottom: 0;
    }

    .learning-summary-strip {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .session-preview.is-updating,
    .ds-faq-answer {
        animation: none !important;
    }

    #start-btn,
    .ds-hero-cta,
    .check-item,
    .start-btn-arrow {
        transition: none !important;
    }
}

/* =========================================================
   数式・コード表示（DS検定版で追加）

   問題文・選択肢・解説の中にKaTeXの数式とコードブロックが
   混ざるため、行間と横スクロールだけを最低限整える。
   ここより上のトークンは変更していないので、配色を変える
   ときは :root の --ds-brand 系だけを差し替えれば足りる。
   ========================================================= */
.ds-rich {
    white-space: pre-wrap;
}

.ds-math-inline {
    white-space: normal;
}

.ds-math-block {
    display: block;
    margin: 12px 0;
    padding: 4px 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: normal;
    text-align: center;
}

/* KaTeXの既定サイズは本文に対して大きいので、周囲の文字に合わせる。 */
.ds-rich .katex {
    font-size: 1.05em;
    line-height: 1.4;
}

.ds-math-block .katex-display {
    margin: 0;
}

/* KaTeXが読み込めなかったときのフォールバック表示。 */
.ds-math-inline.is-fallback,
.ds-math-block.is-fallback {
    padding: 2px 6px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-muted);
    color: var(--ds-text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono", monospace;
    font-size: 0.86em;
}

.ds-code-block {
    margin: 12px 0;
    padding: 14px 16px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-muted);
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}

.ds-code-block code {
    display: block;
    color: var(--ds-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono", monospace;
    font-size: 0.84rem;
    line-height: 1.7;
    white-space: pre;
}

.ds-code-inline {
    padding: 1px 5px;
    border: 1px solid var(--ds-border);
    border-radius: 5px;
    background: var(--ds-surface-muted);
    color: var(--ds-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono", monospace;
    font-size: 0.86em;
    white-space: normal;
    word-break: break-all;
}

/* 選択肢の中では余白を詰めて、行の高さを揃える。 */
.option-btn .ds-code-block {
    margin: 8px 0 0;
    padding: 10px 12px;
}

.option-btn .ds-math-block {
    margin: 6px 0;
    text-align: left;
}

@media (max-width: 600px) {
    .ds-code-block code {
        font-size: 0.78rem;
    }

    .ds-rich .katex {
        font-size: 1em;
    }
}
