/* Self-hosted Roboto variable font, limited to the site's 400–700 range. */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/roboto/roboto-cyrillic-YQZmGO3.woff2") format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/roboto/roboto-latin-EEph2sr.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
        U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light;

    /*
     * Semantic color roles. Components consume these roles instead of
     * introducing their own palette. Charge colors belong to the battery;
     * destructive controls use the separate danger role.
     */
    --color-page: light-dark(#f1f3f7, #0f172a);
    --color-surface: light-dark(#fff, #1e293b);
    --color-surface-muted: light-dark(#f7fafc, #273449);
    --color-field: light-dark(#fff, #111827);
    --color-border: light-dark(#e2e8f0, #64748b);
    --color-text: light-dark(#2d3748, #f8fafc);
    --color-text-muted: light-dark(#5f6b7a, #cbd5e1);
    --color-text-faint: light-dark(#667085, #94a3b8);
    --color-accent: light-dark(#5568d3, #a5b4fc);
    --color-accent-hover: light-dark(#4654b6, #c7d2fe);
    --color-accent-subtle: light-dark(#eef0fb, #293156);
    --color-accent-subtle-hover: light-dark(#e1e5fa, #394477);
    --color-accent-pulse: light-dark(rgba(85, 104, 211, 0.45), rgba(165, 180, 252, 0.45));
    --color-action: light-dark(#5568d3, #4f46e5);
    --color-action-hover: light-dark(#4654b6, #4338ca);
    --color-on-action: #fff;
    --color-charge-high: light-dark(#38a169, #4ade80);
    --color-charge-medium: light-dark(#dd6b20, #fbbf24);
    --color-charge-low: light-dark(#e53e3e, #f87171);
    --color-success: light-dark(#276749, #86efac);
    --color-success-subtle: light-dark(#f0fff4, #143424);
    --color-success-action: light-dark(#2f855a, #15803d);
    --color-on-success: #fff;
    --color-danger: light-dark(#c53030, #fca5a5);
    --color-danger-hover: light-dark(#9b2c2c, #fecaca);
    --color-danger-subtle: light-dark(#fff5f5, #3b171b);
    --color-danger-border: light-dark(#feb2b2, #ef4444);
    --color-danger-hatch: light-dark(#fed7d7, rgba(248, 113, 113, 0.24));
    --color-warning: light-dark(#9c4221, #fdba74);
    --color-warning-subtle: light-dark(#fffaf0, #422006);
    --color-warning-border: light-dark(#f6ad55, #c2410c);
    --color-focus-ring: var(--color-text);
    --color-overlay: light-dark(rgba(0, 0, 0, 0.55), rgba(2, 6, 23, 0.78));
    --background-app: linear-gradient(
        135deg,
        light-dark(#5568d3, #0f172a) 0%,
        light-dark(#4654b6, #312e81) 100%
    );

    /* Battery chrome stays quiet so charge color and percentage lead. */
    --battery-case: light-dark(#cbd5e0, #64748b);
    --battery-track: light-dark(#eef0f4, #273449);
    --battery-tick: light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.38));
    --battery-height: 96px;
    --battery-percentage-size: 48px;
    --battery-percentage-size-small: 40px;

    /* One shared shape, spacing, border and elevation scale. */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-dashboard-card: 14px;
    --radius-pill: 999px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 20px;
    --space-xl: 40px;
    --border-default: 1px solid var(--color-border);
    --border-strong: 2px solid var(--color-border);
    --shadow-card: 0 16px 40px light-dark(rgba(45, 55, 72, 0.12), rgba(0, 0, 0, 0.45));
    --shadow-dashboard-card: 0 4px 16px light-dark(rgba(45, 55, 72, 0.08), rgba(0, 0, 0, 0.35));
    --shadow-control: 0 2px 5px light-dark(rgba(45, 55, 72, 0.1), rgba(0, 0, 0, 0.3));
    --shadow-action: 0 6px 14px light-dark(rgba(85, 104, 211, 0.22), rgba(99, 102, 241, 0.32));
    --shadow-shell: 0 20px 60px light-dark(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.55));
    --shadow-dialog: 0 20px 60px light-dark(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.65));
    --shadow-action-hover: 0 10px 20px light-dark(rgba(85, 104, 211, 0.4), rgba(99, 102, 241, 0.38));
    --shadow-secondary-hover: 0 4px 12px light-dark(rgba(45, 55, 72, 0.1), rgba(0, 0, 0, 0.35));
    --copy-button-width: auto;
    --copy-button-padding: 10px 24px;
    --copy-button-background: var(--color-action);
    --copy-button-hover-background: var(--color-action-hover);
    --copy-button-radius: var(--radius-sm);
    --copy-button-font-size: 14px;
    --copy-button-margin-bottom: 0;
    --footer-margin-top: 30px;
    --footer-padding-top: 20px;
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
    }
}

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

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.clipboard-copy-source {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

:where(a, button, input, textarea, select):focus-visible {
    outline: 3px solid var(--color-focus-ring) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px var(--color-surface) !important;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background-app);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.theme-switcher {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 8px 6px 12px;
    background: var(--color-surface);
    border: var(--border-default);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-control);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
}

.theme-switcher [data-theme-select] {
    min-height: 32px;
    padding: 5px 8px;
    border: var(--border-default);
    border-radius: var(--radius-pill);
    background: var(--color-field);
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
}

:where(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
    background: var(--color-field);
    color: var(--color-text);
}

.container {
    width: 100%;
    max-width: 500px;
}

.btn-copy {
    width: var(--copy-button-width);
    padding: var(--copy-button-padding);
    background: var(--copy-button-background);
    color: var(--color-on-action);
    border: none;
    border-radius: var(--copy-button-radius);
    font-weight: 600;
    cursor: pointer;
    font-size: var(--copy-button-font-size);
    margin-bottom: var(--copy-button-margin-bottom);
}

.btn-copy:hover {
    background: var(--copy-button-hover-background);
}

.site-footer {
    margin-top: var(--footer-margin-top);
    padding-top: var(--footer-padding-top);
    border-top: var(--border-default);
    text-align: center;
    font-size: 13px;
}

.site-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.back-link {
    display: inline-block;
    margin-top: var(--space-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.battery-hero,
.battery-capacity-line,
.battery-visual,
.battery-empty-note {
    width: 100%;
    max-width: 430px;
    margin-inline: auto;
}

.battery-hero {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.battery-percentage {
    color: var(--color-text);
    font-size: var(--battery-percentage-size);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
    pointer-events: none;
}

.battery-remaining {
    min-width: 0;
    color: var(--color-text-muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.battery-capacity-line {
    margin-top: 2px;
    margin-bottom: 16px;
    color: var(--color-text-faint);
    font-size: 13px;
}

.battery-visual {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--battery-height);
}

.battery-body {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 5px;
    overflow: hidden;
    background: var(--battery-track);
    border: 3px solid var(--battery-case);
    border-radius: var(--radius-lg);
    transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.battery-fill {
    position: relative;
    height: 100%;
    border-radius: 10px;
    animation: battery-breathe 3.5s ease-in-out infinite;
    transition: width 0.3s ease;
}

/* Server-rendered public fallback until its module applies continuous color. */
.battery-fill.high {
    background: var(--color-charge-high);
}

.battery-fill.medium {
    background: var(--color-charge-medium);
}

.battery-fill.low {
    background: var(--color-charge-low);
}

.battery-ticks {
    position: absolute;
    inset: 5px;
    display: flex;
    pointer-events: none;
}

.battery-ticks span {
    flex: 1;
    border-right: 2px solid var(--battery-tick);
}

.battery-ticks span:last-child {
    border-right: none;
}

.battery-terminal {
    flex: 0 0 10px;
    width: 10px;
    height: 36px;
    background: var(--battery-case);
    border-radius: 0 5px 5px 0;
    transition: background-color 0.4s ease;
}

.battery-empty-note {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--color-danger-subtle);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.battery-empty-note[hidden] {
    display: none;
}

.battery-empty-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    background: var(--color-charge-low);
    border-radius: 50%;
}

.is-empty .battery-fill {
    animation-duration: 1.6s;
}

/* Today's Events rows: the owner's dashboard list and, when the owner shares it,
   the public card (#94). Owner-only parts such as the Remove button stay in
   dashboard.css. */
.today-events {
    margin-top: var(--space-lg);
    padding-top: 16px;
    border-top: var(--border-default);
}

.today-events[hidden],
.today-events-list[hidden],
.today-events-empty[hidden] {
    display: none;
}

.today-events-title {
    margin-bottom: var(--space-sm);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
}

.today-events-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.today-event {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 0;
    border-bottom: var(--border-default);
}

.today-event:last-child {
    border-bottom: none;
}

.today-event .label {
    min-width: 0;
    font-weight: 500;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.today-event .charge {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--color-text-muted);
    font-size: 13px;
}

.today-events-empty {
    color: var(--color-text-muted);
    font-size: 13px;
}

@keyframes battery-breathe {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.82;
    }
}

@media (max-width: 360px) {
    .battery-hero {
        gap: var(--space-sm);
    }

    .battery-percentage {
        font-size: var(--battery-percentage-size-small);
    }

    .battery-remaining {
        font-size: 13px;
    }
}

@media (max-width: 1100px) {
    body {
        padding-top: 76px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
}
