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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: #1e293b;
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1em;
    opacity: 0.8;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #2563eb;
    font-size: 2em;
    margin-bottom: 5px;
}

.stat-card p {
    color: #64748b;
    font-size: 0.9em;
}

.level-badge {
    display: inline-block;
    background: #2563eb;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1em;
    margin: 12px 0 0;
}

.progress-section {
    padding: 30px;
}

.overall-progress {
    margin-bottom: 30px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1e293b;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 700;
    font-size: 0.85em;
}

.legal-form-selector {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.legal-form-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legal-form-btn {
    flex: 1;
    min-width: 160px;
    padding: 18px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 1em;
    text-align: left;
}

.legal-form-btn:hover {
    border-color: #93c5fd;
}

.legal-form-btn:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.legal-form-btn.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1e3a8a;
}

.legal-form-btn strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.phase {
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.phase-header {
    background: #1e293b;
    color: white;
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.phase-header:hover {
    background: #334155;
}

.phase-header:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: -3px;
}

.phase-header h2 {
    font-size: 1.3em;
    font-weight: 600;
}

.phase-progress {
    font-size: 0.9em;
    opacity: 0.8;
    white-space: nowrap;
    margin-left: 15px;
}

.phase-content {
    padding: 20px;
    display: none;
}

.phase.expanded .phase-content {
    display: block;
}

.checklist-item {
    background: #f8fafc;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

.checklist-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.checklist-item.completed {
    background: #f0fdf4;
    border-color: #86efac;
    border-left: 4px solid #22c55e;
}

.checklist-item.not-applicable {
    background: #f1f5f9;
    border-left: 4px solid #94a3b8;
    opacity: 0.65;
}

.optional-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
    margin-left: 8px;
    border: 1px solid #fde68a;
    vertical-align: middle;
}

.na-button {
    padding: 4px 10px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82em;
    transition: background 0.2s;
}

.na-button:hover {
    background: #475569;
}

.na-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.na-button.active {
    background: #dc2626;
}

.checkbox {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 2px solid #2563eb;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.checkbox:hover {
    background: #eff6ff;
}

.checkbox:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.checkbox.checked {
    background: #2563eb;
    border-color: #2563eb;
}

.checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 1.1em;
    font-weight: 700;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
}

.item-description {
    color: #64748b;
    font-size: 0.9em;
    line-height: 1.4;
}

.item-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.item-cost {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.82em;
}

.item-time {
    display: inline-block;
    background: #e0f2fe;
    color: #075985;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.82em;
}

.detail-btn {
    background: none;
    border: 1px solid #cbd5e1;
    color: #2563eb;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.detail-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.detail-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.achievements {
    background: #f8fafc;
    padding: 30px;
    border-top: 1px solid #e2e8f0;
}

.achievements h2 {
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.achievement {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s;
}

.achievement.unlocked {
    border-color: #fbbf24;
    background: #fffbeb;
    animation: unlock 0.5s ease;
}

@keyframes unlock {
    0% { transform: scale(0.8) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.achievement-icon {
    font-size: 3em;
    margin-bottom: 10px;
    filter: grayscale(100%);
    opacity: 0.3;
}

.achievement.unlocked .achievement-icon {
    filter: grayscale(0%);
    opacity: 1;
}

.achievement-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
}

.achievement-desc {
    font-size: 0.75em;
    color: #64748b;
    margin-top: 5px;
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s linear;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.export-section {
    padding: 30px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.export-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.export-btn:hover {
    background: #1d4ed8;
}

.export-btn:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: #2563eb;
    font-weight: bold;
    margin-left: 5px;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: #1e293b;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.85em;
    line-height: 1.4;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.25s;
    position: relative;
}

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

.modal-header {
    background: #1e293b;
    color: white;
    padding: 24px 30px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    padding-right: 45px;
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.3em;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-close:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.modal-body {
    padding: 24px 30px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body h3 {
    color: #2563eb;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.05em;
    font-weight: 600;
}

.modal-body p {
    line-height: 1.6;
    color: #334155;
    margin-bottom: 15px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #475569;
}

.modal-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 600;
    margin-right: 8px;
    margin-top: 10px;
}

.modal-badge.cost {
    background: #fef3c7;
    color: #92400e;
}

.modal-badge.time {
    background: #e0f2fe;
    color: #075985;
}

.modal-badge.legal-form {
    background: #dcfce7;
    color: #166534;
}

.modal-badge.optional {
    background: #fef3c7;
    color: #92400e;
}

.modal-actions {
    padding: 16px 24px;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid #e2e8f0;
}

.modal-action-btn {
    flex: 1;
    min-width: 150px;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.modal-action-btn:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.modal-action-btn.primary {
    background: #2563eb;
    color: white;
}

.modal-action-btn.primary:hover {
    background: #1d4ed8;
}

.modal-action-btn.secondary {
    background: #64748b;
    color: white;
}

.modal-action-btn.secondary:hover {
    background: #475569;
}

.modal-action-btn.danger {
    background: #dc2626;
    color: white;
}

.modal-action-btn.danger:hover {
    background: #b91c1c;
}

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

/* Responsive */
@media (max-width: 600px) {
    body { padding: 10px; }
    .header h1 { font-size: 1.6em; }
    .legal-form-buttons { flex-direction: column; }
    .modal-content { width: 95%; max-height: 90vh; }
    .stats-container { padding: 20px; gap: 12px; }
    .progress-section { padding: 20px; }
}
