:root {
  --ink: #050706;
  --surface: #0a0d0c;
  --surface-high: #101513;
  --surface-soft: #0d1210;
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-bright: rgba(255, 255, 255, 0.14);
  --text: #f3f7f4;
  --muted: #9aa59f;
  --subtle: #69746e;
  --green: #72f1b8;
  --green-deep: #34c887;
  --green-soft: rgba(73, 225, 157, 0.11);
  --red: #ff7a8d;
  --red-soft: rgba(255, 98, 122, 0.11);
  --amber: #f1c66f;
  --amber-soft: rgba(241, 198, 111, 0.11);
  --violet: #a58cff;
  --blue: #85a8ff;
  --radius-shell: 34px;
  --radius-core: 27px;
  --ease-heavy: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(74, 215, 153, 0.1), transparent 28rem),
    radial-gradient(circle at 88% 28%, rgba(133, 112, 255, 0.09), transparent 34rem),
    radial-gradient(circle at 50% 105%, rgba(63, 131, 110, 0.08), transparent 40rem),
    var(--ink);
  font: 400 16px/1.55 Geist, "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--text);
  transform: translateY(-160%);
  transition: transform 500ms var(--ease-heavy);
}
.skip-link:focus { transform: translateY(0); }

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  opacity: 0.1;
  pointer-events: none;
  filter: blur(120px);
}
.ambient-one { top: 10%; right: -16rem; background: #7064ff; }
.ambient-two { bottom: -16rem; left: -12rem; background: #31d493; }

.refresh-button {
  display: inline-flex;
  min-height: 42px;
  margin-left: auto;
  padding: 5px 5px 5px 16px;
  gap: 11px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 620;
  cursor: pointer;
  transition: transform 650ms var(--ease-heavy);
}
.refresh-button:hover { background: rgba(255, 255, 255, 0.11); transform: translateY(-1px); }
.refresh-button:active { transform: scale(0.98); }
.refresh-button:focus-visible, a:focus-visible { outline: 2px solid rgba(133, 168, 255, 0.72); outline-offset: 3px; }
.refresh-button:disabled { cursor: wait; opacity: 0.58; }

.refresh-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: rgba(114, 241, 184, 0.1);
  transition: transform 700ms var(--ease-spring);
}
.refresh-button:hover .refresh-icon { transform: rotate(24deg) scale(1.05); }
.refresh-icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.refresh-button.is-loading .refresh-icon { animation: spin 900ms var(--ease-heavy) infinite; }

.container { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }

.overview { margin-bottom: 48px; padding-top: 40px; }
.overall-shell {
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: var(--radius-shell);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.2);
}
.overall-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 116px;
  padding: 23px 26px;
  gap: 20px;
  align-items: center;
  border-radius: var(--radius-core);
  background:
    radial-gradient(circle at 2% 0, rgba(255, 255, 255, 0.055), transparent 20rem),
    var(--surface-high);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.085), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}
.overall-card[data-state="up"] { background: radial-gradient(circle at 0 50%, rgba(70, 219, 152, 0.12), transparent 24rem), var(--surface-high); }
.overall-card[data-state="down"] { background: radial-gradient(circle at 0 50%, rgba(255, 107, 125, 0.1), transparent 24rem), var(--surface-high); }
.overall-card[data-state="pending"] { background: radial-gradient(circle at 0 50%, rgba(241, 198, 111, 0.1), transparent 24rem), var(--surface-high); }

.overall-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--subtle);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}
.overall-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-state="up"] .overall-icon { color: var(--green); background: var(--green-soft); }
[data-state="down"] .overall-icon { color: var(--red); background: var(--red-soft); }
[data-state="pending"] .overall-icon { color: var(--amber); background: var(--amber-soft); }

.overall-copy { display: flex; min-width: 0; flex-direction: column; }
.overall-label { margin-bottom: 4px; color: var(--subtle); font-size: 0.66rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; }
.overall-copy strong { overflow-wrap: anywhere; font-size: clamp(1.2rem, 2.2vw, 1.6rem); font-weight: 590; letter-spacing: -0.025em; }

.summary-list { display: flex; margin: 0; gap: 10px; }
.summary-list div { min-width: 82px; padding: 12px 16px; border-radius: 17px; background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 1px rgba(255, 255, 255, 0.055); }
.summary-list dt { color: var(--subtle); font-size: 0.65rem; font-weight: 580; letter-spacing: 0.06em; white-space: nowrap; }
.summary-list dd { margin: 3px 0 0; font-size: 1.45rem; font-weight: 630; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }

.meta-row { display: flex; padding: 16px 8px 0; gap: 20px; align-items: center; justify-content: space-between; color: var(--subtle); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.meta-status { display: flex; min-width: 0; gap: 20px; align-items: center; }

.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 28px; gap: 14px; align-items: start; }
.source-shell {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: var(--radius-shell);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.16);
}
.source-section {
  overflow: visible;
  border-radius: var(--radius-core);
  background: var(--surface);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.075), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}
.source-header {
  display: flex;
  min-height: 74px;
  padding: 15px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.source-title { display: flex; gap: 14px; align-items: center; }
.source-title h2 { margin: 0; font-size: 1.05rem; font-weight: 590; letter-spacing: -0.025em; }
.source-title p { margin: 3px 0 0; color: var(--subtle); font-size: 0.7rem; }
.source-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--subtle); box-shadow: 0 0 0 6px rgba(105, 116, 110, 0.09); }
.source-dot.up { background: var(--green); box-shadow: 0 0 0 6px var(--green-soft); }
.source-dot.down { background: var(--red); box-shadow: 0 0 0 6px var(--red-soft); }
.source-dot.pending { background: var(--amber); box-shadow: 0 0 0 6px var(--amber-soft); }

.service-list { margin: 0; padding: 0; list-style: none; }
.service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 38px auto;
  min-height: 0;
  padding: 9px 14px;
  gap: 6px 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  transition: transform 650ms var(--ease-heavy);
}
.service-row:hover { background: rgba(255, 255, 255, 0.018); }
.service-row:last-child { border-bottom: 0; }
.service-name { min-width: 0; grid-column: 1; grid-row: 1; overflow-wrap: anywhere; font-size: 0.92rem; font-weight: 570; letter-spacing: -0.018em; }

.status-badge { display: inline-flex; width: fit-content; min-height: 28px; padding: 4px 9px; gap: 6px; grid-column: 2; grid-row: 1; align-items: center; justify-self: end; border-radius: 999px; font-size: 0.65rem; font-weight: 630; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.up { color: var(--green); background: var(--green-soft); }
.status-badge.down { color: var(--red); background: var(--red-soft); }
.status-badge.pending { color: var(--amber); background: var(--amber-soft); }

.metric { grid-column: 2; grid-row: 3; align-self: center; justify-self: end; color: var(--subtle); font-size: 0.65rem; text-align: right; font-variant-numeric: tabular-nums; }
.metric strong { display: block; color: var(--text); font-size: 0.86rem; font-weight: 590; letter-spacing: -0.02em; }

.history { display: flex; height: 38px; gap: 0.5px; grid-column: 1 / -1; grid-row: 2; align-items: stretch; }
.history-point {
  display: grid;
  position: relative;
  min-width: 4px;
  max-width: 18px;
  height: 38px;
  flex: 1 1 0;
  padding: 0;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  cursor: help;
  transition: transform 520ms var(--ease-spring);
}
.history-point:hover, .history-point:focus-visible { z-index: 30; background: rgba(133, 168, 255, 0.12); transform: translateY(-2px); }
.history-point:focus-visible { outline: 2px solid rgba(133, 168, 255, 0.78); outline-offset: 1px; }
.history-bar { display: block; width: 7px; min-height: 8px; border-radius: 99px; background: var(--subtle); pointer-events: none; transition: transform 520ms var(--ease-spring), opacity 520ms var(--ease-heavy); }
.history-point:hover .history-bar { transform: scaleY(1.12); }
.history-bar.up { height: 17px; background: linear-gradient(to top, var(--green-deep), var(--green)); box-shadow: 0 0 14px rgba(114, 241, 184, 0.12); }
.history-bar.down { height: 10px; background: linear-gradient(to top, #df4d67, var(--red)); }
.history-bar.pending { height: 8px; background: var(--amber); }

.status-tooltip {
  position: absolute;
  bottom: calc(100% + 11px);
  left: 50%;
  display: flex;
  width: 248px;
  max-width: min(310px, 84vw);
  padding: 6px;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 19px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.26);
  font-size: 0.74rem;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 9px) scale(0.96);
  transform-origin: 50% 100%;
  transition: opacity 460ms var(--ease-heavy), transform 600ms var(--ease-spring), visibility 460ms var(--ease-heavy);
}
.status-tooltip::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: -1;
  border-radius: 13px;
  background: linear-gradient(145deg, #141a17, #0a0e0c);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.09);
}
.history-point:hover .status-tooltip, .history-point:focus-visible .status-tooltip { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); }
.history-point:first-child .status-tooltip { left: 0; transform: translate(0, 9px) scale(0.96); transform-origin: 0 100%; }
.history-point:first-child:hover .status-tooltip, .history-point:first-child:focus-visible .status-tooltip { transform: translate(0, 0) scale(1); }
.history-point:last-child .status-tooltip { right: 0; left: auto; transform: translate(0, 9px) scale(0.96); transform-origin: 100% 100%; }
.history-point:last-child:hover .status-tooltip, .history-point:last-child:focus-visible .status-tooltip { transform: translate(0, 0) scale(1); }

.tooltip-header { display: flex; padding: 10px 10px 0; gap: 9px; align-items: center; }
.tooltip-header strong { font-size: 0.82rem; font-weight: 620; }
.tooltip-state-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--subtle); box-shadow: 0 0 0 5px rgba(105, 116, 110, 0.1); }
.status-tooltip.up .tooltip-state-dot { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.status-tooltip.down .tooltip-state-dot { background: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }
.status-tooltip.pending .tooltip-state-dot { background: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.tooltip-time { padding: 4px 10px 10px; color: var(--muted); font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.tooltip-metric, .tooltip-error { display: flex; margin: 0 6px; padding: 10px 4px; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.tooltip-metric span, .tooltip-error span { color: var(--subtle); }
.tooltip-metric strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip-error { padding-bottom: 11px; flex-direction: column; gap: 5px; }
.tooltip-error strong { display: -webkit-box; overflow: hidden; color: var(--red); overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 6; }

.availability-metrics { display: grid; grid-template-columns: repeat(4, minmax(40px, 1fr)); grid-column: 1; grid-row: 3; gap: 4px; }
.availability-item {
  display: flex;
  min-width: 0;
  padding: 5px 4px;
  gap: 2px;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}
.availability-period { color: var(--subtle); font-size: 0.58rem; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; }
.availability-item strong { color: var(--muted); font-size: 0.7rem; font-weight: 630; font-variant-numeric: tabular-nums; }
.availability-item.good strong { color: var(--green); }
.availability-item.warning strong { color: var(--amber); }
.availability-item.bad strong { color: var(--red); }
.availability-item.unavailable { border-style: dashed; }
.availability-item.unavailable strong { color: var(--subtle); }

.source-error { margin: 8px; padding: 28px 24px; border-radius: 20px; color: var(--muted); background: rgba(255, 255, 255, 0.025); }
.source-error strong { display: block; margin-bottom: 5px; color: var(--text); }
.page-error { margin-top: 24px; padding: 18px 20px; border: 1px solid rgba(255, 122, 141, 0.2); border-radius: 20px; color: var(--muted); background: var(--red-soft); box-shadow: inset 0 1px rgba(255, 255, 255, 0.05); }
.page-error strong { margin-right: 7px; color: var(--text); }

.source-skeleton { height: 260px; padding: 7px; border: 1px solid rgba(255, 255, 255, 0.075); border-radius: var(--radius-shell); background: rgba(255, 255, 255, 0.03); }
.source-skeleton span { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--radius-core); background: var(--surface); }
.source-skeleton span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.045) 46%, transparent 64%); transform: translateX(-110%); animation: shimmer 1.8s var(--ease-heavy) infinite; }

footer {
  display: flex;
  width: min(1160px, calc(100% - 48px));
  margin: 74px auto 0;
  padding: 30px 0 48px;
  gap: 11px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: var(--subtle);
  font-size: 0.68rem;
}
footer a { text-decoration-color: transparent; }
footer a:hover { color: var(--text); text-decoration-color: currentColor; }

.reveal { opacity: 0; transform: translateY(50px) scale(0.985); transition: opacity 900ms var(--ease-heavy), transform 1000ms var(--ease-heavy); }
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { transform: translateX(-110%); opacity: 0.4; } to { transform: translateX(110%); opacity: 1; } }

@media (max-width: 1050px), (orientation: portrait) {
  .sources { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
  .refresh-button { min-height: 38px; padding-left: 13px; }
  .refresh-icon { width: 28px; height: 28px; }
  .container, footer { width: calc(100% - 32px); }
  .overview { margin-bottom: 40px; padding-top: 24px; }
  .overall-shell, .source-shell { padding: 5px; border-radius: 27px; }
  .overall-card { grid-template-columns: auto 1fr; min-height: auto; padding: 18px; gap: 14px; border-radius: 21px; }
  .overall-icon { width: 50px; height: 50px; border-radius: 16px; }
  .summary-list { grid-column: 1 / -1; width: 100%; padding-top: 18px; justify-content: space-between; border-top: 1px solid rgba(255, 255, 255, 0.055); }
  .summary-list div { min-width: 0; flex: 1; padding: 10px 12px; }
  .source-section { border-radius: 21px; }
  .source-header { min-height: 68px; padding: 13px 16px; }
  .service-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; padding: 10px 13px; gap: 7px 10px; }
  .service-name { grid-column: 1; grid-row: 1; align-self: center; }
  .status-badge { grid-column: 2; grid-row: 1; justify-self: end; }
  .history { grid-column: 1 / -1; grid-row: 2; gap: 0.5px; }
  .availability-metrics { grid-column: 1 / -1; grid-row: 3; }
  .metric { display: block; grid-column: 1 / -1; grid-row: 4; text-align: left; }
  .meta-row { align-items: flex-end; }
  .meta-status { gap: 4px; flex-direction: column; align-items: flex-start; }
  .history-point:nth-child(-n + 9) .status-tooltip { left: 0; transform: translate(0, 9px) scale(0.96); transform-origin: 0 100%; }
  .history-point:nth-child(-n + 9):hover .status-tooltip,
  .history-point:nth-child(-n + 9):focus-visible .status-tooltip { transform: translate(0, 0) scale(1); }
  .history-point:nth-last-child(-n + 9) .status-tooltip { right: 0; left: auto; transform: translate(0, 9px) scale(0.96); transform-origin: 100% 100%; }
  .history-point:nth-last-child(-n + 9):hover .status-tooltip,
  .history-point:nth-last-child(-n + 9):focus-visible .status-tooltip { transform: translate(0, 0) scale(1); }
  footer { margin-top: 52px; }
}

@media (max-width: 400px) {
  .refresh-button > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .refresh-button { padding-left: 5px; }
  .source-title p { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .summary-list { gap: 7px; }
  .summary-list div { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
