/* QuakeGuard — аварийные страницы (now.html, family.html) и общие красные кнопки */

/* ===== Общие элементы на всех страницах (показываются только при тревоге от датчика) ===== */
.nav a.nav-sos {
    display: none;
    background: #b91c1c;
    color: #fff;
    border-radius: 100px;
    padding: 6px 12px;
    font-weight: 700;
    white-space: nowrap;
}
body.quake-active .nav a.nav-sos {
    display: inline-flex;
    align-items: center;
}
.nav a.nav-sos:hover { background: #dc2626; color: #fff; }

@media (min-width: 901px) and (max-width: 1500px) {
    .header .nav { gap: 2px; }
    .header .nav a { padding: 8px 8px; font-size: .8rem; }
}

.now-cta {
    display: none;
    align-items: center;
    gap: 16px;
    margin: 0 0 24px;
    padding: 18px 22px;
    border-radius: 20px;
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    border: 1px solid rgba(248, 113, 113, .6);
    color: #fff;
    box-shadow: 0 10px 40px -10px rgba(220, 38, 38, .6);
    animation: nowPulse 2.4s ease-in-out infinite;
}
body.quake-active .now-cta {
    display: flex;
}
.now-cta:hover { filter: brightness(1.1); color: #fff; }
.now-cta-ico { font-size: 2.4rem; line-height: 1; flex: none; }
.now-cta-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.now-cta-body b { font-family: 'Space Grotesk', sans-serif; font-size: clamp(1.1rem, 3.5vw, 1.5rem); line-height: 1.15; letter-spacing: .01em; }
.now-cta-body span { font-size: .9rem; opacity: .9; }
.now-cta-go { margin-left: auto; font-size: 1.6rem; flex: none; }
@keyframes nowPulse {
    0%, 100% { box-shadow: 0 10px 40px -10px rgba(220, 38, 38, .55); }
    50% { box-shadow: 0 10px 50px 0 rgba(220, 38, 38, .85); }
}

.fam-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 24px;
    padding: 14px 20px;
    border-radius: 16px;
    background: var(--surface-2, rgba(255, 255, 255, .06));
    border: 1px solid var(--border-strong, rgba(139, 92, 246, .28));
}
.fam-cta:hover { border-color: var(--primary, #a78bfa); }
.fam-cta b { display: block; }
.fam-cta span { color: var(--text-2, #b8bcd0); font-size: .88rem; }
.fam-cta-ico { font-size: 1.8rem; }

@media (prefers-reduced-motion: reduce) { .now-cta { animation: none; } }

/* ===== Аварийные страницы ===== */
body.eb-page {
    --eb-bg: #050915;
    --eb-card: #0d1128;
    --eb-line: rgba(255, 255, 255, .14);
    --eb-text: #f5f7fa;
    --eb-text2: #c3c8dc;
    --eb-red: #b91c1c;
    --eb-red-hot: #ef4444;
    --eb-green: #15803d;
    margin: 0;
    min-height: 100vh;
    overflow: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--eb-bg);
    color: var(--eb-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body.eb-now {
    background: radial-gradient(900px 500px at 50% -5%, rgba(185, 28, 28, .45), transparent 70%), #12060a;
}
.eb-page *, .eb-page *::before, .eb-page *::after { box-sizing: border-box; }
.eb-page a { color: inherit; text-decoration: none; }
.eb-page button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.eb-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(5, 9, 21, .9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--eb-line);
}
.eb-back { font-weight: 600; font-size: .95rem; padding: 8px 4px; }
.eb-lang { display: flex; margin-left: auto; border: 1px solid var(--eb-line); border-radius: 100px; overflow: hidden; }
.eb-lang button { padding: 8px 14px; font-weight: 700; font-size: .85rem; color: var(--eb-text2); min-width: 44px; }
.eb-lang button.on { background: #fff; color: #111; }
.eb-top .header-actions { display: flex; align-items: center; }

.eb-wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); }
.eb-wrap h1 { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.15; margin: 0 0 8px; }
.eb-sub { color: var(--eb-text2); font-size: .95rem; margin: 0 0 18px; }

/* hero */
.eb-hero { text-align: center; position: relative; padding: 8px 0 18px; }
.eb-pulse {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px;
    background: var(--eb-red-hot);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .7);
    animation: ebPulse 1.4s ease-out infinite;
}
@keyframes ebPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .7); }
    100% { box-shadow: 0 0 0 40px rgba(239, 68, 68, 0); }
}
.eb-timer { display: flex; flex-direction: column; align-items: center; margin: 14px 0 16px; }
.eb-timer-val { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: clamp(3.4rem, 18vw, 5rem); font-weight: 700; line-height: 1; letter-spacing: .02em; }
.eb-timer-lbl { color: var(--eb-text2); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }

/* buttons */
.eb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    padding: 12px 20px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.05rem;
    border: 2px solid transparent;
    width: 100%;
}
.eb-ico { font-size: 1.5rem; line-height: 1; }
.eb-btn-stop { background: var(--eb-red); color: #fff; }
.eb-btn-stop:active { background: #991b1b; }
.eb-btn-call { background: var(--eb-green); color: #fff; }
.eb-btn-tool { background: rgba(255, 255, 255, .08); border-color: var(--eb-line); color: var(--eb-text); }
.eb-btn-tool.on { background: #f59e0b; border-color: #f59e0b; color: #1a1203; }
.eb-btn-ghost { color: var(--eb-text2); border-color: var(--eb-line); min-height: 48px; font-size: .95rem; font-weight: 600; }
.eb-page button:focus-visible, .eb-page a:focus-visible, .eb-page input:focus-visible, .eb-page textarea:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }

/* steps */
.eb-steps { list-style: none; margin: 8px 0 20px; padding: 0; display: grid; gap: 10px; }
.eb-step {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 14px 16px;
    background: rgba(255, 255, 255, .05);
    border: 2px solid var(--eb-line);
    border-radius: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.eb-num {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 800; font-size: 1.15rem;
    background: rgba(255, 255, 255, .12);
}
.eb-step h2 { margin: 0 0 2px; font-size: 1.2rem; font-family: 'Space Grotesk', 'Inter', sans-serif; }
.eb-step p { margin: 0; color: var(--eb-text2); font-size: .95rem; }
.eb-step.active { border-color: var(--eb-red-hot); background: rgba(239, 68, 68, .14); box-shadow: 0 0 0 4px rgba(239, 68, 68, .15); }
.eb-step.active .eb-num { background: var(--eb-red-hot); color: #fff; }
.eb-step.active p { color: var(--eb-text); font-size: 1.02rem; }
.eb-step.done { opacity: .5; }
.eb-step.done h2 { text-decoration: line-through; }
.eb-step.done .eb-num { background: var(--eb-green); color: #fff; }

/* tools */
.eb-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.eb-tools .eb-btn-call { grid-column: 1 / -1; min-height: 64px; font-size: 1.2rem; }
.eb-hint { color: var(--eb-text2); font-size: .85rem; margin: 10px 2px 0; }
.eb-links { display: grid; gap: 8px; margin-top: 22px; }
.eb-links a { display: block; padding: 14px 16px; border: 1px solid var(--eb-line); border-radius: 14px; background: rgba(255, 255, 255, .04); font-weight: 600; }
.eb-offline { text-align: center; font-size: .85rem; margin-top: 22px; color: var(--eb-text2); min-height: 1.2em; }
.eb-offline[data-state="ready"] { color: #4ade80; }

.eb-screenlight { position: fixed; inset: 0; z-index: 9999; background: #fff; color: #222; display: flex; align-items: flex-end; justify-content: center; padding: 30px; font-weight: 600; cursor: pointer; }
.eb-screenlight[hidden] { display: none; }

/* family */
.eb-card { background: var(--eb-card); border: 1px solid var(--eb-line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.eb-card h2 { margin: 0 0 12px; font-size: 1.1rem; font-family: 'Space Grotesk', 'Inter', sans-serif; }
.eb-field { display: block; margin-bottom: 12px; }
.eb-field > span { display: block; font-size: .85rem; color: var(--eb-text2); margin-bottom: 4px; }
.eb-card input, .eb-card textarea {
    width: 100%;
    font-size: 1rem;
    padding: 11px 12px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--eb-line);
    border-radius: 10px;
    color: var(--eb-text);
    font-family: inherit;
}
.eb-card textarea { resize: vertical; }
.eb-card ::placeholder { color: #8a92ab; }
.eb-members { display: grid; gap: 10px; margin-bottom: 12px; }
.eb-member { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; padding-bottom: 10px; border-bottom: 1px dashed var(--eb-line); }
.eb-member input:nth-child(3) { grid-column: 1 / 3; }
.eb-del { grid-column: 3; grid-row: 1 / 3; border: 1px solid var(--eb-line); border-radius: 10px; color: var(--eb-text2); }
.eb-members + .eb-btn { width: auto; min-height: 44px; font-size: .95rem; margin-bottom: 16px; }
.eb-numbers ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.eb-numbers b { display: inline-block; min-width: 3.2ch; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 1.15rem; }
.eb-rules p { margin: 0; color: var(--eb-text2); }
.eb-actions { display: grid; gap: 10px; margin-top: 18px; }
.print-only { display: none; }

@media (min-width: 560px) {
    .eb-actions { grid-template-columns: 1fr 1fr; }
    .eb-actions .eb-btn-call, .eb-actions .eb-btn-ghost { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { .eb-pulse { animation: none; } }

/* печать */
@media print {
    body.eb-page { background: #fff !important; color: #000 !important; }
    .no-print { display: none !important; }
    .print-only { display: block; }
    .eb-wrap { max-width: none; padding: 0; }
    .eb-wrap h1 { color: #000; font-size: 22pt; }
    .eb-card { background: #fff; border: 1px solid #999; color: #000; break-inside: avoid; }
    .eb-card h2, .eb-field > span, .eb-rules p { color: #000; }
    .eb-card input, .eb-card textarea { background: #fff; color: #000; border: 0; border-bottom: 1px solid #555; border-radius: 0; min-height: 28px; }
    .eb-card textarea { border: 1px solid #555; }
    .eb-card ::placeholder { color: transparent; }
    .eb-member { border-bottom: 0; }
    .eb-print-date { color: #444; font-size: 10pt; margin: 0 0 10px; }
}
