:root {
  color-scheme: light;
  --red: #e33b2f;
  --red-dark: #bd2b23;
  --ink: #181918;
  --muted: #686c68;
  --line: #e5e7e4;
  --page: #f3f5f2;
  --surface: #ffffff;
  --green: #15855d;
  --green-soft: #eaf7f1;
  --yellow: #f4b63d;
  --yellow-soft: #fff7df;
  --danger-soft: #fff0ee;
  --shadow: 0 10px 24px rgba(24, 25, 24, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

button,
input {
  font: inherit;
}

button,
a,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
label[for]:focus-within {
  outline: 3px solid rgba(227, 59, 47, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  border-radius: 8px;
  background: var(--red);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.25;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 66px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.live-status > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

main > section {
  padding: 24px 20px;
  border-bottom: 8px solid var(--page);
}

.claim-band {
  background: var(--ink);
  color: #fff;
}

.claim-copy .eyebrow {
  color: #f8cd73;
}

.claim-copy h1 {
  max-width: 520px;
  margin: 8px 0 10px;
  font-size: 27px;
  line-height: 1.28;
}

.claim-copy p {
  margin: 0;
  color: #c7cac7;
  font-size: 14px;
}

.claim-copy p strong {
  color: #fff;
  font-size: 20px;
}

.eyebrow {
  display: block;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-action,
.submit-button,
.secondary-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-action {
  width: 100%;
  min-height: 54px;
  margin-top: 22px;
  padding: 0 18px;
  color: #fff;
  background: var(--red);
  box-shadow: 0 8px 20px rgba(227, 59, 47, 0.28);
}

.primary-action:hover,
.submit-button:hover {
  background: var(--red-dark);
}

.primary-action svg,
.secondary-action svg {
  width: 19px;
  height: 19px;
}

.claim-result {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed #555a55;
  border-radius: 8px;
  background: #232523;
}

.claim-result > span {
  color: #aeb3ae;
  font-size: 12px;
}

.claim-result > strong {
  display: block;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
  font-size: 25px;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.secondary-action {
  flex: 1;
  color: var(--ink);
  background: #fff;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: 21px;
  line-height: 1.3;
}

.privacy-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 0 9px;
  color: var(--green);
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
}

.privacy-badge svg {
  width: 14px;
  height: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: 44px;
  margin-bottom: 18px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
}

.segmented button {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.segmented button[aria-selected="true"] {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 5px rgba(24, 25, 24, 0.1);
}

.segmented svg {
  width: 16px;
  height: 16px;
}

.code-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 750;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.input-row input {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid #cfd2ce;
  border-radius: 7px;
  background: #fff;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.input-row input:focus {
  border-color: var(--red);
}

.submit-button {
  min-width: 84px;
  padding: 0 16px;
  color: #fff;
  background: var(--red);
}

.field-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.upload-zone {
  display: grid;
  min-height: 158px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 22px;
  color: var(--ink);
  border: 1px dashed #b9bdb8;
  border-radius: 8px;
  background: var(--page);
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--red);
  background: var(--danger-soft);
}

.upload-zone svg {
  width: 30px;
  height: 30px;
  color: var(--red);
}

.upload-zone strong {
  font-size: 14px;
}

.upload-zone span {
  color: var(--muted);
  font-size: 11px;
}

.ocr-workspace {
  margin-top: 16px;
}

#imagePreview {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f7;
}

.ocr-status {
  margin: 12px 0;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

#ocrStatusText {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.candidate-list button {
  min-height: 40px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--yellow-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  cursor: pointer;
}

.candidate-list button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.compact-heading {
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid > div {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 12px 6px;
}

.stats-grid > div + div {
  border-left: 1px solid var(--line);
}

.stats-grid strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.stats-grid div:nth-child(1) strong {
  color: var(--red);
}

.stats-grid div:nth-child(2) strong {
  color: var(--green);
}

.stats-grid div:nth-child(3) strong {
  color: #aa6e00;
}

.stats-grid span {
  color: var(--muted);
  font-size: 11px;
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.activity-header h3 {
  margin: 0;
  font-size: 14px;
}

.activity-header span {
  color: var(--muted);
  font-size: 10px;
}

.activity-list {
  display: grid;
  gap: 8px;
  min-height: 70px;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.activity-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.status-chip {
  display: inline-flex;
  min-width: 54px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--red);
  border-radius: 999px;
  background: var(--danger-soft);
  font-size: 10px;
  font-weight: 800;
}

.status-chip.claimed {
  color: var(--green);
  background: var(--green-soft);
}

.empty-state {
  display: grid;
  min-height: 110px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.empty-state svg {
  width: 24px;
  height: 24px;
}

.skeleton-row {
  height: 64px;
  border-radius: 8px;
  background: #eef0ed;
  animation: pulse 1.2s ease-in-out infinite alternate;
}

footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
  background: var(--page);
  font-size: 11px;
  text-align: center;
}

footer svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: 480px;
  min-height: 46px;
  margin: auto;
  padding: 13px 16px;
  color: #fff;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  text-align: center;
  transform: translateY(130%);
  transition: transform 180ms ease;
}

.toast.visible {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@keyframes pulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

@media (min-width: 721px) {
  .app-shell {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  main > section {
    padding: 30px 36px;
  }

  .claim-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 245px;
    align-items: center;
    gap: 24px;
  }

  .primary-action {
    margin-top: 0;
  }

  .claim-result {
    grid-column: 1 / -1;
  }
}

@media (max-width: 370px) {
  .topbar,
  main > section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .privacy-badge {
    max-width: 105px;
    white-space: normal;
  }

  .claim-copy h1 {
    font-size: 23px;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 7px;
  }

  .submit-button {
    min-width: 74px;
    padding: 0 9px;
    font-size: 12px;
  }
}

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