@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap");

:root {
  --font-family: "Poppins", sans-serif;
  --bg-color: hsl(0, 0%, 88%);
  --shadow-dark: hsl(0, 0%, 76%);
  --shadow-light: hsl(0, 0%, 95%);
  --text-color: hsl(0, 0%, 20%);
  --text-light: hsl(0, 0%, 40%);
  --radius-large: clamp(1.5rem, 1.2rem + 1.25vw, 2rem);
  --radius-medium: clamp(0.75rem, 0.6rem + 0.625vw, 1rem);
  --logo-bg: hsl(0, 0%, 70%);
  --sun-color: linear-gradient(
    40deg,
    hsl(330, 100%, 50%) hsl(33, 100%, 50%) 70%
  );
  --moon-shadow: inset -3px -2px 5px -2px hsl(243, 80%, 71%),
    inset -10px -4px 0 0 hsl(202, 89%, 85%);
  --white: hsl(0, 0%, 100%);
}

.dark {
  --bg-color: hsl(0, 0%, 20%);
  --shadow-dark: hsl(0, 0%, 12%);
  --shadow-light: hsl(0, 0%, 25%);
  --text-color: hsl(0, 0%, 90%);
  --text-light: hsl(0, 0%, 70%);
  --logo-bg: hsl(0, 0%, 35%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  display: grid;
  place-items: center;
  color: var(--text-color);
  transition: background 0.3s ease, color 0.3s ease;
}

.logo-container {
  position: absolute;
  top: clamp(0.75rem, 0.6rem + 0.625vw, 1rem);
  left: clamp(0.75rem, 0.6rem + 0.625vw, 1rem);
}

.logo-text {
  font-size: clamp(1.75rem, 1.2rem + 2.3vw, 2.375rem);
  font-weight: bold;
  color: var(--logo-bg);
  text-shadow: 1px 1px 1px var(--shadow-light), -1px -1px 1px var(--shadow-dark);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.content-container {
  max-width: clamp(20rem, 15rem + 20vw, 43.75rem);
  padding: clamp(0.625rem, 0.4rem + 0.94vw, 1.25rem);
  z-index: 10;
}

.todo-list-container {
  background: var(--bg-color);
  padding: clamp(1.25rem, 0.85rem + 1.67vw, 1.875rem);
  border-radius: var(--radius-large);
  box-shadow: 10px 10px 20px var(--shadow-dark),
    -10px -10px 20px var(--shadow-light), inset -6px -6px 6px var(--shadow-dark),
    inset 6px 6px 6px var(--shadow-light);
  position: relative;
  z-index: 10;
  transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.todo-list-container h2 {
  text-align: center;
  font-size: clamp(1.5rem, 1.2rem + 1.25vw, 2rem);
  margin-bottom: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  color: var(--text-color);
  font-weight: 600;
}

.todo-list-container h3 {
  margin-bottom: clamp(0.75rem, 0.6rem + 0.625vw, 0.9375rem);
  font-size: clamp(1.125rem, 0.9rem + 0.94vw, 1.5rem);
  color: var(--text-color);
  font-weight: 500;
}

#todo-list {
  list-style-type: none;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(0.625rem, 0.4rem + 0.94vw, 0.9375rem);
  background: var(--bg-color);
  margin-bottom: clamp(0.625rem, 0.4rem + 0.94vw, 0.9375rem);
  border-radius: var(--radius-medium);
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  color: var(--text-color);
  transition: box-shadow 0.2s ease-in-out, background 0.3s ease, color 0.3s ease;
}

.todo-item:hover,
.todo-item.completed {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.todo-item.completed label {
  text-decoration: line-through;
  color: var(--text-light);
  transition: color 0.5s ease, text-decoration 0.5s ease;
}

.todo-item.completed .todo-actions {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.todo-item.completed .todo-actions .icon {
  color: var(--text-light);
  cursor: not-allowed;
}

.todo-item.completed .todo-actions .icon img {
  filter: grayscale(1) opacity(0.5);
}

.add-todo-container {
  display: flex;
  gap: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  margin-bottom: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  width: 100%;
  max-width: 100%;
  /* overflow: hidden; */
}

#new-todo {
  flex: 1 1 auto;
  min-width: 0; /* Allow input to shrink below content size */
  padding: clamp(0.75rem, 0.6rem + 0.625vw, 0.9375rem);
  border-radius: var(--radius-medium);
  border: none;
  background: var(--bg-color);
  font-size: clamp(0.875rem, 0.8rem + 0.31vw, 1rem);
  color: var(--text-color);
  outline: none;
  box-shadow: inset 4px 4px 8px var(--shadow-dark),
    inset -4px -4px 8px var(--shadow-light);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Focus styles for accessibility */
#new-todo:focus {
  outline: none;
}

#new-todo::placeholder {
  color: var(--text-light);
}

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

#add-button {
  flex: 0 0 auto; /* Don't grow or shrink */
  padding: clamp(0.75rem, 0.6rem + 0.625vw, 0.9375rem)
    clamp(1.25rem, 0.95rem + 1.25vw, 1.5625rem);
  border: none;
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  transition: all 0.2s ease-in-out;
  white-space: nowrap; /* Prevent text wrapping */
}

/* Focus styles for accessibility */
#add-button:focus {
  outline: none;
}

#add-button:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

#add-button:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.checkbox-wrapper {
  flex-grow: 1;
}

.checkbox-wrapper .checkbox {
  display: table-cell;
  width: 100%;
  height: 100%;
  vertical-align: middle;
  text-align: center;
}

.checkbox-wrapper label {
  display: inline-block;
  color: var(--text-color);
  cursor: pointer;
  position: relative;
}
.checkbox-wrapper label span {
  display: inline-block;
  position: relative;
  background-color: hsla(0, 0%, 0%, 0);
  width: 25px;
  height: 25px;
  transform-origin: center;
  border: 2px solid var(--text-color);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 10px;
  transition: background-color 150ms 200ms,
    transform 350ms cubic-bezier(0.78, -1.22, 0.17, 1.89);
}
.checkbox-wrapper label span:before {
  content: "";
  width: 0px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-color);
  position: absolute;
  transform: rotate(45deg);
  top: 11px;
  left: 8px;
  transition: width 50ms ease 50ms;
  transform-origin: 0% 0%;
}
.checkbox-wrapper label span:after {
  content: "";
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--text-color);
  position: absolute;
  transform: rotate(305deg);
  top: 15px;
  left: 9px;
  transition: width 50ms ease;
  transform-origin: 0% 0%;
}
.checkbox-wrapper label:hover span:before {
  width: 5px;
  transition: width 100ms ease;
}
.checkbox-wrapper label:hover span:after {
  width: 10px;
  transition: width 150ms ease 100ms;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}
.checkbox-wrapper input[type="checkbox"]:checked + label span {
  background-color: var(--text-color);
  transform: scale(1.25);
}
.checkbox-wrapper input[type="checkbox"]:checked + label span:after {
  width: 10px;
  background: var(--bg-color);
  transition: width 150ms ease 100ms;
}
.checkbox-wrapper input[type="checkbox"]:checked + label span:before {
  width: 5px;
  background: var(--bg-color);
  transition: width 150ms ease 100ms;
}
.checkbox-wrapper input[type="checkbox"]:checked + label:hover span {
  background-color: var(--text-color);
  transform: scale(1.25);
}
.checkbox-wrapper input[type="checkbox"]:checked + label:hover span:after {
  width: 10px;
  background: var(--bg-color);
  transition: width 150ms ease 100ms;
}
.checkbox-wrapper input[type="checkbox"]:checked + label:hover span:before {
  width: 5px;
  background: var(--bg-color);
  transition: width 150ms ease 100ms;
}

.edit-input {
  padding: 0;
  margin: 0;
  border: none;
  background: hsla(0, 0%, 0%, 0);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 1rem;
  outline: none;
  line-height: inherit;
  height: 1em;
  width: 100%; /* Take full available width */
  max-width: 100%; /* Don't exceed container */
  min-width: 0; /* Allow shrinking */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis; /* Show ellipsis for overflow */
}

.checkbox-wrapper label {
  display: flex;
  align-items: center;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding-bottom: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  text-align: center;
  width: 100%;
  color: var(--logo-bg);
  font-size: clamp(0.8125rem, 0.75rem + 0.26vw, 0.875rem);
  font-weight: 400;
  text-shadow: 1px 1px 1px var(--shadow-light), -1px -1px 1px var(--shadow-dark);
  z-index: 10;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  pointer-events: none; /* Allow clicks to pass through to content below */
}

.footer * {
  pointer-events: auto; /* Re-enable clicks on footer content (links) */
}

.designer-link {
  color: var(--logo-bg);
  text-decoration: none;
  font-weight: 600;
  text-shadow: 1px 1px 1px var(--shadow-light), -1px -1px 1px var(--shadow-dark);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.designer-link:hover {
  color: var(--text-light);
  text-decoration: underline;
  text-shadow: 1px 1px 1px var(--shadow-light), -1px -1px 1px var(--shadow-dark);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* Overlay */
#timer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: hsla(0, 0%, 0%, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--white);
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
}

#timer-overlay.visible {
  visibility: visible;
}

#timer-task-title {
  font-size: clamp(1.25rem, 1rem + 1.04vw, 2rem);
  font-weight: 500;
  margin-bottom: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  color: var(--white);
  text-align: center;
}

#timer-display {
  font-size: clamp(6rem, 5rem + 10vw, 10vw);
  font-weight: 700;
  letter-spacing: clamp(1px, 0.5px + 0.1vw, 2px);
  cursor: pointer;
  border: 2px solid hsla(0, 0%, 0%, 0);
  border-radius: clamp(0.5rem, 0.4rem + 0.42vw, 0.5rem);
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  transition: border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1px, 0.5px + 0.1vw, 2px);
  min-height: calc(
    clamp(6rem, 5rem + 10vw, 10vw) + clamp(1rem, 0.75rem + 1.04vw, 1.25rem)
  );
  max-height: calc(
    clamp(6rem, 5rem + 10vw, 10vw) + clamp(1rem, 0.75rem + 1.04vw, 1.25rem)
  );
  width: auto;
  box-sizing: border-box;
}

#timer-display[contenteditable="true"] {
  font-size: clamp(6rem, 5rem + 10vw, 10vw) !important;
  font-weight: 700 !important;
  letter-spacing: clamp(1px, 0.5px + 0.1vw, 2px) !important;
  line-height: 1 !important;
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem) !important;
  margin: 0 !important;
  border: 2px solid hsla(0, 0%, 100%, 0.3) !important;
  background: hsla(0, 0%, 0%, 0) !important;
  color: var(--white) !important;
  outline: none !important;
  display: block !important;
  text-align: center !important;
  min-height: calc(
    clamp(6rem, 5rem + 10vw, 10vw) + clamp(1rem, 0.75rem + 1.04vw, 1.25rem)
  ) !important;
  max-height: calc(
    clamp(6rem, 5rem + 10vw, 10vw) + clamp(1rem, 0.75rem + 1.04vw, 1.25rem)
  ) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

.timer-digit,
.timer-separator {
  display: inline-block;
  line-height: 1;
}

.timer-digit {
  min-width: 0.6em;
  text-align: center;
}

.timer-separator {
  color: var(--white);
  opacity: 0.8;
}

.timer-controls {
  display: flex;
  gap: clamp(1.875rem, 1.4rem + 1.98vw, 2.5rem);
  margin-top: clamp(2rem, 1.5rem + 2.08vw, 2.5rem);
}

.timer-control-icon {
  width: clamp(3.125rem, 2.5rem + 2.6vw, 3.75rem);
  height: clamp(3.125rem, 2.5rem + 2.6vw, 3.75rem);
  cursor: pointer;
  color: var(--white);
  transition: transform 0.2s;
}

/* Focus styles for accessibility */
.timer-control-icon:focus {
  outline: none;
}

.timer-control-icon:hover {
  transform: scale(1.1);
}

.timer-control-icon img {
  transition: opacity 0.2s ease;
  filter: invert(1);
}

.timer-sound-toggle {
  position: absolute;
  top: clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  right: clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  z-index: 1001;
}

.sound-toggle-icon {
  width: clamp(2rem, 1.7rem + 1.25vw, 2.5rem);
  height: clamp(2rem, 1.7rem + 1.25vw, 2.5rem);
  cursor: pointer;
  color: var(--white);
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.8;
}

.sound-toggle-icon:hover {
  transform: scale(1.1);
  opacity: 1;
}

.sound-toggle-icon img {
  width: 100%;
  height: 100%;
  filter: invert(1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sound-toggle-icon.switching img {
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

.timer-lock-toggle {
  position: absolute;
  bottom: clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
}

.lock-toggle-icon {
  width: clamp(2rem, 1.7rem + 1.25vw, 2.5rem);
  height: clamp(2rem, 1.7rem + 1.25vw, 2.5rem);
  cursor: pointer;
  color: var(--white);
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.8;
}

.lock-toggle-icon:hover {
  transform: scale(1.1);
  opacity: 1;
}

.lock-toggle-icon img {
  width: 100%;
  height: 100%;
  filter: invert(1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lock-toggle-icon.switching img {
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

/* Accessibility styles for lock toggle */
.timer-lock-toggle:focus {
  outline: 2px solid var(--white);
  border-radius: clamp(0.2rem, 0.15rem + 0.21vw, 0.25rem);
}

.timer-lock-toggle.is-locked .lock-toggle-icon {
  opacity: 1;
  transform: scale(1.05);
}

/* Disabled state for timer controls when locked */
/* Disabled state for timer controls when locked */
#timer-overlay.locked .timer-control-icon,
#timer-overlay.locked .edit-timer-icon,
#timer-overlay.locked .sound-toggle-icon {
  pointer-events: none;
  opacity: 0.3;
  cursor: not-allowed;
}

#timer-overlay.locked .timer-control-icon img,
#timer-overlay.locked .edit-timer-icon img,
#timer-overlay.locked .sound-toggle-icon img {
  filter: grayscale(1);
}

#timer-overlay.locked .timer-lock-toggle {
  pointer-events: auto !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

#timer-overlay.locked .timer-lock-toggle .lock-toggle-icon img {
  filter: invert(1) !important;
}
.todo-actions {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 0.15rem + 0.42vw, 0.3125rem);
  flex-shrink: 0; /* Prevent icons from shrinking */
  margin-left: clamp(
    0.5rem,
    0.375rem + 0.52vw,
    0.625rem
  ); /* Add spacing from text */
}

.icon {
  width: clamp(1.25rem, 1.05rem + 0.83vw, 1.5rem);
  height: clamp(1.25rem, 1.05rem + 0.83vw, 1.5rem);
  cursor: pointer;
  color: var(--text-color);
  transition: color 0.3s ease, opacity 0.3s ease;
  flex-shrink: 0; /* Prevent icons from shrinking */
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.3s ease;
}

.dark-mode-toggle-wrapper {
  position: absolute;
  top: clamp(1.25rem, 0.95rem + 1.25vw, 1.625rem);
  right: max(0.75rem, clamp(0.75rem, 0.5rem + 1.04vw, 1.25rem));
  /* Use max() to prevent going below 0.75rem (12px) on very small screens */
  /* Desktop stays at original 1.25rem (20px) */
}

.dark-mode-toggle-wrapper input[type="checkbox"] {
  visibility: hidden;
  display: none;
}

.dark-mode-toggle-wrapper *,
.dark-mode-toggle-wrapper ::after,
.dark-mode-toggle-wrapper ::before {
  box-sizing: border-box;
}

/* The switch - the box around the slider */
.dark-mode-toggle-wrapper .switch {
  --width-of-switch: 3.5em;
  --height-of-switch: 2em;
  /* size of sliding icon -- sun and moon */
  --size-of-icon: 1.4em;
  /* it is like a inline-padding of switch */
  --slider-offset: 0.3em;
  position: relative;
  width: var(--width-of-switch);
  height: var(--height-of-switch);
  display: inline-block;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  border-radius: 30px;
  transition: box-shadow 0.2s ease-in-out;
}

/* Focus styles for accessibility */
.dark-mode-toggle-wrapper .switch:focus {
  outline: none;
}

.dark-mode-toggle-wrapper .switch:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

/* The slider */
.dark-mode-toggle-wrapper .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  transition: 0.4s;
  border-radius: 30px;
}

.dark-mode-toggle-wrapper .slider:before {
  position: absolute;
  content: "";
  height: var(--size-of-icon, 1.4em);
  width: var(--size-of-icon, 1.4em);
  border-radius: 20px;
  left: var(--slider-offset, 0.3em);
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(
    40deg,
    hsla(330, 100%, 50%, 1),
    hsla(33, 100%, 50%, 1) 70%
  );
  transition: 0.4s;
}

.dark-mode-toggle-wrapper input:checked + .slider {
  background-color: var(--bg-color);
}

.dark-mode-toggle-wrapper input:checked + .slider:before {
  left: calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, 0.3em)));
  background: var(--bg-color);
  /* change the value of second inset in box-shadow to change the angle and direction of the moon  */
  box-shadow: inset -3px -2px 5px -2px hsla(243, 88%, 74%, 1),
    inset -10px -4px 0 0 hsla(202, 89%, 85%, 1);
}

.dark .todo-actions .icon img {
  filter: invert(1);
}

.dark .todo-item.completed .todo-actions .icon img {
  filter: invert(1) grayscale(1) opacity(0.5);
}

.dark .icon img {
  filter: invert(1);
}

.dark .icon {
  color: var(--text-color);
}

.timer-overlay .icon {
  color: var(--text-color);
}

/* Settings Panel */
#settings-button {
  position: absolute;
  top: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  right: max(4.5rem, clamp(4.5rem, 3.8rem + 2.92vw, 5.625rem));
  /* Use max() to ensure minimum 4.5rem (72px) on very small screens */
  /* Desktop stays at original 5.625rem (90px) spacing */
  background: var(--bg-color);
  border: none;
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  border-radius: var(--radius-medium);
  cursor: pointer;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  transition: all 0.2s ease-in-out, background 0.3s ease, box-shadow 0.3s ease;
}

#settings-button img {
  width: clamp(1.25rem, 1.05rem + 0.83vw, 1.5rem);
  height: clamp(1.25rem, 1.05rem + 0.83vw, 1.5rem);
  transition: transform 0.3s ease;
}

#settings-button:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

#settings-button:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

#settings-button.rotating img {
  transform: rotate(180deg);
}

.dark #settings-button img {
  filter: invert(1);
}

/* Responsive design for mobile devices - Most sizing now handled by clamp() */
@media (max-width: 768px) {
  /* Additional mobile-specific adjustments if needed */
}

/* Reset Button with Wave Animation */
.reset-container {
  --size: clamp(5rem, 4.25rem + 3.13vw, 6.25rem);
  --scalingFactor: 3;
  --gray: var(--bg-color);
  position: fixed;
  bottom: clamp(3rem, 2.4rem + 2.5vw, 3.75rem);
  right: clamp(2.5rem, 1.9rem + 2.5vw, 3.125rem);
  width: var(--size);
  height: var(--size);
  z-index: 5;
}

.dot,
.trigger {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: var(--size);
  width: var(--size);
  margin: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  background: var(--gray);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  border-radius: 50%;
}

.trigger {
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  letter-spacing: 0.05em;
  cursor: pointer;
  font-size: clamp(0.7rem, 0.6rem + 0.42vw, 0.75rem);
  font-weight: 600;
  transition: all 0.2s ease-in-out;
}

.trigger:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.trigger:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.trigger:before {
  content: "Reset";
}

#trigger:checked + .trigger:before {
  content: "Resetting...";
}

#trigger:checked + .trigger + .dots > .dot {
  animation-name: wave;
  animation-timing-function: ease-in-out;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

.dot {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale3d(0, 0, 1);
  z-index: 1;
}

.dot:nth-of-type(2) {
  animation-delay: 0.5s;
  z-index: 1;
}

.dot:nth-of-type(3) {
  animation-delay: 1s;
  z-index: 1;
}

@keyframes wave {
  0% {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale3d(1, 1, 1);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0)
      scale3d(var(--scalingFactor), var(--scalingFactor), 1);
  }
}

/* Settings Panel */
#settings-panel {
  text-align: center;
  transition: background 0.3s ease, color 0.3s ease;
}

#settings-panel h3 {
  margin-bottom: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  color: var(--text-color);
  transition: color 0.3s ease;
}

.settings-group {
  margin-bottom: clamp(0.75rem, 0.6rem + 0.625vw, 0.9375rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.settings-group label {
  margin-bottom: clamp(0.25rem, 0.15rem + 0.42vw, 0.3125rem);
  color: var(--text-color);
  transition: color 0.3s ease;
}

.settings-group input {
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  border-radius: var(--radius-medium);
  border: none;
  background: var(--bg-color);
  color: var(--text-color);
  box-shadow: inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  width: clamp(10rem, 8.5rem + 6.25vw, 12.5rem);
  text-align: center;
}

.settings-group input:focus {
  outline: none;
}

.settings-group input:invalid {
  border: 2px solid hsl(348, 100%, 61%);
  background: hsla(348, 100%, 61%, 0.1);
}

.settings-buttons {
  margin-top: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  display: flex;
  gap: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem);
  justify-content: center;
}

.settings-buttons button {
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem)
    clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  border: none;
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
  transition: all 0.2s ease-in-out;
}

.settings-buttons button:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.settings-buttons button:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

@keyframes errorShake {
  0%,
  100% {
    transform: translate(-50%, -50%) translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translate(-50%, -50%) translateX(-2px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translate(-50%, -50%) translateX(2px);
  }
}

/* Enforce portrait mode on mobile devices with rotation and message */
@media screen and (max-width: 768px) and (min-aspect-ratio: 16/9) {
  body {
    transform: rotate(-90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
  }

  .orientation-message {
    display: block !important;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    background: var(--bg-color);
    color: var(--text-color);
    padding: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
    border-radius: var(--radius-medium);
    text-align: center;
    font-size: clamp(1rem, 0.85rem + 0.63vw, 1.125rem);
    font-weight: 600;
    box-shadow: 0 8px 32px hsla(0, 0%, 0%, 0.3);
    z-index: 9999;
    max-width: clamp(16rem, 14rem + 8.33vw, 18.75rem);
  }
}

.orientation-message {
  display: none;
}

/* Hidden elements */
#timer-input-helper {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#background-music {
  display: none;
}

/* Settings panel initially hidden */
#settings-panel {
  display: none;
}

/* Timer control icon sizing - now handled by earlier declaration */

/* Error dialog styles */
.error-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: hsla(348, 100%, 61%, 0.95);
  color: white;
  padding: clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  border-radius: clamp(0.6rem, 0.45rem + 0.625vw, 0.75rem);
  font-size: clamp(0.875rem, 0.8rem + 0.31vw, 1rem);
  text-align: center;
  box-shadow: 0 8px 32px hsla(348, 100%, 61%, 0.3);
  z-index: 99999;
  max-width: clamp(18rem, 15rem + 12.5vw, 31.25rem);
}

.error-dialog h3 {
  margin: 0 0 clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem) 0;
}

.error-dialog p {
  margin: 0;
}

.error-dialog button {
  margin-top: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem)
    clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  background: white;
  color: hsl(348, 100%, 61%);
  border: none;
  border-radius: clamp(0.3rem, 0.225rem + 0.31vw, 0.375rem);
  cursor: pointer;
  font-weight: 600;
}

/* PWA Install Banner - Neumorphic Style */
.install-banner {
  position: fixed;
  top: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-color);
  color: var(--text-color);
  padding: clamp(1rem, 0.75rem + 1.04vw, 1.25rem)
    clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  border-radius: var(--radius-medium);
  box-shadow: 8px 8px 16px var(--shadow-dark),
    -8px -8px 16px var(--shadow-light);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  font-family: var(--font-family);
  animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: clamp(18rem, 15rem + 12.5vw, 31.25rem);
  width: 90%;
}

.install-banner-content {
  flex: 1;
}

.install-banner-title {
  font-weight: 600;
  font-size: clamp(0.875rem, 0.8rem + 0.31vw, 1rem);
  margin-bottom: clamp(0.2rem, 0.15rem + 0.21vw, 0.25rem);
  color: var(--text-color);
}

.install-banner-subtitle {
  font-size: clamp(0.75rem, 0.7rem + 0.21vw, 0.8125rem);
  color: var(--text-light);
}

.install-btn,
.dismiss-btn {
  background: var(--bg-color);
  color: var(--text-color);
  border: none;
  padding: clamp(0.5rem, 0.375rem + 0.52vw, 0.625rem)
    clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  border-radius: clamp(0.6rem, 0.45rem + 0.625vw, 0.75rem);
  font-weight: 600;
  cursor: pointer;
  font-size: clamp(0.8125rem, 0.75rem + 0.26vw, 0.875rem);
  font-family: var(--font-family);
  transition: all 0.2s ease-in-out;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light),
    inset -3px -3px 3px var(--shadow-dark),
    inset 3px 3px 3px var(--shadow-light);
}

.install-btn:hover,
.dismiss-btn:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.install-btn:active,
.dismiss-btn:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .install-banner {
    flex-direction: column;
    width: calc(100% - clamp(2rem, 1.5rem + 2.08vw, 2.5rem));
  }

  .install-banner-content {
    text-align: center;
  }

  .install-btn,
  .dismiss-btn {
    width: 100%;
  }
}

/* Custom Fullscreen Tip Banner - Dark Theme like Timer Overlay */
.fullscreen-tip-banner {
  position: fixed;
  top: clamp(1.5rem, 1.1rem + 1.67vw, 1.875rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: none;
  align-items: center;
  gap: clamp(1rem, 0.75rem + 1.04vw, 1.25rem);
  padding: clamp(0.875rem, 0.7rem + 0.73vw, 1.125rem)
    clamp(1.25rem, 0.95rem + 1.25vw, 1.75rem);
  background: hsla(0, 0%, 0%, 0.95);
  backdrop-filter: blur(10px);
  color: var(--white);
  border-radius: clamp(0.75rem, 0.6rem + 0.625vw, 1rem);
  box-shadow: 0 10px 40px hsla(0, 0%, 0%, 0.5), 0 4px 12px hsla(0, 0%, 0%, 0.3),
    inset 0 1px 1px hsla(0, 0%, 100%, 0.1);
  border: 1px solid hsla(0, 0%, 100%, 0.1);
  font-family: var(--font-family);
  max-width: clamp(20rem, 16rem + 16.67vw, 37.5rem);
  width: auto;
  animation: slideDownFade 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fullscreen-tip-content {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 0.6rem + 0.625vw, 0.875rem);
  flex: 1;
}

.fullscreen-tip-icon {
  font-size: clamp(1.125rem, 0.95rem + 0.73vw, 1.375rem);
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px hsla(0, 0%, 0%, 0.3));
}

.fullscreen-tip-text {
  font-size: clamp(0.875rem, 0.8rem + 0.31vw, 0.9375rem);
  font-weight: 500;
  line-height: 1.5;
  color: hsla(0, 0%, 100%, 0.95);
  text-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.3);
}

.fullscreen-tip-dismiss {
  padding: clamp(0.5rem, 0.4rem + 0.42vw, 0.5rem)
    clamp(1rem, 0.8rem + 0.83vw, 1.125rem);
  background: hsla(0, 0%, 100%, 0.1);
  backdrop-filter: blur(5px);
  color: var(--white);
  border: 1px solid hsla(0, 0%, 100%, 0.2);
  border-radius: clamp(0.6rem, 0.45rem + 0.625vw, 0.75rem);
  font-size: clamp(0.8125rem, 0.75rem + 0.26vw, 0.875rem);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  flex-shrink: 0;
  text-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.2);
}

.fullscreen-tip-dismiss:hover {
  background: hsla(0, 0%, 100%, 0.2);
  border-color: hsla(0, 0%, 100%, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px hsla(0, 0%, 0%, 0.3);
}

.fullscreen-tip-dismiss:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px hsla(0, 0%, 0%, 0.2);
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Mobile responsive for fullscreen tip banner */
@media (max-width: 768px) {
  .fullscreen-tip-banner {
    max-width: calc(100% - clamp(2rem, 1.5rem + 2.08vw, 2.5rem));
    flex-direction: column;
  }

  .fullscreen-tip-content {
    flex-direction: column;
  }

  .fullscreen-tip-text {
    text-align: center;
  }

  .fullscreen-tip-dismiss {
    width: 100%;
  }
}
