/* Look shared by every page: colours, header, buttons. */
:root {
  --bg: #ffffff;
  --surface: #f2f2f2;
  --surface-hover: #e5e5e5;
  --text: #0f0f0f;
  --text-secondary: #606060;
  --border: #e5e5e5;
  --accent: #ff0000;
  --accent-hover: #cc0000;
  --track: #d9d9d9;
  --hover-fill: rgba(0, 0, 0, .18);
  --on-accent: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --surface: #272727;
    --surface-hover: #3f3f3f;
    --text: #f1f1f1;
    --text-secondary: #aaaaaa;
    --border: #3f3f3f;
    --track: #3f3f3f;
    --hover-fill: rgba(255, 255, 255, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #272727;
  --surface-hover: #3f3f3f;
  --text: #f1f1f1;
  --text-secondary: #aaaaaa;
  --border: #3f3f3f;
  --track: #3f3f3f;
  --hover-fill: rgba(255, 255, 255, .3);
}

* { box-sizing: border-box; }
html {
  height: 100%;
  /* Like an app: no text inflation in landscape, no double-tap zoom (pinch zoom stays), a tap highlight in the
     colours of the theme. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: var(--hover-fill);
}
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  transition: background-color .2s, color .2s;
  /* viewport-fit=cover lets the page reach under the rounded corners, the notch and the home indicator. */
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header {
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.5px;
  color: inherit;
  text-decoration: none;
}
.logo svg { width: 30px; height: 21px; }
/* Only in the home-screen app: the page does not bounce as a whole (Safari tabs keep pull to refresh), and as there
   is no browser Back button, the logo on the tool pages shows a back arrow. */
.logo .back { display: none; width: 24px; height: 24px; margin: 0 -4px 0 -8px; fill: currentColor; }
@media (display-mode: standalone) {
  html { overscroll-behavior-y: none; }
  .logo .back { display: block; }
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

.main-btn {
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 500 18px "Roboto", Arial, sans-serif;
  padding: 18px 56px;
  min-width: 220px;
  cursor: pointer;
  transition: background-color .15s, transform .08s;
}
.main-btn:active { transform: scale(.97); }

.pill-btn {
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px "Roboto", Arial, sans-serif;
  height: 36px;
  padding: 0 16px 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.pill-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* Only with a mouse: a touch screen keeps :hover on whatever was tapped last. */
@media (hover: hover) {
  .icon-btn:hover { background: var(--surface); }
  .main-btn:hover { background: var(--accent-hover); }
  .pill-btn:hover { background: var(--surface-hover); }
}

/* Labels of buttons and links are no text to select, and a long press opens no link menu. */
a, button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
