@font-face { font-family: "Tektur"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/vendor/fonts/tektur-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Tektur"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/vendor/fonts/tektur-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/vendor/fonts/onest-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/vendor/fonts/onest-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --void: #020807;
  --deep: #062019;
  --ink: #def7ee;
  --muted: #7fa69a;
  --faint: #4f7468;
  --mint: #5af2c0;
  --amber: #ffb547;
  --coral: #ff5470;
  --replay: #ffd27a;
  --glass: rgba(5, 22, 19, 0.66);
  --glass-hi: rgba(10, 38, 32, 0.8);
  --edge: rgba(120, 255, 210, 0.13);
  --edge-hi: rgba(120, 255, 210, 0.32);
  --display: "Tektur", ui-sans-serif, system-ui, sans-serif;
  --text: "Onest", ui-sans-serif, system-ui, sans-serif;
  --panel-w: 360px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(120% 90% at 42% 50%, var(--deep) 0%, #03110e 42%, var(--void) 78%);
  color: var(--ink);
  font: 14px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
}

button, time { font: inherit; color: inherit; }

button { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

[hidden] { display: none !important; }

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.mark {
  margin: 0;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--mint);
}

/* Gate */

#gate {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  position: relative;
}

#gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(90, 242, 192, 0.18) 1px, transparent 1.5px);
  background-size: 14px 14px;
  background-position: center;
  -webkit-mask-image: radial-gradient(42% 52% at 50% 50%, #000 20%, transparent 100%);
  mask-image: radial-gradient(42% 52% at 50% 50%, #000 20%, transparent 100%);
  pointer-events: none;
}

.gate-card {
  position: relative;
  width: min(380px, 100%);
  padding: 32px 28px 26px;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  text-align: center;
}

.gate-card h1 {
  margin: 10px 0 8px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.hint { margin: 0 0 22px; color: var(--muted); }

#widget { min-height: 40px; }

#gate-error { margin: 14px 0 0; color: var(--coral); }

/* Stage */

#app { height: 100%; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#view.dragging { cursor: grabbing; }
#view.hovering { cursor: pointer; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }

.flag {
  display: inline-block;
  width: 18px;
  height: 13.5px;
  flex: none;
  border-radius: 2px;
  background-image: url("/vendor/flags.png");
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.flag.none { background: rgba(255, 255, 255, 0.08); }

.origin {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -100%);
  will-change: transform;
  transition: opacity 0.2s;
}

.origin .flag { width: 16px; height: 12px; }

.origin span {
  font-size: 11px;
  color: var(--ink);
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.origin.dim { opacity: 0.35; }

.server {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  border: 1px solid var(--edge-hi);
  background: rgba(2, 12, 10, 0.72);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  will-change: transform;
}

.server .flag { width: 14px; height: 10.5px; }

#tip {
  position: fixed;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: var(--glass-hi);
  font-size: 12px;
  white-space: nowrap;
  transform: translate(14px, 14px);
}

#tip time { color: var(--muted); font-variant-numeric: tabular-nums; }
#tip small { color: var(--muted); font-size: 12px; }

.capital {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11px;
  line-height: 1;
  color: rgba(222, 247, 238, 0.82);
  text-shadow: 0 0 3px #020807, 0 0 6px #020807;
  white-space: nowrap;
  will-change: transform;
  visibility: hidden;
}

/* Brand */

#brand {
  position: fixed;
  top: 20px;
  left: 24px;
  z-index: 2;
}

#brand .title {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}

/* Clock */

#clockbar {
  position: fixed;
  top: 18px;
  left: 0;
  right: calc(var(--panel-w) + 32px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  z-index: 3;
  pointer-events: none;
}

#clockbar > * { pointer-events: auto; }

#clockwrap {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(4, 18, 15, 0.9);
  transition: border-color 0.25s, background 0.25s;
}

#state {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--mint);
  white-space: nowrap;
}

#state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: beacon 2.4s ease-out infinite;
}

#clock {
  min-width: 15ch;
  font-family: var(--display);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#clockbar.replay #clockwrap { border-color: rgba(255, 210, 122, 0.45); background: rgba(28, 21, 6, 0.92); }
#clockbar .round { background: rgba(4, 18, 15, 0.9); -webkit-backdrop-filter: none; backdrop-filter: none; }
#clockbar.replay #state { color: var(--replay); }
#clockbar.replay #state i { animation: none; border-radius: 1px; width: 6px; height: 8px; background: none; border-left: 2px solid; border-right: 2px solid; }
#clockbar.replay #clock { color: var(--replay); }

.round {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, background 0.15s;
}

.round svg { width: 18px; height: 18px; }

.round:hover { border-color: var(--edge-hi); background: var(--glass-hi); }

#live {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(90, 242, 192, 0.5);
  background: rgba(90, 242, 192, 0.12);
  color: var(--mint);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

#live svg { width: 18px; height: 18px; }
#live:hover { background: rgba(90, 242, 192, 0.2); }

#live b {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--void);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* Zoom */

#zoom {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#zoom-track {
  position: relative;
  width: 36px;
  height: 180px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  cursor: ns-resize;
  touch-action: none;
}

#zoom-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(120, 255, 210, 0.12);
}

#zoom-fill {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--mint);
  opacity: 0.6;
}

#zoom-mark {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 1px;
  margin-left: -5px;
  background: rgba(222, 247, 238, 0.45);
}

#zoom-thumb {
  position: absolute;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 4px rgba(90, 242, 192, 0.18), 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Side panel */

#side {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(var(--panel-w), calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

#detail, #feed {
  border: 1px solid var(--edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: 18px;
}

#detail {
  position: relative;
  padding: 16px 16px 14px;
  border-color: rgba(255, 210, 122, 0.3);
  animation: settle 0.22s ease-out;
}

#detail .close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}

#detail .close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
#detail .close svg { width: 16px; height: 16px; }

.place {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 32px;
}

.place .flag { width: 28px; height: 21px; border-radius: 3px; }

.place strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.25; }
.place small { display: block; color: var(--muted); font-size: 12px; }

.ip {
  margin: 14px 0 12px;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.02em;
  word-break: break-all;
}

#detail dl {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 13px;
}

#detail dt { color: var(--muted); }
#detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.kind i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.path { color: var(--muted); }

#detail .keys {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--edge);
  color: var(--faint);
  font-size: 12px;
}

kbd {
  font: inherit;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--edge-hi);
  color: var(--muted);
}

#feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#feed > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

#feed h2 { margin: 0; font-family: var(--display); font-size: 15px; font-weight: 500; }

#feed-count { margin: 0; color: var(--muted); font-size: 12px; }

#history {
  flex: 1;
  overflow: auto;
  padding: 0 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 255, 210, 0.2) transparent;
}

.day {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 10px 10px 4px;
  font-size: 12px;
  color: var(--faint);
  background: linear-gradient(rgba(5, 22, 19, 0.96) 70%, rgba(5, 22, 19, 0));
}

.row {
  position: relative;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  column-gap: 10px;
  cursor: pointer;
}

.row .who { min-width: 0; }

.row .who strong {
  display: block;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .who small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.row .who small i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }

.row time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.row:hover { background: rgba(120, 255, 210, 0.06); }

.row.on { background: rgba(255, 210, 122, 0.1); box-shadow: inset 2px 0 0 var(--replay); }
.row.on time { color: var(--replay); }

.row.fresh::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(90, 242, 192, 0.28), rgba(90, 242, 192, 0.04));
  box-shadow: inset 2px 0 0 var(--mint);
  animation: fresh 9s ease-out var(--age, 0s) forwards;
}

.row.fresh time { color: var(--mint); }

.empty { color: var(--muted); padding: 12px 10px; margin: 0; }

/* Legend */

#legend {
  position: fixed;
  left: 24px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--muted);
  max-width: calc(100% - var(--panel-w) - 80px);
}

#legend span { display: inline-flex; align-items: center; gap: 7px; }
#legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
#legend b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

@keyframes beacon {
  0% { box-shadow: 0 0 0 0 rgba(90, 242, 192, 0.6); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(90, 242, 192, 0); }
}

@keyframes fresh {
  0%, 35% { opacity: 1; }
  100% { opacity: 0; }
}

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

@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  #brand { top: 14px; left: 16px; }
  #brand .title { font-size: 15px; }
  #clockbar { top: 62px; left: 12px; right: 12px; flex-wrap: wrap; }
  #clock { font-size: 15px; min-width: 0; }
  #clockwrap { height: 38px; gap: 8px; padding: 0 12px; }
  #state-text { display: none; }
  .round { width: 34px; height: 34px; }
  #live { height: 34px; }
  #zoom { left: 12px; top: 40%; }
  #zoom-track { height: 120px; }
  #side { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; height: 40%; }
  #detail { padding: 12px 14px; flex: none; }
  #detail .ip { margin: 8px 0; font-size: 20px; }
  #feed { min-height: 96px; }
  #legend { display: none; }
}

@media (hover: none) {
  #detail .keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #state i, .row.fresh::after, #detail { animation: none; }
}
