:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

body {
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.timer {
  --accent: #c0202a;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  width: min(360px, calc(100vw - 24px));
  min-height: 58px;
  padding: 0 14px 2px;
  color: #fff;
  background: rgba(7, 9, 7, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 3px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.status i {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
}

.status strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#timer {
  min-width: 65px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  overflow: hidden;
  background: #242424;
}

.progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(1);
  transform-origin: left;
  transition: background-color 300ms ease;
}

.timer.is-due { --accent: #53fc18; }

.timer.is-warning {
  animation: warning-pulse 1.15s ease-in-out infinite;
}

.timer.is-warning #timer {
  animation: timer-pulse 1.15s ease-in-out infinite;
}

.timer.is-warning .status i {
  animation: status-blink 1.15s ease-in-out infinite;
}

.timer.is-critical,
.timer.is-critical #timer,
.timer.is-critical .status i {
  animation-duration: 550ms;
}

.timer.is-due.is-warning { animation-name: due-pulse; }

@keyframes warning-pulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow: 0 8px 28px rgba(192, 32, 42, 0.58);
  }
}

@keyframes due-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32); }
  50% { box-shadow: 0 8px 28px rgba(83, 252, 24, 0.46); }
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.52; transform: scale(1.05); }
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@media (max-width: 380px) {
  .timer {
    width: calc(100vw - 24px);
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress i { transition: none; }
  .timer.is-warning,
  .timer.is-warning #timer,
  .timer.is-warning .status i { animation: none; }
}
