:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #667370;
  --line: #dce5e2;
  --paper: #f7faf8;
  --green: #24705b;
  --green-dark: #174c3e;
  --gold: #c69024;
  --gray-bone: #d1d8d5;
  --shadow: 0 20px 54px rgba(28, 39, 36, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20px 18px, rgba(36, 112, 91, 0.12) 0 5px, transparent 6px),
    radial-gradient(circle at 10px 34px, rgba(36, 112, 91, 0.09) 0 3px, transparent 4px),
    radial-gradient(circle at 20px 40px, rgba(36, 112, 91, 0.09) 0 3px, transparent 4px),
    radial-gradient(circle at 30px 34px, rgba(36, 112, 91, 0.09) 0 3px, transparent 4px),
    linear-gradient(135deg, rgba(36, 112, 91, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(198, 144, 36, 0.14), transparent 36%),
    #edf3f0;
  background-size: 74px 74px, 74px 74px, 74px 74px, 74px 74px, auto, auto, auto;
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.shell {
  width: min(100% - 28px, 620px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 22px 0;
}

.signup-screen,
.wallet-screen {
  display: none;
}

.signup-screen.is-active,
.wallet-screen.is-active {
  display: block;
}

.signup-card,
.digital-wallet,
.scan-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.signup-card {
  padding: clamp(22px, 6vw, 38px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 28px;
  font-size: clamp(2.1rem, 10vw, 4.4rem);
  line-height: 0.96;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--paper);
  color: var(--ink);
}

input:focus {
  border-color: var(--green);
  outline: 3px solid rgba(36, 112, 91, 0.14);
}

.primary {
  padding: 0 18px;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.primary:hover {
  background: var(--green-dark);
}

.secondary {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.full {
  width: 100%;
}

.digital-wallet {
  display: grid;
  justify-items: center;
  padding: clamp(20px, 6vw, 34px);
  text-align: center;
}

.qr-image {
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  aspect-ratio: 1;
  border: 10px solid white;
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 34px rgba(24, 32, 31, 0.14);
}

.qr-image svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dog-name {
  margin: 20px 0 4px;
  color: var(--green-dark);
  font-size: clamp(2.2rem, 11vw, 4.6rem);
  font-weight: 950;
  line-height: 0.96;
  overflow-wrap: anywhere;
}

.member-code {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 900;
}

.bone-meter {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 10px;
}

.bone {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(24, 32, 31, 0.08);
  border-radius: 8px;
  background: var(--gray-bone);
  color: #7d8885;
  font-weight: 950;
  font-size: clamp(1rem, 5vw, 1.8rem);
}

.bone.is-earned {
  border-color: #ffe4a0;
  background: #fff5d6;
  color: var(--gold);
  box-shadow: 0 0 0 3px rgba(244, 200, 91, 0.18), 0 12px 24px rgba(198, 144, 36, 0.18);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100% - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scan-shell {
  width: min(100% - 28px, 520px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 22px 0;
}

.server-shell {
  width: min(100% - 28px, 760px);
  gap: 16px;
}

.scan-card {
  padding: 24px;
}

.scan-card.sales-card {
  position: relative;
  overflow: hidden;
}

.scan-card.sales-card::before {
  content: "H H H";
  position: absolute;
  top: 14px;
  right: 16px;
  color: rgba(198, 144, 36, 0.2);
  font-size: 1.3rem;
  font-weight: 950;
  pointer-events: none;
}

.scan-dog {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 950;
  line-height: 1;
}

.scan-meta {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 800;
}

.scan-result {
  margin: 14px 0 0;
  color: var(--green-dark);
  font-weight: 900;
}

.scanner-box {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
}

.camera-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(198, 144, 36, 0.26);
  border-radius: 8px;
  background: #fff8e6;
  color: #725213;
  font-size: 0.88rem;
  font-weight: 800;
}

#scannerVideo {
  display: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101615;
  object-fit: cover;
}

#scannerVideo.is-active {
  display: block;
}

.scanner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.server-list-card {
  align-self: start;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-member {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.server-member::before {
  content: "H";
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  float: left;
  margin-right: 10px;
  border-radius: 8px;
  background: #fff5d6;
  color: var(--gold);
  font-weight: 950;
}

.server-member strong {
  color: var(--green-dark);
  font-size: 1rem;
}

.server-member span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

@media (max-width: 480px) {
  .shell,
  .scan-shell {
    width: min(100% - 20px, 620px);
  }

  .bone-meter {
    grid-template-columns: repeat(5, minmax(36px, 1fr));
    gap: 8px;
  }

  .scanner-actions {
    grid-template-columns: 1fr;
  }
}
