/* === Pretendard Font === */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    color: #1B2559;
    background: #FFFFFF;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1B2559;
    margin-bottom: 10px;
    text-wrap: balance;
}

h2, h3 {
    text-wrap: balance;
    color: #1B2559;
}

.subtitle {
    font-size: 1.1rem;
    color: #6B7280;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0 10px;
}

.progress-fill {
    height: 100%;
    background: #0E9F6E;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.9rem;
    color: #6B7280;
    font-weight: 500;
}

/* Main Content */
main {
    flex: 1;
    background: #FFFFFF;
    border-radius: 16px;
    padding: 60px 40px;
    margin-bottom: 20px;
}

/* Hero Section (index.html) */
.hero-section {
    text-align: center;
    background: #FFF8F0;
    border-radius: 16px;
    padding: 60px 40px;
    margin-bottom: 40px;
}

.hero-section h1 {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.hero-section .subtitle {
    font-size: 1.15rem;
    margin-bottom: 32px;
}

/* How It Works Section */
.how-it-works {
    padding: 60px 20px;
    margin-bottom: 40px;
}

.how-it-works h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.step-card {
    text-align: center;
    padding: 30px 20px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #0E9F6E;
    color: #FFFFFF;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 16px;
}

.step-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-card p {
    color: #6B7280;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Form Styles */
.create-section {
    text-align: center;
    margin-bottom: 40px;
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    color: #1B2559;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #0E9F6E;
    box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.15);
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid #0E9F6E;
    outline-offset: 2px;
}

button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: 2px solid #0E9F6E;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(14, 159, 110, 0.2);
}

input[type="text"]:focus-visible {
    outline: none;
    border-color: #0E9F6E;
    box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.15);
}

input[readonly] {
    background: #F9FAFB;
    cursor: default;
}

.help-text {
    color: #6B7280;
    font-size: 0.9rem;
}

.link-notice {
    background: #FFF8F0;
    border: 1px solid #F59E0B;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #92400E;
    line-height: 1.6;
    margin-top: 16px;
}

/* Button Styles */
.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #0E9F6E;
    color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
    background: #0C8A5E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 159, 110, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #F3F4F6;
    color: #1B2559;
}

.btn-secondary:hover {
    background: #E5E7EB;
    transform: translateY(-1px);
}

.copy-btn {
    padding: 10px 15px;
    background: #0E9F6E;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
}

.copy-btn:hover {
    background: #0C8A5E;
}

/* Link Display Area */
.link-display-area {
    background: #F0FDF4;
    border: 2px solid #0E9F6E;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 40px;
}

.success-message h3 {
    color: #1B2559;
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.link-container {
    margin-bottom: 25px;
}

.link-item {
    margin-bottom: 20px;
}

.link-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1B2559;
}

.link-box {
    display: flex;
    gap: 10px;
}

.link-box input[type="text"] {
    flex: 1;
    min-width: 0;
}

/* Questions Styles */
.question-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #FFFFFF;
    border-radius: 16px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.question-title {
    font-size: 1.2rem;
    color: #1B2559;
    margin-bottom: 20px;
    line-height: 1.5;
}

.choices-container {
    display: grid;
    gap: 12px;
}

.choice-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: #F9FAFB;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.choice-item:hover {
    border-color: #0E9F6E;
    box-shadow: 0 2px 8px rgba(14, 159, 110, 0.08);
}

.choice-item.selected {
    border-color: #0E9F6E;
    background: #F0FDF4;
}

.choice-item input[type="radio"] {
    margin-top: 2px;
    accent-color: #0E9F6E;
}

.choice-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.4;
}

/* Keywords Styles */
.keyword-instruction {
    color: #6B7280;
    font-size: 1rem;
    margin-bottom: 20px;
    text-align: center;
}

.keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.keyword-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #FFFFFF;
    border: 2px solid #E5E7EB;
    border-radius: 25px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    text-align: center;
    justify-content: center;
    font-size: 0.9rem;
}

.keyword-item:hover {
    border-color: #0E9F6E;
    transform: translateY(-2px);
}

.keyword-item.selected {
    background: #0E9F6E;
    color: #FFFFFF;
    border-color: #0E9F6E;
}

.keyword-item input[type="checkbox"] {
    accent-color: #0E9F6E;
}

.selected-count {
    text-align: center;
    font-weight: 600;
    color: #1B2559;
}

/* Form Actions */
.form-actions {
    text-align: center;
    margin-top: 40px;
}

/* Success Section */
.success-section {
    text-align: center;
    padding: 40px;
}

.success-content h2 {
    color: #1B2559;
    margin-bottom: 20px;
}

.success-content p {
    color: #6B7280;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* My Reports (localStorage) */
.my-reports {
    margin-top: 40px;
}

.my-reports h2 {
    color: #1B2559;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.my-reports-list {
    display: grid;
    gap: 12px;
}

.my-report-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.my-report-card:hover {
    border-color: #0E9F6E;
    box-shadow: 0 4px 12px rgba(14, 159, 110, 0.08);
}

.my-report-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.my-report-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1B2559;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-report-name:hover {
    color: #0E9F6E;
}

.my-report-date {
    color: #6B7280;
    font-size: 0.85rem;
}

.my-report-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.btn-copy-feedback {
    background: #F0FDF4;
    color: #0E9F6E;
    font-weight: 600;
}

.btn-copy-feedback:hover {
    background: #D1FAE5;
}

.btn-view-result {
    background: #F3F4F6;
    color: #1B2559;
    display: inline-block;
}

.btn-view-result:hover {
    background: #E5E7EB;
}

.btn-delete-report {
    background: none;
    color: #9CA3AF;
    font-size: 1.2rem;
    padding: 4px 8px;
    line-height: 1;
}

.btn-delete-report:hover {
    color: #EF4444;
}

/* Personality Type Preview */
.personality-preview {
    margin-top: 50px;
}

.personality-preview h2 {
    color: #1B2559;
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.section-subtitle {
    color: #6B7280;
    margin-bottom: 24px;
    font-size: 1rem;
}

.personality-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.personality-type-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.personality-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.type-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.personality-type-card h3 {
    color: #1B2559;
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.personality-type-card p {
    color: #6B7280;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Link Actions (share + create another) */
.link-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.link-actions .btn-primary,
.link-actions .btn-secondary {
    flex: 1;
}

.loading, .no-reports {
    text-align: center;
    color: #6B7280;
    padding: 40px;
    font-style: italic;
}

/* Waiting View */
.waiting-content {
    text-align: center;
}

.response-counter {
    margin-bottom: 40px;
}

.response-counter h2 {
    color: #1B2559;
    margin-bottom: 20px;
}

.counter-display {
    font-size: 4rem;
    font-weight: 700;
    color: #0E9F6E;
    margin-bottom: 10px;
}

.counter-label {
    font-size: 1.5rem;
    color: #6B7280;
    margin-left: 10px;
}

.counter-description {
    color: #6B7280;
    font-size: 1rem;
}

.share-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #F9FAFB;
    border-radius: 16px;
}

.share-section h3 {
    color: #1B2559;
    margin-bottom: 20px;
}

.share-help {
    color: #6B7280;
    font-size: 0.9rem;
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Result Report Styles */
.report-view section {
    margin-bottom: 40px;
}

.report-view h2 {
    color: #1B2559;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
}

.archetype-card {
    background: #FFFFFF;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #E5E7EB;
}

.archetype-card.main {
    border-color: #0E9F6E;
    border-width: 2px;
    background: #F0FDF4;
}

.archetype-card.sub {
    border-color: #F59E0B;
    border-width: 2px;
    background: #FFFBEB;
}

.archetype-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #1B2559;
}

.archetype-card p {
    color: #6B7280;
    margin-bottom: 15px;
    font-size: 1rem;
}

.archetype-percentage {
    font-size: 2rem;
    font-weight: 700;
    color: #0E9F6E;
}

.archetype-card.sub .archetype-percentage {
    color: #D97706;
}

/* Chart Styles */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 20px;
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-color.leader { background: #3B82F6; }
.legend-color.counselor { background: #0E9F6E; }
.legend-color.artist { background: #F59E0B; }
.legend-color.energizer { background: #EF4444; }
.legend-color.strategist { background: #8B5CF6; }
.legend-color.explorer { background: #06B6D4; }

/* Keywords Cloud */
.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.keyword-tag {
    background: #0E9F6E;
    color: #FFFFFF;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 1rem;
}

.keyword-tag.size-1 {
    font-size: 0.85rem;
    padding: 6px 14px;
    font-weight: 400;
    opacity: 0.85;
}

.keyword-tag.size-2 {
    font-size: 0.95rem;
    padding: 8px 16px;
    font-weight: 500;
}

.keyword-tag.size-3 {
    font-size: 1.1rem;
    padding: 10px 18px;
    font-weight: 600;
}

.keyword-tag.size-4 {
    font-size: 1.3rem;
    padding: 12px 20px;
    font-weight: 700;
}

/* Comment Card */
.comment-card {
    background: #F9FAFB;
    padding: 30px;
    border-radius: 16px;
    border-left: 5px solid #1B2559;
}

.comment-card p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #1B2559;
    font-style: italic;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: #F9FAFB;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #0E9F6E;
    margin-bottom: 5px;
}

.stat-label {
    color: #6B7280;
    font-size: 0.9rem;
}

/* Report Actions */
.report-actions {
    text-align: center;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: #6B7280;
    font-size: 0.9rem;
}

/* Dark footer variant for index page */
footer.footer-dark {
    background: #1B2559;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    margin-top: auto;
}

/* Question Navigation */
.question-navigation {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 30px 20px;
    }

    main {
        padding: 40px 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .hero-section {
        padding: 40px 20px;
    }

    .hero-section h1 {
        font-size: 2.2rem;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    input[type="text"] {
        min-width: unset;
    }

    .link-box {
        flex-direction: column;
    }

    .keywords-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .counter-display {
        font-size: 3rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .action-buttons button {
        width: 100%;
        max-width: 300px;
    }

    .report-actions {
        flex-direction: column;
        align-items: center;
    }

    .report-actions button {
        width: 100%;
        max-width: 300px;
    }

    .personality-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .my-report-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .my-report-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .link-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .chart-legend {
        grid-template-columns: 1fr;
    }

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

    .personality-grid {
        grid-template-columns: 1fr;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Copy success animation */
@keyframes copySuccess {
    0% { background: #0E9F6E; }
    50% { background: #0C8A5E; }
    100% { background: #0E9F6E; }
}

.copy-success {
    animation: copySuccess 0.5s ease;
}

/* Keyword Reset Button */
.keyword-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn-keyword-reset {
    padding: 6px 14px;
    background: #F3F4F6;
    color: #1B2559;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-keyword-reset:hover {
    background: #E5E7EB;
}

/* Loading Spinner (standardized) */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #0E9F6E;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

.loading-message {
    text-align: center;
    color: #6B7280;
    padding: 40px;
}

.loading-message p {
    font-size: 1rem;
    margin-top: 10px;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 30px;
    color: #1B2559;
}

.error-message .error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    font-style: normal;
}

.error-message p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.error-message button {
    padding: 8px 16px;
    background: #F3F4F6;
    color: #1B2559;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.error-message button:hover {
    background: #E5E7EB;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .progress-fill {
        transition: none;
    }

    .btn-primary:hover:not(:disabled),
    .btn-secondary:hover,
    .keyword-item:hover,
    .personality-type-card:hover {
        transform: none;
    }
}

/* Tabular nums for statistics */
.stat-number,
.counter-display,
.archetype-percentage {
    font-variant-numeric: tabular-nums;
}
