@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-body), system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  font-family: var(--font-heading), system-ui, sans-serif;
  margin: 0;
}

#app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#app[hidden] {
  display: none !important;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--ground-text);
  padding-top: 4px;
}

.view {
  display: block;
  padding: 14px 16px 24px;
}

.view > h1 {
  color: var(--ground-text);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

header.topbar {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--ground);
  color: var(--ground-text);
  border-bottom: 1px solid var(--line);
}

header.topbar .logo {
  flex: none;
  display: block;
}

header.topbar .wordmark {
  font-family: var(--font-heading), system-ui, sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--ground-text);
}

.spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  min-height: 30px;
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ground-muted);
  flex: none;
}

.conn[data-status="open"] .conn-dot {
  background: #3fd68a;
}

.conn[data-status="connecting"] .conn-dot {
  background: #f2b544;
}

.conn[data-status="lost"] .conn-dot {
  background: #ff6b5e;
}

.limit-pill {
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 999px;
  padding: 5px 9px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.limit-pill:empty {
  display: none;
}

.limit-pill[data-raised="true"] {
  background: #f2b544;
  color: #15110e;
}

nav[aria-label="Main"] {
  flex: none;
  height: 76px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--ground);
  color: var(--ground-muted);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-sizing: border-box;
}

nav[aria-label="Main"] button {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  font-family: var(--font-body), system-ui, sans-serif;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ground-muted);
  cursor: pointer;
}

nav[aria-label="Main"] button .icon {
  display: block;
}

nav[aria-label="Main"] button[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.card {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

#unreachable {
  margin: 12px 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

#unreachable .icon {
  flex: none;
  color: var(--accent);
}

#unreachable h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

#unreachable p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

#pairing {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ground);
  color: var(--text);
  padding: 24px;
  z-index: 5;
  overflow-y: auto;
}

#pairing[hidden] {
  display: none !important;
}

.pair-wrap {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.pair-wrap .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading), system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ground-text);
  margin-bottom: 12px;
}

.pair-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}

.pair-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* The Bluetooth connect block (12/04/2026): hint, a full-width button, then the status, stacked. */
.ble-connect {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ble-connect[hidden] {
  display: none;
}

.ble-connect button {
  width: 100%;
  min-height: 48px;
}

.pair-code {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 20px;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.pair-code:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  appearance: none;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  font-family: var(--font-body), system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

.pair-status {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.pair-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

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

#toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(76px + 12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
  z-index: 6;
}

.toast {
  max-width: 100%;
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.toast.is-error {
  border-color: #ff6b5e;
}

@media (min-width: 720px) {
  .view {
    max-width: 640px;
    margin: 0 auto;
  }

  #unreachable {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* The smallest phones (320 px): the logo alone, so the connection light and the volume limit still fit. */
@media (max-width: 359px) {
  header.topbar .wordmark {
    display: none;
  }
}
