:root {
  color-scheme: light;
  --bg: #f3f4ee;
  --surface: #ffffff;
  --surface-soft: #fbfbf7;
  --surface-strong: #eef1ea;
  --time: #101612;
  --text: #121713;
  --muted: #4f5b51;
  --border: #8a958b;
  --border-soft: #d7ddd4;
  --border-strong: #263029;
  --start-bg: #075c43;
  --start-text: #ffffff;
  --start-border: #054633;
  --stop-bg: #a0342f;
  --stop-text: #ffffff;
  --stop-border: #802722;
  --focus: #8a3b00;
  --shadow-soft: 0 18px 46px rgba(17, 24, 19, 0.1);
  --shadow-panel: 0 28px 70px rgba(17, 24, 19, 0.22);
  --pressed: translateY(2px);
  --page-pad-x: clamp(18px, 3.4vw, 48px);
  --time-size: clamp(6.6rem, 13.8vw, 13rem);
  --ms-fit-desktop: clamp(4.9rem, 10vw, 9.4rem);
  --ms-fit-mobile: min(clamp(2.28rem, 10.6vw, 4.3rem), calc((100vw - 42px) / 9.6));
  --ms-fit-landscape: min(clamp(2.6rem, 9.5vw, 6.1rem), calc((70vw - 40px) / 8.1));
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1411;
  --surface: #171d19;
  --surface-soft: #131915;
  --surface-strong: #202821;
  --time: #f6f8f3;
  --text: #f6f8f3;
  --muted: #c9d2ca;
  --border: #829087;
  --border-soft: #334039;
  --border-strong: #e4ebe3;
  --start-bg: #7ed9a7;
  --start-text: #071d13;
  --start-border: #7ed9a7;
  --stop-bg: #ff9289;
  --stop-text: #241111;
  --stop-border: #ff9289;
  --focus: #ffd166;
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-panel: 0 30px 70px rgba(0, 0, 0, 0.5);
}

body[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --surface-soft: #000000;
  --surface-strong: #000000;
  --time: #ffffff;
  --text: #ffffff;
  --muted: #ffffff;
  --border: #ffffff;
  --border-soft: #ffffff;
  --border-strong: #ffffff;
  --start-bg: #ffd800;
  --start-text: #000000;
  --start-border: #ffd800;
  --stop-bg: #ffffff;
  --stop-text: #000000;
  --stop-border: #ffffff;
  --focus: #ffd800;
  --shadow-soft: none;
  --shadow-panel: none;
}

body[data-size="larger"] {
  --time-size: clamp(7.2rem, 15vw, 14.2rem);
  --ms-fit-desktop: clamp(5.35rem, 10.9vw, 10.1rem);
  --ms-fit-mobile: min(clamp(2.45rem, 11.2vw, 4.55rem), calc((100vw - 42px) / 9.15));
  --ms-fit-landscape: min(clamp(2.8rem, 10.2vw, 6.45rem), calc((70vw - 40px) / 7.7));
}

body[data-size="maximum"] {
  --time-size: clamp(7.8rem, 16.4vw, 15.6rem);
  --ms-fit-desktop: clamp(5.8rem, 11.8vw, 10.8rem);
  --ms-fit-mobile: min(clamp(2.62rem, 11.9vw, 4.8rem), calc((100vw - 42px) / 8.75));
  --ms-fit-landscape: min(clamp(3rem, 10.8vw, 6.8rem), calc((70vw - 40px) / 7.35));
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--surface-soft) 0 46%, var(--bg) 46% 100%);
  font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:active:not(:disabled) {
  transform: var(--pressed);
}

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  inset: 12px auto auto 12px;
  padding: 12px 16px;
  color: var(--start-text);
  background: var(--start-bg);
  border: 2px solid var(--border);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  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 {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  padding:
    max(20px, env(safe-area-inset-top))
    max(var(--page-pad-x), env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom));
}

.app-shell:fullscreen {
  overflow: auto;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100%, 1240px);
  min-width: 0;
  margin: 0 auto;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-lockup h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.document-brand-name {
  color: var(--text);
  font-size: clamp(1.26rem, 2vw, 1.72rem);
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.brand-tld {
  color: var(--start-bg);
  font-weight: 780;
}

body[data-theme="contrast"] .brand-tld {
  color: #ffd800;
}

.brand-mark {
  flex: 0 0 auto;
  width: clamp(38px, 4.5vw, 48px);
  height: clamp(38px, 4.5vw, 48px);
  color: var(--time);
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.tool-button,
.icon-button,
.control-secondary {
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  font-size: clamp(0.98rem, 1vw, 1.08rem);
  font-weight: 780;
  max-width: 100%;
  overflow: hidden;
}

.tool-button svg,
.icon-button svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stopwatch {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: center;
  align-items: center;
  justify-items: center;
  gap: clamp(22px, 3vh, 36px);
  width: min(100%, 1240px);
  min-width: 0;
  max-width: 100%;
  min-height: calc(100dvh - 98px);
  margin: 0 auto;
  padding: clamp(20px, 4vh, 42px) 0 0;
}

.readout-area {
  display: grid;
  place-items: center;
  align-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: clamp(20px, 4vh, 44px) clamp(12px, 3vw, 34px);
  border-block: 3px solid var(--border-strong);
  background: var(--surface-soft);
  box-shadow: var(--shadow-soft);
}

.time-display {
  display: flex;
  justify-content: center;
  width: 100%;
  color: var(--time);
  font-family: "Aptos Display", "Segoe UI Variable Display", Aptos, "Segoe UI", sans-serif;
  font-size: var(--time-size);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1, "zero" 0;
  line-height: 0.88;
  letter-spacing: 0;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.time-text {
  display: block;
  width: 8ch;
  white-space: nowrap;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1, "zero" 0;
}

body.has-milliseconds .time-display,
body.has-long-readout .time-display {
  font-size: min(var(--time-size), var(--ms-fit-desktop));
}

body.has-milliseconds .time-text {
  width: 12ch;
}

body.has-long-readout .time-text {
  width: auto;
}

.status-line {
  min-height: 1.3em;
  margin: clamp(10px, 1.7vh, 16px) 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.45vw, 1.28rem);
  font-weight: 800;
  line-height: 1.2;
}

.controls {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 440px);
  min-width: 0;
  max-width: 100%;
  margin: 0 auto;
}

.control-primary {
  width: 100%;
  min-height: 86px;
  padding: 0 30px;
  color: var(--start-text);
  background: var(--start-bg);
  border: 3px solid var(--start-border);
  box-shadow: var(--shadow-soft);
  font-size: clamp(1.72rem, 2.3vw, 2.12rem);
  font-weight: 850;
  line-height: 1;
}

body.is-running .control-primary {
  color: var(--stop-text);
  background: var(--stop-bg);
  border-color: var(--stop-border);
}

.secondary-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.control-secondary {
  min-height: 58px;
  padding: 0 20px;
  color: var(--text);
  font-size: clamp(1.02rem, 1.2vw, 1.15rem);
  font-weight: 780;
}

.control-secondary.confirm {
  color: var(--stop-text);
  background: var(--stop-bg);
  border-color: var(--stop-bg);
}

.lap-panel {
  width: min(100%, 760px);
  margin: 0 auto;
  padding-top: 18px;
  border-top: 2px solid var(--border-soft);
}

.lap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lap-header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.2;
}

.lap-list {
  display: grid;
  gap: 8px;
  max-height: 28vh;
  max-height: 28dvh;
  padding: 0;
  margin: 0;
  overflow: auto;
  list-style: none;
}

.lap-item {
  display: grid;
  grid-template-columns: minmax(74px, auto) 1fr auto;
  gap: 14px;
  align-items: baseline;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--text);
  border: 2px solid var(--border-soft);
  background: var(--surface);
}

.lap-index {
  color: var(--muted);
  font-weight: 800;
}

.lap-time {
  font-family: "Aptos Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.lap-delta {
  color: var(--muted);
  font-family: "Aptos Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
}

.settings-panel {
  position: fixed;
  z-index: 30;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(100%, 440px);
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  color: var(--text);
  background: var(--surface);
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-panel);
}

.settings-panel[hidden],
.backdrop[hidden],
.lap-panel[hidden],
.toggle-row[hidden] {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border-soft);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
}

.settings-form {
  display: grid;
  align-content: start;
  gap: 24px;
  padding-top: 22px;
  overflow: auto;
}

fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 820;
}

.segmented-control {
  display: grid;
  gap: 10px;
}

.segmented-control.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  color: var(--text);
  border: 2px solid var(--border);
  background: var(--surface);
  font-weight: 790;
  text-align: center;
}

.segmented-control input:checked + span {
  color: var(--start-text);
  background: var(--start-bg);
  border-color: var(--start-bg);
}

body[data-theme="contrast"] .segmented-control input:checked + span {
  color: #000000;
  background: #ffd800;
  border-color: #ffd800;
}

.segmented-control input:focus-visible + span {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

.swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
}

.swatch-light {
  background: linear-gradient(135deg, #fbfbf7 0 50%, #075c43 50%);
}

.swatch-dark {
  background: linear-gradient(135deg, #0f1411 0 50%, #7ed9a7 50%);
}

.swatch-contrast {
  background: linear-gradient(135deg, #000000 0 50%, #ffd800 50%);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 0;
  color: var(--text);
  border-top: 2px solid var(--border-soft);
  font-weight: 790;
}

.toggle-row input {
  width: 30px;
  height: 30px;
  accent-color: var(--start-bg);
}

.information-content {
  padding:
    clamp(42px, 6vw, 72px) max(var(--page-pad-x), env(safe-area-inset-right))
    clamp(44px, 6vw, 72px) max(var(--page-pad-x), env(safe-area-inset-left));
  color: var(--text);
  background: var(--surface);
  border-top: 2px solid var(--border-soft);
}

.information-inner {
  display: grid;
  gap: clamp(34px, 5vw, 54px);
  width: min(100%, 960px);
  margin: 0 auto;
}

.information-intro {
  width: min(100%, 720px);
}

.information-content h2,
.information-content h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-weight: 850;
  line-height: 1.18;
}

.information-content h2 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.information-content h3 {
  font-size: clamp(1.25rem, 2vw, 1.48rem);
}

.information-content p,
.faq-list dd {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.2vw, 1.12rem);
  font-weight: 520;
  line-height: 1.65;
}

.information-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 56px);
}

.faq-section {
  padding-top: clamp(28px, 4vw, 42px);
  border-top: 2px solid var(--border-soft);
}

.related-pages {
  padding-top: clamp(28px, 4vw, 42px);
  border-top: 2px solid var(--border-soft);
}

.faq-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 10px 0 0;
}

.faq-list div {
  padding: 22px 0;
  border-bottom: 2px solid var(--border-soft);
}

.faq-list dt {
  margin-bottom: 8px;
  color: var(--text);
  font-size: clamp(1.08rem, 1.3vw, 1.16rem);
  font-weight: 820;
  line-height: 1.35;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.related-grid a {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 2px solid var(--border-soft);
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 780;
  line-height: 1.25;
  text-decoration: none;
}

.related-grid a:hover {
  border-color: var(--border);
}

.site-footer {
  padding:
    22px max(var(--page-pad-x), env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(var(--page-pad-x), env(safe-area-inset-left));
  color: var(--muted);
  background: var(--bg);
  border-top: 2px solid var(--border-soft);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100%, 1240px);
  margin: 0 auto;
}

.footer-brand {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 850;
  text-decoration: none;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(18px, 3vw, 28px);
}

.footer-links a {
  color: var(--text);
  font-size: 1rem;
  font-weight: 730;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 5px;
}

.footer-links a:hover {
  text-decoration-color: var(--start-bg);
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 650;
}

.document-body {
  background: var(--surface-soft);
}

.document-shell {
  min-height: calc(100vh - 86px);
  min-height: calc(100dvh - 86px);
  padding:
    max(20px, env(safe-area-inset-top))
    max(var(--page-pad-x), env(safe-area-inset-right))
    clamp(44px, 7vw, 80px)
    max(var(--page-pad-x), env(safe-area-inset-left));
}

.document-topbar {
  padding-bottom: clamp(42px, 8vw, 88px);
}

.document-kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.1vw, 1.05rem);
  font-weight: 780;
  line-height: 1.25;
}

.document-action {
  min-height: 52px;
  padding: 0 20px;
  color: var(--start-text);
  background: var(--start-bg);
  border: 2px solid var(--start-border);
  border-radius: 8px;
  font-size: 1.04rem;
  font-weight: 780;
  line-height: 48px;
  white-space: nowrap;
  text-decoration: none;
}

.document-main {
  width: min(100%, 820px);
  margin: 0 auto;
}

.document-main h1 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  font-weight: 860;
  line-height: 1.08;
  overflow-wrap: break-word;
}

.document-lead {
  max-width: 66ch;
  margin: 0 0 clamp(40px, 6vw, 58px);
  color: var(--muted);
  font-size: clamp(1.1rem, 1.5vw, 1.24rem);
  line-height: 1.65;
}

.document-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  margin: 0 0 clamp(34px, 5vw, 48px);
  padding: 0 22px;
  color: var(--start-text);
  background: var(--start-bg);
  border: 2px solid var(--start-border);
  border-radius: 8px;
  font-size: 1.08rem;
  font-weight: 820;
  line-height: 1;
  text-decoration: none;
}

.document-section {
  padding: clamp(26px, 4vw, 34px) 0;
  border-top: 2px solid var(--border-soft);
}

.document-section h2 {
  margin: 0 0 13px;
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 1.62rem);
  font-weight: 840;
  line-height: 1.25;
}

.document-section p,
.document-list {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.2vw, 1.1rem);
  line-height: 1.68;
}

.document-section p + p {
  margin-top: 14px;
}

.document-list {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

.document-updated {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 720;
}

@media (max-width: 720px) {
  :root {
    --page-pad-x: 14px;
  }

  body {
    background: var(--surface-soft);
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
    padding:
      max(16px, env(safe-area-inset-top))
      max(var(--page-pad-x), env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .topbar {
    align-items: center;
  }

  .app-shell > .topbar {
    position: relative;
    display: block;
    min-height: 48px;
    padding-inline-end: 106px;
  }

  .brand-lockup {
    gap: 8px;
    min-height: 48px;
  }

  .brand-lockup h1 {
    min-width: 0;
    overflow: hidden;
    font-size: clamp(0.96rem, 3.7vw, 1.08rem);
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    stroke-width: 5.2;
  }

  .top-actions {
    position: absolute;
    inset: 0 0 auto auto;
    justify-content: flex-end;
    flex: 0 1 auto;
    gap: 8px;
  }

  .tool-button {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
  }

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

  .stopwatch {
    grid-template-rows: auto auto auto;
    align-content: start;
    gap: clamp(22px, 3vh, 30px);
    width: 100%;
    min-height: calc(100dvh - 70px);
    margin-top: 0;
    padding-block-start: clamp(42px, 7vh, 64px);
  }

  .readout-area {
    min-height: min(32dvh, 286px);
    padding: clamp(22px, 5vh, 38px) 0;
    border-block-width: 2px;
    box-shadow: none;
  }

  .time-display {
    font-size: min(clamp(4.6rem, 20vw, 7.8rem), calc((100vw - 36px) / 5));
  }

  body[data-size="larger"] .time-display {
    font-size: min(clamp(4.9rem, 21.2vw, 8.3rem), calc((100vw - 36px) / 5));
  }

  body[data-size="maximum"] .time-display {
    font-size: min(clamp(5.2rem, 22.4vw, 8.8rem), calc((100vw - 36px) / 5));
  }

  body.has-milliseconds .time-display,
  body.has-long-readout .time-display,
  body.has-milliseconds[data-size="larger"] .time-display,
  body.has-milliseconds[data-size="maximum"] .time-display,
  body.has-long-readout[data-size="larger"] .time-display,
  body.has-long-readout[data-size="maximum"] .time-display {
    font-size: var(--ms-fit-mobile);
  }

  .status-line {
    margin-top: 10px;
    font-size: 1.05rem;
  }

  .controls,
  .control-primary,
  .secondary-controls {
    width: 100%;
    max-width: 100%;
  }

  .control-primary {
    min-height: 84px;
    font-size: clamp(1.62rem, 7vw, 2rem);
  }

  .secondary-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-secondary {
    min-height: 58px;
  }

  .lap-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .settings-panel {
    border-left: 0;
    border-top: 3px solid var(--border);
  }

  .information-content {
    padding-top: 38px;
    padding-bottom: 44px;
  }

  .information-inner {
    gap: 34px;
  }

  .information-columns {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding-top: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .footer-links {
    gap: 26px;
  }

  .document-shell {
    padding:
      max(16px, env(safe-area-inset-top))
      max(var(--page-pad-x), env(safe-area-inset-right))
      42px
      max(var(--page-pad-x), env(safe-area-inset-left));
  }

  .document-topbar {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 14px;
    padding-bottom: 44px;
  }

  .document-topbar .brand-mark {
    width: 34px;
    height: 34px;
  }

  .document-brand-name {
    font-size: clamp(0.94rem, 3.8vw, 1.08rem);
  }

  .document-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    font-size: 0.96rem;
    line-height: 1;
  }

  .document-main h1 {
    font-size: clamp(1.82rem, 7.4vw, 2.28rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .document-lead {
    margin-bottom: 28px;
  }

  .document-primary-link {
    width: 100%;
    margin-bottom: 30px;
  }
}

@media (max-width: 380px) {
  .brand-lockup h1 {
    font-size: 0.94rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .tool-button {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .secondary-controls {
    grid-template-columns: 1fr;
  }

  .document-topbar .brand-lockup {
    width: 100%;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .app-shell {
    padding: 12px 16px;
  }

  .topbar {
    width: 100%;
  }

  .brand-lockup h1 {
    font-size: clamp(1.12rem, 2.2vw, 1.48rem);
  }

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

  .tool-button {
    min-height: 46px;
  }

  .stopwatch {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 30vw);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px 18px;
    align-items: center;
    width: 100%;
    min-height: calc(100dvh - 58px);
    padding: 10px 0 0;
  }

  .readout-area {
    justify-items: start;
    min-height: 0;
    padding: 14px 18px;
    border-block-width: 2px;
    box-shadow: none;
  }

  .time-display {
    justify-content: flex-start;
    font-size: min(clamp(4rem, 15vw, 8.2rem), calc((70vw - 40px) / 5.5));
  }

  body[data-size="larger"] .time-display,
  body[data-size="maximum"] .time-display {
    font-size: min(clamp(4.25rem, 16vw, 9rem), calc((70vw - 40px) / 5.5));
  }

  body.has-milliseconds .time-display,
  body.has-long-readout .time-display,
  body.has-milliseconds[data-size="larger"] .time-display,
  body.has-milliseconds[data-size="maximum"] .time-display,
  body.has-long-readout[data-size="larger"] .time-display,
  body.has-long-readout[data-size="maximum"] .time-display {
    font-size: var(--ms-fit-landscape);
  }

  .status-line {
    justify-self: start;
    margin-top: 8px;
  }

  .controls {
    width: 100%;
  }

  .control-primary,
  .secondary-controls {
    width: 100%;
  }

  .control-primary {
    min-height: 70px;
    font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  }

  .control-secondary {
    min-height: 50px;
  }

  .lap-panel {
    grid-column: 1 / -1;
    max-height: 26vh;
    max-height: 26dvh;
    overflow: hidden;
  }
}

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