:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #66737c;
  --line: #dbe2e6;
  --primary: #126b5d;
  --primary-dark: #0b4f44;
  --danger: #b42318;
  --warning: #946200;
  --success: #14723b;
  --low-bg: #fee4e2;
  --uncertain-bg: #fff4cc;
  --high-bg: #dcfce7;
  font-family: Arial, Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.screen {
  display: none;
  min-height: calc(100vh - 40px);
}

.screen.is-active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand,
.screen-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  padding-top: 18px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 24px;
}

.lead,
.hint,
.status-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.primary-action,
.secondary-action,
.mock-result-controls button,
.quality-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-action {
  margin-top: auto;
  background: var(--primary);
  color: #fff;
}

.primary-action:disabled {
  background: #b9c5ca;
  color: #f7fafb;
}

.registered-items {
  display: grid;
  gap: 10px;
}

.registered-items h2 {
  font-size: 20px;
}

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

.registered-item {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.registered-item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
}

.registered-item-name,
.registered-item-secondary {
  overflow-wrap: anywhere;
}

.registered-item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.registered-item-menu {
  position: relative;
}

.registered-item-menu summary {
  display: grid;
  width: 36px;
  height: 36px;
  cursor: pointer;
  list-style: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
}

.registered-item-menu summary::-webkit-details-marker {
  display: none;
}

.archive-menu-action {
  position: absolute;
  z-index: 2;
  top: 40px;
  right: 0;
  min-width: 130px;
  min-height: 42px;
  border: 1px solid #f5b7b1;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--danger);
  font-weight: 700;
}

.archive-feedback {
  margin: 0;
  color: var(--success);
  font-weight: 700;
}

.archive-home-action {
  width: 100%;
  margin-top: 12px;
}

.archive-dialog {
  width: min(calc(100% - 32px), 420px);
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.archive-dialog::backdrop {
  background: rgba(23, 32, 38, 0.55);
}

.archive-dialog-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.archive-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

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

.danger-action {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
}

.danger-action:disabled {
  background: #d8a8a4;
}

.registered-item-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.registered-item-secondary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.registered-item-action {
  min-height: 44px;
  white-space: nowrap;
}

.registered-item-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 340px) {
  .registered-item-top,
  .registered-item-actions {
    grid-template-columns: 1fr;
  }

  .registered-item-secondary {
    text-align: left;
  }

  .registered-item-meta {
    justify-content: space-between;
  }
}

.secondary-action {
  background: #e8eff1;
  color: var(--ink);
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 30px;
  line-height: 1;
}

.field-label {
  font-weight: 700;
}

.text-field {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 18px;
}

.photo-list {
  display: grid;
  gap: 12px;
}

.photo-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.slot-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.slot-title {
  margin: 0;
  font-weight: 700;
}

.slot-guide {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  min-width: 82px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  background: #edf2f4;
  color: var(--muted);
}

.status-pill.accepted {
  background: var(--high-bg);
  color: var(--success);
}

.status-pill.retake {
  background: var(--low-bg);
  color: var(--danger);
}

.upload-card {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px dashed #a6b3ba;
  border-radius: 8px;
  background: #fff;
  color: var(--primary-dark);
  font-weight: 700;
}

.upload-card input {
  display: none;
}

.thumb {
  width: 100%;
  max-height: 210px;
  margin-top: 10px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.quality-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.quality-actions button:first-child {
  background: var(--high-bg);
  color: var(--success);
}

.quality-actions button:last-child {
  background: var(--low-bg);
  color: var(--danger);
}

.anchor-stage {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3f5;
}

.anchor-stage img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
}

.anchor-box {
  position: absolute;
  width: 82px;
  height: 82px;
  border: 3px solid #00a86b;
  border-radius: 8px;
  background: rgba(0, 168, 107, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.success-badge {
  display: grid;
  width: 72px;
  height: 72px;
  margin-top: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--high-bg);
  color: var(--success);
  font-size: 40px;
  font-weight: 700;
}

.test-upload {
  min-height: 88px;
}

.test-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.mock-result-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mock-result-controls button:nth-child(1) {
  background: var(--high-bg);
  color: var(--success);
}

.mock-result-controls button:nth-child(2) {
  background: var(--uncertain-bg);
  color: var(--warning);
}

.mock-result-controls button:nth-child(3) {
  background: var(--low-bg);
  color: var(--danger);
}

.result-card,
.summary-outcome,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.result-card.high,
.summary-outcome.high {
  border-color: #86efac;
  background: var(--high-bg);
}

.result-card.uncertain,
.summary-outcome.uncertain {
  border-color: #facc15;
  background: var(--uncertain-bg);
}

.result-card.low,
.summary-outcome.low {
  border-color: #fca5a5;
  background: var(--low-bg);
}

.notice {
  border-color: #facc15;
  background: var(--uncertain-bg);
  color: var(--warning);
  font-weight: 700;
  line-height: 1.5;
}

.result-label {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.result-body {
  margin: 0;
  line-height: 1.5;
}

.last-seen-image-button {
  margin-top: 10px;
}

.last-seen-image {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
  border-radius: 8px;
}

@media (min-width: 520px) {
  body {
    background: #dfe7ea;
  }

  .app-shell {
    min-height: calc(100vh - 32px);
    margin-top: 16px;
    margin-bottom: 16px;
    border-radius: 8px;
  }
}

.last-seen-image[hidden] {
  display: none !important;
}
