/* Alca phone — base. 墨 Mono: near-black (or near-white) field, hairlines,
   pills; color only where it means something (amber: waiting on you,
   vermilion: payment / send / delete / publish). Tokens only. */

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

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

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--c-canvas);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-ui);
  letter-spacing: var(--tracking-cjk);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app {
  height: 100%;
}

p,
h1,
h2,
h3 {
  /* No lone last character on its own line (CJK paragraphs). */
  text-wrap: pretty;
}

::selection {
  background: var(--c-selection);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-ring);
}

[hidden] {
  display: none !important;
}

.icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out);
}

.btn.big {
  min-height: var(--touch-big);
  width: 100%;
  font-size: var(--text-lg);
}

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

.btn.primary {
  background: var(--c-inverse);
  color: var(--c-inverse-ink);
}

.btn.primary[data-tone="danger"] {
  background: var(--c-danger);
  /* Canvas ink on vermilion reads in both themes (dark: near-black on coral, light: near-white on red). */
  color: var(--c-canvas);
}

.btn.secondary {
  background: transparent;
  border-color: var(--c-line-strong);
  color: var(--c-ink);
}

.btn.secondary:active:not(:disabled) {
  background: var(--c-hover);
}

.btn:disabled {
  opacity: 0.4;
}

.btn[data-busy="true"] {
  opacity: 1;
}

.btn[data-busy="true"] .btn-label::after,
.btn[data-busy="true"]:not(:has(.btn-label))::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: var(--space-2);
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--c-ink);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.icon-btn:active {
  background: var(--c-active);
  transform: scale(0.94);
}

.icon-btn.inverse {
  background: var(--c-inverse);
  color: var(--c-inverse-ink);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--touch);
  padding: 0 var(--space-4) 0 var(--space-3);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  background: var(--c-surface-raised);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.text-btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.text-btn.danger {
  color: var(--c-danger);
}

.text-btn:active {
  background: var(--c-hover);
}

/* ── Small parts ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--c-ink-soft);
  white-space: nowrap;
}

.badge[data-tone="danger"] {
  border-color: var(--c-danger-line);
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-ink-faint);
}

.spin {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border: 1.75px solid var(--c-ink-muted);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--c-accent-soft);
  color: var(--c-ink-soft);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  vertical-align: 2px;
}

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

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1;
}

.wordmark.small {
  font-size: var(--text-2xl);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--c-surface-sunken);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
  .spin,
  .btn[data-busy="true"] .btn-label::after {
    animation: none !important;
    border-right-color: currentColor;
    opacity: 0.6;
  }
}
