@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --surface-0: #f6f0e7;
  --surface-1: rgba(255, 251, 246, 0.92);
  --surface-2: rgba(20, 28, 43, 0.1);
  --surface-3: rgba(255, 255, 255, 0.72);
  --text-0: #172033;
  --text-1: #33415e;
  --text-inverse: #fbf6ef;
  --border: rgba(23, 32, 51, 0.12);
  --blue: #0057d9;
  --gold: #e7c214;
  --success: #0f8e68;
  --danger: #c4473f;
  --shadow: 0 22px 60px rgba(24, 34, 56, 0.12);
  --page-bg:
    radial-gradient(circle at 10% 10%, rgba(231, 194, 20, 0.22), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(0, 87, 217, 0.18), transparent 32%),
    linear-gradient(180deg, #f7f2ea 0%, #efe6d9 100%);
}

body[data-theme="dark"] {
  --surface-0: #0b1220;
  --surface-1: rgba(10, 17, 30, 0.9);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(22, 31, 48, 0.88);
  --text-0: #f7efe2;
  --text-1: #b7c5de;
  --text-inverse: #09101c;
  --border: rgba(183, 197, 222, 0.12);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
  --page-bg:
    radial-gradient(circle at 15% 15%, rgba(231, 194, 20, 0.16), transparent 28%),
    radial-gradient(circle at 80% 5%, rgba(0, 87, 217, 0.22), transparent 28%),
    linear-gradient(180deg, #09111f 0%, #060b14 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: var(--page-bg);
  color: var(--text-0);
  position: relative;
}

button,
input,
textarea,
a {
  font: inherit;
}

a {
  color: inherit;
}

.background-glow {
  position: fixed;
  inset: auto;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.background-glow-a {
  top: 3rem;
  right: -7rem;
  background: rgba(0, 87, 217, 0.45);
}

.background-glow-b {
  bottom: 5rem;
  left: -9rem;
  background: rgba(231, 194, 20, 0.35);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 1.5rem;
  padding: 1rem;
  backdrop-filter: blur(20px);
}

.hero-panel {
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -50% auto;
  width: 20rem;
  height: 20rem;
  background:
    radial-gradient(circle, rgba(231, 194, 20, 0.28), transparent 55%),
    radial-gradient(circle at 35% 35%, rgba(0, 87, 217, 0.18), transparent 58%);
  transform: rotate(14deg);
}

.hero-copy,
.hero-actions {
  position: relative;
  z-index: 1;
}

.brand-logo {
  width: min(14rem, 55vw);
  height: auto;
  display: block;
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.18));
}

.hero-copy h1,
.section-header h2 {
  margin: 0.2rem 0 0;
  font-family: "Fraunces", serif;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  max-width: 12ch;
}

.hero-summary,
.supporting-copy,
.instructions-list {
  margin: 0;
  color: var(--text-1);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--text-1);
  margin: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.compact-header {
  margin-bottom: 0.75rem;
}

.section-header h2 {
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--blue), #1f7fff);
  color: #fff;
  border-color: transparent;
}

.ghost-button {
  background: var(--surface-3);
  color: var(--text-0);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.control-stack {
  display: grid;
  gap: 0.9rem;
}

.counter-card {
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(0, 87, 217, 0.12), transparent),
    var(--surface-3);
}

.counter-value {
  margin: 0.3rem 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1;
}

.sync-badge {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 142, 104, 0.12);
  color: var(--success);
  border: 1px solid rgba(15, 142, 104, 0.2);
  font-size: 0.82rem;
  white-space: nowrap;
}

.sync-badge.loading {
  background: rgba(0, 87, 217, 0.12);
  color: var(--blue);
  border-color: rgba(0, 87, 217, 0.24);
}

.sync-badge.error {
  background: rgba(196, 71, 63, 0.12);
  color: var(--danger);
  border-color: rgba(196, 71, 63, 0.24);
}

.results-panel {
  display: grid;
  gap: 1rem;
}

.voucher-list {
  display: grid;
  gap: 0.85rem;
}

.voucher-card,
.empty-state,
.message-card {
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background: var(--surface-3);
}

.voucher-card {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 1.4rem 1rem;
}

.loading-copy {
  margin: 0;
  color: var(--text-1);
  text-align: center;
}

.loading-dots {
  display: inline-flex;
  gap: 0.45rem;
}

.loading-dots span {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), #1f7fff);
  animation: bounce 0.9s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.12s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.24s;
}

.voucher-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.voucher-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.voucher-code {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.1;
  word-break: break-all;
}

.copy-button {
  min-width: 6.5rem;
  padding: 0.7rem 0.95rem;
}

.copy-button.copied {
  background: rgba(15, 142, 104, 0.15);
  color: var(--success);
  border-color: rgba(15, 142, 104, 0.28);
}

.empty-state {
  padding: 1rem;
  color: var(--text-1);
}

.message-card {
  padding: 0.9rem 1rem;
}

.message-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.message-card.note strong {
  color: var(--success);
}

.message-card.warning strong {
  color: var(--danger);
}

.control-panel .primary-button {
  width: 100%;
}

.instructions-list {
  padding-left: 1.2rem;
}

.instructions-list li + li {
  margin-top: 0.4rem;
}

.footer-panel {
  text-align: center;
}

.footer-copy {
  font-size: 0.95rem;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  40% {
    transform: translateY(-0.45rem);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .section-header {
    flex-direction: column;
  }

  .hero-actions {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .voucher-row {
    align-items: stretch;
  }

  .copy-button {
    width: 100%;
  }
}
