:root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f5f5f5;
    background-color: #05060a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html,
#root {
    margin: 0;
    padding: 0;
    height: 100%;
}

/* MAIN SCREEN LAYOUT */
.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;

    background: radial-gradient(circle at top left, #1b2140, #05060a 55%);
    padding: 4px 16px 8px;
    gap: 8px;

    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

.top-bar-left {
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 1.4rem;
    font-weight: 600;
}

.subtitle {
    font-size: 0.85rem;
    color: #b0b4c3;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #34c759;
}

.status-label {
    color: #b0b4c3;
}

.center-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #e5e5ea;
}

.center-message.error {
    color: #ff453a;
}

/* CONTENT AREA */
.content {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;

    padding-bottom: 12px;
}

/* PANELS */
.panel {
    background: rgba(9, 11, 22, 0.9);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.panel-header h2 {
    font-size: 1rem;
    margin: 0;
}

.panel-subtitle {
    font-size: 0.8rem;
    color: #a2a6b8;
}

.panel-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* CURRENT SOH SECTION */
.current-soh-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.current-soh-value {
    flex: 1;
}

.current-soh-value .value {
    display: block;
    font-size: 2.2rem;
    font-weight: 600;
}

.soh-change {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-row {
    display: flex;
    gap: 12px;
}

.summary-item {
    flex: 1;
}

.label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a2a6b8;
}

.value {
    display: block;
    font-size: 1rem;
    font-weight: 500;
}

.secondary {
    display: block;
    font-size: 0.8rem;
    color: #8a8ea0;
}

.delta-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #2c2f3e;
}

.delta-tag.small {
    font-size: 0.75rem;
    padding: 2px 6px;
}

.delta-up {
    color: #34c759;
}

.delta-down {
    color: #ff453a;
}

.delta-flat {
    color: #f5f5f5;
}

/* Chart */
.panel-chart {
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 80px;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-line {
    stroke: #4da6ff;
    stroke-width: 0.8;
}

.chart-dot {
    fill: #ffffff;
}

.chart-placeholder {
    font-size: 0.9rem;
    color: #a2a6b8;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #a2a6b8;
}

/* Session list */

.panel-list {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.session-list {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(17, 20, 36, 0.9);
}

.session-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-title {
    font-size: 0.9rem;
    font-weight: 500;
}

.session-subtitle {
    font-size: 0.8rem;
    color: #a2a6b8;
}

.session-metrics {
    display: flex;
    gap: 10px;
    align-items: center;
}

.session-metric {
    text-align: right;
}

/* STATUS BAR */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 4px;
    font-size: 0.8rem;
    color: #cfd2e1;
    opacity: 0.9;
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-time {
    font-weight: 500;
}

.status-temp {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.status-car {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    font-size: 0.82rem;
}

.status-car-range {
    font-weight: 500;
}

.status-icon {
    opacity: 0.9;
}

/* BOTTOM NAV – fixed overlay inside the car screen */
.bottom-nav {
    position: sticky;
    bottom: 0;

    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 6px;
    padding-bottom: 6px;
    margin-top: 4px;

    border-top: 1px solid rgba(255, 255, 255, 0.06);

    border-radius: 16px;

    background: rgba(5, 6, 10, 0.95)
}

.nav-button {
    flex: 1;
    border: none;
    background: transparent;
    color: #8c90a4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    padding: 4px 0;
}

.nav-icon {
    font-size: 1.1rem;
}

.nav-button-active {
    color: #ffffff;
    font-weight: 500;
}

.nav-button-active .nav-icon {
    transform: translateY(-1px);
}

/* INFOTAINMENT VIEWPORT – fixed 21:9 ratio */
#viewport-wrapper {
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#viewport {
    aspect-ratio: 21 / 9;
    width: min(90vw, 1600px);
    max-height: 90vh;
    border-radius: 20px;
    background: #05060a;
    overflow: hidden;
    display: flex;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.6),
        0 0 0 8px #111;
}

#root {
    width: 100%;
    height: 100%;
}

/* VW-style HOME MENU GRID – fills the screen under the header */

.home-menu-content {
    flex: 1;
    min-height: 0;

    display: flex;
    align-items: stretch;
    justify-content: stretch;

    padding: 20px 0;
}

.home-menu-grid {
    flex: 1;
    width: 100%;
    height: 100%;

    display: grid;

    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));

    gap: 20px;

    margin: 0;
    padding: 0;
}

.home-menu-tile {
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    background: radial-gradient(circle at top, #272b37, #141722 60%, #05060a);
    box-shadow:
        0 6px 10px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    color: #f5f5f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
    cursor: default;
}

.home-menu-icon {
    font-size: 1.6rem;
}

.home-menu-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Battery tile – interactive, glow on hover */
.home-menu-tile-battery {
    cursor: pointer;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease,
        filter 0.25s ease;
}

.home-menu-tile-battery:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 0 25px rgba(80, 220, 255, 0.8),
        0 8px 18px rgba(0, 0, 0, 0.8);
    background: radial-gradient(circle at top, #2f3f6a, #111423 65%, #05060a);
    filter: drop-shadow(0 0 12px rgba(80, 220, 255, 0.7));
}

.home-menu-tile-battery:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow:
        0 0 14px rgba(80, 220, 255, 0.7),
        0 4px 10px rgba(0, 0, 0, 0.8);
    filter: drop-shadow(0 0 8px rgba(80, 220, 255, 0.6));
}

/* Screen enter animation */
.screen-battery-enter {
    animation: battery-screen-in 300ms ease-out;
    transform-origin: bottom center;
}

@keyframes battery-screen-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
        filter: blur(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.screen-home-enter {
    animation: home-screen-in 200ms ease-out;
    transform-origin: bottom center;
}

@keyframes home-screen-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
        filter: blur(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}