:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

.screen {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 20px 80px;
    min-height: 100vh;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0f172a;
    color: white;
}

.loading-screen .logo { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.05em; }
.loading-screen .tagline { color: #94a3b8; margin: 8px 0 24px; font-size: 0.875rem; }

.spinner {
    width: 32px; height: 32px;
    border: 3px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.brand { text-align: center; margin-bottom: 32px; }
.brand h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text); }
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    min-height: 48px;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-lg { padding: 16px 24px; font-size: 1.05rem; }

label { display: block; margin-bottom: 16px; font-size: 0.875rem; font-weight: 500; }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
}

.error-msg { color: var(--error); font-size: 0.875rem; margin: 12px 0; }
.hidden { display: none !important; }

.install-screen, .access-screen { text-align: center; }
.install-message { margin-bottom: 24px; color: var(--text-muted); }
.install-alt { margin: 24px 0 12px; color: var(--text-muted); font-size: 0.875rem; }
.ios-guide { text-align: left; background: #f1f5f9; padding: 16px; border-radius: var(--radius); margin: 20px 0; font-size: 0.875rem; }
.ios-guide ol { margin-left: 20px; margin-top: 8px; }

.profile-screen h2 { margin-bottom: 8px; }
.hint { color: var(--text-muted); margin-bottom: 24px; font-size: 0.9rem; }

.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }

.question-header { margin-bottom: 16px; font-size: 0.875rem; color: var(--text-muted); }
.question-category { font-size: 0.75rem; color: var(--primary); font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.question-text { font-size: 1.1rem; margin-bottom: 24px; line-height: 1.5; }

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

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.option-label:hover { border-color: #cbd5e1; }
.option-label.selected { border-color: var(--primary); background: #eff6ff; }
.option-label input { width: auto; margin-top: 4px; }
.option-letter { font-weight: 700; min-width: 20px; }
.option-text { flex: 1; }

.question-nav { display: flex; gap: 12px; }
.question-nav .btn { flex: 1; }

.review-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0; }
.review-item {
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.8rem;
    cursor: pointer;
}
.review-item.answered { background: #dcfce7; border-color: #86efac; }
.review-item.unanswered { background: #fef3c7; border-color: #fcd34d; }

.result-screen { text-align: center; }
.result-message { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; font-style: italic; }
.result-card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.score-circle { margin: 20px 0; }
.score-value { display: block; font-size: 3rem; font-weight: 800; color: var(--primary); }
.score-level { display: block; font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-top: 4px; }
.result-stats { display: flex; justify-content: space-around; margin-top: 16px; font-size: 0.875rem; }
.category-breakdown, .strengths, .improvements { text-align: left; margin-bottom: 20px; }
.category-breakdown h3, .strengths h3, .improvements h3 { font-size: 0.95rem; margin-bottom: 12px; }
.category-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.strengths ul, .improvements ul { margin-left: 20px; font-size: 0.875rem; }
.encouragement { color: var(--text-muted); font-size: 0.9rem; margin: 16px 0; }
.sync-note { font-size: 0.8rem; color: var(--text-muted); }

.instructions-body { background: var(--surface); padding: 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; white-space: pre-wrap; }
.instruction-stats { list-style: none; margin-bottom: 16px; }
.instruction-stats li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.offline-note { background: #eff6ff; padding: 12px; border-radius: 8px; margin-bottom: 24px; font-size: 0.875rem; }

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    z-index: 100;
}

.connection-dot.online { color: #4ade80; }
.connection-dot.offline { color: #fbbf24; }
.btn-sync { background: transparent; border: 1px solid #475569; color: white; padding: 4px 12px; border-radius: 6px; font-size: 0.75rem; cursor: pointer; margin-left: auto; }

@media (min-width: 768px) {
    .screen { max-width: 560px; padding-top: 40px; }
}
