:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #1a1f24;
  --muted: #5b6770;
  --line: #d7dde2;
  --accent: #c8102e;
  --accent-dark: #9e0c24;
  --success: #1f8a4c;
  --shadow: 0 10px 30px rgba(26, 31, 36, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(200, 16, 46, 0.08), transparent 40%),
    linear-gradient(180deg, #fafbfc 0%, var(--bg) 100%);
}

.app {
  width: min(480px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.header {
  margin-bottom: 1.5rem;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn.secondary {
  margin-top: 1.25rem;
  background: #eef1f4;
  color: var(--ink);
}

.btn.secondary:hover {
  background: #e3e8ed;
}

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

.status.error {
  color: var(--accent);
}

.display-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.display-panel[hidden],
.panel[hidden] {
  display: none;
}

.qr-frame {
  width: min(280px, 100%);
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.waiting-hint {
  margin: 1rem 0 0;
  color: var(--muted);
  font-weight: 600;
}

.dots::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    width: 0;
  }
  100% {
    width: 1.2em;
  }
}

.success-title {
  margin: 1rem 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--success);
}

.success-detail {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.checkmark {
  width: 96px;
  height: 96px;
  margin: 0 auto;
}

.checkmark svg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: block;
  stroke: var(--success);
  stroke-width: 2;
  stroke-miterlimit: 10;
  box-shadow: inset 0 0 0 var(--success);
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: var(--success);
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-width: 3;
  stroke: var(--success);
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes scale {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: scale3d(1.08, 1.08, 1);
  }
}

@keyframes fill {
  100% {
    box-shadow: inset 0 0 0 48px rgba(31, 138, 76, 0.08);
  }
}
