:root {
  color-scheme: light;
  --coffee-950: #2a0f0b;
  --coffee-900: #34150f;
  --coffee-800: #4b2119;
  --coffee-700: #653326;
  --cream-50: #fffdf8;
  --cream-100: #fbf4e8;
  --cream-200: #f2e4d0;
  --gold-300: #e7bd6a;
  --gold-400: #d9a94f;
  --gold-500: #c28a31;
  --ink: #2b211d;
  --muted: #75655c;
  --success: #23724a;
  --danger: #a3362f;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--coffee-950);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(231, 189, 106, 0.2), transparent 34%),
    linear-gradient(155deg, var(--coffee-800), var(--coffee-950));
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.loyalty-card {
  width: min(100%, 440px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 28px;
  background: var(--cream-50);
  box-shadow: 0 24px 80px rgba(23, 7, 4, 0.38);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 18px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 55%),
    var(--coffee-900);
}

.logo {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.brand-location,
.progress-label {
  margin: 0;
  color: var(--gold-300);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.17em;
}

h1 {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.58rem, 7vw, 2rem);
  line-height: 1.05;
}

.promotion-card {
  position: relative;
  margin: 16px 16px 0;
  overflow: hidden;
  padding: 17px;
  border: 1px solid #ead2a3;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(231, 189, 106, 0.32), transparent 38%),
    linear-gradient(135deg, #fff8e8, #f7ead1);
}

.promotion-card::after {
  position: absolute;
  right: -22px;
  bottom: -32px;
  content: "✦";
  color: rgba(101, 51, 38, 0.09);
  font-size: 7rem;
  line-height: 1;
}

.promotion-card.is-today {
  border-color: var(--gold-500);
  box-shadow: inset 0 0 0 1px rgba(194, 138, 49, 0.14);
}

.promotion-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.promotion-eyebrow,
.promotion-status {
  color: var(--coffee-700);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.promotion-status {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(101, 51, 38, 0.08);
  letter-spacing: 0.06em;
}

.promotion-status.is-active {
  color: #fff;
  background: var(--success);
}

.promotion-status.is-finished {
  color: var(--muted);
  background: rgba(117, 101, 92, 0.12);
}

.promotion-status.is-used {
  color: #fff;
  background: var(--coffee-700);
}

.promotion-card h2 {
  position: relative;
  z-index: 1;
  margin: 12px 0 7px;
  color: var(--coffee-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
}

.promotion-card p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #604f45;
  font-size: 0.92rem;
  line-height: 1.45;
}

.promotion-card .promotion-date {
  margin-top: 8px;
  color: var(--coffee-700);
  font-size: 0.78rem;
  font-weight: 800;
}

.promotion-card .promotion-limit {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.progress-section {
  padding: 24px 20px 18px;
  text-align: center;
}

.progress-label {
  color: var(--coffee-700);
}

.coffee-summary {
  margin: 7px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 330px;
  margin: 0 auto;
}

.stamp {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1.5px dashed #cbb9aa;
  border-radius: 50%;
  color: #a29184;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.stamp.is-earned {
  border-style: solid;
  border-color: var(--coffee-700);
  color: #fff;
  background: var(--coffee-700);
  box-shadow: 0 4px 12px rgba(75, 33, 25, 0.2);
  font-size: 1rem;
}

.stamp.is-reward:not(.is-earned) {
  border-color: var(--gold-500);
  color: var(--gold-500);
  background: #fff9ed;
}

.reward-track {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  max-width: 330px;
  margin: 11px auto 20px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.reward-track span:last-child {
  text-align: right;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  padding: 13px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--coffee-700), var(--coffee-900));
  box-shadow: 0 9px 20px rgba(52, 21, 15, 0.23);
  font-size: 1rem;
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.98);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.terms-button:focus-visible {
  outline: 3px solid rgba(194, 138, 49, 0.42);
  outline-offset: 3px;
}

.stamp-helper,
.feedback {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.feedback {
  min-height: 1.1em;
  font-weight: 800;
}

.feedback.is-success {
  color: var(--success);
}

.feedback.is-error {
  color: var(--danger);
}

.notification-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin: 0 16px 14px;
  padding: 15px;
  border-radius: 18px;
  background: #f3ede7;
}

.install-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin: 14px 16px 0;
  padding: 15px;
  border: 1px solid #ead2a3;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff8e8, #f7ead1);
}

.install-title,
.install-copy,
.install-feedback {
  margin: 0;
}

.install-title {
  color: var(--coffee-900);
  font-size: 0.9rem;
  font-weight: 900;
}

.install-copy,
.install-feedback {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.install-feedback {
  grid-column: 1 / -1;
}

.install-button {
  min-height: 42px;
  padding: 9px 15px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--coffee-700), var(--coffee-900));
  box-shadow: 0 7px 16px rgba(52, 21, 15, 0.2);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.install-button:active {
  transform: scale(0.98);
}

.install-button:focus-visible {
  outline: 3px solid rgba(194, 138, 49, 0.42);
  outline-offset: 3px;
}

.notification-title,
.notification-copy,
.notification-feedback {
  margin: 0;
}

.notification-title {
  color: var(--coffee-900);
  font-size: 0.86rem;
  font-weight: 900;
}

.notification-copy,
.notification-feedback {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.notification-feedback {
  grid-column: 1 / -1;
}

.secondary-button {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--coffee-900);
  border: 1px solid #d9c6b9;
  background: #fff;
  font-size: 0.74rem;
}

.secondary-button:disabled {
  cursor: default;
  opacity: 0.68;
}

.terms-button {
  display: block;
  margin: 0 auto 18px;
  padding: 5px 10px;
  border: 0;
  color: var(--coffee-700);
  background: transparent;
  font-size: 0.73rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.message-dialog {
  width: min(calc(100% - 32px), 380px);
  padding: 24px;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--cream-50);
  box-shadow: 0 24px 80px rgba(23, 7, 4, 0.45);
  text-align: center;
}

.message-dialog::backdrop {
  background: rgba(24, 9, 6, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #fff;
  background: var(--coffee-700);
  font-size: 1.45rem;
}

.message-dialog h2 {
  margin: 0 0 8px;
  color: var(--coffee-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.message-dialog p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.terms-dialog p {
  white-space: pre-line;
  text-align: left;
}

[hidden] {
  display: none !important;
}

@media (max-width: 370px) {
  .brand-header {
    padding-inline: 17px;
  }

  .logo {
    width: 62px;
    height: 62px;
  }

  .promotion-card,
  .notification-panel,
  .install-panel {
    margin-inline: 12px;
  }

  .progress-section {
    padding-inline: 15px;
  }

  .notification-panel,
  .install-panel {
    grid-template-columns: 1fr;
  }

  .secondary-button,
  .install-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
