/* yoloy till — dark by default.
   A counter is often dim, the phone is held low, and a bright white screen in
   a customer's face is rude. */

:root {
  --ink: #f4ede5;
  --ink-soft: #a99e93;
  --bg: #16120e;
  --surface: #221b15;
  --line: #382d24;
  --accent: #fb923c;
  --accent-ink: #1a0f06;
  --ok: #4ade80;
  --bad: #f87171;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/**
 * `hidden` must always win.
 *
 * The attribute only hides an element because the browser's own stylesheet says
 * `display: none` — and *any* author rule setting `display` beats it. Screens
 * are `display: flex`, so without this every screen rendered at once, stacked a
 * viewport apart, and switching screens appeared to do nothing at all.
 */
[hidden] { display: none !important; }


html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  /* Nothing here should rubber-band; it is an app, not a document. */
  overscroll-behavior: none;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.pane {
  width: min(100% - 2rem, 26rem);
  margin: auto;
  padding: 1.5rem 0;
}

.logo {
  font-size: 1.6rem;
  font-weight: 780;
  letter-spacing: -0.03em;
  margin: 0 0 1.75rem;
}
.logo span {
  color: var(--accent);
  font-weight: 600;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 620;
  color: var(--ink-soft);
  margin: 1rem 0 0.35rem;
}

input, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  font: inherit;
  font-weight: 640;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  cursor: pointer;
  /* Never let a double-tap zoom the page mid-transaction. */
  touch-action: manipulation;
}
.btn:disabled { opacity: 0.45; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-link { background: none; color: var(--ink-soft); border: none; }
.btn-block { display: block; width: 100%; margin-top: 1.5rem; }
.btn-big { font-size: 1.15rem; padding: 1.1rem 1.4rem; }

.error {
  margin-top: 1rem;
  color: var(--bad);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  min-height: 3rem;
}
.bar-title {
  flex: 1;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-btn {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
.bar-spacer { width: 2.6rem; }

/* ---------- camera ---------- */

.screen-scan { justify-content: space-between; }

.camera-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
  display: grid;
  place-items: center;
}
#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reticle {
  position: absolute;
  width: min(62vw, 16rem);
  aspect-ratio: 1;
  border: 3px solid rgba(251, 146, 60, 0.9);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}
.camera-hint {
  position: absolute;
  bottom: 1.2rem;
  left: 1rem;
  right: 1rem;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.scan-actions { padding: 1rem; }

.scan-alt { display: flex; gap: 0.5rem; }
.scan-alt .btn { flex: 1; }

.manual {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.manual input { flex: 1; }

/* A spoken code is read back character by character; spacing them out makes
   a typo visible before the cashier submits it. */
#reward-code {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
}

/* ---------- card ---------- */

.pane-card { margin-top: 1.5rem; }

.card-phone {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}

.stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.dot {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.dot-on {
  background: var(--accent);
  border-color: var(--accent);
}

.card-progress {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.rewards {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.rewards h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.reward + .reward { margin-top: 0.75rem; }
.btn-reward {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
}

.stamp-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.counter {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
}
.counter-btn {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.5rem;
  width: 2.8rem;
  height: 3.1rem;
  cursor: pointer;
  touch-action: manipulation;
}
.counter-btn:disabled { opacity: 0.3; }
.counter-value {
  min-width: 1.6rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}
.stamp-controls .btn { flex: 1; }

/* ---------- management ---------- */

.pane-scroll {
  width: min(100% - 2rem, 30rem);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
  overflow-y: auto;
}

.group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
  margin: 2rem 0 0.6rem;
}
.group-title:first-of-type { margin-top: 0.5rem; }

.banner {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.rows { display: flex; flex-direction: column; gap: 0.5rem; }

.row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  cursor: pointer;
  touch-action: manipulation;
}
.row:active { border-color: var(--accent); }
.row-main { font-weight: 620; }
.row-sub { font-size: 0.9rem; color: var(--ink-soft); }

.muted { color: var(--ink-soft); font-size: 0.95rem; margin: 0.25rem 0; }

.hint {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.4rem 0 0;
}

/* A checkbox at input width would be a stretched grey slab. */
input.check {
  width: 1.5rem;
  height: 1.5rem;
  accent-color: var(--accent);
}

/* ---------- receipt ---------- */

.steps-lead { color: var(--ink-soft); margin: 0 0 0.5rem; }

/* The number the cashier keys into the register — large enough to read at
   arm's length while looking away at the keypad. */
.amount {
  font-size: 2.6rem;
  font-weight: 780;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin: 0;
}

#receipt-number {
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ---------- done ---------- */

.screen-done { justify-content: center; text-align: center; }
.done-inner {
  width: min(100% - 2rem, 24rem);
  margin: auto;
}
.done-icon { font-size: 4rem; line-height: 1; }
.done-inner h2 {
  font-size: 2rem;
  margin: 1rem 0 0.5rem;
}
.done-inner p {
  color: var(--ink-soft);
  margin: 0 0 2.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .done-icon { animation: pop 0.35s ease-out; }
}
@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
