:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #111111;
  --muted: #696969;
  --line: #111111;
  --soft: #f7f7f4;
  --accent: #1d6b4f;
  --alert: #a33a24;
  --nav: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100svh;
  background: var(--bg);
}

.screen {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.screen--app {
  padding-bottom: calc(var(--nav) + var(--safe-bottom));
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 20px;
  font-weight: 300;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.page {
  flex: 1;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px;
}

.page--tight {
  padding-top: 34px;
}

.auth {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.auth__body {
  width: min(100%, 440px);
  margin: 0 auto;
  padding: 28px 18px;
}

.title-xl {
  margin: 0 0 6px;
  font-size: clamp(34px, 9vw, 58px);
  line-height: 0.95;
  font-weight: 200;
}

.subtitle {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 17px;
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 14px 12px;
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  box-shadow: inset 0 0 0 1px var(--line);
}

.button {
  min-height: 48px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.button--fill {
  background: var(--ink);
  color: var(--bg);
}

.button--ghost {
  border-color: transparent;
  color: var(--muted);
}

.button--full {
  width: 100%;
}

.button--danger {
  color: var(--alert);
  border-color: var(--alert);
}

.link-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.text-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 20;
}

.nav__item {
  border: 0;
  border-right: 1px solid #d8d8d8;
  background: transparent;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px 2px;
  color: var(--muted);
  cursor: pointer;
}

.nav__item:last-child {
  border-right: 0;
}

.nav__item.is-active {
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--ink);
}

.nav svg,
.icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
}

.nav__label {
  font-size: 11px;
}

.talk-stage {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding: 20px 0 30px;
}

.driving-controls {
  display: none;
}

.talk-button {
  width: min(54vw, 210px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.talk-button svg {
  width: 54px;
  height: 54px;
  stroke-width: 1.2;
}

.talk-button.is-active {
  background: var(--ink);
  color: var(--bg);
}

.talk-meta {
  margin-top: 18px;
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.talk-time {
  color: var(--ink);
  font-size: 28px;
  font-weight: 200;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.quick-row .button {
  min-height: 54px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
}

.quick-row .button:last-child {
  border-right: 0;
}

.placement-panel {
  background: var(--soft);
}

.button.is-on {
  background: var(--soft);
}

.panel {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.panel:last-child {
  border-bottom: 0;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel__title {
  margin: 0;
  font-size: 17px;
  font-weight: 300;
}

.panel__meta {
  color: var(--muted);
  font-size: 13px;
}

.subtitle-box {
  display: grid;
  gap: 12px;
}

.line {
  display: grid;
  gap: 5px;
}

.line__role {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.line__text {
  min-height: 30px;
  line-height: 1.45;
}

.natural {
  font-size: 21px;
  line-height: 1.35;
}

.focus {
  color: var(--accent);
}

.tolerance-panel {
  background: var(--soft);
}

.tolerance-readout {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: center;
}

.tolerance-number {
  font-size: 38px;
  line-height: 1;
  font-weight: 200;
}

.tolerance-copy {
  display: grid;
  gap: 5px;
}

.tolerance-copy strong {
  font-weight: 300;
}

.tolerance-copy span,
.setting-note span:not(.label) {
  color: var(--muted);
  line-height: 1.4;
}

.tolerance-track {
  height: 5px;
  margin-top: 14px;
  background: #e1e1dc;
  position: relative;
}

.tolerance-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--tolerance);
  background: var(--accent);
}

.manual-entry {
  display: grid;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.level-hero {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.level-badge {
  width: 118px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 200;
}

.level-copy {
  display: grid;
  gap: 8px;
}

.level-copy strong {
  font-weight: 300;
}

.thin {
  font-weight: 200;
}

.metric-list {
  display: grid;
  gap: 14px;
}

.metric {
  display: grid;
  gap: 7px;
}

.metric__row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 5px;
  background: #e5e5e5;
  position: relative;
}

.bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  background: var(--ink);
}

.list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}

.list-row__main {
  display: grid;
  gap: 3px;
}

.list-row__title {
  font-size: 16px;
}

.list-row__sub {
  color: var(--muted);
  font-size: 13px;
}

.status {
  border: 1px solid var(--line);
  padding: 5px 9px;
  font-size: 12px;
  text-transform: uppercase;
}

.status--ok {
  color: var(--accent);
  border-color: var(--accent);
}

.status--locked {
  color: var(--muted);
  border-color: #cfcfcf;
}

.wallet-hero {
  display: grid;
  gap: 7px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.wallet-number {
  font-size: clamp(48px, 14vw, 84px);
  line-height: 1;
  font-weight: 200;
}

.wallet-label {
  color: var(--muted);
}

.settings-list {
  display: grid;
  gap: 18px;
}

.setting-note {
  display: grid;
  gap: 6px;
}

.setting-note strong {
  font-weight: 300;
}

.range {
  width: 100%;
  accent-color: var(--ink);
}

.toast {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: calc(var(--nav) + var(--safe-bottom) + 14px);
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 14px;
  z-index: 40;
  box-shadow: 0 10px 30px rgb(0 0 0 / 8%);
}

.hidden {
  display: none !important;
}

.route-talk.is-driving .topbar,
.route-talk.is-driving .nav,
.route-talk.is-driving .panel,
.route-talk.is-driving .quick-row {
  display: none;
}

.route-talk.is-driving.screen--app {
  padding-bottom: 0;
}

.route-talk.is-driving .page {
  width: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.route-talk.is-driving .talk-stage {
  border: 0;
  width: 100%;
}

.route-talk.is-driving .talk-button {
  width: min(72vw, 320px);
}

.route-talk.is-driving .driving-controls {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  left: 18px;
  right: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.route-talk.is-driving .driving-controls .button {
  min-height: 42px;
  background: var(--bg);
}

@media (min-width: 740px) {
  .screen--app {
    padding-bottom: 0;
    padding-left: 96px;
  }

  .nav {
    top: 0;
    right: auto;
    bottom: 0;
    width: 96px;
    height: 100svh;
    padding-bottom: 0;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 1fr);
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .nav__item {
    border-right: 0;
    border-bottom: 1px solid #d8d8d8;
  }

  .nav__item.is-active {
    box-shadow: inset 2px 0 0 var(--ink);
  }

  .page {
    padding: 26px;
  }
}

@media (max-width: 340px) {
  .quick-row {
    grid-template-columns: 1fr;
  }

  .quick-row .button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .level-hero {
    grid-template-columns: 1fr;
  }
}
