/* =========================================================
   App shell: install banner, offline bar, bottom tab bar, safe areas.
   Everything is prefixed pp- so it can't clash with the site's own CSS.
   ========================================================= */
:root { --pp-bg: #0b0b0b; --pp-surface: #151515; --pp-line: #262626; --pp-green: #2ecc71; --pp-text: #f2f2f2; --pp-muted: #9aa0a6; }

html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
a, button { touch-action: manipulation; }

/* keyboard users always see where they are */
:focus-visible { outline: 2px solid var(--pp-green); outline-offset: 2px; }

/* ------------------------------------------------ install banner */
.pp-banner {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-width: 520px; margin: 0 auto; z-index: 9999;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 14px; background: var(--pp-surface); color: var(--pp-text);
    border: 1px solid var(--pp-line); border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
    animation: pp-rise .25s ease-out;
}
.pp-banner-icon { border-radius: 10px; flex: 0 0 auto; }
.pp-banner-text { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; line-height: 1.35; }
.pp-banner-text strong { font-size: .95rem; }
.pp-banner-text span { color: var(--pp-muted); }
.pp-banner-actions { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.pp-btn {
    min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600;
    background: transparent; color: var(--pp-muted); border: 1px solid var(--pp-line);
}
.pp-btn:hover { color: var(--pp-text); border-color: #444; }
.pp-btn-primary { background: var(--pp-green); color: #000; border-color: var(--pp-green); }
.pp-btn-primary:hover { background: #3be083; color: #000; }
@keyframes pp-rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------ offline bar */
.pp-offline-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10000; text-align: center;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; font-size: .82rem; font-weight: 600;
    background: #7a4b00; color: #ffe2a8;
}
.pp-offline-bar[hidden] { display: none; }

/* ------------------------------------------------ footer "Install the app" link */
.pp-install-row { text-align: center; padding: 14px 12px; }
.pp-install-row[hidden] { display: none; }
.pp-install-row button {
    background: none; border: 1px solid var(--pp-line); color: var(--pp-muted); border-radius: 999px;
    padding: 9px 18px; font: inherit; font-size: .85rem; cursor: pointer;
}
.pp-install-row button:hover { color: var(--pp-text); border-color: var(--pp-green); }

/* ------------------------------------------------ bottom tab bar (only inside the installed app) */
.pp-bottom-nav { display: none; }

html.pp-standalone .pp-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
    background: rgba(14, 14, 14, .96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--pp-line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.pp-standalone .pp-bottom-nav a {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; padding: 6px 4px; color: var(--pp-muted); text-decoration: none;
    font-size: .68rem; font-weight: 600; letter-spacing: .2px;
}
html.pp-standalone .pp-bottom-nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.pp-standalone .pp-bottom-nav a.active { color: var(--pp-green); }
html.pp-standalone .pp-bottom-nav a:active { background: rgba(255, 255, 255, .05); }

/* room for the tab bar so it never covers the footer, and the banner sits above it */
html.pp-standalone.pp-has-nav body { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
html.pp-standalone.pp-has-nav .pp-banner { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }

/* on pages that have the tab bar, the website's top links are redundant on a phone */
@media (max-width: 760px) {
    html.pp-standalone.pp-has-nav .main-nav { display: none; }
    html.pp-standalone.pp-has-nav .main-header { justify-content: center; }
}

/* notch / rounded-corner safe areas for the sticky header in the installed app */
html.pp-standalone .main-header { padding-top: max(0px, env(safe-area-inset-top, 0px)); }

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

/* Logout is a POST form (so other sites can't log you out with an <img> tag). Make the button look like the nav links. */
.logout-form { display: inline; margin: 0; padding: 0; }
.main-nav .logout-btn, .logout-btn {
    background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
    font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--text-muted, var(--text-light, #aaa));
    transition: color 0.3s ease;
}
.main-nav .logout-btn:hover, .logout-btn:hover { color: var(--primary-green, var(--primary-color, #2ecc71)); }
html.pp-standalone .pp-bottom-nav .pp-logout-form { flex: 1 1 0; display: flex; margin: 0; }
html.pp-standalone .pp-bottom-nav .pp-logout-form button {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; padding: 6px 4px; background: none; border: 0; cursor: pointer; font-family: inherit;
    color: var(--pp-muted); font-size: .68rem; font-weight: 600; letter-spacing: .2px;
}
html.pp-standalone .pp-bottom-nav .pp-logout-form button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.pp-standalone .pp-bottom-nav .pp-logout-form button:active { background: rgba(255, 255, 255, .05); }

/* "Please verify your email" banner (only rendered for logged-in, unverified users) */
.pp-verify[hidden] { display: none !important; }
.pp-verify {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 900;
    max-width: 560px; margin: 0 auto; padding: 12px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #14301f; color: #eafbea; border: 1px solid rgba(46, 204, 113, .55); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45); font-size: .88rem; line-height: 1.35;
}
.pp-verify-text { margin: 0; flex: 1 1 auto; }
.pp-verify-text strong { display: block; margin-bottom: 2px; }
.pp-verify-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pp-verify-btn {
    background: #2ecc71; color: #06220f; border: 0; border-radius: 8px; padding: 8px 12px;
    font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pp-verify-btn:disabled { opacity: .6; cursor: default; }
.pp-verify-close { background: none; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
html.pp-standalone .pp-verify { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 480px) { .pp-verify { flex-direction: column; align-items: stretch; } .pp-verify-actions { justify-content: space-between; } }
