/* ==========================================================================
   POLITICAL COMPASS - MODERN DESIGN SYSTEM
   ========================================================================== */

:root {
    --bg-main: #060913;
    --bg-card: rgba(15, 23, 42, 0.65);
    --border-glow: rgba(99, 102, 241, 0.15);
    --border-light: rgba(255, 255, 255, 0.08);
    
    /* Text colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents & Brand */
    --color-accent: #6366f1;
    --color-accent-hover: #4f46e5;
    
    /* Political Quadrant Colors */
    --color-auth-left: #ef4444;    /* Red */
    --color-auth-right: #3b82f6;   /* Blue */
    --color-lib-left: #10b981;     /* Green */
    --color-lib-right: #f59e0b;    /* Orange/Yellow */

    /* Option Colors */
    --color-sa: #10b981;  /* Strongly Agree */
    --color-a: #06b6d4;   /* Agree */
    --color-d: #f43f5e;   /* Disagree */
    --color-sd: #e11d48;  /* Strongly Disagree */
    
    --font-sans: 'Inter', 'Noto Sans KR', sans-serif;
    --font-heading: 'Outfit', 'Inter', 'Noto Sans KR', sans-serif;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 16px;
    line-height: 1.6;
}

/* Background Glowing Orbs */
.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
    transition: all 1s ease;
}

.glow-left {
    background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
    top: -200px;
    left: -200px;
}

.glow-right {
    background: radial-gradient(circle, #ec4899 0%, transparent 70%);
    bottom: -200px;
    right: -200px;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
    pointer-events: none;
}

/* Main Container (Mobile-First bounds) */
.app-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 40%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .highlight {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-tag {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 3px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.03);
}

/* Main Card */
.main-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    box-shadow: 
        0 10px 30px -10px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

/* View Panels & Transitions */
.view-panel {
    display: none;
    flex-direction: column;
    padding: 28px 24px;
    flex-grow: 1;
    animation: fadeIn 0.4s ease-out forwards;
}

.view-panel.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   1. WELCOME SCREEN STYLES
   ========================================================================== */

.intro-graphics {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0 28px 0;
}

.compass-preview {
    width: 140px;
    height: 140px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.compass-preview .quad {
    position: absolute;
    width: 50%;
    height: 50%;
    opacity: 0.15;
}

.compass-preview .quad.red { top: 0; left: 0; background-color: var(--color-auth-left); }
.compass-preview .quad.blue { top: 0; right: 0; background-color: var(--color-auth-right); }
.compass-preview .quad.green { bottom: 0; left: 0; background-color: var(--color-lib-left); }
.compass-preview .quad.yellow { bottom: 0; right: 0; background-color: var(--color-lib-right); }

.compass-preview .center-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.compass-preview .pulse-dot {
    position: absolute;
    top: 35%;
    left: 65%;
    width: 10px;
    height: 10px;
    background-color: var(--color-accent);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--color-accent);
    transform: translate(-50%, -50%);
    animation: previewPulse 2s infinite ease-in-out;
}

@keyframes previewPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; box-shadow: 0 0 20px var(--color-accent); }
}

.intro-text {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.title-main {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.35;
    background: linear-gradient(135deg, #fff 60%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.desc-main {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.desc-main strong {
    color: var(--text-primary);
    font-weight: 500;
}

.info-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    padding: 6px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge .icon {
    font-size: 0.85rem;
}

.action-wrapper {
    margin-top: auto;
    padding-top: 24px;
}

/* ==========================================================================
   2. QUIZ SCREEN STYLES
   ========================================================================== */

.quiz-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-accent);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 4px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.category-tag.society {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.progress-counter {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.progress-bar-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 5%;
    background: linear-gradient(90deg, var(--color-accent), #ec4899);
    border-radius: 99px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-container {
    min-height: 90px;
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.55;
    word-break: keep-all;
    color: var(--text-primary);
}

/* Options Grid */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-option {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 14px 20px;
    text-align: left;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-option-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.option-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 900;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.option-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-title {
    font-size: 0.95rem;
    font-weight: 700;
    transition: color 0.2s ease;
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Hover States & Accent Colors per Option */
/* Strongly Agree */
.btn-option.option-sa:hover {
    border-color: var(--color-sa);
    background: rgba(16, 185, 129, 0.03);
}
.btn-option.option-sa:hover .option-title { color: var(--color-sa); }
.btn-option.option-sa:hover .option-check { border-color: var(--color-sa); }
.btn-option.option-sa:active, .btn-option.option-sa.selected {
    border-color: var(--color-sa);
    background: rgba(16, 185, 129, 0.08);
}
.btn-option.option-sa.selected .option-check {
    background-color: var(--color-sa);
    border-color: var(--color-sa);
    color: #fff;
}
.btn-option.option-sa.selected .option-title { color: var(--color-sa); }

/* Agree */
.btn-option.option-a:hover {
    border-color: var(--color-a);
    background: rgba(6, 182, 212, 0.03);
}
.btn-option.option-a:hover .option-title { color: var(--color-a); }
.btn-option.option-a:hover .option-check { border-color: var(--color-a); }
.btn-option.option-a:active, .btn-option.option-a.selected {
    border-color: var(--color-a);
    background: rgba(6, 182, 212, 0.08);
}
.btn-option.option-a.selected .option-check {
    background-color: var(--color-a);
    border-color: var(--color-a);
    color: #fff;
}
.btn-option.option-a.selected .option-title { color: var(--color-a); }

/* Disagree */
.btn-option.option-d:hover {
    border-color: var(--color-d);
    background: rgba(244, 63, 94, 0.03);
}
.btn-option.option-d:hover .option-title { color: var(--color-d); }
.btn-option.option-d:hover .option-check { border-color: var(--color-d); }
.btn-option.option-d:active, .btn-option.option-d.selected {
    border-color: var(--color-d);
    background: rgba(244, 63, 94, 0.08);
}
.btn-option.option-d.selected .option-check {
    background-color: var(--color-d);
    border-color: var(--color-d);
    color: #fff;
}
.btn-option.option-d.selected .option-title { color: var(--color-d); }

/* Strongly Disagree */
.btn-option.option-sd:hover {
    border-color: var(--color-sd);
    background: rgba(225, 29, 72, 0.03);
}
.btn-option.option-sd:hover .option-title { color: var(--color-sd); }
.btn-option.option-sd:hover .option-check { border-color: var(--color-sd); }
.btn-option.option-sd:active, .btn-option.option-sd.selected {
    border-color: var(--color-sd);
    background: rgba(225, 29, 72, 0.08);
}
.btn-option.option-sd.selected .option-check {
    background-color: var(--color-sd);
    border-color: var(--color-sd);
    color: #fff;
}
.btn-option.option-sd.selected .option-title { color: var(--color-sd); }


.quiz-nav {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   3. LOADING SCREEN STYLES
   ========================================================================== */

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    text-align: center;
    gap: 16px;
    padding: 40px 0;
}

.scanner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.scanner-circle {
    width: 100%;
    height: 100%;
    border: 3px dashed rgba(99, 102, 241, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.scanner-bar {
    position: absolute;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--color-accent);
    animation: scanPulse 2s infinite ease-in-out;
}

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

@keyframes scanPulse {
    0%, 100% { transform: translate(-50%, -40px) scaleX(0.8); opacity: 0.3; }
    50% { transform: translate(-50%, 40px) scaleX(1); opacity: 1; }
}

.loading-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.loading-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 320px;
    margin-bottom: 24px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 260px;
    text-align: left;
}

.step-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
    padding-left: 20px;
    transition: all 0.3s ease;
}

.step-item::before {
    content: "●";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.step-item.active {
    color: var(--color-accent);
    font-weight: 600;
}

.step-item.active::before {
    color: var(--color-accent);
    animation: blink 1s infinite alternate;
}

.step-item.done {
    color: var(--text-primary);
}

.step-item.done::before {
    content: "✓";
    color: var(--color-lib-left);
    font-weight: bold;
}

@keyframes blink {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* ==========================================================================
   4. RESULT SCREEN STYLES
   ========================================================================== */

.result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.result-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-accent);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 3px 10px;
    border-radius: 6px;
}

.result-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
}

/* Result layout */
.result-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.compass-canvas-container {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 12px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

#svg-compass {
    display: block;
}

/* Animated node on SVG */
#result-dot {
    transition: cx 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), cy 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#result-dot-glow {
    transition: cx 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), cy 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: markerGlow 1.8s infinite alternate ease-in-out;
}

@keyframes markerGlow {
    from { r: 12px; opacity: 0.3; }
    to { r: 22px; opacity: 0.6; }
}

/* Ideology Card */
.ideology-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 20px;
}

.result-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ideology-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
}

.ideology-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    word-break: keep-all;
}

.similar-icons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px dashed var(--border-light);
    padding-top: 14px;
}

.icon-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.keyword-tag {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--text-secondary);
}

/* Metrics Section */
.metrics-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    border-left: 3px solid var(--color-accent);
    padding-left: 8px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.metric-value {
    color: #fff;
    font-family: var(--font-heading);
}

.text-red { color: var(--color-auth-left); }
.text-blue { color: var(--color-auth-right); }
.text-purple { color: #a855f7; }
.text-green { color: var(--color-lib-left); }

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    position: relative;
    overflow: hidden;
}

/* Double-sided custom filling */
.progress-fill-bi {
    position: absolute;
    height: 100%;
    width: 0%;
    left: 50%;
    transform: translateX(0%);
    border-radius: 99px;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Figures Card */
.figures-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 16px 20px;
    margin-top: 8px;
}

.figures-card .card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.values-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.values-list li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 16px;
}

.values-list li::before {
    content: "•";
    position: absolute;
    left: 4px;
    color: var(--color-accent);
    font-weight: bold;
}

/* Actions */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

/* ==========================================================================
   BUTTONS AND INTERACTIVE ELEMENTS
   ========================================================================== */

.btn {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 14px 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 
        0 4px 15px rgba(99, 102, 241, 0.35),
        inset 0 1px 1px rgba(255,255,255,0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(99, 102, 241, 0.45);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.btn-secondary:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Ripple effect utility */
.ripple {
    position: relative;
    overflow: hidden;
}

/* Sound control & footer elements */
.app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.audio-control {
    display: flex;
    justify-content: center;
}

.audio-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.audio-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.audio-toggle-btn.active {
    color: var(--color-accent);
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.05);
}

.copyright {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* Responsive Overrides */
@media (min-width: 600px) {
    body {
        padding: 24px;
    }
    
    .app-container {
        max-width: 480px;
    }
    
    .view-panel {
        padding: 36px 30px;
    }
}
