:root {
  --bg: #f7f7f7;
  --text: #1d1d1f;
  --muted: #666;
  --line: #ececec;
  --panel: #fafafa;
  --white: #fff;
  --orange: #f39b1f;
  --orange-2: #eb7d1d;
  --green: #1ea672;
  --red: #c94a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 28px 14px;
}

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  text-align: center;
}

h1 {
  margin: 0 0 20px;
  font-size: 2.25rem;
  font-weight: 700;
}

.title-with-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.title-logo {
  width: 34px;
  height: 34px;
}

.username-panel {
  text-align: left;
  width: min(420px, 100%);
  margin: 0 auto 22px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.panel-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.panel-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.panel-row input {
  flex: 1;
  min-width: 0;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.update-btn {
  border: 1px solid #d79b38;
  background: var(--orange);
  color: #fff;
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}

.secondary-btn {
  border: 1px solid #ddd;
  background: #fff;
  color: #222;
  padding: 0 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}

.hidden {
  display: none;
}

.donate-btn {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, var(--orange), var(--orange-2));
  transition: filter 0.15s ease;
}

.donate-btn:hover {
  filter: brightness(1.06);
}

.donation-card {
  width: min(420px, 100%);
  margin: 0 auto;
  background: var(--white);
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-align: left;
}

input {
  width: 100%;
  background: #fff;
  color: var(--text);
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px 10px;
  font-size: 0.95rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
  margin-bottom: 10px;
}

.blink-brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blink-logo {
  height: 28px;
  width: auto;
  display: block;
}

.blink-badge {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #f4e6bf;
  font-size: 10px;
}

.blink-text {
  font-style: italic;
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
}

.recipient-username {
  font-size: 0.7rem;
  color: var(--muted);
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.amount-row input {
  border: 0;
  border-radius: 0;
}

.sats-tag {
  padding: 10px 10px;
  border-left: 1px solid #ddd;
  background: #f7f7f7;
  font-size: 0.95rem;
  color: #555;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sats-logo {
  width: 14px;
  height: 14px;
}

.payment-state {
  margin-top: 10px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
}

.error {
  color: var(--red);
}

.ok {
  color: var(--green);
}

.invoice-panel {
  text-align: left;
  width: min(420px, 100%);
  margin: 16px auto 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: var(--white);
}

.invoice-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.invoice-row input {
  flex: 1;
  min-width: 0;
  border-radius: 4px;
}

.qr-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

#invoiceQr {
  width: 236px;
  min-height: 236px;
  margin: 12px auto 0;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ddd;
  display: grid;
  place-items: center;
}

#invoiceQr img,
#invoiceQr canvas {
  display: block;
  width: 220px !important;
  height: 220px !important;
}

.qr-placeholder {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.copy-btn {
  border: 1px solid #ddd;
  background: #fafafa;
  color: #222;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

.details {
  margin-top: 8px;
  text-align: left;
}

.details .hint {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.history-list li {
  border-bottom: 1px solid #efefef;
  padding: 8px 0;
  font-size: 0.85rem;
  color: #444;
}

.history-list li:last-child {
  border-bottom: 0;
}

.hint {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

#donationCard.paid {
  animation: paidGlow 0.85s ease-in-out 2;
}

#invoiceQr.paid {
  animation: qrPulse 1.1s ease-in-out 3;
  border-color: rgba(16, 185, 129, 0.75);
  box-shadow:
    0 0 0 2px rgba(16, 185, 129, 0.2),
    0 0 24px rgba(16, 185, 129, 0.35);
}

#invoiceQr.expired {
  border-color: rgba(239, 68, 68, 0.65);
}

#donationCard.expired {
  border-color: rgba(239, 68, 68, 0.45);
}

.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 20;
}

.qr-modal.hidden {
  display: none;
}

.qr-modal-content {
  position: relative;
  background: #fff;
  padding: 16px;
  border-radius: 10px;
}

.close-btn {
  position: absolute;
  top: 4px;
  right: 8px;
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

#invoiceQrLarge {
  width: 320px;
  min-height: 320px;
  display: grid;
  place-items: center;
}

#invoiceQrLarge img,
#invoiceQrLarge canvas {
  width: 300px !important;
  height: 300px !important;
}

@keyframes paidGlow {
  0% {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(16, 185, 129, 0.3),
      0 20px 60px rgba(16, 185, 129, 0.4);
  }
  100% {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
}

@keyframes qrPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}
