/* How skeletonkey.systems looks: colours, fonts, spacing.
   Theme recycled from the Skeleton Key Engineering page (2025).
   Change a colour in :root below and it changes everywhere:
   --bg background, --fg text, --accent orange, --muted grey text, --border lines. */

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

:root {
    --bg: #0a0a0a;
    --fg: #e8e8e8;
    --accent: #ff6b35;
    --muted: #888;
    --border: #333;
    --head-h: 52px;
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.7;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

[hidden] { display: none !important; }

/* Header: logo, tabs, account */
.site-head {
    flex: 0 0 auto;
    height: calc(var(--head-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--fg);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.05rem;
    white-space: nowrap;
}

.brand img { height: 26px; width: auto; display: block; }
.brand span span { color: var(--accent); }

.tabs { display: flex; gap: 0.25rem; }

.tabs a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0 0.75rem;
    line-height: calc(var(--head-h) - 3px);
    border-bottom: 3px solid transparent;
    display: block;
}

.tabs a:hover { color: var(--fg); }
.tabs a[hidden] { display: none; }        /* the Admin tab, for everyone but admins */

.tabs a[aria-selected="true"] {
    color: var(--fg);
    border-bottom-color: var(--accent);
}

.account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.account a, .account button {
    color: var(--accent);
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    padding: 0.5rem 0;
}

.account a:hover, .account button:hover { color: var(--fg); }

main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

p { margin-bottom: 1.5rem; }
.muted { color: var(--muted); }

/* Demo: the app fills everything under the header */
/* The demo page grows to fill the screen once the app is showing */
.page-with-demo { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

#app {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    display: block;
    background: #080b10;
}

body.demo-live { height: 100vh; height: 100dvh; overflow: hidden; }

/* Callout and arrow list, from the old page */
.callout {
    font-size: 1.1rem;
    border-left: 3px solid var(--accent);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--fg);
}

ul.arrows {
    list-style: none;
    margin: 0 0 1.5rem;
}

ul.arrows li {
    padding: 0.6rem 0 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

ul.arrows li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.fine { font-size: 0.85rem; color: var(--muted); }

/* Demo, signed out: the sign-in card, centered (the "what is WXR" copy now
   lives inside the app itself, on its About tab, next to Change Log). */
.demo-grid {
    max-width: 380px;
    margin: 0 auto;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* Signed in and on the demo tab: the app fills the page and the sign-in
   card is gone (#signin-wrap hides), so there is nothing left to pad. */
.demo-live .demo-grid { padding: 0; }

/* Sign-in card, in the style of the old page's CTA block */
.signin {
    padding: 2.5rem 2rem;
    border: 1px solid var(--border);
    position: sticky;
    top: 1.5rem;
}

.signin h2 { margin-bottom: 0.5rem; }
.signin p { color: var(--muted); font-size: 1rem; margin-bottom: 1.5rem; }

.signin label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.signin input {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.7rem 0.8rem;
    font: inherit;
    font-size: 16px;            /* 16px keeps iOS from zooming on focus */
    color: var(--fg);
    background: #141414;
    border: 1px solid var(--border);
    border-radius: 0;
}

.signin input:focus { outline: none; border-color: var(--accent); }

.signin button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.8rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg);
    background: var(--accent);
    border: 0;
    cursor: pointer;
}

.signin button:hover { background: var(--fg); }
.signin button:disabled { opacity: 0.6; cursor: default; }

.signin .error {
    color: var(--accent);
    font-size: 0.9rem;
    margin: 1rem 0 0;
    min-height: 1.5em;
}

/* Mobile */
@media (max-width: 600px) {
    body { font-size: 16px; }
    :root { --head-h: 48px; }
    .site-head { gap: 0.5rem; }
    .container { padding: 1rem; }
    .signin { padding: 2rem 1.25rem; }
    .tabs a { padding: 0 0.6rem; }
    .account { gap: 0.7rem; }
}

/* One column: the sign-in card first, for people who came to sign in */
@media (max-width: 860px) {
    .demo-grid { padding-top: 1.5rem; }
}

@media (max-width: 520px) {
    .brand span { display: none; }         /* the mark alone */
}

/* Headings inside page text (## in a page file) */
.page h3 { font-size: 1.25rem; margin: 2rem 0 1rem; color: var(--fg); }
.page a { color: var(--accent); }

/* The Account page's forms: the same look as the sign-in box, without the frame */
.account-form { max-width: 420px; margin: 2.5rem 0; }
.account-form h3 { margin-top: 0; }
.account-form p { color: var(--muted); font-size: 1rem; margin-bottom: 1rem; }
.account-form label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.account-form input {
    display: block; width: 100%; margin-top: 0.35rem; padding: 0.7rem 0.8rem;
    font: inherit; font-size: 16px; color: var(--fg); background: #141414;
    border: 1px solid var(--border); border-radius: 0;
}
.account-form input:focus { outline: none; border-color: var(--accent); }
.account-form button {
    padding: 0.7rem 1.2rem; font: inherit; font-size: 1rem; font-weight: 600;
    color: var(--bg); background: var(--accent); border: 0; cursor: pointer;
}
.account-form button:hover { background: var(--fg); }
.account-form button:disabled { opacity: 0.6; cursor: default; }
#sign-out-everywhere { background: none; color: var(--accent); border: 1px solid var(--accent); }
#sign-out-everywhere:hover { color: var(--bg); background: var(--accent); }
.form-note { margin: 0.8rem 0 0; font-size: 0.9rem; min-height: 1.4em; }
.form-note.ok { color: #7fd1a0; }
.form-note.bad { color: var(--accent); }

/* The username in the header is a link to the Account page */
#who { color: var(--muted); }
#who:hover { color: var(--fg); }
@media (max-width: 520px) {
    #who { display: inline-block; max-width: 6em; overflow: hidden;
           text-overflow: ellipsis; vertical-align: bottom; }
}

/* ---------- Server status (admins) ---------- */
#status-link { color: var(--muted); }
#status-link:hover { color: var(--fg); }
.admin-warning {
    background: #2a190c; border-bottom: 1px solid #5c3a1c; color: #f6d5b8;
    padding: 0.6rem max(1rem, env(safe-area-inset-left, 0px)); font-size: 0.9rem; line-height: 1.5;
}
.admin-warning strong { color: var(--accent); }
.admin-warning a { color: var(--accent); margin-left: 0.5rem; white-space: nowrap; }
#admin-warning-dismiss {
    background: none; border: 1px solid #5c3a1c; color: #f6d5b8; font: inherit; font-size: 0.85rem;
    padding: 0.1rem 0.6rem; margin-left: 0.6rem; border-radius: 3px; cursor: pointer;
}
#admin-warning-dismiss:hover { border-color: var(--accent); color: var(--accent); }
.status-table tr.muted-row td { opacity: 0.55; }
.status-table tr.muted-row td.row-buttons { opacity: 1; }
.container.wide { max-width: 1100px; }
.status-verdict { margin: 1rem 0 2rem; padding: 1rem 1.25rem; border-left: 3px solid; font-size: 1rem; }
.status-verdict.good { border-color: #7fd1a0; color: #cfeedd; background: #0f1a14; }
.status-verdict.bad { border-color: var(--accent); color: #f6d5b8; background: #2a190c; }
.status-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.5rem 0 2rem; }
.status-table th, .status-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.status-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.status-table .fine { margin: 0.1rem 0 0; font-size: 0.75rem; }
.status-table code { color: var(--fg); font-size: 0.85rem; }
.lvl { font-weight: 600; }
.lvl-fine { color: #7fd1a0; }
.lvl-warning { color: #f2d43d; }
.lvl-trouble { color: var(--accent); }
.lvl-quiet { color: var(--muted); }
.history-stats { display: flex; gap: 2rem; margin: 0.75rem 0 1rem; flex-wrap: wrap; }
.history-stat .num { font-size: 1.8rem; font-weight: 600; color: var(--fg); display: block; }
.history-stat .label { font-size: 0.8rem; color: var(--muted); }
.history-chart {
    width: 100%;
    height: 120px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.history-chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.history-chart .area { fill: var(--accent); opacity: 0.12; stroke: none; }
.history-chart .grid { stroke: var(--border); stroke-width: 1; }

.seg-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0; }
.seg-buttons button {
    background: none; border: 1px solid var(--border); color: var(--muted);
    padding: 0.35rem 0.8rem; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.seg-buttons button.on { border-color: var(--accent); color: var(--fg); }
@media (max-width: 700px) {
    .status-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---------- Admin: People ---------- */
.add-person { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin: 1rem 0 0.5rem; }
.add-person label { display: block; font-size: 0.85rem; color: var(--muted); flex: 1 1 200px; }
.add-person input {
    display: block; width: 100%; margin-top: 0.35rem; padding: 0.6rem 0.7rem;
    font: inherit; font-size: 16px; color: var(--fg); background: #141414; border: 1px solid var(--border);
}
.add-person input:focus { outline: none; border-color: var(--accent); }
.add-person button, .password-reveal button {
    padding: 0.65rem 1.1rem; font: inherit; font-size: 0.95rem; font-weight: 600;
    color: var(--bg); background: var(--accent); border: 0; cursor: pointer;
}
.password-reveal {
    display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
    margin: 1rem 0; padding: 1rem 1.25rem; border-left: 3px solid #7fd1a0; background: #0f1a14; color: #cfeedd;
}
.password-reveal code { font-size: 1.05rem; color: #fff; user-select: all; }
.password-reveal button + button { background: none; color: var(--fg); border: 1px solid var(--border); }
.row-buttons { white-space: nowrap; }
.row-buttons button {
    background: none; border: 1px solid var(--border); color: var(--fg);
    padding: 0.25rem 0.6rem; font: inherit; font-size: 0.8rem; cursor: pointer; margin: 0 0.2rem 0.2rem 0;
}
.row-buttons button:hover { border-color: var(--accent); color: var(--accent); }
.row-buttons button[data-action="remove"]:hover { background: var(--accent); color: var(--bg); }
