:root {
    --bg: #f4f4f4;
    --surface: #fff;
    --text: #0a0a0a;
    --dim: #6b6b6b;
    --rule: #0a0a0a;
    --rule-light: #d4d4d4;
    --green: #00e639;
    --red: #ff2d46;
    --amber: #ffb800;
    --font: 'Inter', sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0a0a;
        --surface: #111;
        --text: #e8e8e8;
        --dim: #666;
        --rule: #e8e8e8;
        --rule-light: #222;
    }
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.6;
    padding: 24px;
    min-height: 100vh;
}

.mono  { font-family: var(--mono); }
.label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.dim   { font-weight: 500; color: var(--dim); }
.num   { text-align: right; }

.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.015) 2px, rgba(0,0,0,0.015) 4px);
}

@media (prefers-color-scheme: dark) {
    .scanlines {
        background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 4px);
    }
}

.shell {
    max-width: 1440px;
    margin: 0 auto;
    border: 1px solid var(--rule);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 2px solid var(--rule);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 1.25rem;
    color: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

.topbar h1 {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.meta {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.meta-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-block.row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    position: relative;
}

.dot::after {
    content: '';
    position: absolute;
    inset: 0;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.dot.pending        { background: var(--amber); }
.dot.pending::after { background: var(--amber); }
.dot.ok             { background: var(--green); }
.dot.ok::after      { background: var(--green); }
.dot.fail           { background: var(--red); }
.dot.fail::after    { background: var(--red); }

@keyframes dotPulse {
    0%, 100% { transform: scale(1);   opacity: 0.6; }
    50%      { transform: scale(2.2); opacity: 0; }
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
}

.card {
    grid-column: span 12;
    border: 1px solid var(--rule);
    border-top: none;
    padding: 32px 24px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--rule);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

@media (min-width: 768px) {
    .card { grid-column: span 6; }
    .card + .card { border-left: none; }
}

.tag {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 3px 8px;
    border: 1px solid var(--rule);
    color: var(--dim);
    align-self: flex-start;
}

.pair {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.value {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    transition: color 0.3s ease;
}

.value.flash-up   { color: var(--green); }
.value.flash-down { color: var(--red); }

.table-panel {
    grid-column: span 12;
    border: 1px solid var(--rule);
    border-top: none;
    background: var(--surface);
}

.table-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--rule-light);
}

h2 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 24px;
}

th {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    border-bottom: 2px solid var(--rule);
    background: var(--surface);
    position: sticky;
    top: 0;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, background 0.2s;
}

th.sortable:hover {
    color: var(--bg);
    background: var(--text);
}

th.sortable::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
}

th.sortable.asc::after  { content: '↑'; }
th.sortable.desc::after { content: '↓'; }

td {
    font-family: var(--mono);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--rule-light);
    background: var(--surface);
    transition: background 0.15s;
}

td.name-cell {
    font-family: var(--font);
    color: var(--dim);
    font-size: 0.8rem;
}

td:first-child {
    font-weight: 700;
    letter-spacing: 0.05em;
}

tbody tr:hover td {
    background: var(--bg);
}

@keyframes rowIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

tbody tr.enter {
    animation: rowIn 0.2s ease both;
}

.info-bar {
    grid-column: span 12;
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--rule);
    border-top: none;
    background: var(--surface);
}

.info-item {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 24px;
    border-right: 1px solid var(--rule-light);
}

.info-item:last-child { border-right: none; }

.info-item .mono {
    font-size: 0.75rem;
    font-weight: 500;
}

.skeleton {
    color: transparent;
    background: linear-gradient(90deg, var(--rule-light) 25%, transparent 50%, var(--rule-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skel-row td { opacity: 0.5; }

@media (max-width: 640px) {
    body { padding: 10px; }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px;
    }

    .meta { width: 100%; justify-content: space-between; }

    .card { padding: 24px 16px; }

    .info-bar { flex-direction: column; }
    .info-item { border-right: none; border-bottom: 1px solid var(--rule-light); }
    .info-item:last-child { border-bottom: none; }

    th, td { padding: 10px 14px; }
}