:root {
  --text: #f4f7ff;
  --text-dim: rgba(244, 247, 255, 0.78);
  --glass: rgba(12, 19, 34, 0.36);
  --glass-border: rgba(255, 255, 255, 0.18);
  --ring-track: rgba(255, 255, 255, 0.2);
  --accent: #7aaeff;
  --shadow: 0 14px 34px rgba(4, 9, 20, 0.35);
}

body.theme-light {
  --text: #12203f;
  --text-dim: rgba(18, 32, 63, 0.76);
  --glass: rgba(250, 252, 255, 0.5);
  --glass-border: rgba(30, 46, 90, 0.14);
  --ring-track: rgba(30, 46, 90, 0.15);
  --accent: #2c68dd;
  --shadow: 0 10px 30px rgba(35, 52, 96, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  color: var(--text);
}

body {
  overflow: hidden;
}

.app-background {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(140deg, #12192b, #22375f, #162d4f);
  background-position: center;
  background-size: cover;
  transform: scale(1.08);
  transition: background-image 450ms ease, transform 700ms ease, filter 420ms ease;
  z-index: -3;
}

.app-background.image-loaded {
  filter: saturate(1.1);
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.32) 0%, rgba(4, 8, 16, 0.55) 60%, rgba(4, 8, 16, 0.72) 100%);
  z-index: -2;
}

body.theme-light .app-overlay {
  background: linear-gradient(180deg, rgba(240, 246, 255, 0.32) 0%, rgba(240, 246, 255, 0.48) 60%, rgba(240, 246, 255, 0.62) 100%);
}

.app {
  min-height: 100vh;
  max-width: 940px;
  margin: 0 auto;
  padding: 22px 16px 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.top-icons {
  display: flex;
  gap: 8px;
}

.center-stage {
  align-self: center;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  animation: fade-up 320ms ease;
}

.route-line {
  margin: 0;
  font-size: clamp(1.8rem, 3vw + 1.2rem, 3rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.meta-pill {
  margin: 0;
  padding: 5px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text-dim);
  backdrop-filter: blur(6px);
  font-size: 1rem;
}

.timer-wrap {
  display: flex;
  justify-content: center;
}

.timer-ring {
  position: relative;
  width: min(76vw, 330px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 8;
}

.ring-track {
  stroke: var(--ring-track);
}

.ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 700ms linear;
}

.timer-text {
  position: absolute;
  text-align: center;
}

.mode {
  margin: 0 0 4px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.timer-value {
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 12px 25px rgba(0, 0, 0, 0.28);
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

button,
input[type="range"] {
  font: inherit;
}

.icon-btn {
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 220ms ease;
  box-shadow: var(--shadow);
}

.icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.icon-btn:not(:disabled):hover {
  transform: translateY(-1px) scale(1.02);
}

.primary-btn {
  background: rgba(122, 174, 255, 0.34);
}

.bottom-dock {
  justify-self: center;
  width: min(95vw, 620px);
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 8px;
}

.sound-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: end;
}

.music-panel {
  width: 96px;
}

.footer-dog-track {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.music-sprite {
  position: absolute;
  top: 0;
  left: 0;
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  animation: dog-walk-right 60s linear infinite;
}

.footer-json-sprite {
  --sprite-size: 74px;
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--sprite-size);
  height: var(--sprite-size);
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  animation-name: dog-walk-right;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.footer-json-sprite svg,
.footer-json-sprite canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Edit --sprite-size in each item below to resize individual animations. */
.footer-json-sprite-1 {
  --sprite-size: 84px;
  animation-duration: 66s;
  animation-delay: -9s;
  bottom: -15px;
  animation-direction: reverse;
}

.footer-json-sprite-2 {
  --sprite-size: 86px;
  animation-duration: 70s;
  animation-delay: -22s;
  bottom: 10px;
}

.footer-json-sprite-3 {
  --sprite-size: 82px;
  /* animation-duration: 100s;
  animation-delay: -35s; */
  bottom: -15px;
  animation-direction: reverse;
}

.footer-json-sprite-4 {
  --sprite-size: 80px;
  animation-duration: 52s;
  animation-delay: -14s;
  bottom: -10px;
  animation-direction: reverse;
}

.footer-json-sprite-5 {
  --sprite-size: 88px;
  animation-duration: 78s;
  animation-delay: -41s;
  bottom: 12px;
}

.footer-json-sprite-6 {
  --sprite-size: 106px;
  animation-duration: 48s;
  animation-delay: -27s;
  bottom: -10px;
}

.icon-control {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0 12px;
  height: 42px;
  color: var(--text-dim);
}

.music-toggle {
  min-width: 96px;
  padding: 0 16px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ring-track);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #64ddff, var(--accent));
  transition: width 350ms ease;
}

.progress-text {
  margin: 0;
  text-align: right;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 620px) {
  .sound-strip {
    grid-template-columns: 1fr;
  }

  .bottom-dock {
    width: min(94vw, 420px);
  }
}

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

@keyframes dog-walk-right {
  0% {
    transform: translateX(-64px);
  }
  100% {
    transform: translateX(calc(100vw + 64px));
  }
}
