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

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #242836;
    --border: #2a2e3a;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

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

/* Header */
.header {
    padding: 24px 0 16px;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-meta {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-free {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-progress {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-hover);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Progress Overview */
.progress-overview {
    padding: 20px 0;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.phase-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.phase-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.phase-pill:hover {
    background: var(--bg-card);
    color: var(--text);
}

.phase-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.phase-pill.completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
}

/* Main */
.main {
    flex: 1;
    padding: 32px 0;
}

.screen {
    animation: fadeIn 0.3s ease;
}

.screen.hidden {
    display: none;
}

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

/* Welcome */
.welcome-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.welcome-card h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.welcome-card > p {
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.architecture-summary {
    margin-bottom: 32px;
}

.architecture-summary h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-muted);
}

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

.arch-item {
    background: var(--bg-hover);
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
}

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

.arch-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.arch-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-back {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 12px;
}

.btn-back:hover {
    color: var(--text);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

.btn-close:hover {
    color: var(--text);
}

/* Phase Screen */
.phase-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.phase-header h2 {
    font-size: 1.5rem;
    flex: 1;
}

.phase-description {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Steps */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.step-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.step-card.completed {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.step-card.current {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.step-card.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-card.current .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.step-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.step-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.step-check:hover {
    border-color: var(--success);
}

.step-card.completed .step-check {
    background: var(--success);
    border-color: var(--success);
}

.step-check::after {
    content: '✓';
    color: white;
    font-size: 14px;
    opacity: 0;
}

.step-card.completed .step-check::after {
    opacity: 1;
}

/* Phase Actions */
.phase-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 24px;
    line-height: 1.7;
}

.modal-body h4 {
    margin: 16px 0 8px;
    color: var(--primary-hover);
}

.modal-body p {
    margin-bottom: 12px;
    color: var(--text-muted);
}

.modal-body code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--warning);
}

.modal-body pre {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.modal-body ul {
    margin: 8px 0 12px 20px;
    color: var(--text-muted);
}

.modal-body li {
    margin-bottom: 4px;
}

/* Completion */
.completion-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.completion-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.stat-item {
    background: var(--bg-hover);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Footer */
.footer {
    padding: 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .arch-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .phase-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .phase-actions {
        flex-direction: column;
    }
    
    .phase-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
