* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #233347 0%, #2d4a67 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    width: 100%;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 5px;
    border-radius: 10px;
    flex: 1 1 33.33%;
    max-width: 33.33%;
    min-width: 0;
}

.stat-item .label {
    font-size: 0.85em;
    opacity: 0.8;
    margin-bottom: 3px;
}

.stat-item .value {
    font-size: 1.5em;
    font-weight: bold;
    color: #FFD700;
}

/* Tutorial Section */
.tutorial-section {
    padding: 25px;
    text-align: center;
}

.tutorial-section h2 {
    color: #233347;
    margin-bottom: 15px;
    font-size: 1.6em;
}

.tutorial-section > p {
    font-size: 1.05em;
    color: #666;
    margin-bottom: 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.trait-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 700px;
    margin: 0 auto 20px;
    text-align: left;
}

.trait-card {
    padding: 14px 18px;
    border-radius: 8px;
    color: #333;
    border-left: 4px solid #ccc;
    background: #f8f9fa;
}

.trait-card h3 {
    font-size: 1em;
    color: #233347;
    margin-bottom: 6px;
}

.trait-card h3 strong {
    display: inline;
    margin-right: 2px;
}

.trait-card p {
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
    margin-bottom: 6px;
}

.trait-card .facet-list {
    font-size: 0.8em;
    color: #888;
    font-style: italic;
}

.email-notice {
    text-align: center;
    padding: 12px 20px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 0.9em;
}

.email-notice.sent {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.email-notice.failed {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.trait-o { border-left-color: #9b59b6; }
.trait-c { border-left-color: #2ecc71; }
.trait-e { border-left-color: #f39c12; }
.trait-a { border-left-color: #3498db; }
.trait-n { border-left-color: #e74c3c; }

.privacy-note {
    font-size: 0.85em;
    color: #999;
    margin-bottom: 20px;
}

.test-choice-cards {
    display: flex;
    gap: 20px;
    max-width: 720px;
    margin: 0 auto 20px;
}

.test-card {
    flex: 1;
    background: linear-gradient(160deg, #1a1a2e 0%, #233347 50%, #2d4a67 100%);
    border: none;
    border-radius: 16px;
    padding: 28px 24px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(26, 26, 46, 0.25);
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.test-card::after {
    content: 'Start \2192';
    position: absolute;
    bottom: 20px;
    right: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.test-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 40px rgba(102, 126, 234, 0.35);
}

.test-card:hover::before {
    opacity: 1;
}

.test-card:hover::after {
    color: #FFD700;
}

.test-card:active {
    transform: translateY(-1px) scale(1.01);
}

.test-card h4 {
    font-size: 1.25em;
    color: #fff;
    margin-bottom: 6px;
    position: relative;
}

.test-card-detail {
    font-size: 0.85em;
    color: #FFD700;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 12px;
    padding: 3px 10px;
    background: rgba(255, 215, 0, 0.12);
    border-radius: 20px;
    letter-spacing: 0.3px;
    position: relative;
}

.test-card p {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.55;
    margin: 0 0 20px;
    position: relative;
}

@media (max-width: 600px) {
    .test-choice-cards {
        flex-direction: column;
        gap: 14px;
    }

    .test-card {
        padding: 22px 20px;
    }
}

/* Game Section */
.game-section {
    padding: 25px;
}

#game-area {
    max-width: 800px;
    margin: 0 auto;
}

/* Question styles */
.question-container {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.question-container:last-of-type {
    border-bottom: none;
}

.q-num {
    font-weight: 700;
    color: #233347;
    display: inline;
    margin-right: 4px;
}

.q-text {
    display: inline;
    font-size: 0.95em;
    color: #444;
}

.q-line {
    margin-bottom: 10px;
}

/* Radio group for full test */
.radio-group {
    display: flex;
    gap: 0;
    margin-top: 8px;
}

.radio-group label {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.8em;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fafafa;
    transition: all 0.15s;
}

.radio-group label:first-child {
    border-radius: 6px 0 0 6px;
}

.radio-group label:last-child {
    border-radius: 0 6px 6px 0;
}

.radio-group label:hover {
    background: #e8f0ff;
}

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

.radio-group input[type="radio"]:checked + span {
    font-weight: 700;
}

.radio-group label:has(input:checked) {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Slider question for quick test */
.slider-question {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.slider-question:last-of-type {
    border-bottom: none;
}

.option-text {
    font-size: 0.9em;
    margin-bottom: 6px;
    color: #444;
    text-align: left;
}

.option-text strong {
    color: #222;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.slider-row label {
    width: 24px;
    font-weight: 700;
    color: #233347;
}

.slider-row input[type="range"] {
    flex: 1;
    accent-color: #667eea;
}

.slider-row .val {
    width: 40px;
    text-align: right;
    font-size: 0.9em;
    font-weight: 600;
}

.slider-total {
    font-size: 0.85em;
    margin-top: 4px;
    text-align: center;
}

.slider-total.valid {
    color: #27ae60;
    font-weight: 600;
}

.slider-total.invalid {
    color: #e74c3c;
    font-weight: 700;
}

/* Demo fields */
.demo-fields {
    display: flex;
    gap: 16px;
    margin: 16px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.demo-fields label {
    font-weight: 600;
    color: #233347;
}

.demo-fields select,
.demo-fields input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
}

/* Progress bar */
.progress-bar-container {
    background: #e8ecef;
    border-radius: 8px;
    height: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 8px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.85em;
    color: #888;
    margin-bottom: 12px;
}

/* Email field */
.email-field {
    max-width: 400px;
    margin: 20px auto 0;
    text-align: left;
}

.email-field label {
    display: block;
    font-weight: 600;
    color: #233347;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.email-field input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.email-field input:focus {
    outline: none;
    border-color: #667eea;
}

.email-field .email-hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 4px;
}

/* Submit area */
.submit-area {
    text-align: center;
    margin: 24px 0 8px;
}

.submit-warning {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 8px;
    display: none;
}

/* Results / Confirmation Section */
.results-section {
    padding: 25px;
}

#results-area {
    max-width: 800px;
    margin: 0 auto;
}

.confirmation-area {
    text-align: center;
    padding: 40px 20px;
}

.confirmation-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

.confirmation-area h2 {
    color: #233347;
    font-size: 1.8em;
    margin-bottom: 12px;
}

.confirmation-area p {
    color: #666;
    font-size: 1.1em;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

.results-actions {
    text-align: center;
    padding: 20px 0;
    max-width: 350px;
    margin: 0 auto;
}

.result-block {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.overview-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.overview-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.overview-label {
    width: 28px;
    font-weight: 700;
    font-size: 1em;
    color: #233347;
}

.overview-name {
    flex: 1;
    font-size: 0.88em;
    color: #555;
}

.overview-bar-wrap {
    width: 180px;
    height: 14px;
    background: #e8ecef;
    border-radius: 7px;
    overflow: hidden;
}

.overview-bar {
    height: 100%;
    border-radius: 7px;
}

.overview-pct {
    width: 36px;
    text-align: right;
    font-weight: 700;
    color: #233347;
}

/* Domain section */
.domain-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.domain-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.domain-header h3 {
    flex: 1;
    font-size: 1.15em;
    color: #233347;
    margin: 0;
}

.domain-pct {
    font-size: 1.4em;
    font-weight: 700;
}

.bar-wrap {
    height: 16px;
    background: #e8ecef;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
}

.bar-o { background: linear-gradient(90deg, #9b59b6, #8e44ad); }
.bar-c { background: linear-gradient(90deg, #2ecc71, #27ae60); }
.bar-e { background: linear-gradient(90deg, #f39c12, #e67e22); }
.bar-a { background: linear-gradient(90deg, #3498db, #2980b9); }
.bar-n { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.pct-o { color: #8e44ad; }
.pct-c { color: #27ae60; }
.pct-e { color: #e67e22; }
.pct-a { color: #2980b9; }
.pct-n { color: #c0392b; }

.domain-desc {
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Facet styles */
.facet {
    margin: 10px 0;
}

.facet-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.facet-name {
    flex: 1;
    font-size: 0.88em;
    color: #333;
}

.facet-bar-wrap {
    width: 120px;
    height: 10px;
    background: #e8ecef;
    border-radius: 5px;
    overflow: hidden;
}

.facet-bar {
    height: 100%;
    border-radius: 5px;
}

.facet-pct {
    width: 36px;
    text-align: right;
    font-weight: 600;
    font-size: 0.88em;
    color: #333;
}

.facet-desc {
    font-size: 0.85em;
    color: #666;
    margin: 4px 0 0;
    line-height: 1.5;
}

.facet-toggle {
    font-size: 0.8em;
    color: #667eea;
    cursor: pointer;
    margin-top: 4px;
    display: inline-block;
}

.facet-toggle:hover {
    text-decoration: underline;
}

.facet-detail {
    display: none;
}

.facet-detail.open {
    display: block;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: block;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 25px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
}

.btn-secondary:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Home Button */
.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, background 0.3s ease;
    z-index: 100;
    text-decoration: none;
}

.home-btn:hover {
    transform: scale(1.1);
    background: white;
}

.home-btn svg {
    width: 24px;
    height: 24px;
    color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.4em;
    }

    .stats {
        gap: 8px;
    }

    .stat-item {
        padding: 8px 5px;
    }

    .stat-item .value {
        font-size: 1.3em;
    }

    .tutorial-section,
    .game-section,
    .results-section {
        padding: 15px;
    }

    .overview-bar-wrap {
        width: 120px;
    }

    .overview-name {
        font-size: 0.8em;
    }

    .facet-bar-wrap {
        width: 80px;
    }

    .radio-group label {
        padding: 6px 2px;
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2em;
    }

    .stat-item .label {
        font-size: 0.75em;
    }

    .stat-item .value {
        font-size: 1.1em;
    }

    .overview-bar-wrap {
        width: 80px;
    }

    .overview-name {
        display: none;
    }

    .facet-bar-wrap {
        width: 60px;
    }

    .domain-header h3 {
        font-size: 1em;
    }

    .radio-group label {
        padding: 6px 1px;
        font-size: 0.65em;
    }
}

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

.domain-section {
    animation: fadeIn 0.4s ease;
}

.result-block {
    animation: fadeIn 0.3s ease;
}
