:root {
  --bg-color: black;
  --text-color: lime;
  --text-color-light-mode: #111;
  --panel-bg: rgba(0, 0, 0, 0.5);
  --glow-color: rgba(0, 255, 0, 0.2);
  --clock-face-bg: rgba(0, 0, 0, 1);
  --clock-face-mid: rgba(0, 255, 0, 0.08);
  --clock-face-edge: rgba(0, 255, 0, 0.04);
  --background-edge: rgba(0, 0, 0, 1);
}

html {
  font-size: 18px;
}

@media (max-width: 768px) {
  html {
    font-size: calc(0.8rem + 0.4vw);
  }
}

@media (max-width: 480px) {
  html {
    font-size: calc(0.6rem + 0.3vw);
  }
}

/* Body styles */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: monospace;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 2vmin;
  box-sizing: border-box;
  transition: background-color 0.3s;
}

.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(
    circle,
    var(--glow-color) 0%,
    var(--background-edge) 100%
  );
  animation:
    backgroundPulse 11s ease-in-out infinite,
    backgroundHue 24s ease-in-out infinite;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: opacity, filter;
}

@keyframes backgroundPulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.78;
  }
}

@keyframes backgroundHue {
  0%,
  100% {
    filter: hue-rotate(0deg) brightness(1);
  }
  50% {
    filter: hue-rotate(34deg) brightness(1.04);
  }
}

.clockShell {
  position: relative;
  z-index: 0;
  width: 80vmin;
  height: 80vmin;
  max-width: 80vmin;
  max-height: 80vmin;
  min-width: 50vmin;
  min-height: 50vmin;
  isolation: isolate;
}

.clockShell::before,
.clockShell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.clockShell::before {
  inset: 4%;
  z-index: 0;
  background: var(--clock-face-bg);
  box-shadow: 0 0 3vmin var(--clock-face-edge);
}

.clockShell::after {
  inset: 4%;
  z-index: 1;
  background: radial-gradient(
    circle,
    var(--clock-face-mid) 0%,
    var(--clock-face-mid) 44%,
    var(--clock-face-edge) 68%,
    transparent 100%
  );
}

svg {
  position: relative;
  z-index: 2;
  background-color: transparent;
  fill: none;
  width: 100%;
  height: 100%;
}

svg line,
svg circle[stroke="lime"] {
  fill: none;
}

svg text[fill="lime"],
svg circle[fill="lime"] {
  fill: lime;
}

#minuteHand,
#hourHand,
#secondHand {
  filter: drop-shadow(0 0 5px var(--text-color));
  transition: none;
}

@media (max-width: 768px) {
  .clockShell {
    width: 90vmin;
    height: 90vmin;
    min-width: 40vmin;
    min-height: 40vmin;
  }
}

@media (max-width: 480px) {
  .clockShell {
    width: 95vmin;
    height: 95vmin;
    min-width: 35vmin;
    min-height: 35vmin;
  }
}

#quote {
  position: absolute;
  top: 8vh;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-color);
}

#toggleTheme,
#toggleMode,
#toggleSeconds {
  position: absolute;
  background: none;
  border: 0.1vmin solid var(--text-color);
  color: var(--text-color);
  padding: 0.5vmin 1vmin;
  font-family: monospace;
  cursor: pointer;
  z-index: 20;
}

#toggleTheme {
  right: 1vmin;
  top: 1vmin;
}

#toggleMode {
  left: 1vmin;
  top: 1vmin;
}

#toggleSeconds {
  left: 1vmin;
  top: 4vmin;
}

#digital {
  font-size: 1.5rem;
  color: var(--text-color);
  position: absolute;
  top: 1vh;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 20;
}

#locationControls {
  position: absolute;
  bottom: 1vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: monospace;
  color: var(--text-color);
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5vmin;
  justify-content: center;
  align-items: center;
  background: var(--panel-bg);
  padding: 1vmin;
  border-radius: 0.5vmin;
  max-width: 95%;
  z-index: 20;
}

#locationControls label {
  margin-right: 0.3vmin;
}

#locationControls input::placeholder {
  color: var(--text-color);
  opacity: 0.6;
}

#locationControls input,
#locationControls button {
  background: none;
  border: 0.1vmin solid var(--text-color);
  color: var(--text-color);
  padding: 0.3vmin 0.4vmin;
  font-family: monospace;
  font-size: 0.7rem;
  width: auto;
  min-width: 8vmin;
  box-sizing: border-box;
}

#locationControls button:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
  cursor: pointer;
}

#locationControls select {
  background: none;
  border: 0.1vmin solid var(--text-color);
  color: var(--text-color);
  padding: 0.3vmin 0.4vmin;
  font-family: monospace;
  font-size: 0.7rem;
  width: auto;
  min-width: 10vmin;
}

#locationControls select option {
  background-color: black;
  color: lime;
}

#syncInput {
  width: 12vmin !important;
}

#startup {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: black;
  color: lime;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-width: 768px) {
  #quote {
    top: 8vh;
    font-size: 0.9rem;
  }

  #toggleMode {
    left: 1vmin;
    top: 1vmin;
  }

  #toggleSeconds {
    left: 1vmin;
    top: 3.5vmin;
  }

  #toggleTheme {
    right: 1vmin;
    top: 1vmin;
  }

  #digital {
    font-size: 1.2rem;
  }

  #locationControls {
    bottom: 1vh;
    font-size: 0.8rem;
    padding: 0.8vmin;
    gap: 0.5vmin;
  }

  #locationControls input,
  #locationControls button,
  #locationControls select {
    font-size: 0.8rem;
    padding: 0.3vmin 0.5vmin;
    min-width: 8vmin;
    width: auto;
  }

  #locationControls select {
    min-width: 12vmin;
    width: auto;
  }
}

@media (max-width: 480px) {
  #quote {
    top: 6vh;
    font-size: 0.8rem;
  }

  #toggleMode,
  #toggleSeconds,
  #toggleTheme {
    font-size: 0.8rem;
    padding: 0.3vmin 0.6vmin;
  }

  #digital {
    font-size: 1rem;
  }

  #locationControls {
    bottom: 0.5vh;
    font-size: 0.7rem;
    padding: 0.5vmin;
  }

  #locationControls input,
  #locationControls button,
  #locationControls select {
    font-size: 0.7rem;
    padding: 0.2vmin 0.4vmin;
    min-width: 6vmin;
    width: auto;
  }

  #locationControls select {
    min-width: 10vmin;
  }
}

.martian-glow {
  filter: none;
}

body.martian-background {
  background-color: rgba(139, 0, 0, 0.2);
}

.binary-pulse {
  filter: drop-shadow(0 0 8px var(--text-color));
}

.hex-cyan {
  stroke: cyan !important;
}

svg circle[stroke="lime"],
svg line[stroke="lime"],
svg text[fill="lime"],
svg circle[fill="lime"] {
  transition:
    stroke 0.3s,
    fill 0.3s;
}

button {
  transition: transform 0.1s ease;
}

button:hover {
  transform: scale(1.04);
}

button:focus-visible,
#toggleTheme:focus-visible,
#toggleMode:focus-visible,
#toggleSeconds:focus-visible,
#locationControls button:focus-visible,
#locationControls input:focus-visible,
#locationControls select:focus-visible {
  outline: 2px solid lime;
  outline-offset: 2px;
}
