:root {
  color-scheme: light;
  --ink: #182137;
  --muted: #78839a;
  --line: #dfe5ef;
  --surface: rgba(255, 255, 255, 0.88);
  --brand: #5b6ef5;
  --brand-dark: #4658dc;
  --brand-soft: #eef0ff;
  --success: #1da982;
  --warning: #f29b38;
  --danger: #f05264;
  --danger-dark: #d93c51;
  --danger-soft: #fff0f2;
  --shadow: 0 26px 70px rgba(39, 53, 86, 0.12);
  --ring-size: min(49vh, 460px);
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 760px;
  min-height: 560px;
  margin: 0;
  background: #f3f6fb;
  color: var(--ink);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 0%, rgba(118, 144, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 35%, rgba(156, 97, 250, 0.08), transparent 30rem),
    #f3f6fb;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 110, 245, 0.25);
  outline-offset: 3px;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px clamp(26px, 4vw, 72px) 18px;
  display: grid;
  grid-template-rows: auto auto minmax(490px, 1fr) auto auto;
  gap: 22px;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: linear-gradient(145deg, #6f7ff8, #5264e8);
  box-shadow: 0 10px 24px rgba(79, 96, 226, 0.28);
}

.brand-mark svg {
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 3px;
  color: #8490aa;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 20px;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.beijing-clock {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 13px 6px 9px;
  border: 1px solid rgba(209, 217, 231, 0.86);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: #657088;
  box-shadow: 0 4px 14px rgba(37, 51, 82, 0.05);
}

.beijing-clock-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #5c6ee7;
  background: var(--brand-soft);
}

.beijing-clock-icon svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.beijing-clock-copy {
  min-width: 104px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 8px;
}

.beijing-clock-copy > span {
  color: #7d889e;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.beijing-clock-copy time {
  grid-column: 1 / -1;
  margin-top: 1px;
  color: #29344b;
  font-size: 18px;
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: 0.025em;
  font-variant-numeric: tabular-nums;
}

.beijing-clock-copy small {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: #a0a8b8;
  font-size: 8px;
  white-space: nowrap;
}

.icon-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(209, 217, 231, 0.86);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #5f6b84;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 51, 82, 0.05);
  transition: 160ms ease;
}

.icon-button:hover {
  color: var(--brand);
  border-color: #cbd2ff;
  transform: translateY(-1px);
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-off {
  display: none;
}

.sound-button[aria-pressed="false"] .sound-on {
  display: none;
}

.sound-button[aria-pressed="false"] .sound-off {
  display: block;
}

.reminder-button {
  position: relative;
}

.reminder-count-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.reminder-count-badge:empty {
  display: none;
}

.mode-switch {
  width: min(960px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  padding: 6px;
  border: 1px solid rgba(215, 221, 234, 0.88);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 10px 30px rgba(39, 53, 86, 0.05);
}

.mode-button {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: #758096;
  text-align: left;
  cursor: pointer;
  transition: 170ms ease;
}

.mode-button:hover {
  color: #4f5fda;
  background: rgba(245, 246, 255, 0.84);
}

.mode-button.active {
  border-color: rgba(195, 202, 253, 0.8);
  color: #4d5ed8;
  background: white;
  box-shadow: 0 7px 18px rgba(61, 75, 125, 0.09);
}

.mode-button > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mode-button strong {
  font-size: 13px;
}

.mode-button small {
  overflow: hidden;
  color: #9aa3b5;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mode-icon {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #6575e9;
  background: #eef0ff;
  font-size: 17px;
  font-weight: 800;
}

.tomato-icon {
  color: #ef6473;
  background: #fff0f2;
  font-size: 15px;
}

.timer-stage {
  position: relative;
  isolation: isolate;
  min-height: 500px;
  padding: 22px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  touch-action: manipulation;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(247, 248, 255, 0.84));
  box-shadow: var(--shadow);
  user-select: none;
}

.ambient {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(1px);
  transition: background 500ms ease;
}

.ambient-one {
  width: 380px;
  height: 380px;
  top: -230px;
  left: -80px;
  background: radial-gradient(circle, rgba(111, 128, 248, 0.13), transparent 70%);
}

.ambient-two {
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -270px;
  background: radial-gradient(circle, rgba(159, 102, 245, 0.12), transparent 70%);
}

.status-row {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: #5664d9;
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(91, 110, 245, 0.1);
}

.clock-wrap {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  min-width: 330px;
  min-height: 330px;
  margin: auto 0;
  display: grid;
  place-items: center;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 15;
}

.ring-track {
  stroke: #e9edf5;
}

.ring-progress {
  stroke: url("#progressGradient");
  stroke-linecap: round;
  stroke-dasharray: 1420;
  stroke-dashoffset: 0;
  filter: url("#ringGlow");
  transition: stroke-dashoffset 220ms linear, stroke 300ms ease;
}

.clock-face {
  position: relative;
  width: 83%;
  height: 83%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.98), rgba(247, 249, 255, 0.84));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 24px 55px rgba(63, 75, 114, 0.09);
}

.clock-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: clamp(13px, 1.2vw, 17px);
  font-weight: 650;
  letter-spacing: 0.08em;
}

.clock-digits {
  margin: 0;
  color: #1c253b;
  font-size: clamp(68px, 7.2vw, 112px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  text-indent: -0.055em;
  text-shadow: 0 3px 0 white;
}

.mode-detail {
  min-height: 20px;
  margin: 9px 0 0;
  color: #8a94a8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.overtime-flag {
  height: 28px;
  margin-top: 8px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(5px);
  transition: 200ms ease;
}

.overtime-flag span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.primary-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.control-button {
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 700;
  transition: 150ms ease;
}

.control-button:hover {
  transform: translateY(-2px);
}

.control-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-button.secondary {
  border-color: var(--line);
  background: white;
  color: #5e6a81;
}

.control-button.secondary:hover {
  border-color: #c9d0df;
  box-shadow: 0 8px 18px rgba(36, 49, 79, 0.08);
}

.control-button.primary {
  min-width: 190px;
  color: white;
  background: linear-gradient(135deg, #6175fb, #5265e8);
  box-shadow: 0 10px 24px rgba(79, 96, 226, 0.28);
}

.control-button.primary:hover {
  box-shadow: 0 13px 28px rgba(79, 96, 226, 0.34);
}

.control-button .fill-icon {
  fill: currentColor;
  stroke: none;
}

.pause-icon {
  display: none;
}

.control-button kbd {
  margin-left: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.12);
  font-size: 9px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.compact-adjust {
  min-width: 115px;
}

.compact-adjust .plus {
  color: var(--brand);
  font-size: 20px;
  line-height: 1;
}

.setup-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 1px minmax(340px, 0.65fr);
  gap: clamp(22px, 3vw, 42px);
  padding: 27px 30px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(39, 53, 86, 0.07);
  backdrop-filter: blur(18px);
}

.mode-panel:not(.active) {
  display: none;
}

.panel-divider {
  width: 1px;
  background: var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 17px;
}

.section-note {
  color: #97a0b3;
  font-size: 11px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 10px;
}

.preset-button {
  min-height: 56px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafbfe;
  color: #667187;
  cursor: pointer;
  transition: 150ms ease;
}

.preset-button strong {
  color: #313a50;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.preset-button span {
  font-size: 11px;
}

.preset-button:hover {
  border-color: #bcc5fd;
  background: #f7f7ff;
  transform: translateY(-1px);
}

.preset-button.active {
  border-color: #6073f4;
  background: linear-gradient(135deg, #eef0ff, #f5f0ff);
  color: #6571da;
  box-shadow: inset 0 0 0 1px rgba(96, 115, 244, 0.08);
}

.preset-button.active strong {
  color: #5263dc;
}

.time-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.time-column {
  display: grid;
  grid-template-columns: 35px 52px;
  grid-template-rows: 28px 42px;
  align-items: center;
  justify-items: center;
  gap: 5px 3px;
}

.time-column input {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 52px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfe;
  color: #2b354b;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.time-column input::-webkit-inner-spin-button,
.time-column input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.time-column > span {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  color: #9aa3b7;
  font-size: 10px;
}

.step-button {
  grid-column: 1;
  grid-row: 1;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid #dfe4ef;
  border-radius: 7px;
  background: white;
  color: #6b7690;
  cursor: pointer;
  line-height: 1;
}

.step-button:last-child {
  grid-row: 2;
  align-self: end;
}

.step-button:hover {
  border-color: #bfc7fd;
  color: var(--brand);
}

.time-separator {
  color: #adb4c4;
  font-size: 21px;
  font-weight: 700;
}

.keyboard-hint {
  margin: 17px 0 0;
  display: flex;
  justify-content: center;
  gap: 17px;
  color: #98a1b4;
  font-size: 10px;
}

.custom-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.restore-last-button,
.add-segment-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #cfd6ff;
  border-radius: 10px;
  color: #5364dc;
  background: #f5f6ff;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}

.restore-last-button:hover,
.add-segment-button:hover {
  border-color: #9da9f7;
  background: #eef0ff;
}

.restore-last-button:disabled,
.add-segment-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.duration-scrubber {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 15px 18px 11px;
  border: 1px solid #e1e5f3;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(247, 248, 255, 0.95), rgba(250, 247, 255, 0.92));
}

.duration-scrubber-heading,
.duration-scrubber-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.duration-scrubber-heading > div {
  display: grid;
  gap: 2px;
}

.duration-scrubber-heading strong {
  color: #4653b8;
  font-size: 12px;
}

.duration-scrubber-heading small,
.duration-scrubber-control > span {
  color: #969fb2;
  font-size: 9px;
}

.duration-scrubber-heading output {
  color: #5565db;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.duration-scrubber-control input[type="range"] {
  --scrub-percent: 50%;
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.duration-scrubber-control input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfd6ff 0 var(--scrub-percent), #e3e7f2 var(--scrub-percent) 100%);
  box-shadow: inset 0 1px 2px rgba(60, 71, 112, 0.11);
}

.duration-scrubber-control input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7.5px;
  appearance: none;
  border: 4px solid white;
  border-radius: 50%;
  background: #6173ed;
  box-shadow: 0 3px 10px rgba(72, 84, 180, 0.32);
}

.duration-scrubber-control input[type="range"]::-moz-range-track {
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: #e3e7f2;
}

.duration-scrubber-control input[type="range"]::-moz-range-progress {
  height: 7px;
  border-radius: 999px;
  background: #cfd6ff;
}

.duration-scrubber-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 4px solid white;
  border-radius: 50%;
  background: #6173ed;
  box-shadow: 0 3px 10px rgba(72, 84, 180, 0.32);
}

.duration-scrubber-control > span {
  min-width: 45px;
  white-space: nowrap;
}

.duration-scrubber-control > span:last-child {
  text-align: right;
}

.duration-scrubber-scale {
  margin: -7px 51px 0;
  display: flex;
  justify-content: space-between;
}

.duration-scrubber-scale i {
  width: 1px;
  height: 4px;
  background: #cbd1df;
}

.duration-scrubber-scale i.major {
  height: 7px;
  background: #7786e8;
}

.mode-description {
  max-width: 680px;
  margin: 4px 0 0;
  color: #727d92;
  font-size: 14px;
  line-height: 1.8;
}

.stopwatch-panel {
  grid-template-columns: minmax(0, 1.35fr) 1px minmax(310px, 0.65fr);
}

.stopwatch-tips {
  display: grid;
  gap: 10px;
}

.feature-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #e4e8f1;
  border-radius: 13px;
  background: #fafbfe;
}

.feature-tip strong {
  color: #4d5ed8;
  font-size: 12px;
}

.feature-tip span {
  color: #8d96a9;
  font-size: 11px;
}

.pomodoro-panel {
  grid-template-columns: minmax(0, 1.2fr) 1px minmax(350px, 0.8fr);
}

.pomodoro-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 12px;
}

.pomodoro-field {
  display: grid;
  gap: 8px;
  color: #7b8599;
  font-size: 11px;
  font-weight: 700;
}

.field-input {
  min-height: 51px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafbfe;
}

.field-input input {
  min-width: 0;
  width: 100%;
  height: 49px;
  padding: 0 4px 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #2c354b;
  font-size: 20px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.field-input small {
  padding-right: 12px;
  color: #9aa3b5;
  white-space: nowrap;
}

.pomodoro-options {
  display: grid;
  align-content: center;
  gap: 12px;
}

.lock-setting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid #e3e7f0;
  border-radius: 14px;
  background: #fafbfe;
  cursor: pointer;
}

.lock-setting-copy {
  display: grid;
  gap: 3px;
}

.lock-setting-copy strong {
  font-size: 12px;
}

.lock-setting-copy small {
  color: #8e97aa;
  font-size: 9px;
  line-height: 1.45;
}

.pomodoro-summary {
  margin: 0;
  color: #818b9f;
  font-size: 11px;
  line-height: 1.6;
}

.apply-pomodoro-button {
  min-height: 39px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #f06b78, #e85669);
  box-shadow: 0 8px 18px rgba(218, 71, 90, 0.2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.apply-pomodoro-button:disabled,
.pomodoro-field input:disabled,
.lock-setting-card:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.sequence-panel {
  grid-template-columns: minmax(0, 1.35fr) 1px minmax(310px, 0.65fr);
}

.sequence-segment-list {
  max-height: 245px;
  display: grid;
  gap: 9px;
  padding-right: 4px;
  overflow-y: auto;
}

.sequence-segment-row {
  display: grid;
  grid-template-columns: 29px minmax(120px, 1fr) auto auto;
  align-items: end;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #e3e7f0;
  border-radius: 14px;
  background: #fafbfe;
}

.sequence-number {
  width: 27px;
  height: 27px;
  align-self: center;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #5969de;
  background: #eef0ff;
  font-size: 11px;
  font-weight: 800;
}

.sequence-name-field,
.sequence-time-fields label {
  display: grid;
  gap: 4px;
}

.sequence-name-field small,
.sequence-time-fields small {
  color: #939caf;
  font-size: 9px;
  font-weight: 700;
}

.sequence-name-field input,
.sequence-time-fields input {
  height: 35px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: white;
  color: #30394e;
  font-size: 12px;
  font-weight: 700;
}

.sequence-time-fields {
  display: grid;
  grid-template-columns: repeat(2, 64px);
  gap: 7px;
}

.sequence-time-fields input {
  width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.remove-segment-button {
  height: 35px;
  padding: 0 10px;
  border: 1px solid #f0d8dc;
  border-radius: 9px;
  color: #c95b6b;
  background: #fff7f8;
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.remove-segment-button:disabled {
  cursor: not-allowed;
  opacity: 0.36;
}

.sequence-options {
  display: grid;
  align-content: center;
  gap: 14px;
}

.sequence-cycle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sequence-cycle-field > span:first-child {
  display: grid;
  gap: 4px;
}

.sequence-cycle-field strong {
  font-size: 12px;
}

.sequence-cycle-field > span:first-child small {
  color: #929bad;
  font-size: 9px;
}

.sequence-cycle-field .field-input {
  width: 105px;
}

.sequence-summary {
  margin: 0;
  color: #79849a;
  font-size: 11px;
  line-height: 1.65;
}

.apply-sequence-button {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #6175fb, #7557e7);
  box-shadow: 0 8px 18px rgba(91, 89, 218, 0.2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.apply-sequence-button:disabled,
.sequence-panel input:disabled,
.sequence-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.focus-lock-notice {
  display: none;
}

.app-shell.is-focus-locked {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 18px;
  grid-template-rows: 1fr;
}

.app-shell.is-focus-locked .topbar,
.app-shell.is-focus-locked .mode-switch,
.app-shell.is-focus-locked .mode-panel,
.app-shell.is-focus-locked footer,
.app-shell.is-focus-locked .primary-controls {
  display: none;
}

.app-shell.is-focus-locked .timer-stage {
  min-height: 0;
  height: 100%;
  border-radius: 28px;
}

.app-shell.is-focus-locked .clock-wrap {
  --ring-size: min(66vh, 650px);
}

.app-shell.is-focus-locked .focus-lock-notice {
  width: min(520px, calc(100% - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 15px;
  border: 1px solid rgba(222, 226, 238, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(40, 52, 82, 0.08);
}

.focus-lock-notice > div {
  display: grid;
  gap: 2px;
}

.focus-lock-notice strong {
  color: #d94a5c;
  font-size: 12px;
}

.focus-lock-notice span {
  color: #8c95a7;
  font-size: 10px;
}

#unlockFocusButton {
  position: relative;
  min-height: 36px;
  padding: 0 13px;
  overflow: hidden;
  border: 1px solid #e0e4ed;
  border-radius: 11px;
  background: white;
  color: #687287;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.hold-progress {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(91, 110, 245, 0.14);
}

#unlockFocusButton.holding .hold-progress {
  width: 100%;
  transition: width 2s linear;
}

#unlockFocusButton:not(.holding) .hold-progress {
  transition: width 120ms ease;
}

.pip-view {
  display: none;
}

kbd {
  display: inline-block;
  min-width: 18px;
  margin-right: 2px;
  padding: 2px 4px;
  border: 1px solid #d8deea;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: white;
  color: #7d879c;
  text-align: center;
  font-family: inherit;
  font-size: 9px;
}

footer {
  display: flex;
  justify-content: space-between;
  color: #9aa3b6;
  font-size: 11px;
}

footer p {
  margin: 0;
}

.time-up-banner {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 32px;
  min-width: 340px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #ed5265, #d93d54);
  box-shadow: 0 16px 40px rgba(201, 47, 70, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -130%);
  transition: 350ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.time-up-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.time-up-banner strong,
.time-up-banner span {
  display: block;
}

.time-up-banner strong {
  font-size: 15px;
}

.time-up-banner span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.phase-reminder-banner {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 32px;
  min-width: 360px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #6579f7, #7557e7);
  box-shadow: 0 16px 40px rgba(76, 83, 203, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -130%);
  transition: 350ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.phase-reminder-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.phase-reminder-banner .banner-icon svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phase-reminder-banner strong,
.phase-reminder-banner span {
  display: block;
}

.phase-reminder-banner strong {
  font-size: 15px;
}

.phase-reminder-banner span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.phase-reminder-flash {
  position: fixed;
  z-index: 12;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.phase-reminder-flash[data-kind="interval"] {
  background:
    radial-gradient(circle at 50% 38%, rgba(91, 110, 245, 0.05), rgba(84, 104, 238, 0.28)),
    linear-gradient(135deg, rgba(78, 101, 230, 0.18), rgba(120, 83, 229, 0.08));
}

.phase-reminder-flash[data-kind="final"] {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 193, 92, 0.05), rgba(242, 155, 56, 0.27)),
    linear-gradient(135deg, rgba(240, 170, 58, 0.15), rgba(244, 101, 91, 0.1));
}

.phase-reminder-flash[data-kind="pomodoro-focus"] {
  background:
    radial-gradient(circle at 50% 38%, rgba(240, 92, 110, 0.05), rgba(239, 91, 110, 0.24)),
    linear-gradient(135deg, rgba(244, 96, 111, 0.16), rgba(139, 91, 226, 0.1));
}

.phase-reminder-flash[data-kind="pomodoro-break"] {
  background:
    radial-gradient(circle at 50% 38%, rgba(39, 183, 143, 0.04), rgba(34, 172, 134, 0.22)),
    linear-gradient(135deg, rgba(40, 181, 142, 0.14), rgba(77, 158, 222, 0.08));
}

.phase-reminder-flash[data-kind="pomodoro-complete"] {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 190, 72, 0.05), rgba(242, 166, 49, 0.25)),
    linear-gradient(135deg, rgba(245, 176, 59, 0.17), rgba(240, 98, 102, 0.09));
}

.phase-reminder-flash.visible {
  animation: reminderScreenPulse 3.6s ease-out both;
}

.timer-stage.phase-reminding {
  animation: phaseStageGlow 1.05s ease-in-out 2;
}

.timer-stage.phase-reminding[data-reminder-kind="interval"] {
  --phase-glow: rgba(91, 110, 245, 0.2);
}

.timer-stage.phase-reminding[data-reminder-kind="final"] {
  --phase-glow: rgba(242, 155, 56, 0.24);
}

.timer-stage.phase-reminding[data-reminder-kind^="pomodoro"] {
  --phase-glow: rgba(238, 92, 110, 0.2);
}

.reminder-dialog {
  width: min(680px, calc(100vw - 40px));
  max-height: min(780px, calc(100vh - 42px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 24px;
  color: var(--ink);
  background: #f7f8fc;
  box-shadow: 0 30px 100px rgba(23, 32, 56, 0.28);
}

.reminder-dialog::backdrop {
  background: rgba(31, 40, 65, 0.5);
}

.dialog-shell {
  max-height: min(780px, calc(100vh - 42px));
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 23px 25px 20px;
  border-bottom: 1px solid #e7eaf1;
  background: rgba(255, 255, 255, 0.9);
}

.dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
}

.dialog-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(145deg, #7082fa, #5969e9);
  box-shadow: 0 8px 20px rgba(79, 96, 226, 0.24);
}

.dialog-mark svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dialog-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e0e4ed;
  border-radius: 10px;
  background: white;
  color: #7d879a;
  cursor: pointer;
  font-size: 23px;
  font-weight: 300;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--danger-dark);
  border-color: #f1c3ca;
}

.dialog-content {
  padding: 21px 25px;
  overflow-y: auto;
}

.reminder-setting-card {
  padding: 18px;
  border: 1px solid #e0e4ed;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.76);
  opacity: 0.62;
  transition: 160ms ease;
}

.reminder-setting-card + .reminder-setting-card {
  margin-top: 13px;
}

.reminder-setting-card.enabled {
  border-color: #d9def9;
  background: white;
  opacity: 1;
  box-shadow: 0 8px 20px rgba(45, 57, 89, 0.05);
}

.setting-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.setting-card-heading h3 {
  margin: 0;
  font-size: 16px;
}

.setting-card-heading p,
.setting-example {
  margin: 4px 0 0;
  color: #8c96aa;
  font-size: 11px;
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 25px;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d7dce7;
  transition: 160ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(32, 43, 69, 0.22);
  transition: 160ms ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--brand);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(19px);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 3px solid rgba(91, 110, 245, 0.22);
  outline-offset: 3px;
}

.inline-setting-fields,
.add-reminder-row {
  margin-top: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #69748a;
  font-size: 12px;
}

.compact-number-field {
  height: 38px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #dce1ec;
  border-radius: 10px;
  background: #fafbfe;
}

.compact-number-field:focus-within {
  border-color: #aab5fb;
  box-shadow: 0 0 0 3px rgba(91, 110, 245, 0.1);
}

.compact-number-field input {
  width: 52px;
  height: 100%;
  padding: 0 5px 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #2d374d;
  text-align: center;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.compact-number-field input::-webkit-inner-spin-button,
.compact-number-field input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.compact-number-field span {
  padding-right: 10px;
  color: #939caf;
  font-size: 10px;
}

.reminder-setting-card:not(.enabled) .inline-setting-fields,
.reminder-setting-card:not(.enabled) .reminder-chip-list,
.reminder-setting-card:not(.enabled) .add-reminder-row,
.reminder-setting-card:not(.enabled) .setting-example {
  pointer-events: none;
}

.reminder-chip-list {
  min-height: 38px;
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.reminder-chip {
  height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 7px 0 11px;
  border: 1px solid #d5dafb;
  border-radius: 999px;
  background: #f1f2ff;
  color: #5867d9;
  font-size: 11px;
  font-weight: 700;
}

.reminder-chip button {
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(91, 110, 245, 0.12);
  color: #6977db;
  cursor: pointer;
  line-height: 1;
}

.reminder-chip button:hover {
  background: rgba(240, 82, 100, 0.13);
  color: var(--danger-dark);
}

.empty-reminder-list {
  align-self: center;
  color: #9ba4b5;
  font-size: 11px;
}

.add-reminder-button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.add-reminder-button:hover {
  background: #e2e5ff;
}

.input-error {
  min-height: 16px;
  margin: 6px 0 -4px;
  color: var(--danger-dark);
  font-size: 10px;
}

.reminder-summary {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef1f8;
  color: #69758c;
}

.summary-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dce2f2;
  color: #73809a;
  font-size: 10px;
  font-weight: 800;
}

.reminder-summary p {
  margin: 1px 0 0;
  font-size: 11px;
  line-height: 1.6;
}

.dialog-footer {
  padding: 17px 25px 21px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e7eaf1;
  background: rgba(255, 255, 255, 0.92);
  color: inherit;
  font-size: inherit;
}

.dialog-button {
  height: 40px;
  min-width: 86px;
  padding: 0 18px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.dialog-button.secondary {
  border: 1px solid #dce1eb;
  background: white;
  color: #6e788d;
}

.dialog-button.primary {
  border: 0;
  background: linear-gradient(135deg, #6376f8, #5265e8);
  color: white;
  box-shadow: 0 8px 18px rgba(79, 96, 226, 0.22);
}

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

.app-shell[data-state="running"] .status-pill {
  color: #168e70;
  background: #e9f8f3;
}

.app-shell[data-state="running"] .status-dot {
  animation: statusPulse 1.6s infinite;
}

.app-shell[data-mode="stopwatch"] .timer-stage {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.87));
}

.app-shell[data-mode="stopwatch"] .mode-detail {
  color: #4e8dbb;
}

.app-shell[data-mode="stopwatch"] .ring-progress {
  stroke: #4b9dc7;
}

.app-shell[data-mode="pomodoro"] .timer-stage {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 243, 245, 0.87));
}

.app-shell[data-mode="pomodoro"] .mode-detail {
  color: #d65467;
}

.app-shell[data-mode="pomodoro"] .ring-progress {
  stroke: #ec6577;
}

.app-shell[data-mode="sequence"] .timer-stage {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(242, 240, 255, 0.9));
}

.app-shell[data-mode="sequence"] .mode-detail {
  color: #7658d6;
}

.app-shell[data-mode="sequence"] .ring-progress {
  stroke: #7658d6;
}

.app-shell[data-mode="pomodoro"][data-phase="break"] .timer-stage {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(237, 251, 247, 0.9));
}

.app-shell[data-mode="pomodoro"][data-phase="break"] .mode-detail {
  color: #168e70;
}

.app-shell[data-mode="pomodoro"][data-phase="break"] .ring-progress {
  stroke: #22a985;
}

.app-shell[data-mode="pomodoro"][data-phase="complete"] .clock-digits {
  color: #d99a2d;
}

.app-shell[data-state="running"] .play-icon,
.app-shell[data-state="overtime"] .play-icon {
  display: none;
}

.app-shell[data-state="running"] .pause-icon,
.app-shell[data-state="overtime"] .pause-icon {
  display: block;
}

.app-shell[data-state="paused"] .status-pill,
.app-shell[data-state="overtime-paused"] .status-pill {
  color: #cb761b;
  background: #fff4e7;
}

.app-shell[data-warning="near"]:not([data-state^="overtime"]) .status-pill {
  color: #bd6b13;
  background: #fff4e5;
}

.app-shell[data-warning="near"]:not([data-state^="overtime"]) .ring-progress {
  stroke: var(--warning);
}

.app-shell[data-warning="urgent"]:not([data-state^="overtime"]) .status-pill {
  color: #d74358;
  background: #ffecef;
}

.app-shell[data-warning="urgent"]:not([data-state^="overtime"]) .ring-progress {
  stroke: var(--danger);
}

.app-shell[data-warning="urgent"]:not([data-state^="overtime"]) .clock-digits {
  color: var(--danger-dark);
}

.app-shell[data-state^="overtime"] .timer-stage {
  background:
    linear-gradient(145deg, rgba(255, 253, 253, 0.96), rgba(255, 242, 245, 0.9));
}

.app-shell[data-state^="overtime"] .ambient-one {
  background: radial-gradient(circle, rgba(240, 82, 100, 0.18), transparent 70%);
}

.app-shell[data-state^="overtime"] .ambient-two {
  background: radial-gradient(circle, rgba(247, 118, 91, 0.15), transparent 70%);
}

.app-shell[data-state^="overtime"] .status-pill {
  color: #d74358;
  background: #ffecef;
}

.app-shell[data-state^="overtime"] .clock-digits {
  color: var(--danger-dark);
}

.app-shell[data-state^="overtime"] .overtime-flag {
  opacity: 1;
  transform: translateY(0);
}

.app-shell[data-state^="overtime"] .ring-progress {
  stroke: var(--danger);
}

.app-shell[data-state^="overtime"] .control-button.primary {
  background: linear-gradient(135deg, #f05a6d, #dc4058);
  box-shadow: 0 10px 24px rgba(210, 54, 78, 0.28);
}

.app-shell.is-fullscreen {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 22px 30px;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.app-shell.is-fullscreen .mode-switch {
  display: none;
}

.app-shell.is-fullscreen .timer-stage {
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 26px;
  box-shadow: none;
  background: transparent;
}

.app-shell.is-fullscreen .setup-panel,
.app-shell.is-fullscreen footer {
  display: none;
}

.app-shell.is-fullscreen .clock-wrap {
  --ring-size: min(70vh, 720px);
  min-width: 0;
  min-height: 0;
}

.app-shell.is-fullscreen .clock-digits {
  font-size: clamp(105px, 12vw, 190px);
}

.app-shell.is-fullscreen .clock-label {
  font-size: clamp(16px, 1.4vw, 24px);
}

.app-shell.is-fullscreen .primary-controls {
  opacity: 0;
  transform: translateY(8px);
  transition: 200ms ease;
}

.app-shell.is-fullscreen .timer-stage:hover .primary-controls,
.app-shell.is-fullscreen .primary-controls:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.app-shell.is-fullscreen .compact-adjust,
.app-shell[data-state^="overtime"] .compact-adjust {
  display: none;
}

@keyframes reminderScreenPulse {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  34% {
    opacity: 0.48;
  }
  58% {
    opacity: 0.76;
  }
  100% {
    opacity: 0;
  }
}

@keyframes phaseStageGlow {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  50% {
    box-shadow: 0 0 0 10px var(--phase-glow), 0 26px 70px rgba(39, 53, 86, 0.12);
  }
}

@keyframes statusPulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(29, 169, 130, 0.12);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(29, 169, 130, 0.02);
  }
}

@keyframes finishFlash {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  35% {
    box-shadow: 0 0 0 10px rgba(240, 82, 100, 0.12), 0 26px 70px rgba(173, 43, 64, 0.15);
  }
}

.timer-stage.just-finished {
  animation: finishFlash 800ms ease 2;
}

@media (max-width: 1080px) {
  :root {
    --ring-size: min(46vh, 410px);
  }

  .setup-panel {
    grid-template-columns: 1fr;
  }

  .panel-divider {
    display: none;
  }

  .custom-section {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }

  .custom-section .section-heading {
    margin: 0;
  }

  .custom-section .keyboard-hint {
    grid-column: 1 / -1;
    margin: 0;
  }

  .sequence-options {
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }
}

@media (max-height: 900px) {
  :root {
    --ring-size: min(43vh, 350px);
  }

  .app-shell {
    grid-template-rows: auto auto minmax(410px, 1fr) auto auto;
    gap: 14px;
    padding-top: 18px;
  }

  .timer-stage {
    min-height: 410px;
    padding: 14px 24px 20px;
  }

  .clock-wrap {
    min-width: 285px;
    min-height: 285px;
  }

  .setup-panel {
    padding: 19px 26px;
  }
}

@media (max-height: 760px) {
  :root {
    --ring-size: min(44vh, 360px);
  }

  .app-shell {
    grid-template-rows: auto auto minmax(390px, 1fr) auto auto;
    gap: 14px;
    padding-top: 18px;
  }

  .timer-stage {
    min-height: 390px;
    padding: 14px 24px 20px;
  }

  .setup-panel {
    padding: 20px 26px;
  }

  .clock-wrap {
    min-width: 290px;
    min-height: 290px;
  }
}

@media (max-width: 720px) {
  :root {
    --ring-size: min(78vw, 330px);
  }

  html,
  body {
    min-width: 0;
  }

  .app-shell {
    width: 100%;
    min-height: 100dvh;
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      calc(12px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
    grid-template-rows: auto auto auto auto auto;
    gap: 12px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .brand-mark svg {
    width: 24px;
  }

  h1 {
    font-size: 17px;
  }

  .top-actions {
    width: 100%;
  }

  .beijing-clock {
    min-height: 44px;
    flex: 1 1 auto;
  }

  .beijing-clock-icon {
    width: 29px;
    height: 29px;
  }

  .beijing-clock-copy {
    min-width: 98px;
  }

  .beijing-clock-copy time {
    font-size: 17px;
  }

  .top-actions .icon-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .top-actions .button-label {
    display: none;
  }

  .mode-switch {
    gap: 5px;
    padding: 5px;
    border-radius: 17px;
  }

  .mode-button {
    min-height: 46px;
    justify-content: center;
    gap: 6px;
    padding: 5px 7px;
    border-radius: 12px;
  }

  .mode-button small {
    display: none;
  }

  .mode-button strong {
    font-size: 11px;
  }

  .mode-icon {
    width: 25px;
    height: 25px;
    border-radius: 8px;
    font-size: 14px;
  }

  .reminder-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border: 2px solid #f3f6fb;
  }

  .timer-stage {
    min-height: 430px;
    padding: 14px 14px 18px;
    border-radius: 24px;
  }

  .status-row {
    min-height: 32px;
  }

  .status-row > p {
    display: none;
  }

  .clock-wrap {
    min-width: 260px;
    min-height: 260px;
  }

  .clock-digits {
    font-size: clamp(58px, 20vw, 82px);
  }

  .primary-controls {
    width: min(100%, 350px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .control-button,
  .control-button.primary,
  .compact-adjust {
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 0 12px;
  }

  .control-button kbd {
    display: none;
  }

  #skipPhaseButton:not([hidden]) {
    grid-column: 1 / -1;
  }

  .setup-panel {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px 15px;
    border-radius: 20px;
  }

  .pomodoro-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .field-input input {
    padding-left: 9px;
    font-size: 17px;
  }

  .field-input small {
    padding-right: 7px;
    font-size: 9px;
  }

  .pomodoro-options,
  .stopwatch-tips,
  .sequence-options {
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .feature-tip {
    gap: 8px;
  }

  .app-shell.is-focus-locked {
    padding:
      calc(8px + env(safe-area-inset-top, 0px))
      calc(8px + env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      calc(8px + env(safe-area-inset-left, 0px));
    grid-template-rows: 1fr;
  }

  .app-shell.is-focus-locked .clock-wrap {
    --ring-size: min(78vw, 58vh);
  }

  .app-shell.is-focus-locked .focus-lock-notice {
    padding: 9px 10px;
  }

  .custom-section {
    display: block;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .custom-section .section-heading {
    margin-bottom: 15px;
  }

  .custom-heading-actions {
    align-items: end;
    flex-direction: column-reverse;
    gap: 5px;
  }

  .sequence-segment-list {
    max-height: none;
  }

  .sequence-segment-row {
    grid-template-columns: 27px minmax(0, 1fr) auto;
    align-items: center;
  }

  .sequence-number {
    grid-row: 1 / 3;
  }

  .sequence-name-field {
    grid-column: 2 / 4;
  }

  .sequence-time-fields {
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(58px, 1fr));
  }

  .sequence-time-fields input {
    width: 100%;
  }

  .remove-segment-button {
    grid-column: 3;
    align-self: end;
  }

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

  .preset-button {
    min-height: 50px;
  }

  .preset-button strong {
    font-size: 16px;
  }

  .preset-button span {
    font-size: 9px;
  }

  .time-editor {
    gap: 3px;
  }

  .keyboard-hint {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  footer {
    display: none;
  }

  .reminder-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    border-radius: 20px;
  }

  .dialog-shell {
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .dialog-header {
    padding: 17px;
  }

  .dialog-mark {
    width: 38px;
    height: 38px;
  }

  .dialog-content {
    padding: 14px;
  }

  .reminder-setting-card {
    padding: 15px;
  }

  .inline-setting-fields,
  .add-reminder-row {
    gap: 7px;
  }

  .dialog-footer {
    padding: 14px 17px 17px;
  }

  .dialog-button {
    flex: 1;
  }

  .phase-reminder-banner,
  .time-up-banner {
    top: calc(18px + env(safe-area-inset-top, 0px));
    min-width: 0;
    width: calc(100vw - 28px);
  }

  .app-shell.is-fullscreen {
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      calc(10px + env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      calc(10px + env(safe-area-inset-left, 0px));
  }

  .app-shell.is-fullscreen .clock-wrap {
    --ring-size: min(76vw, 62vh);
  }

  .app-shell.is-fullscreen .clock-digits {
    font-size: clamp(64px, 22vw, 105px);
  }

  .app-shell.is-fullscreen .primary-controls {
    opacity: 1;
    transform: none;
  }
}

body.is-pip {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #171c2b;
}

body.is-pip .app-shell {
  display: none;
}

body.is-pip .pip-view {
  display: grid;
}

.pip-view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  grid-template-columns: minmax(88px, 0.7fr) minmax(130px, 1fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 0 14px;
  padding: 12px 18px;
  color: white;
  background:
    radial-gradient(circle at 12% 20%, rgba(99, 118, 244, 0.38), transparent 48%),
    linear-gradient(135deg, #20283e, #151a29);
}

.pip-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 7px;
}

.pip-brand strong {
  font-size: clamp(11px, 4vw, 18px);
}

.pip-brand small {
  grid-column: 2;
  color: rgba(255, 255, 255, 0.58);
  font-size: clamp(8px, 2.6vw, 12px);
}

.pip-dot {
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7e8eff;
  box-shadow: 0 0 0 5px rgba(126, 142, 255, 0.13);
}

.pip-view > time {
  justify-self: end;
  color: white;
  font-size: clamp(38px, 17vw, 82px);
  line-height: 0.9;
  font-weight: 750;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.pip-view > p {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  text-align: right;
  font-size: clamp(8px, 2.7vw, 12px);
}

.pip-view[data-mode="pomodoro"][data-phase="focus"] {
  background:
    radial-gradient(circle at 12% 20%, rgba(240, 91, 110, 0.37), transparent 48%),
    linear-gradient(135deg, #33212d, #1d1822);
}

.pip-view[data-mode="pomodoro"][data-phase="break"] {
  background:
    radial-gradient(circle at 12% 20%, rgba(34, 170, 133, 0.35), transparent 48%),
    linear-gradient(135deg, #18332f, #151f21);
}

/* Browser edition: keep the access and background-reminder limits readable. */
.app-shell > footer { display: grid; gap: 8px; text-align: left; }
.app-shell > footer p { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.eyebrow a { color: inherit; text-decoration: underline; font-size: 14px; }

@media (max-width: 600px) and (max-height: 320px) {
  html,
  body {
    min-width: 0;
    min-height: 0;
  }

  .app-shell {
    display: none;
  }

  .pip-view {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
