/* Extracted verbatim from test.html inline <style> (P3a). */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}
.progress-text {
    text-align: center;
    color: #666;
    margin-bottom: 10px;
    font-size: 0.9em;
}
.question-section {
    display: none;
}
.question-section.active {
    display: block;
}
.question-text {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 40px;
    text-align: center;
    color: #333;
    line-height: 1.8;
}
.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}
.option-btn {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1em;
    text-align: center;
}
.option-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
}
.option-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.option-btn.neutral {
    border-color: #999;
}
.option-btn.neutral:hover {
    border-color: #666;
    background: #f5f5f5;
}
.option-btn.neutral.selected {
    border-color: #999;
    background: linear-gradient(135deg, #999 0%, #777 100%);
    color: white;
}
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.nav-buttons .btn-group {
    display: flex;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}
.nav-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}
.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-prev {
    background: #f0f0f0;
    color: #333;
}
.btn-prev:hover:not(:disabled) {
    background: #e0e0e0;
}
.btn-next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.btn-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
.result-section {
    display: none;
}
.result-section.active {
    display: block;
}
.result-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 30px;
    padding: 5px;
    background: var(--pc-brand-soft);
    border-radius: var(--pc-radius-pill);
    flex-wrap: wrap;
}
.result-tab {
    flex: 1 1 auto;
    min-width: max-content;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: var(--pc-radius-pill);
    cursor: pointer;
    font-size: 0.98em;
    font-weight: 600;
    color: var(--pc-text-soft);
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.result-tab:hover {
    color: var(--pc-brand);
}
.result-tab.active {
    background: var(--pc-surface);
    color: var(--pc-brand);
    box-shadow: var(--pc-shadow-sm);
}
.result-tab-content {
    display: none;
}
.result-tab-content.active {
    display: block;
}
.result-title {
    font-size: 2em;
    text-align: center;
    margin-bottom: 30px;
    background: var(--pc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Result container cards — career/learning (.result-card) and the
   reference tabs (.reference-result) share one coherent surface look. */
.result-card {
    background: var(--pc-surface-alt);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    padding: 28px;
    margin-bottom: 30px;
}
.result-card h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--pc-brand);
}
.reference-result {
    background: var(--pc-surface);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-lg);
    box-shadow: var(--pc-shadow-md);
    padding: 28px;
    margin-bottom: 24px;
}

/* Shared heading rhythm + brand gradient accent bar */
.result-card h4,
.reference-result h4 {
    position: relative;
    margin: 28px 0 12px;
    padding-left: 14px;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--pc-text);
}
.result-card h4::before,
.reference-result h4::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.18em;
    bottom: 0.18em;
    width: 4px;
    border-radius: var(--pc-radius-pill);
    background: var(--pc-gradient);
}
.reference-result > h4:first-child {
    margin-top: 0;
}

/* Body rhythm */
.result-card p,
.reference-result p {
    margin: 14px 0;
    line-height: 1.8;
    color: var(--pc-text-soft);
}
.result-card ul,
.reference-result ul {
    margin: 14px 0 14px 20px;
    line-height: 1.8;
    color: var(--pc-text-soft);
}
.result-card li,
.reference-result li {
    margin-bottom: 6px;
}
.result-card .rr-lead,
.reference-result .rr-lead {
    margin: 6px 0 18px;
    font-size: 1.12em;
    font-weight: 600;
    line-height: 1.7;
    color: var(--pc-text);
}
.reference-result .trademark-notice {
    font-size: 0.85em;
    color: var(--pc-text-muted);
    margin-top: 28px;
    padding: 12px 14px;
    background: var(--pc-surface-alt);
    border-radius: var(--pc-radius-sm);
    line-height: 1.7;
}

/* Bar charts */
.bar-chart {
    margin: 20px 0;
}
.bar-item {
    margin-bottom: 15px;
}
.bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9em;
}
.bar-label-name {
    font-weight: 600;
    color: var(--pc-text);
}
.bar-label-value {
    color: var(--pc-brand);
    font-weight: 700;
}
.bar-container {
    width: 100%;
    height: 26px;
    background: var(--pc-brand-soft);
    border-radius: var(--pc-radius-pill);
    overflow: hidden;
    position: relative;
}
.bar-container + .bar-container {
    margin-top: 6px;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pc-grad-a) 0%, var(--pc-grad-b) 100%);
    border-radius: var(--pc-radius-pill);
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: #fff;
    font-size: 0.78em;
    font-weight: 700;
    white-space: nowrap;
}
/* On-brand intensity scale (replaces the traffic-light green/amber/red) */
.bar-fill.low {
    background: linear-gradient(90deg, #e0e4f6 0%, #cfd5f0 100%);
    color: var(--pc-text);
}
.bar-fill.medium {
    background: linear-gradient(90deg, #9aa0ec 0%, #8079dc 100%);
}
.bar-fill.high {
    background: linear-gradient(90deg, var(--pc-grad-a) 0%, var(--pc-grad-b) 100%);
}

/* DISC circles — four functional hues, refined + brand-compatible.
   Ring via soft box-shadow tint instead of a heavy drop shadow. */
.disc-chart {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin: 30px 0;
}
.disc-item {
    text-align: center;
    margin: 15px;
    flex: 1;
    min-width: 150px;
}
.disc-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    margin: 6px auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: 800;
    color: #fff;
    position: relative;
}
.disc-circle.D {
    background: linear-gradient(135deg, #ec6284 0%, #d6486d 100%);
    box-shadow: 0 0 0 6px rgba(214, 72, 109, 0.14);
}
.disc-circle.I {
    background: linear-gradient(135deg, #f3b64f 0%, #e59a2b 100%);
    box-shadow: 0 0 0 6px rgba(229, 154, 43, 0.18);
    color: #4d3208;
}
.disc-circle.S {
    background: linear-gradient(135deg, #2ba79b 0%, #157f76 100%);
    box-shadow: 0 0 0 6px rgba(21, 127, 118, 0.16);
}
.disc-circle.C {
    background: linear-gradient(135deg, #5482ec 0%, #3f66db 100%);
    box-shadow: 0 0 0 6px rgba(63, 102, 219, 0.16);
}
.disc-label {
    font-weight: 700;
    margin-top: 5px;
    font-size: 0.9em;
    color: var(--pc-text);
}
.disc-score {
    font-size: 1.2em;
    color: var(--pc-brand);
    margin-top: 5px;
    font-weight: 700;
}

/* Radar grid — neutral surface cards; intensity shown via a tinted
   left accent + the big brand-colored score, not loud pastel fills. */
.radar-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}
.radar-item {
    background: var(--pc-surface);
    padding: 20px;
    border: 1px solid var(--pc-border);
    border-left: 4px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    box-shadow: var(--pc-shadow-sm);
    text-align: center;
}
.radar-item.high {
    border-left-color: var(--pc-brand);
}
.radar-item.medium {
    border-left-color: #8079dc;
}
.radar-item.low {
    border-left-color: #b6bce0;
}
.radar-item .bar-container {
    margin-top: 12px;
}
.radar-score {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--pc-brand);
    margin: 12px 0;
}
.radar-name {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--pc-text);
}
.radar-description {
    font-size: 0.9em;
    color: var(--pc-text-soft);
    margin-top: 10px;
}

/* 16PF top-factor cards (nested inside .reference-result) */
.factor-list {
    margin: 20px 0;
    padding: 0;
    list-style: none;
}
.factor-card {
    background: var(--pc-surface-alt);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    padding: 16px 18px;
    margin-bottom: 18px;
}
.factor-card .bar-label {
    margin-bottom: 8px;
}
.factor-card .bar-label-name,
.factor-card .bar-label-value {
    font-size: 1.05em;
}
.factor-card .bar-container {
    margin-bottom: 10px;
}
.factor-card .factor-desc {
    margin: 10px 0 6px;
    font-size: 0.95em;
    line-height: 1.7;
    color: var(--pc-text-soft);
}
.factor-card .factor-interp {
    margin: 10px 0;
    padding: 10px 12px;
    background: var(--pc-surface);
    border-radius: var(--pc-radius-sm);
    border-left: 3px solid var(--pc-border);
    font-size: 0.9em;
    line-height: 1.7;
    color: var(--pc-text-soft);
}
.factor-card .factor-interp.is-high {
    border-left-color: var(--pc-success);
}
.factor-card .factor-interp.is-low {
    border-left-color: var(--pc-brand);
}
.factor-card .factor-advice {
    margin: 10px 0 0;
    padding: 10px 12px;
    background: var(--pc-brand-soft);
    border-radius: var(--pc-radius-sm);
    font-size: 0.9em;
    line-height: 1.7;
    color: var(--pc-text);
}
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 40px;
}
.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    display: block;
}
.btn-app {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.btn-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
.btn-retry {
    background: #f0f0f0;
    color: #333;
}
.btn-retry:hover {
    background: #e0e0e0;
}

/* 保存提案UI */
.save-option-card {
    background: #f9f9f9;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    text-align: center;
}
.save-option-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}
.save-option-card p {
    margin-bottom: 20px;
    line-height: 1.8;
}
.save-option-card.success {
    background: #e8f5e9;
    border-color: #4caf50;
}
.save-option-card.error {
    background: #ffebee;
    border-color: #f44336;
}
.save-option-card.info {
    background: #e3f2fd;
    border-color: #2196f3;
}
.save-btn, .skip-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s;
}
.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
.skip-btn {
    background: #f0f0f0;
    color: #333;
}
.skip-btn:hover {
    background: #e0e0e0;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: #333;
}
.modal-content h2 {
    margin-bottom: 20px;
    color: #667eea;
}
.modal-content p {
    margin-bottom: 20px;
    line-height: 1.8;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}
.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}
.form-group input:focus {
    outline: none;
    border-color: #667eea;
}
.error-message {
    color: #f44336;
    margin-bottom: 15px;
    padding: 10px;
    background: #ffebee;
    border-radius: 5px;
}
.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}
.btn-primary {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.3s;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-secondary {
    padding: 12px 30px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    background: white;
    color: #333;
    transition: all 0.3s;
}
.btn-secondary:hover {
    background: #f0f0f0;
}

.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 320px;
    justify-content: flex-end;
    z-index: 1000;
}
.lang-btn {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    color: #667eea;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.lang-btn:hover {
    background: #f8f9ff;
    transform: translateY(-1px);
}
.lang-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}
.lang-btn-more {
    padding: 8px 12px;
    border: 2px solid #ccc;
    border-radius: 5px;
    background: white;
    color: #666;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.lang-btn-more:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
}
.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 1100;
}
.lang-dropdown.show {
    display: flex;
}
.lang-dropdown .lang-btn {
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9em;
}
.lang-dropdown .lang-btn:hover {
    background: #f8f9ff;
    transform: none;
}
.container {
    position: relative;
}
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    .question-text {
        font-size: 1.2em;
    }
    .option-btn {
        padding: 15px;
    }
    .lang-switcher {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        max-width: 100%;
        margin-bottom: 10px;
    }
    .lang-btn {
        min-height: 44px; /* タッチターゲット */
        padding: 10px 14px;
        font-size: 0.85em;
    }
    .lang-btn-more {
        min-height: 44px; /* タッチターゲット */
        padding: 10px 14px;
    }
    .lang-dropdown {
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        max-width: calc(100% - 40px);
        max-height: 55vh;
    }
}

/* ============================================================
   P3b redesign layer — overrides the extracted legacy rules
   above via cascade order (same or higher specificity, later).
   ============================================================ */

.container {
    max-width: 760px;
    border-radius: 24px;
    padding: 36px 32px;
}

/* --- progress --- */
.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: #ececf3;
}
.progress-fill {
    border-radius: 999px;
}
.progress-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* --- question --- */
.question-text {
    font-size: 1.45em;
    font-weight: 700;
    line-height: 1.55;
    min-height: 4.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* --- likert options: pill buttons with agree/disagree color ramp --- */
.option-btn {
    border: 2px solid #e2e2ee;
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
    padding: 16px 24px;
    transition: transform 0.12s ease, border-color 0.15s ease,
                background 0.15s ease, color 0.15s ease;
}
.option-btn:hover {
    transform: translateY(-1px);
    background: #f7f7fd;
}
.option-btn[data-value="2"]  { border-color: #8b9cf4; }
.option-btn[data-value="1"]  { border-color: #b9c3f8; }
.option-btn[data-value="-1"] { border-color: #f3cf9e; }
.option-btn[data-value="-2"] { border-color: #eeb46e; }
.option-btn[data-value="2"].selected,
.option-btn[data-value="1"].selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #fff;
}
.option-btn[data-value="-1"].selected,
.option-btn[data-value="-2"].selected {
    background: linear-gradient(135deg, #f0a04b 0%, #d97b29 100%);
    border-color: transparent;
    color: #fff;
}
.option-btn.neutral { border-color: #ddd; color: #666; }
.option-btn.neutral.selected {
    background: #6b7280;
    border-color: transparent;
    color: #fff;
}

/* --- result hero (career / MBTI character) --- */
.result-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    border-radius: 20px;
    margin-bottom: 28px;
    color: #fff;
    background: linear-gradient(135deg, var(--type-primary, #667eea) 0%, var(--type-secondary, #764ba2) 100%);
}
.result-hero-avatar {
    flex: 0 0 auto;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
}
.result-hero--compact {
    padding: 20px 24px;
    margin: 16px 0 24px;
}
.result-hero--compact .result-hero-avatar {
    width: 110px;
    height: 110px;
}
.result-hero-label {
    font-size: 0.9em;
    opacity: 0.85;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.result-hero-name {
    margin: 0 0 6px;
    font-size: 1.7em;
    line-height: 1.3;
}
.result-hero-sub {
    font-size: 0.95em;
    opacity: 0.9;
}
@media (max-width: 600px) {
    .result-hero {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 24px 18px;
    }
    .result-hero-avatar { width: 120px; height: 120px; }
}

/* --- share card --- */
.share-card {
    margin: 28px 0;
    padding: 24px;
    border-radius: 16px;
    background: #f0f4ff;
    text-align: center;
}
.share-card h3 {
    margin: 0 0 8px;
    color: #4c5dd7;
}
.share-card p {
    color: #555;
    margin: 0 0 16px;
}
.share-card-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-share {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.btn-share-copy {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

/* --- respect reduced-motion preference --- */
@media (prefers-reduced-motion: reduce) {
    .bar-fill,
    .progress-fill,
    .option-btn,
    .result-tab,
    .nav-btn,
    .action-btn {
        transition: none;
    }
}
