.tm-app {
  padding: 1.25rem 1rem 1.5rem;
  display: grid;
  gap: 1.1rem;
}

.tm-app > * {
  min-width: 0;
}

.tm-app p {
  margin: 0;
}

.tm-center {
  text-align: center;
}

.kis-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Presets */

.tm-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.tm-preset {
  padding: 0 0.9rem;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* The big clock */

.tm-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem 1.25rem;
  border-radius: 20px;
  background: var(--kis-surface);
  border: 1px solid var(--kis-border);
  text-align: center;
}

.tm-label {
  font-size: 1.1rem;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tm-digits {
  font-size: clamp(4.5rem, 24vw, 8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tm-done {
  font-size: 1.3rem;
  font-weight: 800;
}

.tm-bar {
  width: 100%;
  height: 10px;
  margin-top: 0.75rem;
  border-radius: var(--kis-radius-pill);
  background: var(--kis-border);
  overflow: hidden;
}

.tm-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--kis-accent);
  transition: width 0.25s linear;
}

/* Time's up (or Test alarm): the clock turns the accent color and pulses. */
.tm-flash .tm-face,
.tm-test .tm-face {
  background: var(--kis-accent);
  border-color: transparent;
  color: var(--kis-accent-contrast);
  animation: tm-pulse 1s ease-in-out infinite;
}

.tm-flash .tm-bar,
.tm-test .tm-bar {
  background: transparent;
}

@keyframes tm-pulse {
  50% { opacity: 0.55; }
}

/* Controls */

.tm-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.tm-start {
  min-width: 9rem;
  font-size: 1.15rem;
  padding: 0.9rem 2rem;
}

.tm-ctrl {
  padding: 0 1.25rem;
}

.tm-small {
  font-size: 0.85rem;
  padding: 0 1rem;
}

/* Set a time */

.tm-setter {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
}

.tm-set-title,
.tm-section-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--kis-text);
}

.tm-set-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
}

.tm-unit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tm-step {
  width: 48px;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.tm-field {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--kis-text-muted);
}

.tm-field input {
  width: 4.2rem;
  min-height: 48px;
  text-align: center;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--kis-text);
  border: 1px solid var(--kis-border);
  border-radius: var(--kis-radius);
  background: var(--kis-surface);
}

.tm-hint {
  font-size: 0.8rem;
  color: var(--kis-text-muted);
}

/* My presets & sound */

.tm-more {
  border-top: 1px solid var(--kis-border);
  padding-top: 0.5rem;
}

.tm-more summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  cursor: pointer;
  color: var(--kis-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.tm-section {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.6rem;
}

.tm-input {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  padding: 0 0.75rem;
  border: 1px solid var(--kis-border);
  border-radius: var(--kis-radius);
  background: var(--kis-surface);
  color: var(--kis-text);
  font: inherit;
  font-size: 1rem; /* 16px keeps iPhone from zooming in on focus */
}

.tm-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.tm-my-presets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.tm-my-preset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  overflow-wrap: anywhere;
}

.tm-field-block {
  display: grid;
  gap: 0.35rem;
}

.tm-field-block input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--kis-accent);
}

.tm-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-size: 0.9rem;
  cursor: pointer;
}

.tm-check input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: var(--kis-accent);
}

/* Fullscreen: only the clock and its controls, as big as the screen allows. */

body.presenting .kis-header,
body.presenting .kis-about,
body.presenting .kis-footer,
body.presenting .tm-presets,
body.presenting .tm-setter,
body.presenting .tm-more,
body.presenting #awake-note {
  display: none;
}

body.presenting .kis-main {
  padding: 0;
}

body.presenting .kis-app {
  position: fixed;
  inset: 0;
  max-width: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 1.5rem 1rem;
  align-content: center;
  z-index: 10;
}

body.presenting .tm-face {
  border: none;
  background: transparent;
}

body.presenting .tm-flash .tm-face {
  background: var(--kis-accent);
}

body.presenting .tm-digits {
  font-size: min(26vw, 55dvh);
}

body.presenting .tm-label,
body.presenting .tm-done {
  font-size: clamp(1.3rem, 4vw, 3rem);
}

@media (prefers-reduced-motion: reduce) {
  .tm-flash .tm-face,
  .tm-test .tm-face {
    animation: none;
  }
  .tm-bar-fill {
    transition: none;
  }
}
