/* Basic reset and body styling */
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background-color: #fff;
  min-height: 100vh;
  position: relative;
  line-height: 1.4;
}

/* Main Title and underline */
h1.main-title {
  font-size: 2.1em;
  font-weight: bold;
  margin: 24px 0 8px;
  text-align: center;
  color: #333;
  letter-spacing: 0.03em;
}
hr.main-title-underline {
  width: 450px;
  border: none;
  border-top: 2.5px solid #2e5aaa88;
  margin: 0 auto 24px;
  display: block;
}

/* Controls styling */
.controls {
  display: flex;
  gap: 13px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.controls label {
  font-weight: 500;
  font-size: 1.1em;
  margin-right: 6px;
}

.compact-time {
  font-size: 0.95em;
  letter-spacing: 0.08em;
  padding: 6px 18px;
  border: 1px solid #aaa;
  border-radius: 4px;
  width: 132px;
  min-width: 128px;
  max-width: 142px;
  height: 34px;
  box-sizing: border-box;
  background: #f2f5ff;
  font-family: "Segoe UI Mono", "Consolas", monospace;
  text-align: left;
  display: inline-block;
}

.controls button {
  font-size: 1.07em;
  background-color: #325bb7;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.22s;
  opacity: 0.7;
}

.controls button.active {
  opacity: 1;
  pointer-events: auto;
}

.controls button:disabled {
  opacity: 0.7;
  pointer-events: none;
  cursor: not-allowed;
}

/* Clocks grid container with spacing */
.clocks-row {
  width: 90%;
  max-width: 1080px;
  margin: 0 auto 68px auto;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(4, 1fr);
  justify-content: center;
  align-items: start;
  padding: 0 12px;
  box-sizing: border-box;
}

/* Tablet: 2 columns layout */
@media (max-width: 900px) {
  .clocks-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 0 10px;
  }
}

/* Mobile: 2 columns, smaller clocks */
@media (max-width: 640px) {
  .clocks-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 0 8px;
  }
  .clock {
    width: 160px;
    height: 160px;
  }
  .clock-container {
    max-width: 170px;
  }
  .clock-label {
    font-size: 0.93em;
    padding: 2.5px 10px;
  }
}

/* Extra small phones: 1 column layout */
@media (max-width: 400px) {
  .clocks-row {
    grid-template-columns: 1fr;
    padding: 0 4vw;
    gap: 10px;
  }
  .clock {
    width: 130px;
    height: 130px;
  }
  .clock-container {
    max-width: 130px;
  }
  .clock-label {
    font-size: 0.85em;
    padding: 2px 6px;
  }
}

/* Individual clock container */
.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 238px;
  position: relative;
  margin-bottom: 7px;
}

/* Clock styling */
.clock {
  width: 200px;
  height: 200px;
  background: #fff;
  border: 6px solid #333;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 4px rgba(0,0,0,.07), 0 2px 10px rgba(0,0,0,.16);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 7px;
}

.clock-face {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Clock Hands */
.hand {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: left center;
  pointer-events: none;
  z-index: 4;
}

.hour-hand {
  width: 50px;
  height: 7px;
  background: #222;
  border-radius: 7px;
  margin-top: -3.5px;
}

.min-hand {
  width: 72px;
  height: 4px;
  background: #555;
  border-radius: 4px;
  margin-top: -2px;
}

.second-hand {
  width: 85px;
  height: 2px;
  background: #d11;
  border-radius: 2px;
  margin-top: -1px;
}

/* Center dot */
.center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  background: #222;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,.15);
  pointer-events: none;
  z-index: 10;
}

/* Clock ticks */
.tick {
  position: absolute;
  width: 10px;
  height: 2px;
  background: #333;
  left: 50%;
  top: 50%;
  transform-origin: 0 50%;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}

/* Clock label */
.clock-label {
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 3.5px 15px;
  margin: 7px 0;
  border-radius: 7px;
  max-width: 240px;
  background: #f3f4f8;
  border: 1.1px solid #e3e6ef;
  box-shadow: 0 1px 4px rgba(46, 90, 170, 0.07);
  text-align: center;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Footer space to allow scroll */
.footer-space {
  height: 73px;
  width: 100%;
}

/* Footer styling */
.footer {
  width: 100%;
  background: #f7f8fc;
  color: #232a44;
  font-size: 1em;
  font-family: "Segoe UI", Arial, sans-serif;
  border-top: 1px solid #e0e4ee;
  box-shadow: 0 -2px 8px #d2d8e7;
  padding: 12px 32px 12px 17px;
  position: fixed;
  left: 0;
  bottom: -100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: bottom 0.33s cubic-bezier(0.63, 0.09, 0.47, 1.21),
    opacity 0.23s;
}

.footer.visible {
  bottom: 0;
  opacity: 1;
  pointer-events: auto;
}

.footer-left {
  font-weight: 500;
  letter-spacing: 0.04em;
}

.footer-left a {
  color: #232a44;
  text-decoration: none; /* no underline */
  user-select: text;
}

.footer-right {
  font-size: 1.6em;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  outline: none;
  color: #234e88;
  margin-left: 18px;
  margin-right: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: color 0.18s;
  border-radius: 6px;
}

.footer-right:active,
.footer-right:focus {
  background: #e0e4f8;
}

.footer-right:hover {
  color: #18346a;
}

/* Footer on smaller screens */
@media (max-width: 700px) {
  .footer {
    flex-direction: row;
    text-align: left;
    height: auto;
    gap: 12px;
    min-height: 47px;
    padding-right: 24px;
  }

  .footer-right {
    margin-right: 25px;
  }
}

/* Ensure footer content stays in row, arrow button at right even on very small phones */
@media (max-width: 350px) {
  .footer {
    flex-wrap: nowrap;
    padding-left: 12px;
    padding-right: 12px;
  }
  .footer-left {
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: auto;
  }
  .footer-right {
    margin-left: 12px;
    margin-right: 12px;
    flex-shrink: 0;
  }
}
