/* Here lies the CSS concerned with the telemetry interface layout */

.telem-layout {
    --telem-bg-color: #06020c;
    --telem-bg-image:
        radial-gradient(ellipse 70% 50% at 50% 18%, rgba(109, 40, 217, 0.14) 0%, rgba(36, 10, 78, 0.05) 55%, transparent 80%),
        linear-gradient(180deg, #080311 0%, #05010a 100%);
    --telem-header-bg: rgba(9, 4, 18, 0.88);
    --telem-header-border: rgba(139, 61, 255, 0.22);
    --telem-card-bg: rgba(12, 5, 24, 0.84);
    --telem-card-border: rgba(139, 61, 255, 0.24);
    --telem-card-hover-border: rgba(139, 61, 255, 0.42);
    --telem-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --telem-subcard-bg: rgba(255, 255, 255, 0.03);
    --telem-subcard-border: rgba(255, 255, 255, 0.085);
    --telem-input-bg: rgba(20, 12, 34, 0.92);
    --telem-menu-bg: rgba(11, 5, 22, 0.98);
    --telem-divider: rgba(255, 255, 255, 0.08);
    --telem-track-bg: rgba(255, 255, 255, 0.08);
    --accent-soft: #a78bfa;
    --accent-contrast: #ffffff;

    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--telem-bg-color);
    background-image: var(--telem-bg-image);
    color: var(--text-primary);
    overflow-x: clip;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.telem-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--telem-header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--telem-header-border);
}

.telem-header-inner {
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 0.55rem 1.5rem;
}

.telem-header-left,
.telem-header-center,
.telem-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.telem-header-left {
    min-width: 0;
}

.telem-v-sep {
    width: 1px;
    height: 22px;
    background: var(--telem-divider);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.telem-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none !important;
    user-select: none;
    flex-shrink: 0;
}

.telem-brand::before {
    content: "";
    display: inline-block;
    width: 38px;
    height: 18px;
    flex-shrink: 0;
    background-color: var(--accent-bright);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 28'%3E%3Cpath d='M4 22L18 8C23 3.5 30 2 38 2H60L52 10H32C26 10 21 12.5 16 17L4 22Z' fill='black'/%3E%3Cpath d='M8 23H58L62 19H16L8 23Z' fill='black'/%3E%3Cpath d='M2 26H62' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M26 14H48L44 17H22L26 14Z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 28'%3E%3Cpath d='M4 22L18 8C23 3.5 30 2 38 2H60L52 10H32C26 10 21 12.5 16 17L4 22Z' fill='black'/%3E%3Cpath d='M8 23H58L62 19H16L8 23Z' fill='black'/%3E%3Cpath d='M2 26H62' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M26 14H48L44 17H22L26 14Z' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.telem-brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    line-height: 1;
}

.telem-brand-accent {
    color: var(--accent-bright);
    margin-left: 0.1rem;
}

.telem-brand-ti {
    color: var(--text-primary);
    margin-left: 0.05rem;
    font-weight: 800;
}

.telem-brand-divider {
    width: 1px;
    height: 24px;
    background: var(--border-purple);
}

.telem-brand-meta {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.telem-brand-main {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--text-primary);
    line-height: 1;
}

.telem-brand-sub {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    line-height: 1;
}

.telem-stream-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-dim);
    display: inline-block;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.telem-stream-dot.is-live {
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.75);
}

.telem-stat-pill,
.telem-simtime-pill,
.telem-control-pill {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.75rem;
    background: var(--telem-subcard-bg);
    border: 1px solid var(--telem-subcard-border);
    border-radius: 6px;
}

.telem-stat-icon {
    font-size: 0.78rem;
    color: var(--accent-bright);
}

.telem-stat-key {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}

.telem-stat-val {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.telem-simtime-pill {
    background: var(--telem-input-bg);
    border-color: var(--border-purple);
    padding: 0 0.9rem;
}

.telem-pill-sep {
    width: 1px;
    height: 14px;
    background: var(--border-purple);
}

.telem-simtime-value {
    font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    min-width: 162px;
    text-align: center;
}

.telem-control-pill {
    padding-right: 0.35rem;
}

.telem-record-status.is-recording {
    color: #fb7185;
}

.telem-record-timer {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: #fb7185;
    padding: 0.12rem 0.42rem;
    border-radius: 4px;
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(244, 63, 94, 0.35);
    line-height: 1.1;
}

.telem-record-timer[hidden] {
    display: none !important;
}

.telem-record-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.telem-icon-btn {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.telem-record-play {
    background: var(--accent-subtle);
    border: 1px solid var(--border-purple);
    color: var(--accent-soft);
}

.telem-record-play:hover:not(:disabled) {
    background: var(--accent-bright);
    border-color: var(--accent-bright);
    color: var(--accent-contrast);
}

.telem-record-play.is-active {
    background: rgba(244, 63, 94, 0.24);
    border-color: #fb7185;
    color: #fda4af;
}

.telem-record-stop {
    background: var(--telem-subcard-bg);
    border: 1px solid var(--telem-subcard-border);
    color: var(--text-muted);
}

.telem-record-stop:hover:not(:disabled) {
    background: var(--accent-subtle);
    border-color: var(--border-purple);
    color: var(--text-primary);
}

.telem-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.telem-account {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.telem-account-user {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-secondary);
    text-decoration: none !important;
    border: 1px solid transparent;
    border-radius: 6px;
    box-sizing: border-box;
    min-width: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.telem-account-user:hover {
    background: var(--accent-subtle);
    border-color: var(--border-purple);
    color: var(--text-primary);
}

.telem-account-user i {
    font-size: 0.98rem;
    line-height: 1;
    color: var(--accent-bright);
}

.telem-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    height: 32px;
    padding: 0 0.7rem;
    background: var(--telem-subcard-bg);
    border: 1px solid var(--telem-subcard-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.telem-logout-btn:hover {
    background: var(--accent-subtle);
    border-color: var(--border-purple);
    color: var(--text-primary);
}

.telem-menu-wrapper {
    position: relative;
}

.telem-menu-btn {
    width: 32px;
    height: 32px;
    background: var(--telem-subcard-bg);
    border: 1px solid var(--telem-subcard-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.telem-menu-btn:hover,
.telem-menu-btn[aria-expanded="true"] {
    background: var(--accent-subtle);
    border-color: var(--border-purple);
    color: var(--text-primary);
}

.telem-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--telem-menu-bg);
    border: 1px solid var(--border-purple);
    border-radius: 6px;
    padding: 0.35rem;
    box-shadow: var(--telem-card-shadow);
    z-index: 150;
}

.telem-menu-dropdown[hidden] {
    display: none !important;
}

.telem-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.telem-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--accent-bright);
}

.telem-menu-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.telem-workspace {
    flex: 1;
    width: 100%;
    padding: 1.5rem;
    position: relative;
}

.telem-global-toast {
    position: fixed;
    top: 74px;
    right: 1.35rem;
    z-index: 400;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    max-width: min(420px, calc(100vw - 2rem));
    padding: 0.75rem 1rem;
    background: var(--telem-menu-bg);
    border: 1px solid var(--border-purple-strong);
    border-left: 3px solid var(--accent-bright);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    animation: telemToastSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes telemToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

.telem-global-toast[hidden] {
    display: none !important;
}

.telem-global-toast i:first-child {
    color: var(--accent-bright);
}

.telem-global-toast.is-error {
    border-color: rgba(244, 63, 94, 0.65);
}

.telem-global-toast.is-error i:first-child {
    color: #fb7185;
}

.telem-global-toast-link {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: var(--accent-primary);
    color: var(--accent-contrast) !important;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none !important;
}

.telem-global-toast-link[hidden] {
    display: none !important;
}

.telem-global-toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    font-size: 0.85rem;
}

.telem-global-toast-close:hover {
    color: var(--text-primary);
}

@media (max-width: 1279.98px) {
    .telem-header-inner {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0.65rem 1.25rem;
    }

    .telem-header-right {
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .telem-header-inner {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .telem-brand-divider,
    .telem-brand-meta {
        display: none !important;
    }

    .telem-account {
        gap: 0.35rem;
    }

    .telem-account-user {
        padding: 0 0.5rem;
        max-width: 110px;
    }

    .telem-account-user #header-username {
        max-width: 65px;
    }

    .telem-logout-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .telem-logout-btn span {
        display: none;
    }

    .telem-logout-btn i {
        font-size: 0.95rem;
        margin: 0;
    }
}