:root {
  --ink: #172019;
  --muted: #657067;
  --line: #dfe5df;
  --page: #f6f7f4;
  --card: #ffffff;
  --green: #00843d;
  --green-dark: #006c32;
  --error: #b42318;
  --focus: #0066cc;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

.offline-banner {
  padding: 10px 16px;
  background: #fff4e5;
  border-bottom: 1px solid #f0d7ad;
  color: #6b4914;
  text-align: center;
  font-size: 14px;
}

.site-header {
  width: min(100% - 32px, 560px);
  margin: 0 auto;
  padding: 28px 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
}

.brand span { display: grid; gap: 1px; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 12px; }

.page-shell {
  width: min(100% - 32px, 560px);
  margin: 0 auto;
  padding: 12px 0 44px;
}

.pass-card {
  min-height: 390px;
  padding: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(21, 32, 25, 0.055);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -.025em;
}

h1 {
  max-width: 430px;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.08;
}

h2 {
  font-size: 27px;
  line-height: 1.15;
}

.intro,
.result-copy,
.loading-view > p,
.error-view > p {
  color: var(--muted);
  line-height: 1.55;
}

.intro { margin: 12px 0 28px; }

form { display: grid; gap: 9px; }

label {
  font-size: 14px;
  font-weight: 650;
}

.input-wrap { position: relative; }

input {
  width: 100%;
  height: 54px;
  padding: 0 76px 0 15px;
  border: 1px solid #cdd5ce;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .12);
}

input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .09);
}

.paste-button {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: #eef2ee;
  color: #344139;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.paste-button:hover:not(:disabled) { background: #e5ebe6; }
.paste-button:disabled { opacity: .65; cursor: wait; }

.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 20px;
  color: #78827a;
  font-size: 12px;
}

#characterCount { white-space: nowrap; }

.field-error {
  min-height: 18px;
  margin: -3px 0 0;
  color: var(--error);
  font-size: 13px;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 5px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}

.primary-button:hover:not(:disabled) { background: var(--green-dark); }
.primary-button:active:not(:disabled) { transform: translateY(1px); }
.primary-button:disabled { opacity: .5; cursor: not-allowed; }

.privacy-note {
  margin: 16px 0 0;
  color: #7b857d;
  font-size: 12px;
  text-align: center;
}

.loading-view,
.result-view,
.error-view {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Campfire loader */
.campfire-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  margin: 0 auto 22px;
}

.campfire-halo {
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 55, .2), rgba(255, 176, 55, 0) 68%);
  animation: halo 1.6s ease-in-out infinite alternate;
}

.campfire-graphic {
  position: absolute;
  inset: 0;
  display: block;
  width: 116px;
  height: 116px;
  overflow: visible;
}

.campfire-flames {
  transform-box: view-box;
  transform-origin: 60px 84px;
  animation: flame-sway .72s ease-in-out infinite alternate;
}

.flame-back { fill: #ef8822; }
.flame-mid { fill: #ffbb38; }
.flame-front { fill: #ffe39a; }

.campfire-logs {
  transform-box: view-box;
  transform-origin: 60px 88px;
}

.log-a { fill: #79543b; }
.log-b { fill: #684632; }

.spark {
  fill: #f6a62a;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: spark 1.8s ease-out infinite;
}

.spark-b { animation-delay: .43s; }
.spark-c { animation-delay: .88s; }

@keyframes flame-sway {
  0% { transform: translateX(-1px) scale(.98, 1.03); }
  100% { transform: translateX(1px) scale(1.02, .97); }
}

@keyframes halo {
  from { transform: scale(.92); opacity: .65; }
  to { transform: scale(1.08); opacity: 1; }
}

@keyframes spark {
  0% { opacity: 0; transform: translate(0, 7px) scale(.8); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(4px, -28px) scale(.25); }
}

.loading-view h2 { margin-bottom: 6px; }
.loading-view > p { margin: 0; font-size: 14px; }

.loading-dots {
  display: flex;
  gap: 7px;
  margin-top: 24px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d6ddd7;
  transition: background .2s ease, transform .2s ease;
}

.loading-dots span.is-active { background: var(--green); transform: scale(1.3); }
.loading-dots span.is-done { background: #8bb69c; }

.success-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #e8f5ed;
}

.success-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--green);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-copy { margin: 9px 0 22px; font-size: 14px; }
.result-copy strong { color: var(--ink); overflow-wrap: anywhere; }

.wallet-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.wallet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.wallet-badge img {
  display: block;
  height: 50px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.wallet-badge:focus-visible,
.text-button:focus-visible,
.paste-button:focus-visible,
.primary-button:focus-visible {
  outline: 3px solid rgba(0, 102, 204, .3);
  outline-offset: 3px;
}

.device-note {
  margin: 15px 0 0;
  color: #808981;
  font-size: 12px;
}

.quiet-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  color: #a0a8a1;
}

.text-button {
  padding: 3px 0;
  border: 0;
  background: none;
  color: #55615a;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: #c2c9c3;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-button:hover { color: var(--ink); }

.error-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 15px;
  border-radius: 50%;
  background: #fff0ef;
  color: var(--error);
  font-weight: 800;
}

.error-view .eyebrow { color: var(--error); margin-bottom: 7px; }
.error-view h2 { margin-bottom: 5px; }
.error-view > p { margin: 5px 0; font-size: 14px; }
.error-hint { max-width: 420px; }

.error-request {
  margin: 10px 0 17px;
  color: #7a847d;
  font-size: 12px;
}

.error-request code { user-select: all; }
.error-view .primary-button { max-width: 280px; margin-top: 12px; }
.back-button { margin-top: 10px; }

.site-footer {
  max-width: 500px;
  margin: 18px auto 0;
  color: #7f8881;
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.site-footer p { margin: 3px 0; }
.site-footer strong { color: #59635c; font-weight: 650; }

@media (max-width: 520px) {
  .site-header,
  .page-shell { width: min(100% - 24px, 560px); }
  .site-header { padding-top: 20px; }
  .pass-card { min-height: 0; padding: 27px 22px; border-radius: 15px; }
  h1 { font-size: 30px; }
  .input-meta { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
