:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --bg-accent: #e1eff5;
  --card: #ffffff;
  --text: #1b1a16;
  --muted: #7b7b73;
  --line: #ece9e3;
  --accent: #1f5fbb;
  --accent-dark: #123a73;
  --shadow: 0 24px 48px rgba(19, 16, 12, 0.12);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-accent), transparent 50%),
    linear-gradient(135deg, #fff6e9 0%, #f1f6ff 45%, #f6f4f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  width: min(420px, 100%);
  position: relative;
}

.card {
  background: var(--card);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.7s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f5fbb, #69b2ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.label {
  margin: 0;
  font-weight: 600;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-size: 3rem;
  gap: 4px;
}

.currency {
  font-size: 2rem;
}

.note-pill {
  align-self: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: #f2f3f5;
  font-size: 0.85rem;
  color: var(--muted);
}

.connect {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.connect-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b9b6ad;
  box-shadow: 0 0 0 4px rgba(185, 182, 173, 0.2);
}

.indicator.ok {
  background: #1f6a35;
  box-shadow: 0 0 0 4px rgba(31, 106, 53, 0.2);
}

.indicator.error {
  background: #b21f2a;
  box-shadow: 0 0 0 4px rgba(178, 31, 42, 0.18);
}

.status {
  font-size: 0.85rem;
}

.status.ok {
  color: #1f6a35;
}

.status.error {
  color: #b21f2a;
}

.cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cta-btn {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 16px 26px rgba(31, 95, 187, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(31, 95, 187, 0.45);
}

.cta-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: #f8f6f2;
  border-radius: 24px;
  padding: 14px;
}

.key {
  border: none;
  background: #fff;
  padding: 12px 0;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 14px rgba(22, 20, 16, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.key:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(22, 20, 16, 0.12);
}

.key-muted {
  color: var(--muted);
}

.key-accent {
  background: #d8e8ff;
  color: var(--accent-dark);
}

.key-spacer {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

/* ── Success overlay (Google Pay style) ── */

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.success-overlay.visible {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.success-card {
  background: var(--card);
  border-radius: 32px;
  padding: 40px 32px 32px;
  text-align: center;
  width: min(380px, 100%);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.2);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.success-check {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.check-svg {
  width: 80px;
  height: 80px;
}

.check-circle {
  stroke: #1f6a35;
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: strokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.2s forwards;
}

@keyframes strokeCircle {
  to { stroke-dashoffset: 0; }
}

.check-mark {
  stroke: #1f6a35;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: strokeCheck 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes strokeCheck {
  to { stroke-dashoffset: 0; }
}

.success-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1f6a35;
  margin: 0 0 8px;
}

.success-amount {
  font-family: "Fraunces", serif;
  font-size: 2.8rem;
  font-weight: 600;
  margin: 0 0 24px;
  color: var(--text);
}

.success-detail {
  background: #f8f6f2;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
}

.success-detail .label {
  font-size: 1.1rem;
  margin: 4px 0;
}

.success-detail .muted {
  font-size: 0.85rem;
}

.success-done-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(31, 95, 187, 0.3);
}

.success-done-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(31, 95, 187, 0.4);
}

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .card {
    border-radius: 26px;
    padding: 16px;
  }

  .amount {
    font-size: 2.6rem;
  }
}
