/* CSS Variables */
:root {
  --bg: #0b0c10;
  --fg: #e8e9ed;
  --muted: #666;
  --accent: #30A2FF;
  --border: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.05);
  --shadow: rgba(0, 0, 0, 0.3);
  --calendar-icon-filter: invert(1) brightness(1.1);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

/* Links */
a {
  color: var(--accent);
}

a:hover,
a:focus {
  color: var(--accent);
}

/* Topbar secondary navbar links */
.topbar nav.group {
  gap: 1rem;
  /* más separación entre enlaces */
  margin-right: 1.5rem;
  /* separación respecto al botón de support */
}

.topbar nav.group a {
  text-decoration: none;
  opacity: 0.9;
  display: inline-block;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  font-weight: 700;
  /* Enlaces siempre en negrita para evitar saltos */
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.topbar nav.group a:hover,
.topbar nav.group a:focus {
  opacity: 1;
  border-bottom-color: var(--accent);
}

.topbar nav.group a[aria-current="page"] {
  opacity: 1;
  border-bottom-color: var(--accent);
  cursor: default;
}

/* App layout */
.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: relative;
  z-index: 1;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.brand h1 {
  font-size: 2rem;
  font-weight: 900;
  color: var(--foreground);
  margin: 0;
  letter-spacing: 0.08em;
}

.brand a {
  color: inherit;
  text-decoration: none;
}

.brand a:hover,
.brand a:focus {
  color: inherit;
  text-decoration: none;
}

/* Logo styles */
.brand .logo {
  height: 3rem;
  width: auto;
  color: var(--foreground);
  transition: color 0.2s ease;
}

/* Inicio: Indicador Target activo */
.target-chip {
  position: fixed;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  z-index: 200;
}

.target-chip[hidden] {
  display: none !important;
}

/* Mostrar el chip solo cuando NO tiene el atributo hidden */
.target-chip:not([hidden]) {
  display: inline-flex;
}

.target-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  /* verde */
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.target-chip .chip-text {
  font-size: 0.9rem;
  color: var(--foreground);
}

.target-chip .chip-close.btn-secondary {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .target-chip {
    left: 8px;
    bottom: 8px;
    padding: 0.25rem 0.5rem;
    gap: 0.375rem;
  }

  .target-chip .chip-text {
    font-size: 0.85rem;
  }

  .target-chip .chip-close.btn-secondary {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Fin: Indicador Target activo */

.group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  position: relative;
}

.group.right {
  margin-left: auto;
}

.separator-vertical {
  width: 1px;
  height: 2rem;
  background: var(--border);
  margin: 0 1rem;
}

/* Inputs horas/min/seg con sufijo dentro del campo */
.timer-inputs .input-suffix {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.timer-inputs .input-suffix::after {
  content: attr(data-suffix);
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg);
  font-size: 0.9rem;
  opacity: 0.7;
  pointer-events: none;
}

.timer-inputs input[type="number"] {
  width: 8ch;
  /* ancho suficiente para 2 cifras sin solape */
  text-align: center;
  padding-right: 1.6rem;
  /* espacio para el sufijo (SEC) */
  padding-left: 0.3rem;
  padding-top: 0.5rem;
  /* igual que botón base */
  padding-bottom: 0.5rem;
  /* igual que botón base */
  line-height: 1.3;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  min-height: 40px;
  /* altura alineada con botón en desktop */
}

.timer-inputs input[type="number"]:focus {
  color: var(--accent);
  border-color: var(--accent);
}

/* Ocultar spinners pero mantener ↑↓ y scroll funcionando */
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;
  /* Firefox */
}

.spacer {
  flex: 1;
}

/* Form elements */
label {
  font-size: 1.5rem;
  color: var(--foreground);
  text-transform: uppercase;
  font-weight: 300;
}

input[type="number"],
input[type="range"],
select {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  min-width: 0;
}

input[type="number"] {
  width: 5rem;
  height: 2.5rem;
}

input[type="range"] {
  width: 5rem;
  padding: 0;
}

select {
  min-width: 8rem;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buttons */
button {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

/* Tooltip styles */
button[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
}

button[title]:hover::before {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(0, 0, 0, 0.9);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Play button accent color */
#playBtn {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 8.5rem;
  /* ancho fijo para evitar saltos entre PLAY/PAUSE */
}

#playBtn:hover {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent);
}

/* Top tools toolbar: prevent hover jump and shrinking */
.top-tools button {
  flex: 0 0 auto;
  transform: none;
}

.top-tools button:hover {
  transform: none;
}

.top-tools {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 1rem;
}

/* Texto del botón de Play/Pause alineado a la izquierda del icono */
#playBtn .btn-text {
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-block;
  min-width: 5.2ch;
  /* reserva ancho máximo de "PAUSE" */
  text-align: center;
}

/* Preset selector */
.preset-selector {
  gap: 0.5rem;
  align-items: center;
  margin-left: 10px;
  position: relative;
}

.preset-selector label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

#presetSelect {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--foreground);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  /* altura alineada con botón en desktop */
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

#presetSelect:hover {
  border-color: var(--accent);
}

#presetSelect:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

#hideUIBtn {
  width: 2.5rem;
  padding: 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

/* Stage and timer */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0rem;
  min-height: 0;
}

.timer-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Target chip (definición anterior consolidada en bloque superior) */

.time {
  font-family: 'Chivo Mono', 'Courier New', monospace;
  font-size: 20vw;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--foreground);
  text-align: center;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Kerning más ajustado solo para los dos puntos centrales HH:MM:SS */
.time .colon {
  display: inline-block;
  margin-left: -0.22ch;
  margin-right: -0.22ch;
}

.time .digit-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
}

.time .digits {
  display: block;
  line-height: 0.78;
}

.time .digit-label {
  display: block;
  font-size: 0.05em;
  margin-top: -0.04em;
  text-transform: uppercase;
  letter-spacing: 0.6em;
  font-weight: 400;
  opacity: 0.8;
}

.subtitle {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Chivo Mono', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 4vw;
  font-weight: 600;
  color: var(--foreground);
  text-align: center;
  max-width: 80%;
  word-wrap: break-word;
  z-index: 10;
}

.subtitle-top {
  top: 1rem;
  bottom: auto;
  font-size: 3vw;
}

/* Indicador de hora actual, pequeño y centrado sobre los dos puntos */
.current-time {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 128px;
  /* valor de respaldo; se ajusta vía JS según .topbar */
  text-align: center;
  color: var(--foreground);
  font-family: 'Chivo Mono', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  pointer-events: none;
  z-index: 150;
  /* por encima del timer-box pero debajo de modales */
}

.current-time-title {
  font-size: 0.9vw;
  font-weight: 600;
  opacity: 0.8;
  text-transform: uppercase;
}

.current-time-value {
  font-size: 2.4vw;
  font-weight: 700;
  line-height: 1.1;
}

@media (max-width: 768px) {
  .current-time-title {
    font-size: 2.2vw;
  }

  .current-time-value {
    font-size: 5vw;
  }
}

/* Mirror mode para valor de hora actual */
.current-time.mirror .current-time-value {
  display: inline-block;
  transform: scaleX(-1);
}

/* Mirror mode para el título del indicador */
.current-time.mirror .current-time-title {
  transform: scaleX(-1);
}

/* Theme selector styles removed - no longer needed */
/*
.theme-selector {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: row;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 16px;
  box-shadow: 0 4px 20px var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.theme-selector:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.theme-circle {
  width: 30px;
  height: 35px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-circle:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.theme-circle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-circle:active {
  transform: scale(0.95);
}

.theme-circle.active {
  border-color: var(--accent);
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.theme-circle[data-theme="mono-dark"] {
  background-color: #000000;
}

.theme-circle[data-theme="mono-light"] {
  background-color: #ffffff;
}

.theme-circle[data-theme="solar"] {
  background-color: #26516e;
}

.theme-circle[data-theme="violet"] {
  background-color: #1d1432;
}

.theme-circle[data-theme="neon-cyber"] {
  background-color: #0fe312;
}

.theme-circle[data-theme="ocean-sunset"] {
  background-color: #ff6647;
}

.theme-circle[data-theme="fire-dragon"] {
  background-color: #ff0000;
}

.theme-circle[data-theme="electric-blue"] {
  background-color: #00d1ed;
}

.theme-circle[data-theme="royal-purple"] {
  background-color: #e868ff;
}
*/

/* UI Hidden state */
html.ui-hidden .topbar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

html.ui-hidden .stage {
  padding: 0;
}

/* Show UI button - visible only when UI is hidden */
#showUIBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s ease;
}

#showUIBtn:hover {
  background: var(--accent);
  color: var(--background);
}

html.ui-hidden #showUIBtn {
  display: block !important;
}

html:not(.ui-hidden) #showUIBtn {
  display: none !important;
}

/* Value displays */
[data-label="volume-val"] {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 2.5rem;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
  }

  .topbar>* {
    width: 100%;
  }

  .brand {
    align-self: center;
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .separator-vertical {
    display: none;
  }

  .topbar .timer-inputs {
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    order: 1;
    width: 100%;
    max-width: 400px;
  }

  .timer-inputs input {
    width: 6ch;
    text-align: center;
    font-size: 1.1rem;
    padding: 0.75rem 0.5rem 0.75rem 0.5rem;
    min-height: 48px;
    /* igual que botones en este breakpoint */
  }

  .timer-inputs label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
  }

  .topbar .preset-selector {
    order: 2;
    justify-content: center;
    align-items: center;
    margin: 0.25rem 0;
    width: 100%;
    max-width: 400px;
  }

  .topbar .preset-selector select {
    width: 100%;
    max-width: 280px;
    padding: 0.875rem;
    font-size: 1rem;
    text-align: center;
    min-height: 48px;
    /* igual que botones en este breakpoint */
  }

  .topbar #playBtn {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
    width: 8.5rem;
    /* mantener ancho fijo también en este breakpoint */
  }

  .topbar .group.right {
    order: 3;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 400px;
    margin-left: 0;
  }

  .group {
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
  }

  button {
    padding: 0.625rem;
    font-size: 0.9rem;
    min-width: 48px;
    min-height: 48px;
  }

  .stage {
    padding: 1rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .time {
    font-size: 25vw;
    line-height: 0.8;
    text-align: center;
  }

  .theme-selector {
    left: 50%;
    transform: translateX(-50%);
    gap: 0.5rem;
  }

  .theme-circle {
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (max-width: 480px) {
  .topbar {
    font-size: 0.875rem;
    padding: 0.5rem;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
  }

  .brand {
    margin-bottom: 0.125rem;
  }

  .timer-inputs {
    gap: 0.75rem;
    width: 100%;
    max-width: 350px;
  }

  .timer-inputs input {
    width: 5ch;
    font-size: 1rem;
    padding: 0.625rem 0.375rem;
    min-height: 44px;
    /* igual que botones en este breakpoint */
  }

  .timer-inputs label {
    font-size: 0.75rem;
  }

  .preset-selector {
    margin: 0.125rem 0;
    width: 100%;
    max-width: 350px;
  }

  .preset-selector select {
    width: 100%;
    max-width: 250px;
    padding: 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
    /* igual que botones en este breakpoint */
  }

  #playBtn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    margin-left: 0;
    width: 8.5rem;
    /* mantener ancho fijo también en móvil pequeño */
  }

  .group.right {
    gap: 0.5rem;
    margin-top: 0.25rem;
    width: 100%;
    max-width: 350px;
    margin-left: 0;
  }

  .group {
    gap: 0.5rem;
  }

  button {
    padding: 0.5rem;
    font-size: 0.85rem;
    min-width: 44px;
    min-height: 44px;
  }

  .stage {
    padding: 0.5rem;
    width: 100%;
  }

  .time {
    font-size: 28vw;
    line-height: 0.75;
    text-align: center;
  }

  .theme-selector {
    left: 50%;
    transform: translateX(-50%);
    gap: 0.4rem;
  }

  .theme-circle {
    width: 2rem;
    height: 2rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Focus visible for better keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 255, 255, 0.3);
    --glass: rgba(255, 255, 255, 0.1);
  }
}

/* Mini control layout */
.mini-root {
  padding: 12px;
}

.mini-root .container {
  max-width: 100%;
  width: 100%;
  padding: 0 0.75rem;
}

.mini-root .container .muted {
  white-space: normal;
  overflow-wrap: anywhere;
}

.mini-header {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: 1rem 0;
}

.mini-header .time {
  font-size: 8vw;
  line-height: 0.9;
}

.time-mini {
  font-family: 'Chivo Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--foreground);
}

.mini-content {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.mini-col {
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
}

.mini-inputs {
  margin-bottom: 0.25rem;
  justify-content: center;
  align-items: center;
}

.mini-actions {
  justify-content: center;
  align-items: center;
  margin-top: 0.25rem;
}

.btn-square-sm {
  min-width: 40px;
  min-height: 40px;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-note {
  margin-top: 0.25rem;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.mini-note .muted {
  white-space: normal;
  max-width: 60ch;
  margin: 0 auto;
}

.mini-root .divider {
  margin: 0.25rem 0;
}

/* Espaciado entre el texto superior y las herramientas */
.mini-root>section.group:first-of-type {
  margin-bottom: 1rem;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal:not([hidden]) .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--hover-color);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(80vh - 100px);
}

/* Presets Modal: mosaico de cajas de tamaño fijo */
.presets-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.presets-list .btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  min-width: 140px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

@media (max-width: 480px) {
  .presets-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .presets-list .btn-secondary {
    height: 56px;
    min-width: auto;
    font-size: 0.95rem;
  }
}

/* Popover compacto de presets (debajo del botón de presets) */
.presets-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 1001;
  min-width: 260px;
}

.presets-popover .presets-list {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.5rem;
}

.presets-popover .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  min-height: 40px;
  flex: initial;
}

.support-content {
  text-align: center;
}

.support-icon {
  margin-bottom: 1.5rem;
  color: var(--accent-color);
}

.support-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-color);
  margin-bottom: 2rem;
}

.support-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  color: var(--text-color);
  text-decoration: none;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.support-link:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.support-link svg {
  width: 18px;
  height: 18px;
  transition: all 0.3s ease;
}

/* Subtitle Modal Styles */
.subtitle-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subtitle-form label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.subtitle-form input,
.subtitle-form select {
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--foreground);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.subtitle-form input:focus,
.subtitle-form select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Target Modal refinements */
#targetModal .modal-description {
  margin-bottom: 1rem;
  /* separa el texto de introducción del primer campo */
}

#targetModal .subtitle-form {
  gap: 0.5rem;
  /* pega más los labels a sus campos en este modal */
}

#targetModal .subtitle-form label {
  margin-bottom: 0.125rem;
  /* acercar el label a la parte superior del campo */
}

#targetModal .subtitle-form+.subtitle-form {
  margin-top: 0.75rem;
}

#targetModal .timer-inputs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  /* compacto y elegante para HH y MM */
  margin-left: 0;
  /* neutraliza el margen left del componente en el modal */
}

/* Date input calendar icon adapts to theme */
#targetModal input[type="date"]::-webkit-calendar-picker-indicator {
  filter: var(--calendar-icon-filter);
  opacity: 0.85;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Target Modal: layout en dos columnas con separador */
#targetModal .modal-content {
  max-width: 900px;
}

#targetModal .modal-body.two-columns {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

#targetModal .column-separator {
  width: 1px;
  background: var(--border);
}

#targetModal .target-config,
#targetModal .target-description {
  min-width: 0;
  /* mejor manejo de contenido largo */
}

@media (max-width: 768px) {
  #targetModal .modal-body.two-columns {
    display: block;
  }

  #targetModal .column-separator {
    display: none;
  }

  #targetModal .target-description {
    margin-top: 1rem;
  }
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover, var(--accent));
  transform: translateY(-1px);
  color: var(--bg);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--foreground);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: var(--hover-color);
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .support-description {
    font-size: 1rem;
  }
}

/* SEO Content Sections */
.seo-content {
  display: none;
  background: var(--bg);
  color: var(--fg);
  overflow-y: auto;
  height: auto;
  min-height: 0;
  padding-top: 0;
  position: relative;
  z-index: 2;
}

.seo-content.visible {
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero Section */
.hero-section {
  padding: 4rem 0;
  text-align: center;
  background: var(--bg);
}

/* Promo Banner */
.promo-banner {
  padding: 1.5rem 0;
  background: var(--bg);
}

.promo-banner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: var(--muted);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.feature-badge {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

/* Features Section */
.features-section {
  padding: 4rem 0;
  background: var(--bg);
}

.features-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--fg);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px var(--shadow);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg {
  width: 48px;
  height: 48px;
  stroke: currentColor;
  fill: none;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.feature-card p {
  color: var(--muted);
  line-height: 1.6;
}

/* Use Cases Section */
.use-cases-section {
  padding: 4rem 0;
  background: var(--bg);
}

.use-cases-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--fg);
}

.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.use-case {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.use-case h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.use-case ul {
  list-style: none;
  padding: 0;
}

.use-case li {
  padding: 0.5rem 0;
  color: var(--muted);
  position: relative;
  padding-left: 1.5rem;
}

.use-case li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Benefits Section */
.benefits-section {
  padding: 4rem 0;
  background: var(--bg);
}

.benefits-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.benefits-text h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--fg);
}

.benefit-item {
  margin-bottom: 2rem;
}

.benefit-item h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.benefit-item p {
  color: var(--muted);
  line-height: 1.6;
}

.benefits-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-preview {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem;
  text-align: center;
  backdrop-filter: blur(10px);
}

.preview-display {
  font-family: "Chivo Mono", monospace;
  font-size: 3rem;
  font-weight: 300;
  color: var(--fg);
  margin-bottom: 1rem;
}

.preview-subtitle {
  font-size: 1rem;
  color: var(--muted);
}

/* How It Works Section */
.how-it-works-section {
  padding: 4rem 0;
  background: var(--bg);
}

.how-it-works-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--fg);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.step {
  text-align: center;
  padding: 2rem;
}

.step-number {
  width: 60px;
  height: 60px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0 auto 1rem;
}

.step h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.step p {
  color: var(--muted);
  line-height: 1.6;
}

/* FAQ Section */
.faq-section {
  padding: 4rem 0;
  background: var(--bg);
}

.faq-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--fg);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

/* Ensure each FAQ item occupies a full row */
.faq-grid>.faq-item {
  grid-column: 1 / -1;
}

.faq-item {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.faq-item h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.faq-item p {
  color: var(--muted);
  line-height: 1.6;
}

/* Changelog: estrechar ancho de los bloques usando clase de página */
.changelog-page .faq-item {
  width: min(800px, 100%);
  margin-left: auto;
  margin-right: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
  padding: 1rem 0;
}

.changelog-page .faq-grid {
  gap: 0;
  justify-items: center;
}

.changelog-page .faq-item+.faq-item {
  border-top: 1px solid var(--border);
}

/* CTA Section */
.cta-section {
  padding: 4rem 0;
  text-align: center;
  background: var(--bg);
}

.cta-content h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.cta-content p {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.cta-button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  /* quitar subrayado en enlaces-botón */
}

.cta-button:hover {
  background: #5a8cff;
  color: var(--bg);
  /* mantener contraste del texto en hover */
  text-decoration: none;
  /* evitar subrayado en hover */
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(122, 162, 255, 0.3);
}

/* asegurar que foco no cambie el color ni subraye el texto */
.cta-button:focus,
.cta-button:active {
  color: var(--bg);
  text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .hero-features {
    flex-direction: column;
    align-items: center;
  }

  .features-grid,
  .use-cases-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .benefits-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .preview-display {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 1.5rem;
  }

  .features-section h2,
  .use-cases-section h2,
  .benefits-text h2,
  .how-it-works-section h2,
  .faq-section h2,
  .cta-content h2 {
    font-size: 1.8rem;
  }

  .feature-card,
  .use-case,
  .faq-item {
    padding: 1.5rem;
  }
}

/* Toast styles */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: auto;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.hide {
  opacity: 0;
  transform: translateY(-20px);
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--glass);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 20px var(--shadow);
  z-index: 1002;
}

.cookie-banner .cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.cookie-banner .cookie-message {
  color: var(--text);
  font-size: 0.95rem;
}

.cookie-banner .cookie-actions {
  display: flex;
  gap: 0.75rem;
}

.cookie-banner .cookie-actions .btn-primary,
.cookie-banner .cookie-actions .btn-secondary {
  flex: initial;
  /* evitar expansión completa */
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .cookie-banner .cookie-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .cookie-banner .cookie-actions {
    justify-content: flex-end;
  }
}

/* Configuration Menu */
.config-btn {
  display: none;
}

.config-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.config-menu.show {
  opacity: 1;
  visibility: visible;
}

.config-menu-content {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.config-menu.show .config-menu-content {
  transform: scale(1);
}

.config-menu-content button {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  min-width: 200px;
}

.config-menu-content button:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
}

.config-menu-content button svg {
  flex-shrink: 0;
}

.config-menu-content button span {
  flex: 1;
}

/* Responsive behavior */
@media (max-width: 768px) {
  .topbar .config-btn {
    display: flex;
  }

  .topbar #themeBtn,
  .topbar #repeatBtn,
  .topbar #subtitleBtn,
  .topbar #beepBtn,
  .topbar #shareBtn,
  .topbar #resetBtn,
  .topbar #progressToggleBtn,
  .topbar #autoplayBtn,
  .topbar #displayModeBtn {
    display: none;
  }

  .config-menu-content {
    padding: 1.5rem;
    gap: 0.75rem;
  }

  .config-menu-content button {
    padding: 0.75rem;
    font-size: 0.9rem;
    min-width: 180px;
  }
}

/* Rectangular Progress Border */
.progress-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.progress-border.active {
  opacity: 1;
}

.progress-border.finished {
  animation: progress-blink 0.5s ease-in-out 3;
}

/* Horizontal Progress Bar */
.horizontal-progress-bar {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  width: 100vw;
  height: 25vw;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0;
  overflow: hidden;
  backdrop-filter: blur(10px);
  margin-left: calc(-50vw + 50%);
}

.horizontal-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light, var(--accent)));
  border-radius: 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 20px rgba(var(--accent-rgb, 122, 162, 255), 0.3);
}

.horizontal-progress-bar.finished .horizontal-progress-fill {
  animation: progress-bar-blink 0.5s ease-in-out 3;
}

/* Responsive adjustments for progress bar */
@media (max-width: 768px) {
  .horizontal-progress-bar {
    height: 25vw;
  }
}

@media (max-width: 480px) {
  .horizontal-progress-bar {
    height: 28vw;
  }
}

@keyframes progress-bar-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

@keyframes progress-blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0.3;
  }
}

.progress-line {
  position: absolute;
  background: var(--accent);
  transition: background-color 0.2s ease;
}

.progress-top {
  top: 0;
  left: 0;
  height: 40px;
  width: 0%;
  transform-origin: left;
}

.progress-right {
  top: 0;
  right: 0;
  width: 40px;
  height: 0%;
  transform-origin: top;
}

.progress-bottom {
  bottom: 0;
  right: 0;
  height: 40px;
  width: 0%;
  transform-origin: right;
}

.progress-left {
  bottom: 0;
  left: 0;
  width: 40px;
  height: 0%;
  transform-origin: bottom;
}

/* Hide progress border when UI is hidden - only if progress is active */
html.ui-hidden .progress-border.active {
  opacity: 0.7;
}

/* Remove old circular progress styles */

/* Inicio: Footer */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 1.25rem 0;
  color: var(--fg);
  position: relative;
  z-index: 2;
}

.site-footer .footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.9;
}

.site-footer .footer-links a:hover {
  color: var(--accent);
  opacity: 1;
}

.site-footer .footer-note {
  color: var(--muted);
}

@media (max-width: 768px) {
  .site-footer {
    padding: 1rem 0;
  }
}

/* Fin: Footer */
#targetModal .modal-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* separación entre icono y texto */
}

/* Informational muted text */
.muted {
  color: var(--muted);
  text-align: center;
}

/* Horizontal divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
