/* Base defaults: predictable sizing and a white, system-font canvas. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: #202923;
  font-family: ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

/* Shared layout and typography: centered, mobile-first pages. */
main {
  max-width: 480px;
  margin: auto;
  padding: 28px 24px;
}

.brand {
  text-decoration: none;
  color: inherit;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.7px;
  display: block;
  margin-bottom: 52px;
}

h1 {
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -1.5px;
  font-weight: 650;
}

h2 {
  font-size: 23px;
}

p {
  color: #657067;
}

/* Homepage introduction. */
.hero {
  text-align: center;
  padding: 20px 0;
}

.symbol {
  font-size: 60px;
}

.hero h1 {
  margin: 24px 0;
}

/* Primary actions: full-width blue buttons with large touch targets. */
.button,button {
  display: block;
  width: 100%;
  padding: 18px 20px;
  border: 0;
  border-radius: 16px;
  background: #2563eb;
  color: white;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  margin: 22px 0 12px;
}

/* Supporting links, small text, and footer. */
.quiet {
  display: block;
  margin: 25px;
  color: #657067;
  font-size: 15px;
}

.small,footer {
  font-size: 13px;
}

footer {
  text-align: center;
  color: #727a73;
  margin-top: 60px;
}

/* Forms: visible labels and comfortable input heights. */
label {
  display: block;
  margin: 22px 0 0;
}

input {
  display: block;
  width: 100%;
  min-height: 54px;
  border: 1px solid #d6ddd7;
  border-radius: 12px;
  padding: 14px;
  font: inherit;
  margin-top: 8px;
}

/* Shared cards and messages: subtle borders, rounded corners, no shadows. */
article,.notice {
  border: 1px solid #e1e7e1;
  padding: 24px;
  border-radius: 24px;
  margin: 24px 0;
}

article .symbol,article h1,article h2,article>p {
  text-align: center;
}

/* Stamp grid: four per row, with green indicating earned stamps. */
.stamps {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 12px;
  margin: 32px 0;
}

.stamps span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f3f5f2;
  font-size: 30px;
  color: #849385;
}

.stamps .filled {
  background: #e1eddf;
  color: #315b38;
}

/* Secondary actions and keyboard focus. */
.secondary {
  background: #f3f4f6;
  color: #374151;
}

a {
  color: #2563eb;
}

:focus-visible {
  outline: 3px solid #c39a20;
  outline-offset: 4px;
}

/* Shared QR images: preserve square proportions and crisp edges. */
.qr {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 20px auto;
  image-rendering: pixelated;
}

.join-qr {
  text-align: center;
}

/* Customer card: compact spacing keeps the store brand and QR prominent. */
.card-page main {
  max-width: 440px;
  padding: 16px;
}

.card-page .loyalty-card {
  margin: 0;
  padding: 20px;
  border-radius: 24px;
}

.store-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-heading>span {
  font-size: 36px;
  line-height: 1;
}

.card-page .store-heading h1 {
  text-align: left;
  font-size: 27px;
  letter-spacing: -.8px;
  margin: 0;
}

.store-heading p {
  font-size: 13px;
  margin: 3px 0 0;
}

.card-page .customer-name {
  text-align: left;
  margin: 16px 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.reward-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.reward-heading span {
  color: #657067;
  white-space: nowrap;
}

.card-page .stamps {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 10px;
  max-width: 264px;
  margin: 14px auto;
}

.card-page .stamps span {
  font-size: 30px;
}

.card-page .qr {
  width: 208px;
  height: auto;
  margin: 12px auto 4px;
}

.card-page .scan-instructions {
  font-size: 14px;
  margin: 0;
}

.card-page .customer-number {
  font-size: 12px;
  margin: 2px 0 0;
}

.card-page .reward-ready {
  font-size: 14px;
  margin: 8px 0;
  color: #244e37;
  font-weight: 600;
}

.card-page .logout-button {
  background: transparent;
  color: #657067;
  font-size: 14px;
  font-weight: 400;
  min-height: 44px;
  padding: 10px;
  margin: 4px 0;
  border-radius: 10px;
}

.card-page .powered-by {
  margin: 4px 0;
  font-size: 11px;
}

.powered-by a {
  text-decoration: none;
  color: inherit;
}

/* Extra spacing adjustments for narrow phones. */
@media(max-width:360px) {

  /* Customer card: compact spacing keeps the store brand and QR prominent. */
  .card-page main {
    padding: 12px;
  }

  .card-page .loyalty-card {
    padding: 16px;
  }

  .card-page .stamps {
    gap: 8px;
    max-width: 240px;
  }

}

/* Owner registration card and fullscreen QR display. */
.store-emoji {
  font-size: 48px;
  line-height: 1.2;
}

.join-qr h2 {
  margin: 12px 0;
}

.display-open {
  overflow: hidden;
}

#join-display {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 60px 24px 24px;
  background: white;
  color: #202923;
}

#join-display::backdrop {
  background: white;
}

#join-display:fullscreen {
  height: 100%;
  width: 100%;
}

.join-display-content {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

#join-display h2 {
  font-size: clamp(24px,5vw,36px);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -.7px;
}

#join-display .qr {
  width: min(72vw,48dvh,360px);
  height: auto;
  margin: 0;
}

#close-join {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  background: #f3f4f6;
  color: #374151;
  font-size: 28px;
  border-radius: 50%;
  font-weight: 400;
}

/* Short landscape screens: place the QR beside the heading. */
@media(max-height:450px) and (orientation:landscape) {
  #join-display {
    padding: 16px 64px;
  }

  .join-display-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 24px;
    align-content: center;
  }

  .join-display-content .store-emoji {
    align-self: end;
  }

  .join-display-content h2 {
    grid-column: 1;
    align-self: start;
  }

  #join-display .qr {
    grid-column: 2;
    grid-row: 1 / 3;
    width: min(70dvh,320px);
  }

}

/* Store signup: a compact picker with accessible radio inputs. */
.emoji-picker {
  border: 0;
  padding: 0;
  margin: 24px 0;
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 8px;
}

.emoji-picker legend {
  margin-bottom: 12px;
}

.emoji-picker label {
  margin: 0;
  position: relative;
}

/* Hide the native radio visually while keeping keyboard access. */
.emoji-picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.emoji-picker span {
  display: grid;
  place-items: center;
  border: 2px solid #e1e7e1;
  border-radius: 12px;
  min-height: 48px;
  font-size: 27px;
  cursor: pointer;
}

.emoji-picker input:checked+span {
  border-color: #2563eb;
  background: #eff6ff;
}

.emoji-picker input:focus-visible+span {
  outline: 3px solid #c39a20;
}

.url-prefix {
  display: block;
  font-size: 14px;
  color: #657067;
  margin-top: 8px;
}

/* Bundled Noto PNGs keep emoji artwork identical across platforms. */
.emoji {
  display: inline-block;
  object-fit: contain;
  vertical-align: -.15em;
  width: 1em;
  height: 1em;
}

.store-emoji .emoji {
  width: 48px;
  height: 48px;
}

.store-heading .emoji {
  width: 36px;
  height: 36px;
}

.symbol .emoji {
  width: 60px;
  height: 60px;
}

.emoji-picker .emoji {
  width: 28px;
  height: 28px;
}

/* Infrequent owner access: understated, with a comfortable touch target. */
.store-owner-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px;
  color: #657067;
  font-size: 12px;
  text-decoration: none;
}

.store-owner-link:hover {
  text-decoration: underline;
}

/* Homepage loyalty illustration. */
.hero-card-image {
  display: block;
  width: 144px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Login errors should stand out from ordinary supporting text. */
.form-error {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 15px;
  font-weight: 600;
}

/* Customer lookup and pagination keep long store lists manageable. */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 24px 0;
}
.pagination a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.customer-search button {
  margin-top: 12px;
}
#customers article p {
  overflow-wrap: anywhere;
}

/* Warm orange distinguishes search from blue stamp actions. */
.customer-search .search-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #e5581e;
  border: 2px solid #e5581e;
  color: white;
}

.settings-divider {
  border: 0;
  border-top: 1px solid #d1d5db;
  margin: 32px 0;
}

.team-email { overflow-wrap: anywhere; user-select: all; }
.team-email strong { background: #eff6ff; color: #1d4ed8; }

.card-page [hidden] {
  display: none;
}

#store-slug[aria-invalid="true"] {
  border: 2px solid #b42318;
}
#slug-status[data-error="true"] {
  color: #b42318;
  font-weight: 600;
}

