@import url(https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Space+Grotesk:wght@500;700&display=swap);
:root {
  --bg-ink: #05262e;
  --bg-cloud: #dff0f3;
  --surface: #fbfdff;
  --text: #13313a;
  --text-soft: #4a6269;
  --stroke: #cfe2e6;
  --accent: #e85d2a;
  --accent-strong: #bc3f15;
  --success: #008867;
  --shadow: 0 26px 70px rgba(10, 31, 43, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: 'Manrope', 'Trebuchet MS', sans-serif;
  background:
    radial-gradient(circle at 15% 20%, #ffe0cc 0, transparent 30%),
    radial-gradient(circle at 90% 10%, #acdbe4 0, transparent 34%),
    linear-gradient(145deg, var(--bg-cloud), #f0f8fb 50%, #fff7ef 100%);
}

.app-shell {
  width: min(1120px, 94vw);
  margin: 2.4rem auto;
  display: grid;
  gap: 0;
}

.scanner-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

.panel {
  background: color-mix(in srgb, var(--surface) 93%, #f3fbff);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 1rem;
  box-shadow: 0 14px 36px rgba(12, 37, 46, 0.08);
  animation: reveal 500ms ease-out both;
}

.camera-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #9ec0cb;
  min-height: 330px;
  background: #0c2831;
}

#cameraVideo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  left: 0.65rem;
  top: 0.65rem;
  padding: 0.35rem 0.66rem;
  border-radius: 999px;
  background: rgba(17, 34, 39, 0.7);
  color: #e8f4f7;
  font-size: 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.camera-overlay.is-live {
  background: rgba(0, 136, 103, 0.84);
}

.camera-overlay-capture {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  z-index: 2;
}

.camera-price-overlay {
  position: absolute;
  right: 0.65rem;
  top: 0.65rem;
  z-index: 2;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: rgba(232, 93, 42, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-family: 'Space Grotesk', 'Verdana', sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  backdrop-filter: blur(2px);
  box-shadow: 0 8px 22px rgba(12, 25, 33, 0.35);
}

.camera-price-overlay.is-idle {
  background: rgba(17, 34, 39, 0.72);
}

.ai-wait-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.78rem;
  border-radius: 999px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(7, 25, 33, 0.84);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  font-weight: 700;
}

.ai-wait-inline {
  margin-top: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.72rem;
  border-radius: 999px;
  border: 1px solid #aac9d1;
  background: #eef7fa;
  color: #163640;
  font-size: 0.84rem;
  font-weight: 700;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 800ms linear infinite;
}

.ai-wait-overlay[hidden],
.ai-wait-inline[hidden] {
  display: none !important;
}

.controls {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid #aac9d1;
  background: #f5fbfd;
  color: #163640;
  border-radius: 10px;
  padding: 0.68rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.btn:hover:enabled {
  transform: translateY(-1px);
  border-color: #84aeba;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(130deg, var(--accent), #f4863f);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:enabled {
  border-color: var(--accent-strong);
  background: linear-gradient(130deg, var(--accent-strong), var(--accent));
}

.toggle {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-soft);
}

.status {
  margin: 0.7rem 0 0;
  color: #214a54;
  font-weight: 600;
}

.capture-red-btn {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: 4px solid #ffffff;
  background: radial-gradient(circle at 30% 30%, #ff7a72, #e02929 68%);
  box-shadow: 0 0 0 2px #bf1f1f, 0 6px 18px rgba(149, 13, 13, 0.45);
  cursor: pointer;
}

.capture-red-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.result-panel h2 {
  margin: 0;
  font-size: 1.2rem;
}

.result-hint {
  margin: 0.68rem 0;
  color: var(--text-soft);
}

.rate-meta {
  margin: 0 0 0.8rem;
  color: #2d545f;
  font-size: 0.93rem;
}

.annotated-wrap {
  margin: 0.9rem 0 0;
  border: 1px solid #bad4da;
  border-radius: 12px;
  background: #edf7fa;
  min-height: 130px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#annotatedFrame {
  display: block;
  width: 100%;
  height: auto;
}

.hidden-canvas {
  display: none;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .scanner-grid {
    grid-template-columns: 1fr;
  }

  .camera-wrap {
    min-height: 280px;
  }
}

