@font-face {
  font-family: 'TimeTraveler';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/TimeTravelerPal-Normal-Regular.ttf') format('truetype');
}

body {
  background-color: #2c333f;
  overflow: hidden;
  transition: background-color 0.3s ease;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.light-mode {
  background-color: #ffffff;
}

body.dark-mode {
  background-color: #2c333f;
}

div {
  box-sizing: border-box;
}

#mainContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2vh;
  width: 100%;
  padding: 2vh 5vw;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  #mainContent {
    padding: 2vh 3vw;
  }
}

#digitalClock {
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: 8vmin;
  color: #b3b3b3;
  text-align: center;
  font-weight: bold;
  letter-spacing: 0.2em;
  transition: color 0.3s ease;
}

body.dark-mode #digitalClock {
  color: #ffffff;
}

body.light-mode #digitalClock {
  color: #4a4a4a;
}

#timerContainer {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: min(80vmin, 90vw, calc(100vh - 20vh - 64px));
  max-height: min(80vmin, 90vw, calc(100vh - 20vh - 64px));
  border-radius: 50%;
  --timer-radius: calc(min(80vmin, 90vw, calc(100vh - 20vh - 64px)) / 2);
}

@media (max-width: 768px) {
  #timerContainer {
    max-width: min(94vw, calc(100vh - 20vh - 64px));
    max-height: min(94vw, calc(100vh - 20vh - 64px));
    --timer-radius: calc(min(94vw, calc(100vh - 20vh - 64px)) / 2);
  }
}

#timerMarks {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
}

.timer-tick {
  position: absolute;
  width: 2px;
  height: 5%;
  top: 6.25%;
  left: 50%;
  margin-left: -1px;
  transform-origin: 50% calc(var(--timer-radius) * 0.875);
}

.timer-tick-minor {
  background-color: #ffffff;
  opacity: 0.4;
  height: 4%;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.timer-tick-major {
  background-color: #ffffff;
  opacity: 0.7;
  height: 6%;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

body.dark-mode .timer-tick-minor {
  background-color: #ffffff;
  opacity: 0.4;
}

body.dark-mode .timer-tick-major {
  background-color: #ffffff;
  opacity: 0.7;
}

body.light-mode .timer-tick-minor {
  background-color: #999;
  opacity: 0.6;
}

body.light-mode .timer-tick-major {
  background-color: #4a4a4a;
  opacity: 1;
}

.timer-number {
  position: absolute;
  width: 10%;
  height: 10%;
  top: 50%;
  left: 50%;
  margin-top: -5%;
  margin-left: -5%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: calc(var(--timer-radius) * 0.1125);
  font-weight: normal;
  color: #ffffff;
  opacity: 0.7;
  transform-origin: center center;
  transition: opacity 0.3s ease, color 0.3s ease;
  pointer-events: none;
}

body.dark-mode .timer-number {
  color: #ffffff;
  opacity: 0.7;
}

body.light-mode .timer-number {
  color: #4a4a4a;
  opacity: 1;
}

#timerDisk {
  position: absolute;
  width: 87.5%;
  height: 87.5%;
  top: 6.25%;
  left: 6.25%;
  border-radius: 50%;
  border-width: 5px;
  border-style: solid;
  border-color: hsl(0, 0%, 16%);
  transition: border-color 0.3s ease;
}

@media (max-width: 768px) {
  #timerDisk {
    border-width: 3px;
  }
}

@media (max-width: 480px) {
  #timerDisk {
    border-width: 2px;
  }
}

body.dark-mode #timerDisk {
  border-color: rgba(255, 255, 255, 0.7);
}

body.light-mode #timerDisk {
  border-color: #4a4a4a;
}

#timerDiskHole {
  display: inline-block;
  position: absolute;
  width: 20%;
  height: 20%;
  left: 40%;
  top: 40%;
  border-radius: 50%;
  border-style: solid;
  border-color: rgb(40, 40, 40);
  border-width: 5px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

@media (max-width: 768px) {
  #timerDiskHole {
    border-width: 3px;
  }
}

@media (max-width: 480px) {
  #timerDiskHole {
    border-width: 2px;
  }
}

body.light-mode #timerDiskHole {
  border-color: #d0d0d0;
  background-color: #f8f8f8;
}

#timerDisk > svg > path:nth-child(1) {
 stroke: #2c333f;
 transition: stroke 0.3s ease;
}

body.light-mode #timerDisk > svg > path:nth-child(1) {
 stroke: #ffffff;
}

#timerDisk > svg > path:nth-child(2) {
 stroke: #c11535;
 transition: stroke 0.3s ease;
}

body.light-mode #timerDisk > svg > path:nth-child(2) {
 stroke: #c11535;
}

#timerGroundEnd {
  position: absolute;
  width: 100px;
  height: calc(40% + 5px);
  top: 0px;
  left: 50%;
  background: transparent;
  clip: rect(-53px 6px 1000 -1000px);
  transition: background 0.3s ease;
}

body.light-mode #timerGroundEnd {
  background: transparent;
}

#timerBarEnd {
  display: none;
}

body.light-mode #timerBarEnd {
  background: rgba(100, 100, 100, 0.3);
}

#timerBarKnob {
  position: absolute;
  height: 16px;
  width: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  transform-origin: 8px 8px;
  background-color: #b3b3b3;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

@media (max-width: 768px) {
  #timerBarKnob {
    height: 12px;
    width: 12px;
    margin-left: -6px;
    margin-top: -6px;
    transform-origin: 6px 6px;
  }
}

@media (max-width: 480px) {
  #timerBarKnob {
    height: 10px;
    width: 10px;
    margin-left: -5px;
    margin-top: -5px;
    transform-origin: 5px 5px;
  }
}

body.light-mode #timerBarKnob {
  background-color: #4a4a4a;
}

#timerTime {
  display: inline-block;
  position: absolute;
  width: 20%;
  height: 20%;
  left: 40%;
  top: 39%;
  padding-top: 8%;
  text-align: center;
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: 4.0vmin;
  border-radius: 50%;
  color: #444444;
  transition: color 0.3s ease, background-color 0.3s ease;
}

body.dark-mode #timerTime {
  color: #ffffff;
  background-color: #2c333f;
}

body.light-mode #timerTime {
  color: #4a4a4a;
  background-color: #ffffff;
}

#optionButtons {
    position: absolute;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    padding: 16px;
}

#optionButtons > div {
  position: relative;
  height: 32px;
  width: 32px;
  margin: 0 8px;
  cursor: pointer;
}

#optionButtons > div > button {
  display: block;
  height: 100%;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

#optionButtons > div::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  right: 0;
  transform: translateY(-8px);
  background-color: rgba(0, 0, 0, 0.9);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

#optionButtons > div:hover::after {
  opacity: 1;
  transform: translateY(-4px);
}

body.light-mode #optionButtons > div::after {
  background-color: rgba(0, 0, 0, 0.85);
}

#optionButtons > div img {
  height: 100%;
  width: 100%;
  filter: invert(70%);
}

#buyMeCoffee > a > img {
  height: 100%;
  width: 100%;
}

#timerAlarmControl {
  overflow: visible;
  cursor: default;
}

#timerAlarmMenu {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  min-width: 222px;
  padding: 12px;
  border: 2px solid #1c1c1c;
  border-radius: 18px;
  background-color: #ffffff;
  color: #1c1c1c;
  z-index: 20;
  cursor: default;
}

body.dark-mode #timerAlarmMenu {
  border-color: rgba(255, 255, 255, 0.45);
  background-color: #39404d;
  color: #ffffff;
}

#timerAlarmMenu.is-open {
  display: block;
}

.audio-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-menu-row + .audio-menu-row {
  margin-top: 10px;
}

.audio-menu-label {
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.1;
  white-space: nowrap;
  font-weight: normal;
}

.audio-menu-state,
.audio-menu-duration {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 32px;
  padding: 4px 12px;
  border: 2px solid #1c1c1c;
  border-radius: 8px;
  box-sizing: border-box;
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
  font-weight: normal;
  background-color: #ffffff;
  color: #1c1c1c;
}

.audio-menu-state {
  cursor: pointer;
}

.audio-menu-state.is-muted {
  background-color: #d63a33;
  color: #ffffff;
}

.audio-menu-state.is-unmuted {
  background-color: #ffffff;
  color: #1c1c1c;
}

.audio-menu-duration-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.audio-menu-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid #1c1c1c;
  border-radius: 8px;
  box-sizing: border-box;
  background-color: #ffffff;
  color: #1c1c1c;
  font-family: 'TimeTraveler', Arial, sans-serif;
  font-size: 20px;
  line-height: 1;
  font-weight: normal;
  cursor: pointer;
}

.audio-menu-duration {
  min-width: 0;
  width: 44px;
  padding: 4px 8px;
  cursor: default;
}

body.light-mode #timerAlarmMenu {
  background-color: #ffffff;
}

body.light-mode .audio-menu-state.is-unmuted,
body.light-mode .audio-menu-duration {
  background-color: #ffffff;
}

body.dark-mode .audio-menu-state.is-unmuted,
body.dark-mode .audio-menu-duration,
body.dark-mode .audio-menu-stepper {
  border-color: rgba(255, 255, 255, 0.45);
  background-color: #2c333f;
  color: #ffffff;
}

#versionInfo {
  position: fixed;
  bottom: 8px;
  left: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  z-index: 10;
  cursor: default;
  transition: color 0.3s ease;
}

body.light-mode #versionInfo {
  color: rgba(0, 0, 0, 0.3);
}

#versionInfo::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background-color: rgba(0, 0, 0, 0.9);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  transition-delay: 0.1s;
  z-index: 100;
}

#versionInfo:hover::after {
  opacity: 1;
}

body.light-mode #versionInfo::after {
  background-color: rgba(0, 0, 0, 0.85);
}

.github-corner::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 80px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.9);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
}

.github-corner:hover::after {
  opacity: 1;
}

body.light-mode .github-corner::after {
  background-color: rgba(0, 0, 0, 0.85);
}

#buyMeCoffee {
  display: flex;
  align-items: center;
  height: 32px;
  width: 32px;
}

#buyMeCoffee > a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

#optionButtons > #timerAlarmControl.menu-open::after,
#optionButtons > #timerAlarmControl.menu-open:hover::after {
  opacity: 0;
  pointer-events: none;
}
