:root {
  color-scheme: light;
  --page: #fff;
  --sheet: #fff;
  --card: rgba(255, 255, 255, .28);
  --row-hover: rgba(0, 0, 0, .035);
  --line: rgba(20, 20, 20, .12);
  --text: #101010;
  --copy: #6b6b70;
  --muted: #929297;
  --accent: #087f78;
  --accent-soft: rgba(8, 127, 120, .14);
  --danger: #ce3434;
  --shadow: 0 30px 100px rgba(0, 0, 0, .14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #000;
  --sheet: #000;
  --card: rgba(28, 28, 28, .28);
  --row-hover: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .14);
  --text: #f5f5f5;
  --copy: #b8b8bd;
  --muted: #85858b;
  --accent: #42cfc7;
  --accent-soft: rgba(66, 207, 199, .14);
  --danger: #ff4e4e;
  --shadow: 0 34px 120px rgba(0, 0, 0, .62);
}

* { box-sizing: border-box; }
html { min-width: 0; min-height: 100%; background: var(--page); }
body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a, button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.settings-stage {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 18px;
  background: var(--page);
}

.settings-shell {
  width: min(680px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: var(--sheet);
  box-shadow: none;
  overflow: hidden;
}

.settings-view { min-height: inherit; }
.settings-header {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  min-height: 96px;
  padding: 18px 26px 8px;
}
.settings-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.025em;
  text-align: center;
}
.settings-home-header { justify-items: end; }
.settings-home-header .settings-close { grid-column: 3; }
.settings-close, .settings-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-back {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  transition: background 150ms ease, transform 150ms ease;
}
.settings-close {
  justify-self: end;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  opacity: .92;
  transition: opacity 150ms ease, transform 150ms ease;
}
.settings-close:hover { background: var(--row-hover); opacity: .82; transform: scale(1.04); }
.settings-back:hover { background: var(--row-hover); transform: scale(1.02); }
.settings-close svg { width: 31px; height: 31px; stroke-width: 1.65; }
.settings-back svg { width: 25px; height: 25px; }
.settings-back { justify-self: start; }

.profile-summary {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 56px);
  flex-direction: column;
  align-items: center;
  gap: 11px;
  margin: 8px auto 34px;
  text-align: center;
}
.profile-avatar-button {
  position: relative;
  display: inline-flex;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.profile-avatar, .about-mark {
  display: inline-flex;
  width: 88px;
  height: 88px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #0a8d84, #36b99e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.04em;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar.has-image {
  background-position: center;
  background-size: cover;
}
.profile-avatar.has-image > span { opacity: 0; }
.profile-copy { display: grid; gap: 3px; max-width: 100%; }
.profile-copy strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { overflow: hidden; color: var(--copy); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.profile-edit {
  position: absolute;
  top: 60px;
  left: 65px;
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}
.profile-edit svg { width: 16px; height: 16px; }

.settings-content, .subview-content { padding: 0 26px 36px; }
.settings-section + .settings-section { margin-top: 30px; }
.settings-section h2 {
  margin: 0 0 11px 24px;
  color: var(--copy);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.settings-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}
.settings-row {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 67px;
  align-items: center;
  gap: 15px;
  border: 0;
  padding: 12px 19px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}
.settings-row:hover { background: var(--row-hover); }
.settings-row + .settings-row::before {
  position: absolute;
  top: 0;
  right: 19px;
  left: 66px;
  height: 1px;
  background: var(--line);
  content: "";
}
.settings-row-icon {
  display: inline-flex;
  width: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.settings-row-icon svg { width: 22px; height: 22px; }
.settings-row-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}
.settings-row-copy strong { font-size: 16px; font-weight: 560; letter-spacing: -.015em; }
.settings-row-copy small { overflow: hidden; color: var(--copy); font-size: 12.5px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.settings-chevron, .theme-check {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--muted);
}
.settings-row-accent .settings-row-icon,
.settings-row-accent .settings-row-copy strong { color: var(--accent); }

.settings-logout {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 15px;
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0 21px;
  color: var(--danger);
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  cursor: pointer;
}
.settings-logout svg { width: 22px; height: 22px; }

.subview-content { padding-top: 36px; }
.subview-intro {
  max-width: 520px;
  margin: 0 0 20px;
  color: var(--copy);
  font-size: 15px;
  line-height: 1.5;
}
.subview-intro.centred { margin-right: auto; margin-left: auto; text-align: center; }
.subview-title { margin: 18px 0 7px; font-size: 24px; letter-spacing: -.035em; text-align: center; }
.settings-primary-link {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  border-radius: 999px;
  color: var(--page);
  background: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.settings-primary-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  color: var(--page);
  background: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.settings-primary-button:disabled { cursor: wait; opacity: .58; }
.settings-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.settings-auth-button {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.settings-auth-signup {
  border-color: var(--text);
  color: var(--page);
  background: var(--text);
}
.settings-auth-button:hover { filter: brightness(.96); }
.settings-auth-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.settings-auth-button:disabled { cursor: wait; opacity: .58; }
.settings-status { min-height: 20px; margin: 12px 10px 0; color: var(--copy); font-size: 13px; text-align: center; }

.settings-toggle-row { cursor: default; }
.settings-toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.toggle-control {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(128, 128, 128, .35);
  transition: background 160ms ease;
}
.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  content: "";
  transition: transform 160ms ease;
}
.settings-toggle-row input:checked + .toggle-control { background: var(--accent); }
.settings-toggle-row input:checked + .toggle-control::after { transform: translateX(20px); }
.settings-toggle-row input:focus-visible + .toggle-control { outline: 2px solid var(--accent); outline-offset: 3px; }
.settings-toggle-row input:disabled + .toggle-control { opacity: .45; }

.voice-preview {
  display: flex;
  height: 92px;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.voice-preview span {
  width: 8px;
  border-radius: 99px;
  background: var(--accent);
}
.voice-preview span:nth-child(1), .voice-preview span:nth-child(5) { height: 28px; opacity: .65; }
.voice-preview span:nth-child(2), .voice-preview span:nth-child(4) { height: 50px; opacity: .8; }
.voice-preview span:nth-child(3) { height: 72px; }
.row-value { color: var(--copy); font-size: 14px; }
.static-row { cursor: default; }
.static-row:hover { background: transparent; }

.theme-choice.is-selected .theme-check { color: var(--accent); opacity: 1; }
.theme-choice:not(.is-selected) .theme-check { opacity: 0; }
.about-content { padding-top: 54px; text-align: center; }
.about-mark { width: 96px; height: 96px; font-size: 42px; }
.about-content .settings-card { margin-top: 40px; text-align: left; }

.profile-view-content { text-align: center; }
.profile-avatar-button-large { margin: 12px auto 0; }
.profile-avatar-large { width: 112px; height: 112px; font-size: 38px; }
.profile-avatar-button-large .profile-edit { top: 79px; left: 82px; }
.avatar-hint { margin: 13px 0 28px; color: var(--copy); font-size: 13px; }
.profile-fields-card { text-align: left; }
.profile-field {
  position: relative;
  display: grid;
  min-height: 68px;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
}
.profile-field + .profile-field::before {
  position: absolute;
  top: 0;
  right: 20px;
  left: 20px;
  height: 1px;
  background: var(--line);
  content: "";
}
.profile-field > span { color: var(--copy); font-size: 14px; }
.profile-field strong { overflow: hidden; font-size: 15px; font-weight: 560; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.profile-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 8px 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
  font-weight: 560;
  text-align: right;
}
.profile-field input:disabled { color: var(--muted); opacity: 1; }

.connection-section { margin-top: 30px; }
.connection-section > h2 {
  margin: 0 0 11px 24px;
  color: var(--copy);
  font-size: 15px;
  font-weight: 650;
}
.connection-list:empty::after {
  display: block;
  padding: 26px;
  color: var(--copy);
  content: "Loading connections…";
  text-align: center;
}
.connection-row-icon {
  position: relative;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
}
.connection-row-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.connection-row-icon.is-paired img:first-child {
  width: 29px;
  height: 29px;
  transform: translate(-3px, -3px);
}
.connection-row-icon.is-paired img:last-child {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--card);
  border-radius: 7px;
  background: var(--card);
}
.connection-row-status.is-connected { color: var(--accent); }
.permission-summary .settings-row-copy small {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
.settings-more {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  cursor: pointer;
}
.settings-more svg { width: 23px; height: 23px; }
.connection-detail-content { position: relative; }
.connection-menu {
  position: absolute;
  top: -25px;
  right: 28px;
  z-index: 3;
  display: grid;
  min-width: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.connection-menu button {
  min-height: 52px;
  border: 0;
  padding: 0 18px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.connection-menu button + button { border-top: 1px solid var(--line); color: var(--danger); }
.connection-menu button:hover { background: var(--row-hover); }
.connection-hero {
  display: grid;
  min-height: 190px;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: 17px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}
.connection-hero > .connection-hero-icon {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  grid-column: 1;
  grid-row: 1 / 3;
  place-items: center;
  align-self: center;
}
.connection-hero-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.connection-hero-icon.is-paired img:first-child {
  width: 48px;
  height: 48px;
  transform: translate(-5px, -5px);
}
.connection-hero-icon.is-paired img:last-child {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 36px;
  height: 36px;
  border: 3px solid var(--card);
  border-radius: 11px;
  background: var(--card);
}
.connection-hero strong { grid-column: 2; grid-row: 1; align-self: end; font-size: 25px; letter-spacing: -.035em; }
.connection-hero > [data-settings-connection-state] { grid-column: 2; grid-row: 2; align-self: start; color: var(--copy); font-size: 14px; }
.connection-hero button {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--page);
  background: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.compact-list .settings-row { min-height: 60px; }
.compact-list .settings-row::before { left: 20px; }
.compact-list .settings-row-copy strong { font-size: 15px; }

.usage-only-content { padding-top: clamp(30px, 8vh, 72px); }
.usage-widget {
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: clamp(25px, 5vw, 40px);
  background: var(--card);
  box-shadow: none;
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}
.usage-widget-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.usage-widget-head p {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.usage-widget-head h2 { margin: 0; font-size: clamp(34px, 7vw, 48px); font-weight: 500; letter-spacing: -.05em; }
.usage-widget-head > div:last-child { color: var(--copy); font-size: clamp(17px, 3vw, 23px); white-space: nowrap; }
.usage-widget-head strong { color: var(--text); }
.usage-widget-context { margin: 26px 0 0; color: var(--copy); font-size: 16px; line-height: 1.5; }
.usage-widget-bar {
  height: 14px;
  margin-top: 32px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(128, 128, 128, .25);
}
.usage-widget-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.usage-widget-reset { margin: 15px 0 0; color: var(--copy); text-align: right; }
.visually-hidden {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

@media (max-width: 620px) {
  .settings-stage { padding: 0; }
  .settings-shell {
    min-height: 100dvh;
  }
  .settings-header { min-height: 82px; padding: max(14px, env(safe-area-inset-top)) 20px 4px; }
  .settings-back { width: 48px; height: 48px; }
  .settings-close { width: 36px; height: 36px; }
  .settings-close svg { width: 29px; height: 29px; }
  .settings-content, .subview-content { padding-right: 18px; padding-left: 18px; }
  .profile-summary { margin-bottom: 28px; }
  .settings-section h2 { margin-left: 18px; }
  .settings-card { border-radius: 25px; }
  .settings-row { min-height: 64px; padding-right: 17px; padding-left: 17px; }
  .settings-row-copy small { max-width: 245px; }
  .profile-field { grid-template-columns: 82px minmax(0, 1fr); padding-right: 17px; padding-left: 17px; }
  .connection-hero {
    min-height: 0;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 16px;
    padding: 21px;
  }
  .connection-hero > .connection-hero-icon {
    width: 50px;
    height: 50px;
    grid-column: 1;
    grid-row: 1 / 3;
  }
  .connection-hero-icon.is-paired img:first-child { width: 42px; height: 42px; }
  .connection-hero-icon.is-paired img:last-child { width: 31px; height: 31px; }
  .connection-hero strong { grid-column: 2; grid-row: 1; align-self: end; font-size: 22px; line-height: 1.15; }
  .connection-hero > [data-settings-connection-state] { grid-column: 2; grid-row: 2; align-self: start; line-height: 1.35; }
  .connection-hero button {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    min-height: 42px;
    margin-top: 19px;
  }
  .usage-widget-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .usage-widget-context { margin-top: 19px; font-size: 14px; }
  .usage-widget-bar { height: 11px; margin-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
