:root {
  --ink: #171331;
  --paper: #fffaf0;
  --white: #fff;
  --purple: #6d38ff;
  --blue: #147df5;
  --yellow: #ffd23f;
  --red: #f02d3a;
  --line: rgba(23, 19, 49, .14);
  --shadow: 0 16px 36px rgba(23, 19, 49, .2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

.timer-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, .44);
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.timer-header h1,
.timer-presets h2,
.timer-label,
.timer-kicker,
.timer-status,
.timer-presets-heading p {
  margin: 0;
}

.timer-header h1 {
  font-size: clamp(1.45rem, 2.8vw, 2.2rem);
  line-height: 1;
}

.timer-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.timer-mode-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-height: 44px;
  padding: 3px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
}

.timer-mode-button {
  position: relative;
  min-width: 84px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 1000;
}

.timer-mode-button-new {
  padding-right: 28px;
}

.timer-new-badge {
  position: absolute;
  top: -9px;
  right: -6px;
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 18px;
  padding: 0 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 2px 0 rgba(23, 19, 49, .16);
  font-size: .58rem;
  line-height: 1;
  text-transform: uppercase;
}

.timer-mode-button.is-selected {
  color: #fff;
  background: var(--ink);
}

.timer-mode-button.is-selected .timer-new-badge {
  border-color: #fff;
}

.timer-kicker {
  margin-bottom: 4px !important;
  color: rgba(23, 19, 49, .62);
  font-size: .72rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.timer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 12px;
  min-height: 0;
}

.timer-stage,
.timer-presets {
  min-height: 0;
  border: 3px solid rgba(255, 255, 255, .44);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.timer-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  place-items: center;
  gap: 10px;
  padding: clamp(16px, 3vw, 34px);
  overflow: hidden;
  background: rgba(255, 255, 255, .96);
  transition: background .25s ease, border-color .25s ease;
}

.timer-sequence-mode .timer-stage {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: stretch;
  place-items: stretch;
}

.timer-label {
  color: rgba(23, 19, 49, .62);
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.timer-display {
  align-self: center;
  color: var(--ink);
  font-size: clamp(7rem, 22vw, 18rem);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: .78;
  text-align: center;
  white-space: nowrap;
  transition: color .25s ease, transform .25s ease;
}

.timer-single-clock {
  display: grid;
  place-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
}

.timer-single-clock.is-in-sequence {
  gap: 8px;
  padding: 8px 0 4px;
}

.timer-single-clock.is-in-sequence .timer-display {
  font-size: clamp(4.5rem, 13vw, 9.5rem);
}

.timer-single-clock.is-in-sequence .timer-status {
  display: none;
}

.timer-stage-sequence {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.timer-stage-fold {
  display: grid;
  grid-template-rows: auto 0fr;
  overflow: hidden;
  border: 2px solid rgba(23, 19, 49, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .75);
  transition: grid-template-rows 1.4s ease, border-color .8s ease, background .8s ease, opacity .8s ease;
}

.timer-stage-fold.is-active {
  grid-template-rows: auto 1fr;
  border-color: var(--ink);
  background: rgba(255, 210, 63, .26);
}

.timer-stage-fold.is-holding {
  border-color: var(--ink);
  background: #ff5a3d;
}

.timer-stage-fold.is-holding .timer-stage-fold-summary,
.timer-stage-fold.is-holding .timer-stage-fold-detail p,
.timer-stage-fold.is-holding .timer-display {
  color: #fff;
}

.timer-stage-fold.is-holding .timer-progress span {
  background: rgba(255, 255, 255, .88);
}

.timer-stage-fold.is-complete {
  opacity: .68;
}

.timer-stage-fold-summary {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.timer-stage-fold-summary strong {
  overflow: hidden;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-stage-fold-detail {
  min-height: 0;
  overflow: hidden;
}

.timer-stage-fold-detail-inner {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 260px;
  padding: 0 14px 16px 100px;
}

.timer-stage-fold-detail p {
  margin: 0;
}

.timer-stage-fold-detail p {
  color: rgba(23, 19, 49, .78);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 750;
  line-height: 1.35;
  white-space: pre-wrap;
}

.timer-status {
  font-size: clamp(1.15rem, 2.5vw, 1.7rem);
  font-weight: 1000;
}

.timer-progress {
  width: min(800px, 100%);
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 19, 49, .12);
}

.timer-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  transition: width .1s linear, background .25s ease;
}

.timer-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  justify-self: center;
  width: min(900px, 100%);
}

.timer-view-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  justify-self: center;
  width: auto;
}

.timer-auto-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  font-weight: 800;
}

.timer-auto-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--purple);
}

.timer-share-button {
  min-height: 44px !important;
  background: var(--yellow);
}

.timer-share-feedback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.timer-button {
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 5px 0 rgba(23, 19, 49, .16);
  cursor: pointer;
  font-weight: 1000;
}

.timer-button-primary {
  color: #fff;
  background: var(--ink);
}

.timer-button-secondary {
  min-width: 130px;
  background: var(--yellow);
}

.timer-button:active:not(:disabled),
.timer-preset-select:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(23, 19, 49, .16);
}

.timer-button:disabled {
  cursor: not-allowed;
  opacity: .4;
}

.timer-button:focus-visible,
.timer-mode-button:focus-visible,
.timer-preset-select:focus-visible,
.timer-preset-edit:focus-visible,
.timer-preset-dialog input:focus-visible,
.timer-sequence-form textarea:focus-visible,
.timer-sequence-interval input:focus-visible,
.timer-sequence-side-item:focus-visible,
.timer-stage-fold-summary:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

.timer-presets {
  display: grid;
  padding: 14px;
  overflow: hidden;
  background: rgba(255, 250, 240, .96);
}

.timer-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.timer-sequence-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.timer-presets-heading {
  display: grid;
  gap: 6px;
}

.timer-presets-heading h2 {
  font-size: 1.5rem;
  line-height: 1;
}

.timer-presets-heading > p {
  color: rgba(23, 19, 49, .68);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.25;
}

.timer-preset-grid {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.timer-sequence-form {
  display: grid;
  gap: 8px;
}

.timer-sequence-form label {
  font-size: .78rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.timer-sequence-form textarea {
  width: 100%;
  min-height: 180px;
  resize: none;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.35;
}

.timer-sequence-interval {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
}

.timer-sequence-interval span {
  font-size: .78rem;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: none;
}

.timer-sequence-interval input {
  width: 100%;
  min-height: 36px;
  padding: 4px 6px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 900;
  text-align: center;
}

.timer-sequence-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.timer-sequence-actions .timer-button {
  min-height: 42px;
}

.timer-sequence-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.timer-sequence-empty {
  margin: 0;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  color: rgba(23, 19, 49, .7);
  font-weight: 800;
  line-height: 1.35;
}

.timer-sequence-side-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 2px solid rgba(23, 19, 49, .12);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  cursor: pointer;
  text-align: left;
}

.timer-sequence-side-item.is-active {
  border-color: var(--ink);
  background: rgba(255, 210, 63, .36);
}

.timer-sequence-side-item.is-complete {
  opacity: .7;
}

.timer-sequence-time {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.timer-sequence-side-item strong {
  overflow: hidden;
  font-size: .95rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-preset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 8px;
  min-height: 0;
  padding: 6px;
  border: 3px solid transparent;
  border-radius: 12px;
  background: rgba(23, 19, 49, .05);
}

.timer-preset.is-selected {
  border-color: var(--ink);
  background: rgba(255, 210, 63, .36);
}

.timer-preset-select {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 0;
  padding: 10px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 5px 0 rgba(23, 19, 49, .18);
  cursor: pointer;
  text-align: left;
}

.timer-preset-select span {
  font-size: .72rem;
  font-weight: 900;
  opacity: .82;
  text-transform: uppercase;
}

.timer-preset-select strong {
  font-size: clamp(1.5rem, 3.4vw, 2.35rem);
  line-height: .95;
}

.timer-preset-edit {
  min-width: 0;
  padding: 0 8px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 0 rgba(23, 19, 49, .16);
  cursor: pointer;
  font-weight: 900;
}

.timer-preset-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}

.timer-share-dialog {
  width: min(680px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}

.timer-preset-dialog::backdrop {
  background: rgba(0, 0, 0, .78);
}

.timer-share-dialog::backdrop {
  background: rgba(0, 0, 0, .78);
}

.timer-preset-dialog-form {
  display: grid;
  gap: 16px;
  padding: clamp(24px, 5vw, 42px);
}

.timer-share-dialog-form {
  display: grid;
  gap: 16px;
  padding: clamp(24px, 5vw, 42px);
}

.timer-preset-dialog h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
}

.timer-share-dialog h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
}

.timer-preset-dialog label {
  font-size: 1.05rem;
  font-weight: 900;
}

.timer-share-dialog label {
  font-size: 1.05rem;
  font-weight: 900;
}

.timer-preset-dialog input {
  width: 100%;
  min-height: 104px;
  padding: 8px 18px;
  border: 4px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-size: clamp(3rem, 12vw, 5rem);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1;
  text-align: center;
}

.timer-share-dialog input {
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
}

.timer-preset-dialog input[aria-invalid="true"] {
  border-color: var(--red);
}

.timer-preset-dialog-help {
  margin: 0;
  color: rgba(23, 19, 49, .7);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.4;
}

.timer-preset-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.timer-preset-error {
  grid-column: 1 / -1;
  color: var(--red);
  font-size: .65rem;
  font-weight: 900;
}

.timer-preset-error:empty {
  display: none;
}

.timer-stage.is-warning {
  border-color: rgba(240, 45, 58, .8);
  background: linear-gradient(145deg, #fff 0 42%, #ffd9dc 100%);
}

.timer-stage.is-warning .timer-display,
.timer-stage.is-warning .timer-status {
  color: var(--red);
}

.timer-stage.is-warning .timer-progress span {
  background: var(--red);
}

.timer-stage.is-finished {
  color: #fff;
  border-color: #fff;
  background: var(--red);
}

.timer-stage.is-finished .timer-display,
.timer-stage.is-finished .timer-status,
.timer-stage.is-finished .timer-label {
  color: #fff;
}

.timer-focus-mode .timer-header,
.timer-focus-mode .timer-presets {
  display: none !important;
}

.timer-focus-mode .timer-app {
  grid-template-rows: minmax(0, 1fr);
}

.timer-focus-mode .timer-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.timer-focus-mode .timer-stage {
  width: 100%;
  height: 100%;
}

.timer-focus-mode .timer-display {
  font-size: min(30vw, 44vh);
}

@media (max-width: 900px) and (orientation: portrait) {
  .timer-app {
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .timer-header {
    min-height: 54px;
    padding: 7px 10px;
  }

  .timer-header-actions {
    gap: 5px;
  }

  .timer-mode-toggle {
    min-height: 40px;
  }

  .timer-header-actions .timer-auto-option {
    min-height: 40px;
    padding: 0 8px;
    font-size: .8rem;
  }

  .timer-header-actions .timer-button {
    min-height: 40px !important;
    padding: 0 10px;
  }

  .timer-kicker {
    display: none;
  }

  .timer-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 238px;
    gap: 8px;
  }

  .timer-stage {
    gap: 6px;
    padding: 12px;
  }

  .timer-display {
    font-size: clamp(6rem, 25vw, 12rem);
  }

  .timer-controls {
    gap: 6px;
  }

  .timer-button {
    min-height: 46px;
    padding: 0 8px;
  }

  .timer-view-options {
    gap: 8px;
  }

  .timer-auto-option {
    min-height: 40px;
    padding: 0 10px;
  }

  .timer-presets {
    padding: 8px;
  }

  .timer-panel {
    gap: 6px;
  }

  .timer-presets-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .timer-presets-heading > p {
    max-width: 300px;
    text-align: right;
  }

  .timer-preset-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 6px;
  }

  .timer-preset {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 40px;
    gap: 3px;
    padding: 4px;
  }

  .timer-preset-select {
    padding: 7px;
  }

  .timer-preset-select strong {
    font-size: clamp(1.2rem, 5vw, 2rem);
  }

  .timer-preset-edit {
    min-height: 40px;
  }

  .timer-sequence-form {
    gap: 6px;
  }

  .timer-sequence-form textarea {
    min-height: 132px;
  }

  .timer-sequence-list {
    gap: 6px;
  }
}

@media (max-height: 620px) {
  .timer-header {
    min-height: 50px;
  }

  .timer-display {
    font-size: min(18vw, 32vh);
  }

  .timer-stage {
    gap: 5px;
    padding: 12px;
  }

  .timer-button {
    min-height: 44px;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  .timer-app {
    gap: 6px;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .timer-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-height: 0;
    padding: 6px;
    border-radius: 10px;
  }

  .timer-header > div:first-child {
    text-align: center;
  }

  .timer-header h1 {
    font-size: 1.05rem;
  }

  .timer-header-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .timer-mode-toggle {
    grid-column: 1 / -1;
    min-height: 36px;
  }

  .timer-mode-button {
    min-width: 0;
    font-size: .72rem;
  }

  .timer-header-actions .timer-auto-option {
    justify-content: center;
    gap: 4px;
    min-height: 42px;
    padding: 2px 4px;
    font-size: .67rem;
    line-height: 1.05;
    text-align: center;
  }

  .timer-header-actions .timer-auto-option input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
  }

  .timer-header-actions .timer-button {
    min-height: 42px !important;
    padding: 0 5px;
    font-size: .75rem;
  }

  .timer-layout {
    grid-template-rows: minmax(0, 1fr) 156px;
    gap: 6px;
  }

  .timer-stage,
  .timer-presets {
    border-width: 2px;
    border-radius: 12px;
  }

  .timer-stage {
    gap: 4px;
    padding: 8px;
  }

  .timer-label {
    display: none;
  }

  .timer-display {
    font-size: clamp(4rem, 18dvh, 5.2rem);
  }

  .timer-status {
    font-size: 1rem;
  }

  .timer-progress {
    height: 8px;
  }

  .timer-controls {
    gap: 4px;
  }

  .timer-button {
    min-height: 40px;
    padding: 0 3px;
    font-size: .72rem;
  }

  .timer-view-options {
    gap: 4px;
  }

  .timer-button-secondary {
    min-width: 110px;
  }

  .timer-presets {
    gap: 4px;
    padding: 6px;
  }

  .timer-panel {
    gap: 4px;
  }

  .timer-presets-heading h2 {
    font-size: 1rem;
  }

  .timer-presets-heading > p {
    display: none;
  }

  .timer-preset-grid {
    gap: 3px;
  }

  .timer-preset {
    grid-template-rows: minmax(0, 1fr) 34px;
    gap: 2px;
    padding: 2px;
    border-width: 2px;
    border-radius: 8px;
  }

  .timer-preset-select {
    padding: 4px;
    border-radius: 6px;
  }

  .timer-preset-select span {
    font-size: .58rem;
  }

  .timer-preset-select strong {
    font-size: 1.05rem;
  }

  .timer-preset-edit {
    min-height: 34px;
    padding: 0 3px;
    font-size: .7rem;
  }

  .timer-sequence-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .timer-sequence-form {
    gap: 4px;
  }

  .timer-sequence-form > label:not(.timer-sequence-interval) {
    display: none;
  }

  .timer-sequence-form textarea {
    min-height: 94px;
    padding: 6px;
    font-size: .72rem;
  }

  .timer-sequence-actions {
    gap: 4px;
  }

  .timer-sequence-actions .timer-button {
    min-height: 34px;
    font-size: .7rem;
  }

  .timer-sequence-list {
    gap: 4px;
  }

  .timer-sequence-side-item,
  .timer-stage-fold-summary {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .timer-sequence-time {
    min-height: 28px;
    font-size: .74rem;
  }

  .timer-sequence-side-item strong,
  .timer-stage-fold-summary strong {
    font-size: .78rem;
  }

  .timer-stage-fold-detail-inner {
    gap: 5px;
    min-height: 150px;
    padding: 0 6px 7px 58px;
  }

  .timer-stage-fold-detail p {
    font-size: .72rem;
    line-height: 1.25;
  }

  .timer-single-clock.is-in-sequence .timer-display {
    font-size: clamp(3.2rem, 15dvh, 4.4rem);
  }

  .timer-preset-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow: auto;
    border-radius: 14px;
  }

  .timer-preset-dialog-form {
    gap: 12px;
    padding: 20px;
  }

  .timer-preset-dialog h2 {
    font-size: 2rem;
  }

  .timer-preset-dialog input {
    min-height: 82px;
    font-size: 3rem;
  }

  .timer-preset-dialog-help {
    font-size: .82rem;
  }
}

@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .timer-app {
    gap: 6px;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .timer-header {
    gap: 8px;
    min-height: 44px;
    padding: 4px 8px;
  }

  .timer-header h1 {
    font-size: 1.1rem;
  }

  .timer-header-actions {
    gap: 4px;
  }

  .timer-mode-toggle {
    min-height: 36px;
  }

  .timer-mode-button {
    min-width: 68px;
    padding: 0 6px;
    font-size: .68rem;
  }

  .timer-header-actions .timer-auto-option {
    gap: 4px;
    min-height: 36px;
    padding: 0 6px;
    font-size: .68rem;
  }

  .timer-header-actions .timer-auto-option input {
    width: 16px;
    height: 16px;
  }

  .timer-header-actions .timer-button {
    min-height: 36px !important;
    padding: 0 8px;
    font-size: .72rem;
  }

  .timer-layout {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
    gap: 6px;
  }

  .timer-stage,
  .timer-presets {
    border-width: 2px;
    border-radius: 12px;
  }

  .timer-stage {
    gap: 3px;
    padding: 8px;
  }

  .timer-label {
    display: none;
  }

  .timer-display {
    font-size: clamp(3.6rem, 24dvh, 5.2rem);
  }

  .timer-status {
    font-size: 1rem;
  }

  .timer-progress {
    height: 8px;
  }

  .timer-controls {
    gap: 4px;
  }

  .timer-button {
    min-height: 36px;
    padding: 0 4px;
    font-size: .72rem;
  }

  .timer-button-secondary {
    min-width: 110px;
  }

  .timer-presets {
    gap: 4px;
    padding: 6px;
  }

  .timer-panel {
    gap: 4px;
  }

  .timer-presets-heading h2 {
    font-size: 1.1rem;
  }

  .timer-presets-heading > p {
    display: none;
  }

  .timer-preset-grid {
    gap: 4px;
  }

  .timer-preset {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 4px;
    padding: 3px;
    border-width: 2px;
    border-radius: 8px;
  }

  .timer-preset-select {
    padding: 5px;
  }

  .timer-preset-select span {
    font-size: .58rem;
  }

  .timer-preset-select strong {
    font-size: 1.1rem;
  }

  .timer-preset-edit {
    padding: 0 3px;
    font-size: .68rem;
  }

  .timer-sequence-form {
    gap: 4px;
  }

  .timer-sequence-form > label:not(.timer-sequence-interval) {
    display: none;
  }

  .timer-sequence-form textarea {
    min-height: 82px;
    padding: 6px;
    font-size: .7rem;
  }

  .timer-sequence-actions {
    gap: 4px;
  }

  .timer-sequence-actions .timer-button {
    min-height: 32px;
    font-size: .68rem;
  }

  .timer-sequence-list {
    gap: 4px;
  }

  .timer-sequence-side-item,
  .timer-stage-fold-summary {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .timer-sequence-time {
    min-height: 28px;
    font-size: .72rem;
  }

  .timer-sequence-side-item strong,
  .timer-stage-fold-summary strong {
    font-size: .76rem;
  }

  .timer-stage-fold-detail-inner {
    gap: 5px;
    min-height: 130px;
    padding: 0 6px 7px 58px;
  }

  .timer-stage-fold-detail p {
    font-size: .7rem;
    line-height: 1.25;
  }

  .timer-single-clock.is-in-sequence .timer-display {
    font-size: clamp(3rem, 18dvh, 4.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
