:root {
    /* ── iOS Design System ── */
    --accent: #4F85F3;
    --accent-hover: #3B74E8;
    --accent-light: #DBEAFE;
    --danger: #FF3B30;
    --danger-light: #FEE2E2;
    --success: #22C55E;

    /* Light theme */
    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-elevated: #FBFCFD;
    --surface-muted: #F3F4F6;
    --text: #1C2024;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;

    --radius-lg: 20px;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0A0A0B;
        --surface: #15171B;
        --surface-elevated: #1A1D23;
        --surface-muted: #1E2128;
        --text: #F9FAFB;
        --text-secondary: #D1D5DB;
        --text-muted: #6B7280;
        --border: #272A31;
        --border-light: #1F2229;
        --accent-light: #1D4ED8;
        --danger-light: #3B1111;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.3px;
    transition: opacity 0.2s;
}

.logo:hover { opacity: 0.8; }

.logo svg { flex-shrink: 0; }

.lang-switch {
    display: flex;
    gap: 2px;
    background: var(--surface-muted);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}

.lang-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    letter-spacing: 0.3px;
}

.lang-btn:hover { color: var(--text); }
.lang-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 80px 24px 48px;
    max-width: 600px;
    margin: 0 auto;
}

.hero-icon { margin-bottom: 28px; }
.hero-icon svg { filter: drop-shadow(0 4px 12px rgba(79,133,243,0.15)); }

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1.2px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #63A1FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.5;
}

.hero-buttons { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: var(--font);
    letter-spacing: -0.2px;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(79,133,243,0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(79,133,243,0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

/* ── Features ── */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px 72px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.feature-icon { font-size: 36px; margin-bottom: 16px; line-height: 1; }
.feature-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.3px; }
.feature-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ── Content pages ── */
.content {
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 24px 72px;
    flex: 1;
}

.content h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.8px;
    margin-bottom: 8px;
    color: var(--text);
}

.content .last-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 36px 0 12px;
    color: var(--text);
    letter-spacing: -0.3px;
}

.content p {
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
}

.content ul {
    margin: 12px 0 12px 24px;
    color: var(--text-secondary);
}

.content li { margin-bottom: 8px; font-size: 15px; line-height: 1.6; }

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.content td, .content th {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.content th {
    font-weight: 600;
    color: var(--text);
    background: var(--surface-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.content td { color: var(--text-secondary); }
.content tr:last-child td { border-bottom: none; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    transition: color 0.2s;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.back-link:hover { color: var(--accent); border-color: var(--accent); }

/* ── Emergency page ── */
.profile-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 24px;
}

.pet-photo-large {
    width: 150px;
    height: 150px;
    border-radius: 75px;
    object-fit: cover;
    margin: 0 auto 24px;
    display: block;
    background: var(--surface-muted);
    border: 3px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.pet-name-large {
    font-size: 30px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.8px;
}

.pet-meta {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 8px 0 28px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--danger-light);
    color: var(--danger);
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s;
}

.info-card:hover { border-color: var(--accent); }

.info-card-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-card-label.warn { color: var(--danger); }

.info-card-value {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.info-card-value a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.info-card-value a:hover { text-decoration: underline; }

.report-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow);
}

.report-section h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    margin-bottom: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,133,243,0.15);
}

textarea.input-field { resize: vertical; min-height: 80px; }

.app-link-section {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.toast.show { opacity: 1; }

/* ── Loading state ── */
.loading-state {
    text-align: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

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

/* ── Footer ── */
.footer {
    margin-top: auto;
    text-align: center;
    padding: 28px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }
.footer-links span { color: var(--border); user-select: none; }

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .hero { padding: 48px 20px 36px; }
    .hero h1 { font-size: 30px; }
    .hero-subtitle { font-size: 16px; }
    .features { grid-template-columns: 1fr; padding: 0 16px 48px; }
    .content { padding: 24px 16px 48px; }
    .content h1 { font-size: 26px; }
    .header { padding: 12px 16px; }
}
