.alarms-page {
  --alarm-toolbar-top: max(6.5cqh, calc(env(safe-area-inset-top, 0px) + 2px));
  overflow: hidden;
}
.alarm-toolbar {
  position: absolute;
  top: var(--alarm-toolbar-top);
  left: 4.55%;
  right: 4.55%;
  height: 10cqw;
  margin: 0;
  overflow: visible;
}
.alarm-toolbar .pill,
.sheet-round-button,
.sheet-save-button {
  display: grid;
  place-items: center;
  height: 10cqw;
  padding: 0;
  border: 1px solid #303030;
  border-radius: 999px;
  background: linear-gradient(180deg, #242424 0%, #202020 30%, #202020 90%, #272727 100%);
  box-shadow: inset 0 1px 1px #ffffff12, inset 0 -1px 1px #ffffff16;
  color: #eee;
  font-size: 3.7cqw;
  line-height: 1;
  font-weight: 400;
  text-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}
.alarm-toolbar #edit-alarms { width: 15cqw; }
.alarm-toolbar .pill.plus { width: 10cqw; }
.alarm-toolbar svg,
.sheet-round-button svg {
  display: block;
  width: 6.4cqw;
  height: 6.4cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.alarm-toolbar .edit-check { display: none; }
.alarm-toolbar #edit-alarms.is-editing {
  width: 10cqw;
  color: white;
  background: #00a4f5;
  border-color: #00b1fc;
  box-shadow: inset 0 1px 1px #ffffff24;
}
.alarm-toolbar #edit-alarms.is-editing .edit-label { display: none; }
.alarm-toolbar #edit-alarms.is-editing .edit-check { display: block; }
#alarm-list {
  position: absolute;
  top: calc(var(--alarm-toolbar-top) + 15cqw);
  bottom: 55px;
  left: 0;
  right: 0;
  overflow-y: auto;
}
.clear-alarms { font-size: 3.636cqw; bottom: 1.7cqh; }
.alarm-sheet {
  position: fixed;
  inset: max(6.55dvh, env(safe-area-inset-top, 0px)) 0 0;
  width: min(100%, 480px);
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #080808;
  border-bottom: 0;
  border-radius: 36px 36px 0 0;
  background: #000;
  color: #eee;
  box-shadow: 0 -6px 28px #0005;
  container-type: inline-size;
}
.alarm-sheet::backdrop { background: #000a; }
.alarm-sheet-form { height: 100%; }
.alarm-sheet-view { height: 100%; overflow-y: auto; }
.alarm-sheet-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  height: 16.7cqw;
  margin: 0 4.55cqw;
  padding-top: 4.4cqw;
  border-bottom: 1px solid #2b2b2b;
}
.alarm-sheet-header h2 {
  position: absolute;
  top: 7.5cqw;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: #f3f3f3;
  font-size: 3.8cqw;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
}
.sheet-round-button { width: 10cqw; flex-shrink: 0; }
.sheet-save-button { width: 15cqw; color: #009dff; }
.sheet-save-button:disabled { color: #383838; cursor: default; opacity: 1; }
.alarm-time-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 45.05cqw;
}
.alarm-time-control {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 21.7cqw;
  height: 8.15cqw;
  padding: 0 2.8cqw;
  border-radius: 999px;
  background: #202020;
  color: #eee;
  font-size: 4cqw;
  line-height: 1;
  white-space: nowrap;
}
.alarm-time-control { padding: 0; }
#alarm-time-trigger { width: 100%; height: 100%; min-height: 8.15cqw; padding: 0 2.8cqw; border-radius: inherit; background: transparent; color: inherit; white-space: nowrap; }
#alarm-time-trigger[aria-expanded="true"] { color: #009dff; }
.alarm-repeat-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  width: 100%;
  min-height: 11.35cqw;
  padding: 0 4.55cqw;
  background: #0b0b0b;
  border-radius: 0;
  color: #999;
  font-size: 2.8cqw;
  text-align: left;
}
.alarm-repeat-row::before {
  content: "";
  position: absolute;
  left: 4.55cqw;
  right: 4.55cqw;
  top: 0;
  align-self: flex-start;
  height: 1px;
  background: #303030;
}
.repeat-required { color: #ff1717; }
.repeat-summary { margin-left: auto; }
.alarm-repeat-row svg { width: 2cqw; height: 3cqw; stroke: #505050; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.alarm-repeat-row { border-bottom: 1px solid #303030; }
.alarm-repeat-header { height: 26.8cqw; border-bottom: 0; }
.repeat-complete { background: #00a4f5; border-color: #00b1fc; color: #fff; }
.repeat-day-list { padding: 0; background: #0b0b0b; position: relative; }
.repeat-day-list::before { content: ""; position: absolute; top: 0; left: 4.55cqw; right: 4.55cqw; height: 1px; background: #303030; }
.repeat-day-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 10cqw;
  padding: 0 4.55cqw;
  background: #0b0b0b;
  border: 0;
  border-radius: 0;
  color: #eee;
  font-size: 2.8cqw;
  text-align: left;
}
.repeat-day-option::before { content: ""; position: absolute; left: 4.55cqw; right: 4.55cqw; bottom: 0; height: 1px; background: #303030; }
.repeat-day-option[aria-pressed="true"]::after { content: "✓"; color: #ff9f00; font-size: 5.2cqw; font-weight: 500; }
@media (min-aspect-ratio: 1/1.85) {
  .alarm-sheet { width: min(100%, 46.025105dvh, 480px); }
}

/* The reference uses a floating, scrollable three-column time wheel. */
.alarm-time-popover {
  --wheel-row-height: 8cqw;
  position: absolute;
  z-index: 5;
  top: 45.6cqw;
  right: 5.8cqw;
  width: 52.6cqw;
  height: 46.2cqw;
  overflow: hidden;
  border: 1px solid #3b3b3b;
  border-radius: 6.4cqw;
  background: linear-gradient(145deg, #232424, #202121);
  box-shadow: 0 3px 20px #0005, inset 0 1px 1px #ffffff0b;
}
.wheel-selection {
  position: absolute;
  top: calc(50% - var(--wheel-row-height) / 2);
  left: 3.5cqw;
  right: 3.5cqw;
  height: var(--wheel-row-height);
  border-radius: 999px;
  background: #3d3d3d;
  pointer-events: none;
}
.time-wheel-columns { display: grid; grid-template-columns: 40% 24% 36%; height: 100%; padding: 0 3cqw; }
.time-wheel-column {
  z-index: 1;
  position: relative;
  height: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-block: calc((46.2cqw - var(--wheel-row-height) - 2px) / 2);
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #0005 20%, #000 39%, #000 61%, #0005 80%, transparent);
  mask-image: linear-gradient(transparent, #0005 20%, #000 39%, #000 61%, #0005 80%, transparent);
}
.time-wheel-column::-webkit-scrollbar { display: none; }
.time-wheel-column:focus-visible { outline: 1px solid #009dff; outline-offset: -2px; border-radius: 12px; }
.time-wheel-option {
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--wheel-row-height);
  min-height: var(--wheel-row-height);
  padding: 0;
  scroll-snap-align: center;
  background: transparent;
  color: #999;
  font-size: 5.3cqw;
  line-height: 1;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.time-wheel-option[aria-selected="true"] { color: #fff; }

/* Reminder rows and swipe-to-delete follow the supplied alarm list. */
#alarm-list { top: calc(var(--alarm-toolbar-top) + 12.3cqw); }
.alarm-row {
  position: relative;
  display: block;
  height: 18.18cqw;
  min-height: 18.18cqw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-bottom: 1px solid #292929;
  touch-action: pan-y;
}
.alarm-content {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  padding: 2.5cqw 3.4cqw 1.5cqw;
  overflow: hidden;
  border-radius: 0;
  background: #000;
  color: #eee;
  text-align: left;
  transition: transform .2s ease, border-radius .2s ease, background .2s ease;
  touch-action: pan-y;
}
.alarm-clock-line { display: flex; align-items: baseline; gap: .5cqw; line-height: 1.1; white-space: nowrap; }
.alarm-period { font-size: 6cqw; font-weight: 300; }
.alarm-content .alarm-clock { font-size: 9cqw; font-weight: 200; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: normal; }
.alarm-content .alarm-caption { margin-top: .3cqw; font-size: 3.1cqw; line-height: 1.2; color: #aaa; white-space: nowrap; }
.alarm-row.is-disabled .alarm-content { color: #777; }
.alarm-row.is-disabled .alarm-caption { color: #666; }
.alarm-row.is-revealed .alarm-content { transform: translateX(-16cqw); background: #2c2c2e; border-radius: 0 7cqw 7cqw 0; }
.alarm-row.is-revealed { border-bottom-color: transparent; }
.alarm-row.is-revealed .alarm-content::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: #292929; }
.alarm-row.is-dragging .alarm-content { transition: none; }
.alarm-row .delete-alarm {
  position: absolute;
  z-index: 0;
  top: 1.1cqw;
  bottom: 1.1cqw;
  right: 2.3cqw;
  width: 11.35cqw;
  margin: 0;
  padding: 0;
  border-radius: 3.8cqw;
  background: #ff3b44;
  color: #fff;
  font-size: 2.8cqw;
}
.alarm-edit-minus {
  position: absolute;
  z-index: 2;
  top: calc(50% - 2.5cqw);
  left: 4.8cqw;
  width: 5cqw;
  height: 5cqw;
  padding: 0;
  border-radius: 50%;
  background: #ff3b44;
  color: #fff;
}
.alarm-edit-minus::before { content: ""; position: absolute; left: 25%; right: 25%; top: calc(50% - .17cqw); height: .34cqw; border-radius: 999px; background: #fff; }
.alarm-row.is-editing .alarm-content { padding-left: 13.4cqw; }
.alarm-row.is-editing.is-revealed .alarm-edit-minus { display: none; }
@media (prefers-reduced-motion: reduce) { .alarm-content { transition: none; } }
