/* --- Global Styles & Variables --- */
:root {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-color: #f39c12;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --background-color: #f8fafc;
    --text-color: #2c3e50;
    --light-text-color: #ffffff;
    --border-color: #e2e8f0;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 15px rgba(0, 0, 0, 0.12);
    
    /* Domain Colors */
    --domain-execution: #e53e3e;
    --domain-influencing: #dd6b20;
    --domain-relationship: #3182ce;
    --domain-strategic: #805ad5;
}

/* --- Animations --- */
@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes scaleUp { 
    from { transform: scale(0.95); opacity: 0; } 
    to { transform: scale(1); opacity: 1; } 
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* --- Base Styles --- */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

#app {
    max-width: 900px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

/* --- Card Components --- */
.card {
    background-color: var(--light-text-color);
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    border: 1px solid var(--border-color);
}

/* --- Typography --- */
h1, h2, h3, h4 { 
    font-weight: 700; 
    margin-top: 0;
}

h1 { 
    font-size: 2.2em; 
    text-align: center; 
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    font-weight: 800;
}

h2 { 
    font-size: 1.6em; 
    color: var(--text-color);
    margin-bottom: 16px;
}

h3 { 
    font-size: 1.3em;
    margin-bottom: 12px;
}

h4 { 
    font-size: 1.1em; 
    margin-top: 28px; 
    margin-bottom: 16px; 
    padding-bottom: 8px; 
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

h4::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-gradient);
}

/* --- Button Components --- */
button {
    padding: 14px 28px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--primary-gradient);
    color: var(--light-text-color);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

button.secondary {
    background: var(--light-text-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

button.secondary:hover:not(:disabled) {
    background: var(--background-color);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled::before {
    display: none;
}

/* --- Utility Classes --- */
.hidden { 
    display: none; 
}
.print-only {
    display: none;
}
.text-center {
    text-align: center;
}
.mb-small { margin-bottom: 12px; }
.mb-medium { margin-bottom: 20px; }
.mb-large { margin-bottom: 32px; }

/* --- Loading Spinner --- */
.spinner { 
    border: 4px solid rgba(102, 126, 234, 0.1);
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite; 
    margin: 80px auto;
}

/* --- Start Screen Styles --- */
.start-screen .title { 
    text-align: center; 
    margin-bottom: 32px; 
}

.start-screen .title p {
    font-size: 1.1em;
    color: #64748b;
    margin: 8px 0 0 0;
}

.start-screen .radio-group { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 12px; 
    margin-top: 20px;
    justify-content: center;
}

.start-screen .radio-group label {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.start-screen .radio-group label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left 0.3s ease;
    z-index: -1;
}

.start-screen .radio-group input[type="radio"] { 
    display: none; 
}

.start-screen .radio-group input[type="radio"]:checked + label {
    color: var(--light-text-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.start-screen .radio-group input[type="radio"]:checked + label::before {
    left: 0;
}

.start-screen .description { 
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    padding: 24px; 
    border-radius: 12px; 
    border-left: 5px solid var(--primary-color); 
    margin-top: 32px;
    position: relative;
}

.start-screen .description::before {
    content: '💡';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.2em;
}

.start-screen .description p {
    margin: 0 0 0 30px;
    color: var(--text-color);
}

.start-screen .start-button-container { 
    text-align: center; 
    margin-top: 32px; 
}

/* --- Selection Screen Styles --- */
.selection-screen .header { 
    text-align: center; 
    margin-bottom: 24px; 
}

.selection-screen .header p {
    color: #64748b;
    margin: 8px 0 0 0;
}

.selection-screen .status-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 24px; 
    padding: 16px; 
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px; 
    flex-wrap: wrap; 
    gap: 12px;
    border: 1px solid var(--border-color);
}

.selection-screen .status-bar span:first-child {
    font-weight: 600;
    color: var(--primary-color);
}

.selection-screen #selection-order { 
    font-size: 0.9em; 
    color: #64748b;
    font-family: monospace;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.selection-screen #selection-order span {
    background: var(--light-text-color);
    padding: 4px 8px;
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid var(--border-color);
}

.selection-screen .input-group { 
    margin-bottom: 24px; 
}

.selection-screen .input-group label { 
    font-weight: 600; 
    display: block; 
    margin-bottom: 8px;
    color: var(--text-color);
}

.selection-screen .input-group input { 
    width: 100%; 
    padding: 14px 16px; 
    font-size: 1em; 
    border: 2px solid var(--border-color); 
    border-radius: 12px; 
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: inherit;
}

.selection-screen .input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* --- Strength Grid --- */
.strength-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 16px;
    margin-bottom: 32px;
}

.strength-card {
    padding: 16px 16px 16px 24px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background-color: var(--light-text-color);
    overflow: hidden;
    font-weight: 500;
}

.strength-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: var(--border-color);
    transition: all 0.3s ease;
}

.strength-card.domain-execution::before { background-color: var(--domain-execution); }
.strength-card.domain-influencing::before { background-color: var(--domain-influencing); }
.strength-card.domain-relationship::before { background-color: var(--domain-relationship); }
.strength-card.domain-strategic::before { background-color: var(--domain-strategic); }

.strength-card:hover { 
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}

.strength-card.selected { 
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f0fff4 0%, #e6fff2 100%);
    font-weight: 700;
    transform: translateY(-2px);
}

.selected-rank {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--success-color);
    color: var(--light-text-color);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    animation: pulse 0.6s ease-in-out;
}

.navigation-buttons { 
    text-align: center; 
    margin-top: 40px; 
    display: flex; 
    gap: 16px; 
    justify-content: center; 
    flex-wrap: wrap;
}

/* --- Result Screen Styles --- */
.result-screen { 
    animation: scaleUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.result-header { 
    text-align: center; 
    padding: 40px 32px;
    border-radius: 16px;
    margin: -32px -32px 32px -32px;
    position: relative;
    overflow: hidden;
}

.result-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.9;
    z-index: 1;
}

.result-header * {
    position: relative;
    z-index: 2;
}

.result-header.individual { 
    background: var(--primary-gradient);
    color: white; 
}

.result-header.relationship { 
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: var(--text-color); 
}

.result-header h1 { 
    color: inherit; 
    font-size: 2em; 
    margin: 0;
    -webkit-text-fill-color: inherit;
    background: none;
    font-weight: 800;
}

.result-header .subtitle { 
    font-size: 1.2em; 
    opacity: 0.95; 
    margin: 12px 0 0 0;
    font-weight: 400;
}

.result-strengths-list { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    justify-content: center; 
    margin-top: 24px; 
}

.result-strength-tag { 
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    padding: 8px 16px; 
    border-radius: 20px; 
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.3);
}

.result-header.relationship .result-strength-tag {
    background: rgba(0,0,0,0.05);
    color: var(--text-color);
    border-color: rgba(0,0,0,0.1);
}

.report-credit {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 10px;
    color: #999;
    z-index: 3;
}
.report-credit a {
    color: inherit;
    text-decoration: none;
}


/* --- Result Sections --- */
.result-section { 
    margin: 24px 0; 
    padding: 28px; 
    border-left: 5px solid var(--primary-color); 
    background-color: var(--light-text-color);
    border-radius: 0 12px 12px 0;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.result-section:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-medium);
}

.result-section:nth-child(even) { /* Swapped for better visual flow with header */
    background: linear-gradient(135deg, #fdfdff 0%, #f7f7ff 100%);
}

.result-section .section-title { 
    font-size: 1.4em; 
    margin-bottom: 16px; 
    display: flex; 
    align-items: center; 
    border-bottom: 2px solid #e2e8f0; 
    padding-bottom: 8px;
    font-weight: 700;
}

.result-section .emoji { 
    font-size: 1.6em; 
    margin-right: 12px; 
}

.result-section .section-content {
    line-height: 1.8;
    color: var(--text-color);
}

/* --- Comparison Components --- */
.persons-comparison { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 20px; 
    margin-top: 24px; 
}

@media (min-width: 768px) { 
    .persons-comparison { 
        grid-template-columns: 1fr 1fr; 
    } 
}

.person-card { 
    padding: 24px; 
    background: var(--light-text-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.person-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.person-card h4 {
    margin-top: 0;
    color: var(--text-color);
}

.person-card h4::after {
    background: var(--primary-gradient);
}


.compatibility-score { 
    text-align: center; 
    padding: 32px 24px;
    background: linear-gradient(135deg, #fff0f3 0%, #f0f3ff 100%);
    border-radius: 16px; 
    margin: 24px 0;
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.compatibility-score::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.05) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.compatibility-score h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.score-display { 
    font-size: 3.5em; 
    font-weight: 800; 
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 16px 0;
    font-family: 'Noto Sans JP', sans-serif;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .card {
        padding: 20px;
    }
    
    .strength-grid {
        grid-template-columns: 1fr;
    }
    
    .navigation-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .navigation-buttons button {
        width: 100%;
        max-width: 300px;
    }
    
    .start-screen .radio-group {
        flex-direction: column;
    }
    
    .start-screen .radio-group label {
        text-align: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }
    
    .result-header {
        padding: 24px 20px;
        margin: -20px -20px 20px -20px;
    }
    
    .result-section {
        padding: 20px;
        margin: 16px 0;
    }
    
    .score-display {
        font-size: 2.5em;
    }
}