:root {
  color-scheme: light;
  --ink: #242824;
  --page: #f5f3ed;
  --panel: #fffefa;
  --surface: #fff;
  --hover: #eeeee8;
  --soft: #eeefe7;
  --notice: #f4f1e7;
  --instrument: #efeee7;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  --red: #b82e2c;
  --line: #dedfd7;
  --muted: #656a61;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 10px 17px;
  color: inherit;
  font-weight: 600;
}
button:hover {
  border-color: #a5aaa0;
  background: var(--hover);
}
button.primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #367596;
  outline-offset: 3px;
}
header {
  height: 88px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1216px) / 2));
}
.brand {
  color: inherit;
  text-decoration: none;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  font-size: 30px;
}
.by {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--muted);
  margin-left: 9px;
}
.quiet {
  background: transparent;
  border-color: transparent;
  font-size: 14px;
}
main {
  max-width: 1264px;
  margin: auto;
  padding: 0 24px;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 310px;
  padding: 34px 12px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 14px;
}
h1 {
  font-size: 49px;
  line-height: 1.05;
  letter-spacing: -2px;
  margin: 0 0 18px;
}
h1 em {
  font-style: normal;
  color: var(--red);
}
p {
  line-height: 1.65;
}
.intro p:not(.eyebrow) {
  font-size: 15px;
  color: var(--muted);
  margin: 12px 0 18px;
}
.tag {
  font-size: 12px;
  display: inline-flex;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--soft);
}
.knife {
  width: 390px;
  margin-right: 35px;
}
.workspace {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin: 6px 0 34px;
}
aside {
  padding-top: 20px;
}
aside > .eyebrow {
  padding-left: 15px;
}
nav {
  display: grid;
  gap: 5px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--muted);
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.tool svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.tool.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 2px 3px #3331;
  color: var(--red);
}
.tool.active:after {
  content: "↗";
  margin-left: auto;
}
.tool:hover {
  background: var(--hover);
}
.aside-note {
  margin: 30px 14px;
  font-size: 12px;
  color: var(--muted);
}
.aside-note p {
  color: var(--muted);
  margin: 8px 0;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #66815a;
  border-radius: 50%;
  margin-right: 6px;
}
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 17px;
  box-shadow: 0 5px 20px #343b2b04;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 27px 32px 21px;
  border-bottom: 1px solid var(--line);
}
.panel-head .eyebrow {
  font-size: 10px;
  margin-bottom: 8px;
}
h2 {
  font-size: 27px;
  letter-spacing: -0.8px;
  margin: 0;
}
.metric {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  background: var(--soft);
  border-radius: 4px;
  padding: 7px 9px;
}
#content {
  padding: 25px 32px 30px;
}
#content > p:first-child {
  margin-top: 0;
  color: var(--muted);
  font-size: 14px;
}
.notice {
  background: var(--notice);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 15px;
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0;
}
.notice.good {
  background: var(--soft);
  border-color: var(--line);
}
.notice button {
  flex-shrink: 0;
  font-size: 12px;
  padding: 8px 12px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.measure-grid {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 1fr;
  gap: 30px;
  align-items: center;
}
.ruler-wrap {
  position: relative;
  height: 350px;
  border-radius: 10px;
  background: var(--instrument);
  overflow: hidden;
  touch-action: none;
  border: 1px solid var(--line);
}
.ruler-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ruler-wrap line {
  stroke: var(--ink);
}
.ruler-wrap text {
  font-size: 13px;
  fill: var(--ink);
  font-family: monospace;
}
.marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  padding: 0;
  touch-action: none;
  cursor: ns-resize;
}
.marker:before {
  content: "";
  height: 1px;
  background: var(--red);
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
}
.marker:after {
  content: "◀";
  color: var(--red);
  position: absolute;
  right: 8px;
  top: 12px;
}
.readout {
  font-size: 57px;
  font-weight: 500;
  letter-spacing: -2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}
.readout small {
  font-size: 20px;
  letter-spacing: 0;
  color: var(--muted);
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  margin: 12px 0;
}
input:not([type="range"]),
select {
  display: block;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 11px;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  color: var(--ink);
}
input[type="range"] {
  display: block;
  width: 100%;
  min-height: 44px;
  accent-color: var(--red);
}
.footnote {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin: 22px 0 0;
  line-height: 1.7;
}
.dial {
  width: min(100%, 340px);
  display: block;
  margin: 20px auto;
}
.dial text {
  fill: var(--muted);
  font-size: 13px;
}
.dial line {
  stroke: var(--muted);
}
.center {
  text-align: center;
}
.big-timer {
  font-variant-numeric: tabular-nums;
  font-family: monospace;
  font-size: clamp(36px, 7vw, 65px);
  letter-spacing: -2px;
  margin: 50px 0 30px;
  text-align: center;
}
.level {
  width: min(100%, 290px);
  aspect-ratio: 1;
  border: 2px solid #b3bca8;
  border-radius: 50%;
  margin: 25px auto;
  background: radial-gradient(
    circle,
    #f5f8ef 20%,
    #e9efdf 21%,
    #f5f8ef 22%,
    #f5f8ef 49%,
    #e1e7d9 50%,
    #f5f8ef 51%
  );
  position: relative;
}
.level:before,
.level:after {
  content: "";
  position: absolute;
  background: #a6b29a;
}
.level:before {
  width: 1px;
  height: 100%;
  left: 50%;
}
.level:after {
  height: 1px;
  width: 100%;
  top: 50%;
}
.bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #9bb48799;
  border: 2px solid #617c4e;
  position: absolute;
  left: calc(50% - 22px);
  top: calc(50% - 22px);
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.result {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin: 20px 0;
  overflow-wrap: anywhere;
}
.result output {
  font-size: 32px;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 12px;
}
dialog {
  max-width: 560px;
  width: calc(100% - 30px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  color: inherit;
  background: var(--panel);
  max-height: 90dvh;
}
dialog::backdrop {
  background: #24282480;
}
.close {
  float: right;
}
.cal-space {
  overflow: hidden;
  width: 100%;
  padding: 12px 0;
}
.cal-line {
  height: 45px;
  border: 2px solid var(--red);
  border-top: 0;
  border-bottom: 0;
  position: relative;
}
.cal-line:before {
  content: "";
  height: 1px;
  background: var(--red);
  width: 100%;
  position: absolute;
  top: 22px;
}
.cal-line:after {
  content: "↔";
  display: block;
  text-align: center;
  font-size: 24px;
  color: var(--red);
}
.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline > * {
  flex: 1;
}
details {
  margin: 20px 0;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font-size: 14px;
}
#laps {
  font-variant-numeric: tabular-nums;
  max-height: 190px;
  overflow: auto;
  padding-left: 30px;
}
#laps li {
  padding: 7px;
}
dialog h2 {
  font-size: 25px;
  padding-top: 5px;
}
dialog p {
  font-size: 14px;
}
button:disabled:hover {
  background: inherit;
}
body.focus-tool .intro,
body.focus-tool aside,
body.focus-tool footer {
  display: none;
}
body.focus-tool .workspace {
  display: block;
  margin: 10px 0;
}
body.focus-tool .ruler-wrap {
  height: calc(100dvh - 210px);
  min-height: 300px;
}
@media (min-width: 1800px) {
  main {
    max-width: 1390px;
  }
  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
  }
  .intro {
    min-height: 350px;
  }
}
@media (max-width: 850px) {
  .knife {
    width: 290px;
    margin-right: 0;
  }
  h1 {
    font-size: 42px;
  }
  .workspace {
    grid-template-columns: 175px minmax(0, 1fr);
    gap: 15px;
  }
  .panel-head {
    padding: 22px;
  }
  #content {
    padding: 20px;
  }
  .measure-grid {
    gap: 16px;
  }
  .tool {
    padding: 12px 10px;
  }
}
@media (max-width: 640px) {
  header {
    height: 69px;
    padding: 0 17px;
  }
  .brand {
    font-size: 23px;
  }
  .by {
    display: none;
  }
  #install {
    font-size: 12px;
    padding: 6px;
  }
  main {
    padding: 0 14px;
  }
  .intro {
    min-height: auto;
    padding: 25px 3px 21px;
    position: relative;
  }
  .intro .eyebrow {
    font-size: 9px;
    letter-spacing: 1px;
  }
  h1 {
    font-size: 36px;
    letter-spacing: -1.3px;
  }
  .intro p:not(.eyebrow) {
    font-size: 13px;
    max-width: 240px;
  }
  .knife {
    position: absolute;
    width: 145px;
    right: 0;
    top: 44px;
    opacity: 0.95;
    pointer-events: none;
  }
  .intro h1 {
    position: relative;
    z-index: 1;
  }
  .tag {
    font-size: 10px;
    padding: 4px 6px;
    margin-right: 4px;
  }
  .workspace {
    display: block;
    margin-top: 0;
  }
  aside {
    padding: 0;
    margin-bottom: 15px;
  }
  aside > .eyebrow,
  .aside-note {
    display: none;
  }
  nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .tool {
    padding: 9px 2px;
    gap: 5px;
    flex-direction: column;
    font-size: 11px;
    min-height: 65px;
  }
  .tool.active:after {
    display: none;
  }
  .tool svg {
    width: 21px;
    height: 21px;
  }
  .panel {
    border-radius: 12px;
  }
  .panel-head {
    padding: 19px;
  }
  .panel-head h2 {
    font-size: 24px;
  }
  #content {
    padding: 16px;
  }
  .notice {
    padding: 10px;
    font-size: 12px;
    gap: 7px;
    flex-wrap: wrap;
  }
  .readout {
    font-size: 42px;
  }
  .measure-grid {
    grid-template-columns: minmax(100px, 1fr) 1fr;
    gap: 17px;
  }
  .ruler-wrap {
    height: 340px;
  }
  .toolbar button {
    font-size: 12px;
    padding: 8px 11px;
  }
  footer {
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }
  dialog {
    padding: 21px;
  }
  .fields {
    gap: 10px;
  }
  .knife {
    display: none;
  }
  .intro br {
    display: none;
  }
  .intro h1 {
    max-width: 320px;
  }
  .intro p:not(.eyebrow) {
    max-width: none;
  }
  .big-timer {
    margin: 35px 0;
  }
  .metric {
    font-size: 9px;
  }
  .footnote {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
/* Keep installed-app controls clear of notches and the home indicator. */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (max-width: 640px) {
  h1 em {
    display: block;
  }
  .intro br {
    display: block;
  }
  .intro p:not(.eyebrow) br {
    display: none;
  }
  .tool {
    font-size: 12px;
  }
  .intro .eyebrow {
    font-size: 10px;
  }
  .measure-grid {
    align-items: start;
  }
  .readout {
    margin-top: 12px;
  }
}
@media (max-width: 640px) {
  .intro {
    padding: 19px 3px 16px;
  }
  .intro h1 {
    margin-bottom: 10px;
  }
  .intro p:not(.eyebrow) {
    margin: 10px 0 12px;
  }
  .panel-head {
    padding: 15px 19px;
  }
  .notice {
    margin: 12px 0;
  }
}

/* Keep a route home even when a tool fills the screen. */
header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--page);
}
.brand {
  flex: 1;
  align-self: stretch;
  min-width: 0;
}
.brand-icon {
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}
@media (display-mode: standalone),
  (display-mode: fullscreen),
  (display-mode: minimal-ui) {
  #install {
    display: none;
  }
}
body.focus-tool .ruler-wrap {
  height: calc(100dvh - 300px);
}
.update-notice {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 30;
  margin: auto;
  max-width: 600px;
  box-shadow: 0 3px 20px #0002;
  background: var(--panel);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f0f1eb;
  --page: #171a18;
  --panel: #202521;
  --surface: #2b312c;
  --hover: #363e36;
  --soft: #2b352a;
  --notice: #373328;
  --instrument: #2a312b;
  --line: #657061;
  --muted: #b8c2b2;
  --red: #ff8279;
}
button.primary,
.brand-icon {
  background: #b82e2c;
  border-color: #b82e2c;
}
#theme-toggle {
  width: 44px;
  min-width: 44px;
  padding: 8px;
  margin-left: 5px;
}
#theme-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}
#theme-toggle .sun,
[data-theme="dark"] #theme-toggle .moon {
  display: none;
}
[data-theme="dark"] #theme-toggle .sun {
  display: block;
}
.dial .dial-face {
  fill: var(--instrument);
  stroke: var(--line);
}
.dial .accent {
  fill: var(--red);
}
.dial #angle-arm {
  stroke: var(--red);
}
[data-theme="dark"] .dial circle {
  stroke: var(--line);
}
[data-theme="dark"] .level {
  background: radial-gradient(
    circle,
    #283328 20%,
    #66735d 21%,
    #283328 22%,
    #283328 49%,
    #66735d 50%,
    #283328 51%
  );
}
[data-theme="dark"] .bubble {
  background: #9bc78499;
  border-color: #bad9a9;
}
[data-theme="dark"] :focus-visible {
  outline-color: #8ecbff;
}
@media (max-width: 374px) {
  header {
    padding-inline: 10px;
  }
  .brand {
    font-size: 21px;
    gap: 7px;
  }
  #install {
    max-width: 90px;
  }
}
