html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body{
    background-color: #ffffff;
    /* background-color: #5ea297; */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    color:#3c6b64;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 20px;
    background: linear-gradient(to bottom, #eef6f5, #a6d0cb);
    padding: 10px 20px 20px 20px;
    /* background-color: #5ea297; */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    /* min-height: 100vh; */
    justify-content: flex-start;
    align-items: center;
    margin: 0 auto;
}

.header-container{   
    position: relative;
    width: 100%;
    height: 20%;
    /* height: 10%;  */
    padding: 0px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.finish-container{
    display: flex;
    width: 100%;
    padding: 0;
    justify-content: center;
    align-items: center;
}

.content-container {
  width: 100%;
  height: 75%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.section-container {
  width: 100%;
  height: 45%;
  margin:0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}

.sub-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/*margin: top right bottom left */
.distance-select-box {
    background-color: #3c6b64;
    width: clamp(280px, 85%, 340px);
    padding: 8px;
    border-radius: 15px;
    margin: 5px 0 5px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.button-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.distance-button {
    flex: 1;
    padding: 8px 6px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-family: sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-wrap: nowrap;
    min-width: 0;
    box-sizing: border-box;
}

.distance-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.distance-button.selected {
    background-color: rgba(233, 165, 102, 0.3);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 8px rgb(233, 165, 102);
    border: #e9a566;
}

hr{
    background-color: #3c6b64;
    width: 90%;
    height: 5px;
    border-radius: 3px;
    border: none;
    margin: 0 0 5px 0;
}

.trial-grid {
    display: flex;
    width: 80%;
    justify-content: space-between;
    /* gap: 50px; */
    margin-top: 5px;
    margin-bottom: 5px;
}

.trial-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trial-column label {
    color: #3c6b64;
    font-size: 1rem;
    font-family: sans-serif;
    margin-bottom: 0px;
}

.trial-column input[type="number"] {
    width: 120px;
    height: 25px;
    font-size: 1.2rem;
    text-align: center;
    border-radius: 10px;
    border: none;
    color: black;
}

.average {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  font-family: sans-serif;
  color: #3c6b64;
  margin: 5px 0px 20px 0px;
  padding: 8px 15px;
  border: 2px dashed #3c6b64;
  border-radius: 10px;
  background-color: rgba(255,255,255,0.05);
  transition: all 0.3s ease;
}

.average.calculated {
  background-color: #ffffff22;
  border: 2px solid #e9a566;
  color: #3c6b64;
  font-weight: bold;
  box-shadow: 0 0 8px #e9a56688;
}

.finish-button {
  border-width: 4px solid;
  color: white;
  border-color: #e9a566;
  background-color: #3c6b64;
  font-size: 1.8rem;
  font-weight: 600;
  width: auto;
  padding: 5px 10px 5px 10px;
  margin: 5px 0px 0px 0px; 
  border-radius: 10px;
  display: block;
}

h2{
    font-size: 24px;
    margin: 5px 0px 0px 0px;
}
.centered-title {
  margin: 0;
  font-size: 2.5rem;
  text-align: center;
  padding-bottom: 10px;
}

.floating-buttons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* allow clicks through the wrapper */
}
.back-button,
.menu-button {
    width: 10%;
    aspect-ratio: 1 / 1;
    position: absolute;
    border-radius: 50%;
    background-color: #ffffff92;
    border: none;
    display: flex;
    justify-content: center;
    cursor: pointer;
    pointer-events: all; /* allow these buttons to be clickable */
    z-index: 1;

  }
.back-button {
    top: 3%;
    left: 3%;
    align-items: center;
}
.back-button::before {
    content: '';
    width: 12px;
    height: 12px;
    border-top: 5px solid rgb(254, 153, 0);
    border-left: 5px solid rgb(254, 153, 0);
    transform: rotate(-45deg);
    /* move to the right 2px */
    margin-left: 3px;
}
.menu-button {
    bottom: 5%;
    right: 5%;
    align-items: center;
}
.menu-button::before {
    content: '';
    width: 20px;
    height: 3px;
    border-radius: 1px;
    background-color: rgb(254, 153, 0);
    box-shadow:
    0 8px 0 0 rgb(254, 153, 0),
    0 -8px 0 0 rgb(254, 153, 0);
}

#stopwatchToggle {
  font-size: 1rem;
  border-radius: 10px;
  /*left: 100px;*/
  top: 50%;
  transform: translateY(-50%);
  width: 90px;
  height: 40px;
  border-radius: 10px;
  background-color: #3c6b64; 
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: sans-serif;
}

.popup-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  background: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 15px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  margin-bottom: 10px;
  color:black;
  cursor: move;
  padding: 5px;
  border-radius: 6px 6px 0 0;
}

.popup-close {
  font-size: 1.3rem;
  cursor: pointer;
  color: #c0392b;
}

#popupStopwatch {
  font-size: 2rem;
  margin-bottom: 15px;
  text-align: center;
  color: black;
}

.popup-controls button {
  margin: 5px;
  padding: 8px 16px;
  background-color: #3c6b64;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.trial-input {
  text-align: center;
  font-size: 1.1em;
  padding: 6px;
}
.start-indicator {
  border: 2px solid limegreen !important;
  background-color: #eaffea;
  color: darkgreen;
}

.menu-popup {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
}

.menu-popup-content {
  background-color: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
}

.menu-popup-content button {
  margin: 1rem;
  font-size: 1.2rem;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
}

.menu-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
}

.menu-list {
  list-style: none;
  padding: 0;
  margin: 1em 0;
}

.menu-list li {
  margin: 0.5em 0;
  font-size: 1.2em;
}

.menu-list a {
  color: #333;
  text-decoration: none;
}

/* Responsive adjustments for narrow screens */
@media screen and (max-width: 350px) {
  .distance-select-box {
    width: 95%;
    padding: 6px;
  }
  
  .button-row {
    gap: 2px;
  }
  
  .distance-button {
    padding: 6px 4px;
    font-size: 0.85rem;
  }
}

@media screen and (max-width: 280px) {
  .distance-select-box {
    width: 98%;
    padding: 4px;
  }
  
  .distance-button {
    padding: 5px 2px;
    font-size: 0.75rem;
  }
}

