/* Tokens match miniqlab-client/src/styles.scss */
:root {
  --color-primary: #ffb020;
  --color-text: #f5f2ff;
  --color-text-muted: #8d86a3;
  --color-bg: #0d0b12;
  --color-surface: #15121c;
  --color-border: rgba(245, 242, 255, 0.09);
  --color-surface-2: #1b1726;
  --color-primary-muted: rgba(255, 176, 32, 0.32);
  --gradient-accent: linear-gradient(100deg, #ff4b6e, #ffb020);
  --mesh-1: rgba(255, 75, 110, 0.16);
  --mesh-2: rgba(255, 176, 32, 0.12);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-primary: #d9820a;
    --color-text: #1a1625;
    --color-text-muted: #6b6478;
    --color-bg: #faf9fc;
    --color-surface: #ffffff;
    --color-border: rgba(26, 22, 37, 0.09);
    --color-surface-2: #f3f1f7;
    --color-primary-muted: rgba(217, 130, 10, 0.28);
    --gradient-accent: linear-gradient(100deg, #ff4b6e, #d9820a);
    --mesh-1: rgba(255, 75, 110, 0.1);
    --mesh-2: rgba(217, 130, 10, 0.1);
    color-scheme: light;
  }
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 26px 22px;
  font-family: -apple-system, 'SF Pro Display', 'Inter', BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  color: var(--color-text);
  background:
    radial-gradient(circle at 4% 28%, var(--mesh-1), transparent 42%),
    radial-gradient(circle at 96% 78%, var(--mesh-2), transparent 44%),
    var(--color-bg);
  overflow-x: hidden;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.brand__miniq {
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__dot {
  font-weight: 800;
  color: var(--color-primary);
}

.screens {
  flex: 1;
  display: flex;
  justify-content: center;
}

.screen {
  width: 100%;
  max-width: 390px;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.screen[hidden] { display: none; }

.screen__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px 0;
}

.screen h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }

.detail {
  margin-top: -12px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

/* ── NFC waves ─────────────────────────────────────────── */

.waves {
  position: relative;
  width: min(300px, 76vw, 40vh);
  aspect-ratio: 1;
}

.waves__pulse,
.waves__orbit,
.waves__logo {
  position: absolute;
  border-radius: 50%;
}

.waves__pulse {
  inset: 23.3%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: wave 2.4s ease-out infinite;
}

.waves__pulse:nth-child(2) { animation-delay: 0.8s; }
.waves__pulse:nth-child(3) { animation-delay: 1.6s; }

.waves__orbit {
  inset: 13.3%;
  border: 1px solid var(--color-border);
}

.waves__logo {
  inset: 25%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--color-border);
}

.waves__logo img { width: 68%; height: 68%; object-fit: contain; }

@keyframes wave {
  from { transform: scale(1); opacity: 0.85; }
  to { transform: scale(1.9); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .waves__pulse { animation: none; }
}

/* ── Player: liquid orb ────────────────────────────────── */

.orb {
  --progress: 0%;
  position: relative;
  width: min(290px, 74vw, 38vh);
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  /* Safari only clips the animated wave to the circle with its own stacking context. */
  isolation: isolate;
  border: 2px solid var(--color-primary-muted);
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 24px 60px var(--color-primary-muted);
  cursor: pointer;
}

.orb:disabled { cursor: default; opacity: 0.5; }

.orb__fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--progress);
  transition: height 0.25s linear;
}

.orb__wave {
  position: absolute;
  left: -50%;
  top: -16px;
  width: 200%;
  aspect-ratio: 1;
  border-radius: 43%;
  background: var(--gradient-accent);
  animation: spin 7s linear infinite paused;
}

.orb__control {
  position: absolute;
  inset: 28.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: #150f1c;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.orb__control svg { width: 42%; height: 42%; }

.orb__pause { display: none; }

[data-state='playing'] .orb__play { display: none; }
[data-state='playing'] .orb__pause { display: block; }
[data-state='playing'] .orb__wave { animation-play-state: running; }

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

@media (prefers-reduced-motion: reduce) {
  .orb__wave { animation: none; }
}

.time {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.status {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ── Inactive badge, actions ────────────────────────────────────── */

.badge {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  font-size: 0.875rem;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note { font-size: 0.8125rem; color: var(--color-text-muted); }

/* ── States ────────────────────────────────────────────── */

[data-state='loading'] .actions { visibility: hidden; }

[data-state='off'] .waves__pulse { display: none; }

[data-state='off'] .badge { display: inline-flex; }

[data-state='off'] .waves__logo img { filter: grayscale(1); opacity: 0.55; }

[data-state='off'] .button {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
}

.button {
  border: 0;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  border-radius: 9999px;
  background: var(--gradient-accent);
  color: #150f1c;
  font-weight: 800;
  text-decoration: none;
}

.button--ghost {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ── Contact card ──────────────────────────────────────── */

.contact .screen__body { align-items: stretch; gap: 12px; }

.contact [hidden] { display: none; }

.contact__avatar {
  align-self: center;
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #150f1c;
  font-size: 2.4rem;
  font-weight: 800;
}

.contact h1, .contact strong { overflow-wrap: anywhere; }

.contact__message {
  padding: 12px 16px;
  border: 1px solid var(--color-primary-muted);
  border-radius: 16px;
  font-size: 0.875rem;
}

.contact__actions { display: flex; flex-direction: column; gap: 10px; }

.contact-row,
.contact__details {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  text-align: left;
}

.contact-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.contact-row__label { font-size: 0.75rem; color: var(--color-text-muted); }

.round {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #150f1c;
}

.round--ghost {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
}

.contact__details { display: flex; flex-direction: column; text-align: left; }

.contact-detail {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8125rem;
}

.contact-detail:last-child { border-bottom: 0; }

.contact-detail span { color: var(--color-text-muted); }

.contact-detail strong { text-align: right; }
