@property --top {
  syntax: "<color>";
  inherits: true;
  initial-value: #dff6ff;
}

@property --middle {
  syntax: "<color>";
  inherits: true;
  initial-value: #91d0f4;
}

@property --bottom {
  syntax: "<color>";
  inherits: true;
  initial-value: #3d92ce;
}

:root {
  --top: #dff6ff;
  --middle: #91d0f4;
  --bottom: #3d92ce;
  --text: #f8fbff;
  --muted: rgba(248, 251, 255, 0.68);
  --panel: rgba(7, 12, 36, 0.22);
  --status-bg: rgba(5, 12, 35, 0.18);
  --line: rgba(255, 255, 255, 0.22);
  --shadow: rgba(0, 0, 0, 0.28);
  --weather-tint: rgba(255, 255, 255, 0);
  --weather-opacity: 0;
  --grain-opacity: 0.03;
  --horizon-glow: rgba(255, 255, 255, 0.28);
  --celestial-glow: rgba(255, 255, 255, 0.28);
  --star-opacity: 0;
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #080b22;
  overflow-x: hidden;
}

.hero {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(22px, 5vw, 72px);
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(135deg, var(--top), var(--middle), var(--bottom), var(--middle));
  background-size: 240% 240%;
  animation: gradient-flow 24s ease-in-out infinite;
  isolation: isolate;
  transition:
    --top 2400ms ease,
    --middle 2400ms ease,
    --bottom 2400ms ease,
    color 900ms ease;
}

.hero::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    linear-gradient(120deg, var(--weather-tint), transparent 64%),
    radial-gradient(circle at var(--glow-x, 18%) var(--glow-y, 20%), var(--celestial-glow), transparent 30%),
    radial-gradient(ellipse at 50% 102%, var(--horizon-glow), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.28));
  opacity: 0.92;
  pointer-events: none;
  transition: background 900ms ease;
}

.hero::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, var(--star-opacity)) 0 1px, transparent 1.8px),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, calc(var(--star-opacity) * 0.75)) 0 1px, transparent 1.8px),
    radial-gradient(circle at 84% 52%, rgba(255, 255, 255, calc(var(--star-opacity) * 0.6)) 0 1px, transparent 1.8px),
    radial-gradient(circle at 22% 24%, rgba(255, 255, 255, var(--grain-opacity)), transparent 24%),
    radial-gradient(circle at 78% 76%, rgba(3, 12, 26, var(--grain-opacity)), transparent 28%);
  background-size: 260px 220px, 340px 260px, 300px 240px, 100% 100%, 100% 100%;
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  opacity: 1;
  pointer-events: none;
}

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.content {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 820px);
  gap: clamp(16px, 3vw, 26px);
  justify-items: center;
  text-align: center;
  animation: content-enter 680ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.weather-status {
  position: fixed;
  right: clamp(10px, 4vw, 30px);
  bottom: clamp(10px, 4vw, 30px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 20px);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--status-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  backdrop-filter: blur(32px) saturate(2);
  box-shadow: 0 8px 32px var(--shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden; /* Prevent any wrapping */
}

@media (max-width: 600px) {
  .weather-status {
    font-size: 0.68rem;
    padding: 6px 12px;
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    scrollbar-width: none;
  }
}

.weather-status[hidden],
body[data-page-mode="archive"] .weather-status {
  display: none !important;
}

.weather-status::-webkit-scrollbar {
  display: none;
}

.weather-status:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.weather-updated {
  display: inline-block;
  animation: update-flash 1200ms ease-out;
}

@keyframes update-flash {
  0% {
    opacity: 0.4;
    filter: brightness(1.5);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.8rem, 15vw, 10rem);
  line-height: 0.82;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-wrap: balance;
  filter: drop-shadow(0 20px 60px var(--shadow));
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 700;
}

.counter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(22px);
  transition:
    background 900ms ease,
    border-color 900ms ease,
    box-shadow 900ms ease;
}

.counter {
  display: grid;
  width: min(100%, 760px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: clamp(6px, 1.5vw, 12px);
  padding: clamp(10px, 2vw, 14px);
}

.counter-unit {
  display: grid;
  min-width: 0;
  min-height: clamp(88px, 14vw, 134px);
  place-items: center;
  padding: clamp(10px, 2vw, 16px);
}

.counter-unit strong {
  font-size: clamp(2.7rem, 8vw, 5.8rem);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.counter-unit strong.is-changing {
  animation: number-tick 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.counter-unit:nth-child(2) { animation-delay: 70ms; }
.counter-unit:nth-child(3) { animation-delay: 140ms; }
.counter-unit:nth-child(4) { animation-delay: 210ms; }

.counter-unit span {
  color: var(--muted);
  font-size: clamp(0.68rem, 1.8vw, 0.82rem);
  font-weight: 800;
  text-transform: uppercase;
}


.counter {
  transform-origin: center;
  animation: counter-enter 760ms 120ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.counter:hover {
  transform: translateY(-2px);
}

.counter-unit {
  animation: counter-unit-enter 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.counter-unit strong {
  display: inline-block;
}

.history-panel:not([hidden]) {
  animation: panel-enter 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.history-item {
  animation: history-item-enter 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes content-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.985); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes counter-enter {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes counter-unit-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes number-tick {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  38% { transform: translateY(-3px) scale(1.035); filter: brightness(1.18); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes panel-enter {
  from { opacity: 0; backdrop-filter: blur(8px) saturate(1); }
  to { opacity: 1; backdrop-filter: blur(30px) saturate(1.35); }
}

@keyframes history-item-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes gradient-flow {
  0%,
  100% {
    background-position: 0% 48%;
  }

  50% {
    background-position: 100% 52%;
  }
}




body[data-page-mode="complete"] .counter {
  display: none;
}

body[data-page-mode="live"] .home-link,
body[data-page-mode="complete"] .home-link {
  display: none;
}


body[data-page-mode="archive"] .hero {
  background: #08122d;
  animation: none;
}

body[data-page-mode="archive"] .hero::before {
  background: none;
  opacity: 0;
}

body[data-page-mode="archive"] .atmosphere {
  opacity: 1;
}

body[data-page-mode="archive"] .hero::after {
  opacity: 0;
}

.archive-summary {
  display: grid;
  width: min(100%, 760px);
  min-height: clamp(132px, 18vw, 190px);
  place-items: center;
  gap: 10px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px);
  text-align: center;
}

.archive-summary[hidden] {
  display: none;
}

.archive-summary span {
  color: var(--muted);
  font-size: clamp(0.7rem, 1.6vw, 0.82rem);
  font-weight: 850;
  text-transform: uppercase;
}

.archive-summary strong {
  max-width: 18ch;
  font-size: clamp(2rem, 6.8vw, 4.6rem);
  line-height: 0.96;
  font-weight: 900;
  text-wrap: balance;
}

.archive-summary small {
  color: var(--muted);
  font-size: clamp(0.78rem, 1.7vw, 0.95rem);
  font-weight: 750;
}


.home-link {
  display: inline-grid;
  min-height: 42px;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--status-bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
  backdrop-filter: blur(22px);
  box-shadow: 0 12px 38px var(--shadow);
}

.home-link[hidden] {
  display: none;
}

.home-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.32);
}
.history-shell {
  position: fixed;
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}


body[data-page-mode="archive"] .home-link,
body[data-page-mode="archive"] .history-toggle {
  background: rgba(5, 12, 35, 0.18);
  color: #f8fbff;
  border-color: rgba(255, 255, 255, 0.22);
}

.history-toggle {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--status-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(22px);
  box-shadow: 0 12px 38px var(--shadow);
  transition:
    background 240ms ease,
    border-color 240ms ease,
    transform 240ms ease;
}

.history-toggle:hover,
.history-toggle[aria-expanded="true"] {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.32);
}

.history-panel {
  position: fixed;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(22px, 5vw, 72px);
  background: rgba(5, 12, 35, 0.72);
  color: var(--text);
  backdrop-filter: blur(30px) saturate(1.35);
  overflow-y: auto;
}

.history-panel[hidden] {
  display: none;
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 900px);
  margin: 0 auto;
  gap: 16px;
}

.history-panel-header strong {
  font-size: clamp(2rem, 8vw, 5rem);
  line-height: 0.9;
  font-weight: 900;
}

.history-close {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.history-list {
  display: grid;
  width: min(100%, 900px);
  margin: 0 auto;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.history-item strong,
.history-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-item strong {
  font-size: 0.9rem;
  font-weight: 900;
}

.history-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.history-item a {
  display: inline-grid;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.history-item a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.history-empty {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

@media (max-width: 680px) {
  .hero {
    min-height: 100dvh;
    padding: 22px;
  }

  h1 {
    font-size: clamp(3.2rem, 20vw, 5.3rem);
  }

  .counter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .counter-unit {
    min-height: 92px;
    padding: 10px 6px;
  }

  .weather-status {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
