@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/amiri-arabic-400.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
  color-scheme: light dark;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --line: rgba(27, 28, 26, 0.09);
  --text: #1b1c1a;
  --muted: #5c625f;
  --accent: #0d6b5b;
  --accent-strong: #0a5649;
  --accent-soft: #dcece6;
  --on-accent: #ffffff;
  --track: #e5e1d7;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(30, 28, 20, 0.05), 0 6px 20px rgba(30, 28, 20, 0.05);
  --backdrop: rgba(20, 22, 20, 0.36);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-ar: 'Amiri', 'Geeza Pro', 'Noto Naskh Arabic', serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: 58px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1412;
    --surface: #161e1b;
    --surface-2: #212b27;
    --line: rgba(236, 239, 233, 0.09);
    --text: #ecefe9;
    --muted: #a3aca7;
    --accent: #5cc4a7;
    --accent-strong: #84d8c0;
    --accent-soft: #1b3a32;
    --on-accent: #06231c;
    --track: #26312d;
    --danger: #f2a49b;
    --shadow: none;
    --backdrop: rgba(0, 0, 0, 0.55);
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

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

button,
a,
label,
input {
  touch-action: manipulation;
}

h1,
h2,
p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden,
.offscreen {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
}

.icon.small {
  width: 18px;
  height: 18px;
}

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

.small {
  font-size: 14px;
}

/* Arabic with transliteration below */

.ar {
  font-family: var(--font-ar);
  font-size: 23px;
  line-height: 1.55;
  font-weight: 400;
}

.tr {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.3;
}

.phrase-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.phrase-text .ar {
  margin-top: -4px;
}

/* Layout */

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) 16px calc(var(--tabbar) + var(--safe-bottom) + 28px);
  animation: view-in 0.28s var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.page-head {
  padding: 8px 4px 18px;
}

.page-head h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--muted);
  margin-top: 2px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
}

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

.btn.danger {
  background: var(--danger);
  border-color: transparent;
  color: var(--surface);
}

.btn.danger-text {
  background: none;
  border-color: transparent;
  color: var(--danger);
  margin-right: auto;
  padding: 0 8px;
}

.btn.small {
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
}

.btn.wide {
  width: 100%;
}

.btn .icon {
  width: 20px;
  height: 20px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.icon-btn:active:not(:disabled) {
  background: var(--surface-2);
}

.icon-btn:disabled {
  opacity: 0.25;
}

/* Bottom tabs */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  justify-content: space-around;
  padding: 0 8px var(--safe-bottom);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  flex: 1;
  max-width: 140px;
  min-height: var(--tabbar);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tabbar a[aria-current='page'] {
  color: var(--accent);
}

body[data-route='count'] .tabbar {
  display: none;
}

/* Today */

.overview {
  padding: 18px;
  margin-bottom: 18px;
}

.overview-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.overview-ring {
  position: relative;
  width: 76px;
  height: 76px;
  flex: none;
}

.overview-ring .ring {
  width: 100%;
  height: 100%;
}

.overview-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.overview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overview-text strong {
  font-size: 20px;
  line-height: 1.25;
}

.phrase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.phrase-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s var(--ease);
}

.phrase-card:active {
  transform: scale(0.985);
}

.phrase-card .phrase-text {
  flex: 1;
}

.mini-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
}

.mini-ring .ring {
  width: 100%;
  height: 100%;
}

.ring-check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  color: var(--accent);
  stroke-width: 2.5;
}

.phrase-count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.phrase-count strong {
  font-size: 22px;
}

.phrase-count span {
  color: var(--muted);
  font-size: 14px;
}

.phrase-card.done .phrase-count strong {
  color: var(--accent);
}

.empty {
  padding: 28px 20px;
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
}

/* Progress rings */

.ring {
  display: block;
  overflow: visible;
}

.ring-track,
.ring-bar {
  fill: none;
}

.ring-track {
  stroke: var(--track);
}

.ring-bar {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s var(--ease);
}

.ring-bar[stroke-dashoffset='100'] {
  opacity: 0;
}

/* Counter */

body[data-route='count'] .view {
  max-width: none;
  padding: 0;
  animation: none;
}

.counter {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) 0 var(--safe-bottom);
  background: var(--bg);
  animation: view-in 0.28s var(--ease);
}

.counter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 0;
}

.phrase-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  max-width: 62vw;
  padding: 0 14px 0 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.phrase-switch-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tap-zone {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 8px 16px;
  border: 0;
  background: none;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tap-zone:focus-visible {
  outline-offset: -6px;
}

.counter-ar {
  font-family: var(--font-ar);
  font-size: clamp(34px, 10.5vw, 48px);
  line-height: 1.5;
  text-align: center;
}

.counter-tr {
  color: var(--muted);
  font-size: 17px;
  text-align: center;
}

.counter-ar.long {
  font-size: clamp(26px, 7.6vw, 32px);
  line-height: 1.8;
}

.counter-tr.long {
  font-size: 15px;
}

.counter-tr.solo {
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
}

.ring-wrap {
  position: relative;
  width: min(80vw, 340px, 42dvh);
  aspect-ratio: 1;
  margin: 22px 0 14px;
}

.ring-wrap .ring {
  width: 100%;
  height: 100%;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.count-num {
  font-size: clamp(64px, 21vw, 92px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.count-goal {
  color: var(--muted);
  margin-top: 8px;
}

.heard-pill {
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tap-hint {
  color: var(--muted);
  font-size: 15px;
  min-height: 1.45em;
}

.tap-zone.complete .tap-hint {
  color: var(--accent);
  font-weight: 600;
}

.ripple {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  opacity: 0;
}

.listen-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 32px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

.listen-row.paused {
  color: var(--muted);
}

.listen-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  animation: breathe 1.6s ease-in-out infinite;
}

.listen-row.voice .listen-dot {
  animation: none;
  transform: scale(1.35);
}

.listen-row.paused .listen-dot {
  animation: none;
  opacity: 0.6;
}

@keyframes breathe {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.meter .bar {
  width: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.22;
  transition: opacity 0.08s;
}

.meter .bar:nth-child(1) {
  height: 5px;
}
.meter .bar:nth-child(2) {
  height: 8px;
}
.meter .bar:nth-child(3) {
  height: 11px;
}
.meter .bar:nth-child(4) {
  height: 14px;
}
.meter .bar:nth-child(5) {
  height: 16px;
}

.meter .bar.on {
  opacity: 1;
}

.counter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 16px 14px;
}

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, color 0.2s;
}

.tool:active:not(:disabled) {
  transform: scale(0.96);
}

.tool:disabled {
  opacity: 0.4;
}

.tool-icon {
  display: grid;
}

.mic-btn[aria-pressed='true'] {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}

/* History */

.calendar {
  padding: 10px 10px 14px;
  margin-bottom: 16px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 8px;
}

.cal-title {
  font-size: 18px;
  font-weight: 650;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 2px;
  justify-items: center;
}

.cal-wd {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0 4px;
}

.cal-day {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: none;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.cal-day.all {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
}

.cal-day.partial {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--text);
}

.cal-day.none {
  color: var(--muted);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 35%, transparent);
}

.cal-day.future {
  color: var(--muted);
  opacity: 0.4;
  cursor: default;
}

.cal-day.today {
  font-weight: 800;
}

.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}

.cal-day[aria-pressed='true'] {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.swatch.all {
  background: var(--accent);
}

.swatch.partial {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.swatch.none {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 35%, transparent);
}

.day-detail {
  padding: 16px 18px;
}

.detail-title {
  font-size: 17px;
  font-weight: 650;
  margin-bottom: 8px;
}

.detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row .ar {
  font-size: 20px;
}

.detail-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail-count strong {
  color: var(--text);
  font-size: 18px;
}

.detail-row.met .detail-count,
.detail-row.met .detail-count strong {
  color: var(--accent);
}

.detail-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  color: var(--muted);
}

.detail-total strong {
  color: var(--text);
}

/* Settings */

.settings-section {
  margin-bottom: 22px;
}

.section-title {
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.list > :last-child,
.list > :last-child .row {
  border-bottom: 0;
}

.row.column {
  display: block;
  padding-block: 14px;
}

.row-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.row-sub {
  color: var(--muted);
  font-size: 14px;
}

.row-button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.row-button .icon {
  color: var(--accent);
}

.phrase-row {
  padding: 4px 4px 4px 16px;
}

.phrase-row .row-main {
  min-height: 64px;
  justify-content: center;
  padding: 6px 0;
  border: 0;
}

.phrase-row .ar {
  font-size: 21px;
}

.reorder {
  display: flex;
}

.add-row {
  color: var(--accent);
  font-weight: 600;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s var(--ease);
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

.range-block {
  display: grid;
  gap: 6px;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.range-value {
  color: var(--accent);
  font-weight: 600;
}

.range {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--accent);
}

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

.prose {
  padding: 16px 18px;
  color: var(--muted);
}

.hint {
  padding: 16px 18px;
  margin-bottom: 22px;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.hint p {
  color: var(--muted);
  margin-top: 4px;
}

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

.footnote.center {
  text-align: center;
}

.fatal {
  padding: 24px;
  display: grid;
  gap: 8px;
}

.fatal h1 {
  font-size: 22px;
}

/* Sheets */

dialog.sheet {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - var(--safe-top) - 16px);
  margin: auto auto 0;
  padding: 6px 20px calc(16px + var(--safe-bottom));
  border: 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16);
  overflow-y: auto;
  overscroll-behavior: contain;
}

dialog.sheet[open] {
  animation: sheet-in 0.32s var(--ease);
}

dialog.sheet::backdrop {
  background: var(--backdrop);
  animation: fade-in 0.25s ease;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet-grip {
  width: 38px;
  height: 5px;
  margin: 4px auto 10px;
  border-radius: 3px;
  background: var(--surface-2);
}

.sheet-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.sheet-title:focus {
  outline: none;
}

.sheet-content {
  display: grid;
  gap: 14px;
}

.sheet-text {
  line-height: 1.5;
}

.sheet-note {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 15px;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.sheet-actions .btn:not(.danger-text) {
  flex: 1;
  max-width: 220px;
}

.summary-text {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  font: 16px/1.6 var(--font);
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

/* A line that wraps (a long phrase) is indented after its first line. */
.summary-line {
  display: block;
  padding-left: 1em;
  text-indent: -1em;
}

.setting-block {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
}

.setting-block .range-block,
.setting-block .range-head {
  width: 100%;
}

/* Forms */

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

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

.field-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  font-size: 17px;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.ar-input {
  font-family: var(--font-ar);
  font-size: 24px;
  line-height: 1.4;
  padding-block: 6px;
}

.goal-row {
  display: flex;
  gap: 8px;
}

.goal-input {
  flex: 1;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.chip {
  min-width: 56px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-error {
  color: var(--danger);
  font-size: 15px;
}

.form-error:empty {
  display: none;
}

/* Calibration */

.cal-meter {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 18px 0 6px;
}

.cal-dots {
  display: flex;
  gap: 12px;
}

.cal-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--accent);
  transition: background 0.2s, transform 0.2s var(--ease);
}

.cal-dot.on {
  background: var(--accent);
  transform: scale(1.1);
}

.cal-level {
  width: 160px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.cal-level-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.08s linear;
}

.cal-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cal-result:empty {
  display: none;
}

.stat {
  display: grid;
  justify-items: center;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--surface-2);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

/* Phrase picker */

.picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  text-align: left;
  cursor: pointer;
}

.picker-item[aria-current='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.picker-item .ar {
  font-size: 20px;
}

.picker-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Mic result */

.result-phrase {
  align-items: center;
  text-align: center;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.stepper-btn {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
}

.stepper-value {
  width: 120px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  text-align: center;
  font-size: 34px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s, transform 0.3s var(--ease);
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

body[data-route='count'] .toast {
  bottom: calc(var(--safe-bottom) + 104px);
}

.toast-action {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 18%, transparent);
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}

.noscript {
  padding: 24px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  dialog.sheet[open],
  dialog.sheet::backdrop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
