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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    scrollbar-gutter: stable;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
    overflow-y: auto;
}

.header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 12px;
    text-align: center;
}

.header h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.header p a {
    color: white;
}

.mode-selector {
    display: flex;
    background: #f8fafc;
    margin: 15px 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: 44px;
}

.mode-btn {
    flex: 1;
    padding: 0 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.mode-btn.active {
    background: #4f46e5;
    color: white;
}

.step-by-step-container {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 100px;
}

.step-carousel {
    display: flex;
    transition: transform 0.3s ease-in-out;
    align-items: flex-start;
}

.step {
    min-width: 100%;
    padding: 5px 20px 20px 20px;
    display: flex;
    flex-direction: column;
}

.step-header {
    margin-bottom: 10px;
}

.step-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.step-number {
    background: #4f46e5;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-weight: bold;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    text-align: left;
    line-height: 1.3;
}

.step-description {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 400;
    line-height: 1.4;
    margin-top: 4px;
    margin-bottom: 10px;
    text-align: left;
}

.screenshot {
    width: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.screenshot-cover {
    object-fit: cover;
}

.screenshot + .screenshot {
    margin-top: 16px;
}

.screenshot-placeholder {
    width: 100%;
    height: 120px;
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    color: #64748b;
    font-size: 0.9rem;
}

.options {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.option {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.option:hover {
    border-color: #4f46e5;
    background: #f8fafc;
}

.option.selected {
    border-color: #4f46e5;
    background: #eff6ff;
}

.option input[type="radio"],
.option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #4f46e5;
}

.option label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.text-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: #4f46e5;
}

.text-input.error {
    border-color: #dc2626;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 8px;
    display: none;
}

.error-message.show {
    display: block;
}

.step-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.step-navigation.ios-fix {
    position: relative !important;
    transform: none !important;
    left: auto !important;
    width: auto !important;
    max-width: none !important;
}

.nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    grid-column: 2;
}

.step-navigation > .nav-btn:first-child {
    justify-self: start;
}

.step-navigation > .nav-btn:last-child {
    justify-self: end;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #3730a3;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-restart {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
    font-weight: 600 !important;
}

.btn-restart:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
}

.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 20px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

.modal-text {
    color: #6b7280;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.modal-btn-cancel {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-btn-cancel:hover {
    background: #f3f4f6;
}

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

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

.progress-bar-bottom {
    height: 24px;
    background: #e2e8f0;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-fill {
    height: 100%;
    background: #4f46e5;
    transition: width 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 12;
    position: relative;
    color: #64748b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
}

.progress-text.on-filled {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.step-by-step-container .progress-bar-bottom {
    display: flex;
}

body.recovery-mode .progress-bar-bottom {
    display: flex;
}

.advanced-form ~ .progress-bar-bottom,
.advanced-form .progress-bar-bottom,
.action-plan .progress-bar-bottom {
    display: none;
}

.action-plan .step-navigation {
    bottom: 0;
}

.advanced-form {
    padding: 20px;
    display: none;
    flex: 1;
    overflow-y: auto;
}

.advanced-form.active {
    display: block;
}

.form-group {
    margin-bottom: 24px;
}

.form-group.hidden {
    display: none;
}

.form-section {
    margin-bottom: 32px;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.form-separator {
    height: 1px;
    background: linear-gradient(to right, transparent, #d1d5db, transparent);
    margin: 24px 0;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.form-select:focus {
    outline: none;
    border-color: #4f46e5;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.generate-btn:hover:not(:disabled) {
    background: #3730a3;
}

.generate-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.action-plan {
    display: none;
    padding: 20px 20px 80px 20px;
    flex: 1;
    overflow-y: auto;
}

.action-plan.active {
    display: block;
}

.plan-header {
    text-align: center;
    margin-bottom: 20px;
}

.plan-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.back-btn {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1rem;
}

.plan-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.plan-table .separator-row {
    background: #f8fafc !important;
    cursor: default !important;
    border-top: 2px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
}

.plan-table .separator-row:hover {
    background: #f8fafc !important;
}

.plan-table .separator-row td {
    text-align: center;
    font-weight: 700;
    color: #6b7280;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 8px;
    border-bottom: none !important;
}

.plan-table th {
    background: #4f46e5;
    color: white;
    padding: 12px 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
}

.plan-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.plan-table tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.plan-table tr:hover {
    background: #f8fafc;
}

.plan-table tr.current {
    background: #dbeafe;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.plan-table tr.current td:first-child {
    position: relative;
    background: linear-gradient(to right, #3b82f6 0, #3b82f6 4px, #dbeafe 4px, #dbeafe 100%);
}

.plan-table tr.current td {
    font-weight: 600;
    color: #1e40af;
}

.plan-table td:first-child {
    padding-left: 12px;
}

.warning-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    margin-right: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.warning-indicator:hover {
    background: #d97706;
    transform: scale(1.1);
}

.optimization-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 20px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .optimization-modal {
    transform: scale(1);
}

.optimization-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.optimization-option {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.optimization-option:hover {
    border-color: #4f46e5;
    background: #f8fafc;
}

.optimization-option.selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.optimization-option.selected label {
    color: #15803d;
    font-weight: 600;
}

.optimization-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #4f46e5;
}

.optimization-option label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.optimization-recommendation {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #0369a1;
}

.summary-section {
    margin-top: 30px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.summary-header {
    background: #16a34a;
    color: white;
    padding: 16px;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.summary-table td:first-child {
    font-weight: 600;
    color: #374151;
    background: #f8fafc;
}

.summary-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #374151;
}

.summary-table tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state-content {
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #374151;
    margin-bottom: 16px;
}

.empty-state-message {
    font-size: 1rem;
    line-height: 1.6;
    color: #6b7280;
}

.mp-positive {
    color: #16a34a;
    font-weight: 600;
}

.mp-negative {
    color: #dc2626;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

.issue-report {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #6b7280;
}

.issue-report a {
    color: #4f46e5;
    text-decoration: none;
}

.issue-report a:hover {
    text-decoration: underline;
}

.recovery-banner {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 5px 20px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recovery-banner-content {
    max-width: 480px;
    margin: 0 auto;
}

.recovery-banner-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.recovery-banner-text::before, .recovery-banner-text::after {
    content: "🔧";
    font-size: 1.1em;
}

.additional-mp-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-additional-mp-container {
    margin-bottom: 30px;
}

.additional-mp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.additional-mp-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.additional-mp-input:focus {
    outline: none;
    border-color: #4f46e5;
}

.additional-mp-input.error {
    border-color: #dc2626;
}

.mp-label {
    font-weight: 500;
    color: #374151;
    min-width: 20px;
}

.mp-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mp-btn-add {
    background: #10b981;
    color: white;
}

.mp-btn-add:hover:not(:disabled) {
    background: #059669;
}

.mp-btn-remove {
    background: #ef4444;
    color: white;
}

.mp-btn-remove:hover:not(:disabled) {
    background: #dc2626;
}

.mp-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .nav-btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}