/* ===========================================================
   simulai.tech -- cyberpunk compute monitor dashboard
   Single-viewport bento-box. JetBrains Mono only. Sharp corners.
   Palette: #0C0E14 #12151E #1E2D4A #1A1A2E #4A6278 #8BA4B8
            #00F0FF #A855F7 (FF3366 used for peak alerts)
   =========================================================== */

/* ----- Reset ----- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-radius: 0;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #0C0E14;
    color: #8BA4B8;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

ul {
    list-style: none;
}

/* ----- Background scan-line texture ----- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    background-image:
        repeating-linear-gradient(
            to bottom,
            rgba(0, 240, 255, 0.018) 0px,
            rgba(0, 240, 255, 0.018) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: screen;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99;
    background:
        radial-gradient(
            ellipse at 50% 50%,
            transparent 30%,
            rgba(12, 14, 20, 0.55) 100%
        );
}

/* ----- Dashboard grid (bento box, no scroll) ----- */
.dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 132px 1fr 1fr 80px;
    gap: 4px;
    padding: 4px;
    height: 100vh;
    width: 100vw;
    background-color: #0C0E14;
}

/* Panel placement */
.panel-identity   { grid-column: 1 / 3; grid-row: 1 / 2; }
.panel-process    { grid-column: 3 / 4; grid-row: 1 / 2; }
.panel-kernel     { grid-column: 1 / 2; grid-row: 2 / 4; }
.panel-memory     { grid-column: 2 / 3; grid-row: 2 / 4; }
.panel-telemetry  { grid-column: 3 / 4; grid-row: 2 / 4; }
.panel-stream     { grid-column: 1 / 4; grid-row: 4 / 5; }

/* ----- Panels ----- */
.panel {
    position: relative;
    background-color: #12151E;
    border: 1px solid #1E2D4A;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(0, 240, 255, 0.35),
        transparent
    );
    z-index: 2;
    opacity: 0.6;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #1E2D4A;
    background-color: rgba(12, 14, 20, 0.6);
    flex-shrink: 0;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.panel-tag {
    color: #4A6278;
    font-weight: 500;
}

.panel-title {
    color: #00F0FF;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.08em;
}

.panel-meta {
    margin-left: auto;
    color: #4A6278;
    font-size: 10px;
    letter-spacing: 0.04em;
}

.panel-meta::before {
    content: "\2022 ";
    color: #00F0FF;
    margin-right: 4px;
}

.panel-body {
    flex: 1 1 auto;
    padding: 16px;
    overflow: hidden;
    position: relative;
}

/* ===========================================================
   Panel: Identity
   =========================================================== */
.panel-identity .panel-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
}

.domain-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 38px;
    line-height: 1;
    color: #E6F2FF;
    display: flex;
    align-items: baseline;
    letter-spacing: -0.01em;
}

.domain-text {
    color: #E6F2FF;
    text-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}

.cursor {
    display: inline-block;
    width: 12px;
    height: 28px;
    margin-left: 6px;
    background-color: #00F0FF;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
    animation: cursor-blink 530ms steps(2) infinite;
    transform: translateY(2px);
}

@keyframes cursor-blink {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
    100% { opacity: 1; }
}

.tagline {
    font-size: 13px;
    font-weight: 400;
    color: #8BA4B8;
    letter-spacing: 0.01em;
}

.identity-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.meta-pair {
    display: inline-flex;
    gap: 5px;
    align-items: baseline;
}

.meta-key {
    color: #4A6278;
    text-transform: uppercase;
}

.meta-val {
    color: #00F0FF;
    font-weight: 500;
}

/* ===========================================================
   Panel: Process (bar chart)
   =========================================================== */
.panel-process .panel-body {
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.bar-chart {
    flex: 1 1 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding: 6px 4px;
    min-height: 0;
    position: relative;
}

.bar-chart::before {
    content: "";
    position: absolute;
    inset: 6px 4px;
    background-image: linear-gradient(
        to top,
        rgba(30, 45, 74, 0.45) 0,
        rgba(30, 45, 74, 0.45) 1px,
        transparent 1px,
        transparent 25%
    );
    background-size: 100% 25%;
    pointer-events: none;
}

.bar {
    position: relative;
    width: 20px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    background-color: rgba(30, 45, 74, 0.25);
    overflow: hidden;
}

.bar-fill {
    display: block;
    width: 100%;
    background-color: rgba(0, 240, 255, 0.7);
    box-shadow:
        inset 0 -2px 0 rgba(0, 240, 255, 1),
        0 0 10px rgba(0, 240, 255, 0.35);
    height: 60%;
}

/* Each bar gets its own keyframe with discrete steps every 2s */
.bar-1 .bar-fill { animation: bar-1-anim 8s steps(1) infinite; }
.bar-2 .bar-fill { animation: bar-2-anim 8s steps(1) infinite; }
.bar-3 .bar-fill { animation: bar-3-anim 8s steps(1) infinite; }
.bar-4 .bar-fill { animation: bar-4-anim 8s steps(1) infinite; }

@keyframes bar-1-anim {
    0%   { height: 62%; }
    25%  { height: 88%; }
    50%  { height: 41%; }
    75%  { height: 73%; }
    100% { height: 62%; }
}
@keyframes bar-2-anim {
    0%   { height: 84%; }
    25%  { height: 47%; }
    50%  { height: 92%; }
    75%  { height: 55%; }
    100% { height: 84%; }
}
@keyframes bar-3-anim {
    0%   { height: 35%; }
    25%  { height: 70%; }
    50%  { height: 58%; }
    75%  { height: 91%; }
    100% { height: 35%; }
}
@keyframes bar-4-anim {
    0%   { height: 78%; }
    25%  { height: 33%; }
    50%  { height: 67%; }
    75%  { height: 50%; }
    100% { height: 78%; }
}

.bar-axis {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 10px;
    color: #4A6278;
    letter-spacing: 0.04em;
}

.bar-axis span {
    width: 20px;
    text-align: center;
}

.process-readout {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #1E2D4A;
    font-size: 11px;
    color: #4A6278;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.readout-val {
    color: #00F0FF;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}

/* ===========================================================
   Panel: Kernel
   =========================================================== */
.kernel-body {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px 16px 16px;
    overflow: hidden;
}

.kernel-body p {
    font-size: 13px;
    line-height: 1.45;
    color: #8BA4B8;
}

.kernel-line {
    color: #8BA4B8;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.kernel-line.dim {
    color: #4A6278;
    border-top: 1px dashed #1E2D4A;
    padding-top: 8px;
    margin-top: 2px;
}

.kernel-prompt {
    color: #00F0FF;
    margin-right: 8px;
    font-weight: 500;
}

.kernel-list {
    margin-top: 4px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    font-size: 12px;
    line-height: 1.4;
}

.kernel-list li {
    color: #8BA4B8;
    border-left: 2px solid #1E2D4A;
    padding-left: 8px;
}

.ll-key {
    color: #A855F7;
    margin-right: 6px;
    font-weight: 500;
}

/* ===========================================================
   Panel: Memory map (8x8 heatmap)
   =========================================================== */
.memory-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
}

.memory-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 3px;
    min-height: 0;
}

.memory-cell {
    background-color: #1A1A2E;
    width: 100%;
    height: 100%;
    animation-name: memory-pulse;
    animation-duration: 2.4s;
    animation-iteration-count: infinite;
    animation-timing-function: steps(1);
}

@keyframes memory-pulse {
    0%   { background-color: #1A1A2E; }
    16%  { background-color: rgba(0, 240, 255, 0.5); }
    32%  { background-color: #1A1A2E; }
    48%  { background-color: rgba(168, 85, 247, 0.45); }
    64%  { background-color: rgba(0, 240, 255, 0.5); }
    80%  { background-color: rgba(255, 51, 102, 0.6); }
    100% { background-color: #1A1A2E; }
}

.memory-legend {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid #1E2D4A;
    font-size: 10px;
    color: #4A6278;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid #1E2D4A;
}

.legend-swatch.idle   { background-color: #1A1A2E; }
.legend-swatch.active { background-color: rgba(0, 240, 255, 0.5); }
.legend-swatch.peak   { background-color: rgba(255, 51, 102, 0.6); }

/* ===========================================================
   Panel: Telemetry
   =========================================================== */
.telemetry-body {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    overflow: hidden;
}

.telemetry-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    justify-content: space-around;
}

.telem-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: baseline;
    gap: 8px;
    padding: 6px 2px;
    border-bottom: 1px dashed rgba(30, 45, 74, 0.55);
    font-size: 12px;
}

.telem-row:last-child {
    border-bottom: none;
}

.telem-key {
    color: #4A6278;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
}

.telem-val {
    color: #00F0FF;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 56px;
    transition: color 200ms ease;
}

.telem-val.accent-purple { color: #A855F7; }
.telem-val.accent-pink   { color: #FF3366; }

.telem-val.flash {
    animation: telem-flash 380ms ease-out;
}

@keyframes telem-flash {
    0%   { text-shadow: 0 0 8px currentColor; transform: translateX(0); }
    50%  { text-shadow: 0 0 14px currentColor; }
    100% { text-shadow: 0 0 0 currentColor; transform: translateX(0); }
}

.telem-unit {
    color: #4A6278;
    font-size: 10px;
    text-transform: lowercase;
    min-width: 36px;
}

/* ===========================================================
   Panel: Stream (log ticker)
   =========================================================== */
.stream-body {
    padding: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 100%;
}

.stream-track {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.stream-track::before,
.stream-track::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}

.stream-track::before {
    left: 0;
    background: linear-gradient(to right, #12151E 0%, rgba(18, 21, 30, 0) 100%);
}

.stream-track::after {
    right: 0;
    background: linear-gradient(to left, #12151E 0%, rgba(18, 21, 30, 0) 100%);
}

.stream-content {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    flex-shrink: 0;
    animation: stream-marquee 60s linear infinite;
}

@keyframes stream-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.stream-line {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: #4A6278;
    white-space: nowrap;
}

.stream-line:nth-child(8n+1) { color: #8BA4B8; }
.stream-line:nth-child(10n+5) { color: #00F0FF; }

.stream-sep {
    color: #1E2D4A;
    font-size: 11px;
    flex-shrink: 0;
}

/* ===========================================================
   Responsive: viewports < 768px
   =========================================================== */
@media (max-width: 768px) {
    html,
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows:
            96px       /* identity */
            140px      /* process */
            260px      /* kernel */
            220px      /* memory */
            180px      /* telemetry */
            64px;      /* stream */
        height: auto;
        min-height: 100vh;
    }

    .panel-identity,
    .panel-process,
    .panel-kernel,
    .panel-memory,
    .panel-telemetry,
    .panel-stream {
        grid-column: 1 / 2;
    }

    .panel-identity   { grid-row: 1 / 2; }
    .panel-process    { grid-row: 2 / 3; }
    .panel-kernel     { grid-row: 3 / 4; }
    .panel-memory     { grid-row: 4 / 5; }
    .panel-telemetry  { grid-row: 5 / 6; }
    .panel-stream     { grid-row: 6 / 7; }

    .domain-name {
        font-size: 30px;
    }

    .cursor {
        height: 22px;
        width: 10px;
    }

    .identity-meta {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .domain-name { font-size: 26px; }
    .panel-body { padding: 12px; }
    .kernel-body p { font-size: 12px; }
}
