* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}
.wrap {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.panel { width: 100%; max-width: 420px; }
input {
  width: min(320px, 90vw);
  font-size: 16px;
  padding: 11px;
  margin: 7px;
  border: none;
  border-radius: 6px;
}
.btn {
  font-size: 18px;
  padding: 10px 16px;
  margin: 8px 0;
  background: #b28e42;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 6px;
  min-width: 170px;
}
.btn:hover { background: #5f5133; }
.btn.small { min-width: 86px; font-size: 14px; padding: 8px 10px; }
.logo-static { width: 152px; height: auto; margin: 10px auto 4px; }
.logo-button {
  cursor: pointer;
  display: block;
  margin: 22px auto;
  width: 152px;
  height: auto;
  transform-origin: center;
  animation: logoPulse 1.8s ease-in-out infinite;
  transition: transform .2s ease, filter .2s ease, opacity .2s ease;
}
.logo-button:active { transform: scale(.92); }
.disabled.logo-button, .disabled { animation: none; opacity: .45; pointer-events: none; }
@keyframes logoPulse {
  0% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 rgba(176,141,73,0)); }
  50% { transform: scale(1.12); filter: brightness(1.18) drop-shadow(0 0 14px rgba(176,141,73,.95)); }
  100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 rgba(176,141,73,0)); }
}
#app-section { width: 100%; max-width: 720px; }
.topbar {
  width: min(680px, 96vw);
  margin: 0 auto 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  gap: 10px;
}
#file-input { display: none; }
#photo-preview {
  width: min(88vw, 520px);
  height: auto;
  display: none;
  margin: 20px auto;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(255,255,255,.2);
}
.result {
  margin: 20px auto 0;
  text-align: center;
  max-width: 92vw;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.card-result {
  width: min(620px, 94vw);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px;
  background: #111;
}
/* Recognition result: NFC-style gold check + four-segment level bar. */
.recognition-indicator {
  width: min(220px, 64vw);
  margin: 2px auto 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.recognition-symbol {
  display: block;
  width: min(170px, 48vw);
  height: min(170px, 48vw);
  object-fit: contain;
}
.recognition-symbol-ok {
  border-radius: 50%;
}
.level-bar {
  width: min(200px, 58vw);
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.level-segment {
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #47391f 0%, #241b0d 100%);
  border: 1px solid rgba(176, 141, 73, .22);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .04);
  opacity: .72;
}
.level-segment.active {
  background: linear-gradient(180deg, #f2d278 0%, #b08d49 58%, #806325 100%);
  border-color: rgba(242, 210, 120, .9);
  box-shadow:
    0 0 8px rgba(176, 141, 73, .65),
    inset 0 1px 2px rgba(255, 255, 255, .42);
  opacity: 0;
  transform: scaleX(.45);
  transform-origin: left center;
  animation:
    levelSegmentOn .34s ease-out forwards,
    levelSegmentShimmer 4.8s ease-in-out infinite;
  animation-delay:
    calc(var(--segment-index) * 120ms),
    calc(2.8s + var(--segment-index) * 90ms);
}
.recognition-caption {
  margin: 5px 0 8px;
  color: #aaa;
  font-size: 12px;
  line-height: 1.2;
}
@keyframes levelSegmentOn {
  from { opacity: 0; transform: scaleX(.45); filter: brightness(.75); }
  to { opacity: 1; transform: scaleX(1); filter: brightness(1); }
}
@keyframes levelSegmentShimmer {
  0%, 82%, 100% { filter: brightness(1); }
  88% { filter: brightness(1.42); }
  94% { filter: brightness(1.08); }
}

.result-label { margin: 2px 0 8px; }

@media (prefers-reduced-motion: reduce) {
  .level-segment.active {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
.err { color: #ff5555; }
.ok { color: #8ee98e; }
.subtle { color: #aaa; font-size: 13px; }
.hidden { display: none !important; }
a { color: #b08d49; text-decoration: underline; }
a:hover { color: #d8b866; }
h2 { margin: 10px 0 4px; }
h6 { color: #aaa; margin-top: 20px; font-size: 12px; font-weight: normal; }
.action-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.action-links a { display: inline-block; color: #fff; background: #b28e42; padding: 10px 14px; border-radius: 6px; text-decoration: none; min-width: 135px; }
.action-links a:hover { background: #5f5133; color: #fff; }
.meta { font-size: 13px; color: #ccc; line-height: 1.45; }
