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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a1a;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

.center-content {
    text-align: center;
    padding-top: 40px;
}

/* Header */
.form-header {
    text-align: center;
    margin-bottom: 20px;
}

.form-header h1 {
    font-size: 1.4rem;
    color: #333;
}

.child-badge {
    display: inline-block;
    background: #4a90d9;
    color: #fff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 1.1rem;
    margin-top: 8px;
}

/* Sections */
.form-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-section h2 {
    font-size: 1.1rem;
    color: #4a90d9;
    margin-bottom: 12px;
    border-bottom: 2px solid #e8eef5;
    padding-bottom: 8px;
}

.scale-note {
    font-weight: normal;
    font-size: 0.85rem;
    color: #888;
}

.section-instruction {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-bottom: 12px;
}

/* Fields */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #333;
}

.field input[type="date"],
.field input[type="time"] {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    -webkit-appearance: none;
}

.field input[type="date"]:focus,
.field input[type="time"]:focus {
    border-color: #4a90d9;
    outline: none;
}

/* Toggle buttons (Yes/No) */
.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #555;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.15s;
}

.toggle-btn.active {
    border-color: #4a90d9;
    background: #4a90d9;
    color: #fff;
}

.toggle-btn:active {
    transform: scale(0.97);
}

/* Rating buttons (1-5, 0-4) */
.rating-group {
    display: flex;
    gap: 6px;
}

.rating-btn {
    flex: 1;
    padding: 12px 0;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #555;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.15s;
}

.rating-btn.active {
    border-color: #4a90d9;
    background: #4a90d9;
    color: #fff;
}

.rating-btn:active {
    transform: scale(0.95);
}

/* Info toggle */
.info-toggle {
    background: none;
    border: none;
    color: #4a90d9;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 4px;
    vertical-align: middle;
}

.info-text {
    font-size: 0.8rem;
    color: #777;
    background: #f9f9f9;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.hidden {
    display: none;
}

/* Leak location */
.leak-images {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.leak-img-wrap {
    flex: 1;
}

.leak-img-wrap img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.leak-checks {
    display: flex;
    gap: 16px;
}

.leak-group {
    flex: 1;
}

.leak-group h3 {
    font-size: 0.9rem;
    color: #4a90d9;
    margin-bottom: 6px;
}

.check-label {
    display: block;
    padding: 8px 0;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #4a90d9;
}

.skin-scale-info {
    margin-bottom: 12px;
}

/* Submit button */
.submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    min-height: 56px;
    transition: background 0.15s;
}

.submit-btn:active {
    background: #357abd;
}

/* Landing page */
.landing-form {
    margin: 24px 0;
}

.landing-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.big-input {
    width: 100%;
    padding: 16px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 12px;
    margin-bottom: 16px;
}

.big-input:focus {
    border-color: #4a90d9;
    outline: none;
}

.subtitle {
    color: #666;
    margin: 8px 0 16px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    min-height: 48px;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.btn-primary {
    background: #4a90d9;
    color: #fff;
}

.btn-primary:active {
    background: #357abd;
}

.btn-secondary {
    background: #e8eef5;
    color: #4a90d9;
}

.landing-links {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.landing-links a {
    color: #4a90d9;
    text-decoration: none;
    font-size: 0.95rem;
}

/* Success page */
.success-box {
    margin: 20px 0;
}

.success-check {
    font-size: 3rem;
    color: #4caf50;
    margin-bottom: 8px;
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

/* Back link on error page */
.back-link {
    display: inline-block;
    margin-top: 16px;
    color: #4a90d9;
    text-decoration: none;
    font-size: 1rem;
}

/* Review table */
.review-controls {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.review-controls select {
    padding: 8px 12px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.review-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 800px;
}

.review-table th,
.review-table td {
    padding: 8px 6px;
    border: 1px solid #ddd;
    text-align: center;
    white-space: nowrap;
}

.review-table th {
    background: #4a90d9;
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.review-table tr:nth-child(even) {
    background: #f9f9f9;
}

/* Export page */
.export-info {
    color: #666;
    margin: 12px 0 24px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background: #121212;
        color: #e0e0e0;
    }

    .form-header h1 {
        color: #e0e0e0;
    }

    .form-section {
        background: #1e1e1e;
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }

    .form-section h2 {
        border-bottom-color: #333;
    }

    .scale-note {
        color: #999;
    }

    .section-instruction {
        color: #aaa;
    }

    .field label {
        color: #e0e0e0;
    }

    .field input[type="date"],
    .field input[type="time"] {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .toggle-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #bbb;
    }

    .toggle-btn.active {
        border-color: #5a9ee6;
        background: #5a9ee6;
        color: #fff;
    }

    .rating-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #bbb;
    }

    .rating-btn.active {
        border-color: #5a9ee6;
        background: #5a9ee6;
        color: #fff;
    }

    .info-toggle {
        color: #5a9ee6;
    }

    .info-text {
        background: #252525;
        color: #aaa;
    }

    .leak-img-wrap img {
        border-color: #444;
    }

    .leak-group h3 {
        color: #5a9ee6;
    }

    .big-input {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .subtitle {
        color: #aaa;
    }

    .btn-secondary {
        background: #2a2a2a;
        color: #5a9ee6;
    }

    .landing-links a {
        color: #5a9ee6;
    }

    .back-link {
        color: #5a9ee6;
    }

    .review-controls select {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .review-table th,
    .review-table td {
        border-color: #333;
    }

    .review-table th {
        background: #2a4a6e;
    }

    .review-table tr:nth-child(even) {
        background: #1a1a1a;
    }

    .export-info {
        color: #aaa;
    }
}
