:root {
  --bg: #141416;
  --surface: #1f1f23;
  --surface-2: #2a2a30;
  --text: #f4f4f6;
  --muted: #9a9aa3;
  --accent: #e0322a;
  --accent-hi: #ff7a6b;
  --ok: #30d158;
  --err: #ff453a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  /* Native-feel: no rubber-band, no callouts, no text selection, no tap flash */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

.stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: var(--safe-top) 24px var(--safe-bottom);
}

.big-button {
  --size: min(70vw, 60vh, 320px);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 50% 35%, var(--accent-hi), var(--accent) 70%);
  box-shadow:
    0 14px 0 #8f1c16,
    0 24px 40px rgba(0,0,0,.55),
    inset 0 6px 18px rgba(255,255,255,.25);
  transform: translateY(0);
  transition: transform .08s ease, box-shadow .08s ease, filter .2s ease, background .25s ease;
  display: grid;
  place-items: center;
}
.big-button .label {
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 2px 4px rgba(0,0,0,.3);
  max-width: 80%;
  overflow-wrap: anywhere;
}
.big-button:active,
.big-button.pressed {
  transform: translateY(10px);
  box-shadow:
    0 4px 0 #8f1c16,
    0 8px 18px rgba(0,0,0,.5),
    inset 0 6px 18px rgba(255,255,255,.2);
}
.big-button.sending { filter: brightness(.85); }
.big-button.sending .label { animation: pulse 1s ease-in-out infinite; }
.big-button.ok    { background: radial-gradient(circle at 50% 35%, #6ef08f, var(--ok) 70%); box-shadow: 0 14px 0 #1a7a33, 0 24px 40px rgba(0,0,0,.55), inset 0 6px 18px rgba(255,255,255,.25); }
.big-button.error { background: radial-gradient(circle at 50% 35%, #ff8a80, var(--err) 70%); }
.big-button:disabled { opacity: 1; }

@keyframes pulse { 50% { opacity: .4; } }

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.status.error { color: var(--err); }
.status.ok { color: var(--ok); }

/* Hidden haptic switch */
.haptic {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Shared */
h1 { margin: 0; font-size: 26px; font-weight: 700; text-align: center; }
.muted { margin: 0; color: var(--muted); text-align: center; max-width: 32ch; }

.primary-btn {
  min-width: 220px;
  padding: 15px 24px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  font-weight: 600;
  transition: filter .15s ease, transform .08s ease;
}
.primary-btn:active { transform: scale(.98); filter: brightness(.9); }
.primary-btn:disabled { opacity: .6; }

.text-btn {
  background: none;
  border: 0;
  padding: 10px 14px;
  color: var(--accent-hi);
  font-weight: 600;
}
.text-btn.small { font-size: 14px; font-weight: 500; color: var(--muted); }

.footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 16px calc(var(--safe-bottom) + 8px);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.footer > * { pointer-events: auto; }

/* Setup */
.setup {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.setup .muted { align-self: center; margin-bottom: 8px; }
.setup input {
  font: 20px/1.3 ui-monospace, "SF Mono", Menlo, monospace;
  text-align: center;
  letter-spacing: .08em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px;
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
}
.setup input:focus { outline: none; border-color: var(--accent-hi); }

/* Receiver */
.bell {
  width: min(44vw, 180px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  transition: background .3s ease, color .3s ease;
}
.bell svg { width: 46%; height: 46%; }
.bell[data-state="on"] {
  background: radial-gradient(circle at 50% 35%, var(--accent-hi), var(--accent) 70%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(224, 50, 42, .35);
}
.bell[data-state="on"] .slash { display: none; }
.receiver-copy { display: flex; flex-direction: column; align-items: center; gap: 8px; }
