:root {
  color-scheme: light;
  --ink: #172a2a;
  --muted: #617675;
  --line: #d9e6e2;
  --paper: #f5f8f4;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0a514e;
  --mint: #d9f3e8;
  --amber: #f4a340;
  --shadow: 0 18px 45px rgba(20, 66, 61, .1);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 90% 0%, #dcefe5 0, transparent 30%), var(--paper);
}
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(100% - 32px, 680px); margin: 0 auto; padding: 34px 0 28px; }
.app-header, .section-heading, .controls, .input-row { display: flex; align-items: center; }
.app-header { gap: 13px; margin-bottom: 25px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: #fff; background: var(--teal); font-size: 29px; box-shadow: 5px 5px 0 #b9ddd0; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 800 1.35rem Georgia, serif; letter-spacing: 0; }
h2 { margin-bottom: 0; font: 800 clamp(1.45rem, 5vw, 1.8rem) Georgia, serif; letter-spacing: 0; }
.user-badge { margin-left: auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(255,255,255,.55); font-size: .72rem; white-space: nowrap; }
.scanner-panel, .result-panel { padding: 24px; border: 1px solid rgba(217,230,226,.8); border-radius: 9px; background: var(--panel); box-shadow: var(--shadow); }
.result-panel { margin-top: 18px; }
.section-heading { justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.status-dot, .result-state { padding: 6px 9px; border-radius: 99px; color: var(--teal-dark); background: var(--mint); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.status-dot[data-state="scanning"] { color: #7b4b00; background: #fff0d5; }
.status-dot[data-state="error"] { color: #a0362a; background: #fde4df; }
.camera-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 3.5; border-radius: 6px; background: #123b3a; }
video { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 20px; color: #cde8df; text-align: center; }
.camera-placeholder p { max-width: 235px; margin: 10px 0 0; font-size: .88rem; line-height: 1.4; }
.camera-icon { color: #fff; font-size: 3rem; line-height: 1; }
.scan-guide { position: absolute; inset: 18% 6%; display: none; border: 2px solid rgba(255,255,255,.9); border-radius: 8px; box-shadow: 0 0 0 100vmax rgba(4, 39, 37, .22); }
.scan-guide span { position: absolute; top: 50%; left: 3%; width: 94%; height: 2px; background: var(--amber); box-shadow: 0 0 10px var(--amber); animation: sweep 2.2s ease-in-out infinite; }
.camera-frame.is-active .scan-guide { display: block; }
.camera-frame.is-active .camera-placeholder { display: none; }
@keyframes sweep { 0%, 100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }
.controls { gap: 10px; margin-top: 16px; }
.button { min-height: 44px; border: 0; border-radius: 5px; padding: 0 16px; font-weight: 800; transition: transform .15s ease, background .15s ease, opacity .15s ease; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .43; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover:not(:disabled) { background: var(--teal-dark); }
.button-secondary { color: var(--teal-dark); background: #e7f1ed; }
.helper-text { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.ean-output { display: flex; align-items: center; min-height: 68px; margin-bottom: 13px; padding: 0 17px; border: 1px dashed #bcd4cb; border-radius: 5px; background: #f7fbf8; }
#ean-value { color: var(--teal-dark); font: 700 clamp(1.5rem, 7vw, 2.1rem) "Courier New", monospace; letter-spacing: .08em; overflow-wrap: anywhere; }
.button-query { width: 100%; color: #fff; background: var(--teal-dark); }
.api-result { margin-top: 18px; border: 1px solid var(--line); border-radius: 5px; background: #f7fbf8; }
.api-result-heading { display: flex; justify-content: space-between; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--teal-dark); font-size: .76rem; font-weight: 800; }
.api-result-heading span:last-child { color: var(--muted); font-weight: 700; }
#api-result { overflow: auto; max-height: 260px; margin: 0; padding: 14px; color: var(--ink); font: .78rem/1.5 "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.manual-entry { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
summary { color: var(--teal-dark); cursor: pointer; font-size: .86rem; font-weight: 800; }
.manual-row { margin-top: 14px; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.input-row { gap: 8px; }
input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 0 12px; color: var(--ink); background: #fbfdfb; }
input:focus { outline: 3px solid rgba(15,118,110,.2); border-color: var(--teal); }
.app-header .user-badge { width: 116px; min-height: 30px; margin-left: auto; padding: 7px 10px; font: inherit; font-size: .72rem; text-align: center; }
.icon-button { flex: 0 0 44px; min-height: 44px; border: 0; border-radius: 5px; color: #fff; background: var(--teal); font-size: 1.3rem; }
footer { margin-top: 19px; color: var(--muted); font-size: .72rem; text-align: center; }
@media (max-width: 480px) { .shell { width: min(100% - 22px, 680px); padding-top: 22px; } .scanner-panel, .result-panel { padding: 18px; } .user-badge { display: none; } .camera-frame { aspect-ratio: 2.3; } .controls { align-items: stretch; } .controls .button { flex: 1; padding: 0 10px; } }
