:host {
  display: block;
}

.ac {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #1e293b 0%, #0f172a 55%, #020617 100%);
  color: #e2e8f0;
  padding: clamp(1rem, 4vw, 2rem) 1rem calc(1.5rem + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.ac__inner {
  width: 100%;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3.5vw, 1.75rem);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.ac__head {
  text-align: center;
}

.ac__eyebrow {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.ac__title {
  margin: 0.35rem 0 0;
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  font-weight: 700;
  line-height: 1.15;
  color: #f8fafc;

  span {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-top: 0.2rem;
  }
}

.ac__date {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #38bdf8;
}

.ac__status {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #94a3b8;

  &.is-on { color: #4ade80; }
}

.ac__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #64748b;

  .is-on & {
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
  }
}

/* Shown only when it's not the worship day — the page is view-only. */
.ac__readonly {
  margin-top: 0.65rem;
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ── Counter rows ──────────────────────────────────────────────────────── */
.ac__rows {
  display: flex;
  flex-direction: column;
  gap: clamp(0.85rem, 3vw, 1.25rem);
}

.row {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 1.25rem;
  padding: 1rem 1.1rem 1.25rem;
  backdrop-filter: blur(6px);
}

.row__label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.row__en {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
}

.row__zh {
  font-size: 0.95rem;
  color: #94a3b8;
}

.row__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Big, thumb-friendly tap targets */
.btn {
  flex: 0 0 auto;
  width: clamp(4rem, 18vw, 5rem);
  height: clamp(4rem, 18vw, 5rem);
  border-radius: 50%;
  border: none;
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* kill double-tap-to-zoom on rapid taps */
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.6);

  &:active { transform: scale(0.92); }
  &:disabled { opacity: 0.35; cursor: default; }
}

.btn--minus {
  background: linear-gradient(135deg, #475569, #334155);
}

.btn--plus {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}

/* Tap the number to type an exact count */
.row__num {
  flex: 1 1 auto;
  text-align: center;
  font-size: clamp(2.6rem, 13vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  padding: 0.4rem 0;
  border: none;
  background-color: transparent;
  border-radius: 0.85rem;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* kill double-tap-to-zoom on rapid taps */
  transition: transform 0.08s ease, filter 0.15s ease;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  &:active { transform: scale(0.94); }
  &:disabled { cursor: default; }

  &[data-key='adult'] { background-image: linear-gradient(135deg, #38bdf8, #6366f1); }
  &[data-key='youth'] { background-image: linear-gradient(135deg, #34d399, #14b8a6); }
  &[data-key='kid']   { background-image: linear-gradient(135deg, #fbbf24, #fb923c); }
}

/* ── Direct-entry dialog ───────────────────────────────────────────────── */
.edit {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.edit__card {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}

.edit__label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.edit__en {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f1f5f9;
}

.edit__zh {
  font-size: 0.95rem;
  color: #94a3b8;
}

.edit__input {
  width: 100%;
  text-align: center;
  font-size: clamp(2.4rem, 12vw, 3rem);
  font-weight: 800;
  line-height: 1;
  padding: 0.6rem 0.5rem;
  border-radius: 0.85rem;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(99, 102, 241, 0.5);
  outline: none;

  &:focus { border-color: #6366f1; }
}

.edit__actions {
  display: flex;
  gap: 0.75rem;
}

.edit__btn {
  flex: 1 1 0;
  padding: 0.85rem 0.5rem;
  border: none;
  border-radius: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, filter 0.15s ease;

  &:active { transform: scale(0.96); }
}

.edit__btn--cancel {
  background: linear-gradient(135deg, #475569, #334155);
}

.edit__btn--confirm {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}

/* ── Grand total ───────────────────────────────────────────────────────── */
.ac__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(79, 70, 229, 0.18));
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.ac__total-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: #c7d2fe;
}

.ac__total-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
}
