@font-face {
    font-family: "IRANYekanXVF";
    src:
        url("/res/IRANYekanXVF.woff2") format("woff2-variations"),
        url("/res/IRANYekanXVF.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
:root {
    --bg: #0b0e14;
    --card: #131722;
    --border: #1f2430;
    --text: #e6e8ee;
    --muted: #7d8496;
    --up: #33d17a;
    --down: #f14e5e;
    --nodata: #1c2130;
    --accent: #5b8cff;
    --unknown: #b565f2;
    --surface-2: #171b28;
    --border-strong: #2c3244;
    --glass-bg: rgba(19, 23, 34, 0.4);
    --glass-bg-strong: rgba(23, 27, 40, 0.46);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-strong: rgba(255, 255, 255, 0.18);
    --glass-blur: 18px;
}
* {
    box-sizing: border-box;
}
body::before,
body::after {
    content: "";
    position: fixed;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
}
body::before {
    top: -180px;
    right: -140px;
    background: radial-gradient(circle, rgba(91, 140, 255, 0.35), transparent 70%);
}
body::after {
    bottom: -200px;
    left: -160px;
    background: radial-gradient(circle, rgba(181, 101, 242, 0.25), transparent 70%);
}
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 80% -10%, #161c2c 0%, var(--bg) 55%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-family:
        "IRANYekanXVF",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Tahoma,
        sans-serif;
    padding: 40px 20px 60px;
}
.wrap {
    max-width: 980px;
    margin: 0 auto;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 10px;
}
.title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
h1 {
    font-size: clamp(19px, 2.6vw, 25px);
    font-weight: 900;
    margin: 0;
    letter-spacing: 0;
}
.live-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    color: var(--muted);
}
.live-dot svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}
.live-dot::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.28;
    filter: blur(5px);
    animation: live-pulse 2.2s ease-out infinite;
}
.live-dot.up {
    color: var(--up);
}
.live-dot.down {
    color: var(--down);
}
.live-dot.unknown {
    color: var(--unknown);
}
@keyframes live-pulse {
    0% {
        transform: scale(0.6);
        opacity: 0.45;
    }
    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}
#last-updated {
    color: var(--muted);
    font-size: 13px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
}
.indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}
.name {
    font-weight: 900;
    font-size: 15px;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    transition:
        background 0.3s ease,
        box-shadow 0.3s ease;
    flex: 0 0 auto;
}
.dot.up {
    background: var(--up);
    box-shadow: 0 0 10px 1px var(--up);
}
.dot.down {
    background: var(--down);
    box-shadow: 0 0 10px 1px var(--down);
}
.dot.unknown {
    background: var(--unknown);
}
.status-label {
    font-size: 13px;
}
.status-label.up {
    color: var(--up);
}
.status-label.down {
    color: var(--down);
}
.status-label.unknown {
    color: var(--unknown);
}
.indicator .delay {
    color: var(--muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    margin-inline-end: 6px;
}
.name-divider {
    height: 1px;
    background: var(--border);
    margin: 10px -20px;
    width: calc(100% + 40px);
}

.market-card {
    background: linear-gradient(135deg, rgba(21, 27, 44, 0.4), rgba(19, 23, 34, 0.26));
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border: 1px solid var(--glass-border);
    border-inline-start: 3px solid var(--muted);
    border-radius: 14px;
    padding: 20px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}
.market-card:hover {
    border-color: var(--glass-border-strong);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}
.market-card.open {
    border-inline-start-color: var(--up);
}
.market-card.closed {
    border-inline-start-color: var(--down);
}
.market-card .label {
    font-weight: 900;
    font-size: 15px;
}
.market-card .reason {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}
.pill {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.pill.open {
    background: rgba(51, 209, 122, 0.15);
    color: var(--up);
}
.pill.closed {
    background: rgba(241, 78, 94, 0.15);
    color: var(--down);
}

.range-toggle {
    display: inline-flex;
    gap: 4px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 4px;
}
.range-toggle button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease;
}
.range-toggle button:hover {
    color: var(--text);
}
.range-toggle button.active {
    background: var(--accent);
    color: #fff;
}
.settings {
    position: relative;
    z-index: 100;
}
.settings-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border: 1px solid var(--glass-border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}
.settings-icon:hover,
.settings-icon:focus-visible {
    color: var(--text);
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.35);
}
.settings-icon svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}
.settings.open .settings-icon svg {
    transform: rotate(45deg);
}
.settings-card {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    background: rgba(23, 27, 40, 0.34);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition:
        opacity 0.16s ease,
        transform 0.16s ease,
        visibility 0.16s;
}
.settings.open .settings-card,
.settings:hover .settings-card,
.settings:focus-within .settings-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.settings-card .settings-title {
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.settings-card .range-toggle {
    width: 100%;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.history-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 18px 20px 14px;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}
.history-card:hover {
    border-color: var(--glass-border-strong);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}
.history-card + .history-card {
    margin-top: 20px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}
.legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 6px 14px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--muted);
}
.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}
.legend-swatch--nodata {
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.legend-swatch--gradient {
    width: 34px;
    border-radius: 3px;
    /* must mirror SCORE_COLOR_STOPS in js/heatmap.js */
    background: linear-gradient(90deg, rgb(246, 224, 94), rgb(246, 153, 59), rgb(241, 78, 94));
}

/* The heatmap grids read chronologically left-to-right regardless of the
   page's text direction (this matches how Persian calendar apps usually
   keep date grids), so they're pinned to ltr while their labels are
   still rendered in Persian/Farsi. */
.heatmap {
    position: relative;
    padding-top: 16px;
    margin: 14px auto 0;
    width: max-content;
    direction: ltr;
}
.heatmap .months {
    position: absolute;
    top: 0;
    left: 0;
    height: 14px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
}
.heatmap .months span {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 0;
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
}
.heatmap .day-labels {
    position: absolute;
    top: 16px;
    font-size: 10px;
    color: var(--muted);
}
.heatmap .day-labels span {
    position: absolute;
    height: 11px;
    line-height: 11px;
    white-space: nowrap;
}
.heatmap .tiles {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 11px);
    gap: 3px;
}
.tile {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: var(--nodata);
}
.tile.unknown {
    background: var(--unknown);
}
.tile:hover {
    outline: 1px solid rgba(255, 255, 255, 0.5);
}
.tile.empty {
    background: transparent;
    visibility: hidden;
}

.hm-grid {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: max-content;
    margin: 14px auto 0;
    direction: ltr;
}
.hm-grid.with-hours {
    padding-top: 16px;
}
.hm-hours {
    position: absolute;
    top: 0;
    left: 0;
    height: 14px;
    font-size: 10px;
    font-family: inherit;
    color: var(--muted);
    display: flex;
    direction: ltr;
}
.hm-hours span {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 0;
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
}
.hm-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hm-row-label {
    flex: 0 0 64px;
    width: 64px;
    height: 11px;
    line-height: 11px;
    text-align: left;
    font-size: 10.5px;
    color: var(--muted);
    white-space: nowrap;
}
.hm-row-tiles {
    display: grid;
    gap: 3px;
}

.tile-tooltip {
    position: fixed;
    z-index: 1000;
    direction: rtl;
    background: rgba(26, 32, 51, 0.48);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(-10px);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease;
    white-space: nowrap;
}
.tile-tooltip.visible {
    opacity: 1;
}
.tile-tooltip .tt-date {
    font-weight: 700;
    color: var(--text);
}
.tile-tooltip .tt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.tile-tooltip .tt-uptime-label {
    color: var(--muted);
}
.tile-tooltip .tt-uptime-value {
    font-weight: 700;
}
.tile-tooltip .tt-arrow {
    position: absolute;
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--border);
}
.tile-tooltip .tt-arrow::after {
    content: "";
    position: absolute;
    top: -7px;
    right: -5px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(26, 32, 51, 0.48);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .market-card,
    .history-card,
    .settings-card,
    .settings-icon,
    .range-toggle,
    .legend,
    .tile-tooltip {
        background: var(--card);
    }
}

@media (prefers-reduced-motion: reduce) {
    .live-dot::after {
        animation: none;
        display: none;
    }
    .market-card,
    .history-card,
    .settings-icon,
    .settings-card,
    .range-toggle button,
    .settings-icon svg {
        transition: none !important;
    }
}
