:root {
  --ink: #3f2020;
  --muted: #806265;
  --line: #f2c1a6;
  --paper: #fff8f3;
  --surface: #fffdfb;
  --accent: #ff8a4c;
  --accent-strong: #d83a62;
  --accent-soft: #ffd6b8;
  --warm-yellow: #ffc15a;
  --glow-one: rgba(255, 193, 90, 0.38);
  --glow-two: rgba(216, 58, 98, 0.14);
  --background-start: #fff8f3;
  --background-end: #fff1e7;
  --character-end: #f28a83;
  --button-hover: #ff9b68;
  --shadow: 0 16px 36px rgba(169, 65, 55, 0.16), 0 3px 8px rgba(169, 65, 55, 0.08);
  --ring-shadow: 0 8px 20px rgba(216, 58, 98, 0.18);
  --pulse-shadow: rgba(216, 58, 98, 0.42);
  --liquid: #ff8a4c;
  --liquid-soft: #ffc79c;
  --liquid-well: #fff1e7;
  --cursor-glow: rgba(255, 138, 76, 0.2);
  --glass-fill: rgba(255, 253, 251, 0.55);
  --glass-edge: rgba(255, 255, 255, 0.7);
  --glass-sheen: rgba(255, 255, 255, 0.5);
}

* {
  box-sizing: border-box;
}

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

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
}

.blob-one {
  width: 52vmax;
  height: 52vmax;
  left: -14%;
  top: -12%;
  background: radial-gradient(circle at 50% 50%, var(--glow-one), transparent 68%);
  animation: drift-one 26s ease-in-out infinite alternate;
}

.blob-two {
  width: 46vmax;
  height: 46vmax;
  right: -14%;
  bottom: -14%;
  background: radial-gradient(circle at 50% 50%, var(--glow-two), transparent 68%);
  animation: drift-two 34s ease-in-out infinite alternate;
}

.blob-three {
  width: 38vmax;
  height: 38vmax;
  left: 34%;
  top: 38%;
  opacity: 0.6;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 70%);
  animation: drift-three 42s ease-in-out infinite alternate;
}

.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--cursor-glow), transparent 58%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
  will-change: transform;
}

.cursor-glow.is-active {
  opacity: 1;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background:
    radial-gradient(circle at 88% 10%, var(--glow-one), transparent 25%),
    radial-gradient(circle at 8% 88%, var(--glow-two), transparent 27%),
    linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
  background-size: 115% 115%, 120% 120%, 100% 100%;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  animation: page-enter 700ms ease both, ambient-drift 18s ease-in-out 700ms infinite alternate;
}

header,
footer {
  position: relative;
  z-index: 1;
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 14px clamp(20px, 7vw, 112px);
  border-color: var(--line);
}

header {
  justify-content: space-between;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  animation: slide-down 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

footer {
  justify-content: space-between;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  background: var(--surface);
  animation: slide-up 700ms cubic-bezier(0.22, 1, 0.36, 1) 160ms both;
}

.runtime {
  margin: 0;
}

.github-link {
  padding: 9px 15px;
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

@media (hover: hover) {
  .github-link:hover {
    background: var(--accent-soft);
    transform: translateY(-1px);
  }
}

.github-link:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.brand {
  color: var(--ink);
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.header-note {
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.repository-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

@media (hover: hover) {
  .repository-link:hover {
    background: var(--accent-soft);
    transform: translateY(-1px);
  }
}

.repository-link:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 1;
  place-items: center;
  padding: clamp(18px, 4vh, 42px) 24px;
}

.panel {
  position: relative;
  width: min(100%, 580px);
  padding: clamp(24px, 4vh, 42px) clamp(28px, 5vw, 56px);
  border: 1px solid var(--glass-edge);
  border-radius: 32px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.72), var(--glass-fill) 55%, rgba(255, 255, 255, 0.38));
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.45),
    inset 1px 0 0 rgba(255, 255, 255, 0.5),
    inset -1px 0 0 rgba(255, 255, 255, 0.5),
    inset 0 24px 46px rgba(255, 255, 255, 0.4);
  text-align: center;
  overflow: hidden;
  animation: panel-enter 800ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(104deg, transparent 26%, var(--glass-sheen) 44%, rgba(255, 255, 255, 0.12) 52%, transparent 68%);
  transform: translateX(-58%);
  pointer-events: none;
  animation: glass-sheen 9s ease-in-out infinite alternate;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel {
    background: var(--surface);
  }

  .panel::after {
    display: none;
  }
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: fade-up 600ms ease 420ms both;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  animation: fade-up 650ms ease 500ms both;
}

.target {
  margin: 12px 0 22px;
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  overflow-wrap: anywhere;
  animation: fade-up 650ms ease 580ms both;
}

.countdown {
  position: relative;
  width: clamp(158px, 48vw, 214px);
  aspect-ratio: 1;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fade-up 650ms ease 640ms both, breathe 3.2s ease-in-out 1.4s infinite;
}

.liquid {
  display: block;
  width: 100%;
  height: 100%;
}

.liquid-well-base {
  fill: var(--liquid-well);
}

.liquid-well {
  fill: url(#well-gradient);
}

.liquid-rider {
  position: absolute;
  left: 50%;
  top: 1.5%;
  width: 42%;
  aspect-ratio: 1 / 1.15;
  transform: translate(-50%, -92%);
  pointer-events: none;
}

.rider-mascot {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  animation: rider-bob 2.8s ease-in-out infinite;
}

@keyframes rider-bob {
  0%,
  100% { transform: translateY(0) rotate(-2.5deg); }
  50% { transform: translateY(-4%) rotate(2.5deg); }
}

.liquid-ring {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 3;
  animation: ring-glow 3s ease-in-out infinite;
}

.liquid-back {
  fill: var(--liquid-soft);
  opacity: 0.9;
}

.liquid-front {
  fill: var(--liquid);
}

.bubble {
  fill: rgba(255, 255, 255, 0.75);
  opacity: 0;
  animation: bubble-rise 3.2s ease-in infinite;
}

.bubble-two { animation-duration: 4.1s; animation-delay: 0.7s; }
.bubble-three { animation-duration: 2.6s; animation-delay: 1.4s; }
.bubble-four { animation-duration: 3.7s; animation-delay: 2.1s; }

@keyframes bubble-rise {
  0% { transform: translateY(0); opacity: 0; }
  22% { opacity: 0.85; }
  78% { opacity: 0.6; }
  100% { transform: translateY(-44px); opacity: 0; }
}

.wave-flow {
  animation: wave-slide 3.4s linear infinite;
}

.wave-flow-slow {
  animation: wave-slide 5.2s linear infinite reverse;
}

@keyframes wave-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50px); }
}

.countdown.is-final {
  animation: breathe 640ms ease-in-out infinite;
}

.countdown.is-final .liquid-ring {
  animation-duration: 900ms;
}

.countdown-readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.seconds {
  display: block;
  color: var(--ink);
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.seconds-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.loading-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 22px;
  margin: 0 0 8px;
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  transition: opacity 190ms ease, transform 190ms ease;
  animation: fade-up 650ms ease 720ms both;
}

.loading-note::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  animation: dot-pulse 1.4s ease-in-out infinite;
}

.loading-note.is-out {
  opacity: 0;
  transform: translateY(-4px);
}

.message {
  margin: 0;
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  animation: fade-up 650ms ease 780ms both;
}

.fallback {
  display: inline-block;
  margin-top: 16px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 4px 10px var(--pulse-shadow);
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  animation: fade-up 650ms ease 820ms both, button-pulse 3.8s ease-in-out 2s infinite;
}

@media (hover: hover) {
  .fallback:hover {
    background: var(--button-hover);
    box-shadow: 0 7px 14px var(--pulse-shadow);
    text-decoration: none;
    transform: translateY(-2px);
  }
}

.fallback:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

@keyframes breathe {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes page-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ambient-drift {
  from { background-position: 0% 0%, 100% 100%, 0% 0%; }
  to { background-position: 8% 5%, 92% 94%, 0% 0%; }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ring-glow {
  0%,
  100% { stroke: var(--accent-soft); }
  50% { stroke: var(--accent); }
}

@keyframes dot-pulse {
  0%,
  100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes button-pulse {
  0%,
  70%,
  100% { box-shadow: 0 4px 10px var(--pulse-shadow); }
  82% { box-shadow: 0 7px 20px var(--pulse-shadow); }
}

@keyframes drift-one {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(14vw, 10vh, 0) scale(1.16); }
}

@keyframes drift-two {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to { transform: translate3d(-12vw, -9vh, 0) scale(1); }
}

@keyframes drift-three {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-10vw, 12vh, 0) scale(1.22); }
}

@keyframes glass-sheen {
  from { transform: translateX(-58%); }
  to { transform: translateX(58%); }
}

@media (max-width: 520px) {
  header,
  footer {
    min-height: 68px;
    padding: 16px 20px;
  }

  footer {
    flex-direction: column;
    gap: 12px;
  }

  .header-note {
    display: none;
  }

  main {
    padding: 18px 16px 24px;
  }

  .panel {
    padding: 24px 22px 28px;
    border-radius: 26px;
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
  }

  .cursor-glow {
    width: 230px;
    height: 230px;
    margin: -115px 0 0 -115px;
  }

  .countdown {
    width: clamp(136px, 52vw, 168px);
    margin-bottom: 16px;
  }

  .loading-note {
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .panel {
    width: min(100%, 620px);
  }

  .countdown {
    width: clamp(190px, 26vw, 224px);
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  header,
  footer {
    min-height: 52px;
    padding: 10px clamp(20px, 7vw, 112px);
  }

  main {
    padding: 12px 20px;
  }

  .panel {
    padding: 18px 28px 22px;
  }

  h1 {
    font-size: clamp(22px, 4vw, 30px);
  }

  .countdown {
    width: clamp(112px, 28vh, 138px);
    margin-bottom: 12px;
  }

  .loading-note,
  .message {
    margin-bottom: 4px;
  }

  .fallback {
    margin-top: 10px;
    padding: 10px 20px;
  }
}

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