:root {
  color-scheme: light;
  --ink: #233352;
  --muted: #596784;
  --lavender: #b9c6e4;
  --lavender-dark: #8799c6;
  --pink: #e9a2bd;
  --pink-soft: #f9e8ef;
  --paper: #fffefb;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
  color: var(--ink);
  background: var(--paper);
}

.shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
}

.brand-row {
  display: flex;
  min-height: 94px;
  align-items: center;
  gap: 18px;
  padding: 8px clamp(18px, 3vw, 42px);
  background-color: var(--lavender);
  background-image: radial-gradient(#8497c455 22%, transparent 24%);
  background-size: 30px 30px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--pink);
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  font-weight: 800;
  line-height: 1.08;
  text-shadow: 0 1px 2px #52658b55;
}

.connection {
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  background: #ffffffd9;
  font-size: clamp(.8rem, 1.45vw, 1rem);
  font-weight: 700;
  white-space: nowrap;
}

.connection[data-state="ok"] { color: #286b47; }
.connection[data-state="error"] { color: #9e304b; }

.lookup-card {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: clamp(16px, 3vh, 34px) clamp(18px, 5vw, 70px);
  background:
    radial-gradient(circle at 4% 8%, #f8e4eb 0, transparent 18%),
    radial-gradient(circle at 96% 92%, #e8edf9 0, transparent 20%),
    var(--paper);
  text-align: center;
}

.idle-view, .result, .terminal-setup { grid-area: 1 / 1; }

.idle-view {
  width: min(100%, 1060px);
  align-self: center;
}

.idle-view[hidden], .terminal-setup[hidden] { display: none; }

.scan-symbol {
  display: grid;
  width: clamp(94px, 15vh, 142px);
  height: clamp(94px, 15vh, 142px);
  margin: 0 auto clamp(14px, 2.5vh, 30px);
  place-items: center;
  border: 5px solid #fff;
  border-radius: 50%;
  color: var(--ink);
  background: var(--pink-soft);
  box-shadow: 0 8px 22px #7a698724;
}

.scan-symbol span {
  font-size: clamp(4.1rem, 12vh, 7rem);
  font-weight: 800;
  line-height: 1;
  transform: translateY(-5px);
}

h2 {
  margin: 0;
  font-size: clamp(2.8rem, 6.8vw, 5.6rem);
  font-weight: 850;
  line-height: 1.04;
  letter-spacing: -.045em;
}

.hint {
  margin: clamp(12px, 2.5vh, 24px) 0 0;
  color: var(--muted);
  font-size: clamp(1.65rem, 3.6vw, 2.9rem);
  font-weight: 600;
  line-height: 1.16;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .12em;
}

/* The barcode scanner writes to this focused field; customers never need to tap. */
#lookup-form { position: absolute; width: 1px; height: 1px; }
#barcode {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: .01;
  font-size: 16px;
}
#search-button { display: none; }

.result {
  display: none;
  width: min(100%, 1150px);
  min-height: 0;
  align-self: stretch;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  animation: result-in .2s ease-out;
}

.result[data-state="found"],
.result[data-state="not_found"],
.result[data-state="unavailable"],
.result[data-state="loading"] { display: flex; }

.result-icon { display: none; }
.result-copy { width: 100%; min-width: 0; }

.result-status {
  margin: 0 0 clamp(8px, 1.5vh, 18px);
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.5rem);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.result-name {
  display: -webkit-box;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: clamp(2.1rem, 5.1vw, 4.1rem);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.result-variation {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
}

.result-price {
  margin: clamp(12px, 2.6vh, 28px) 0 0;
  color: #243c72;
  font-size: clamp(5.5rem, 11vw, 10rem);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.06em;
  white-space: nowrap;
}

.result-source { display: none; }
.result[data-state="not_found"] .result-name { max-width: 1000px; }

.demo-banner {
  display: flex;
  grid-area: 2 / 1;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #6b5126;
  background: #fff0c7;
  font-size: .9rem;
}
.demo-banner[hidden] { display: none; }

.terminal-setup {
  z-index: 1;
  width: min(100%, 600px);
  padding: clamp(18px, 3vh, 32px);
  border: 2px solid #d9ddef;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 38px #50618020;
  text-align: left;
}
.terminal-setup h2 { margin-top: 6px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.terminal-setup .hint { margin-bottom: 16px; font-size: clamp(1rem, 2vw, 1.25rem); }
.terminal-setup label { display: block; margin-bottom: 7px; font-weight: 700; }
.terminal-setup input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #aeb8d3;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}
.terminal-setup button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #405a94;
  font: inherit;
  font-weight: 800;
}
.terminal-setup button:focus-visible,
.terminal-setup input:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}
.setup-status { min-height: 1.2em; margin: 10px 0 0; color: var(--muted); }
footer { display: none; }

@keyframes result-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-height: 600px) {
  .shell { height: 100vh; height: 100svh; }
  .brand-row { min-height: 70px; padding-top: 5px; padding-bottom: 5px; }
  .brand-mark { width: 60px; height: 60px; flex-basis: 60px; }
  .lookup-card { padding-top: 10px; padding-bottom: 10px; }
  .scan-symbol { width: clamp(78px, 18vh, 108px); height: clamp(78px, 18vh, 108px); margin-bottom: 12px; }
  .scan-symbol span { font-size: clamp(3.8rem, 16vh, 5.5rem); }
  h2 { font-size: clamp(2.6rem, 12vh, 5rem); }
  .hint { margin-top: 9px; font-size: clamp(1.7rem, 7vh, 2.6rem); }
  .result-status { margin-bottom: 6px; }
  .result-name { font-size: clamp(2rem, 9vh, 3.8rem); -webkit-line-clamp: 2; }
  .result-price { margin-top: 8px; font-size: clamp(5rem, 22vh, 8.5rem); }
  .result-variation { margin-top: 4px; }
  .terminal-setup { padding: 12px 18px; }
  .terminal-setup .hint { margin: 5px 0 10px; font-size: 1rem; }
  .terminal-setup input, .terminal-setup button { min-height: 42px; }
}

@media (max-width: 600px) {
  .brand-row { gap: 10px; padding-right: 12px; padding-left: 12px; }
  .brand-mark { width: 56px; height: 56px; flex-basis: 56px; }
  h1 { font-size: 1.1rem; }
  .connection { max-width: 112px; padding: 6px 8px; font-size: .7rem; white-space: normal; }
  .lookup-card { padding-right: 14px; padding-left: 14px; }
  h2 { font-size: clamp(2.5rem, 10vw, 4rem); }
  .hint { font-size: clamp(1.45rem, 5.4vw, 2.3rem); }
  .result-name { font-size: clamp(1.9rem, 7vw, 3rem); }
  .result-price { font-size: clamp(4.2rem, 16vw, 6rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Android 8.1 kiosk browser does not understand clamp() or flex gap.
   Fixed sizes below keep the G-BOT readable and override the modern rules. */
.brand-row {
  position: relative;
  min-height: 82px;
  padding: 7px 30px;
}
.brand-row > div {
  position: absolute;
  left: 50%;
  width: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.brand-mark {
  width: 68px;
  height: 68px;
  flex-basis: 68px;
}
h1 { font-size: 30px; }
.connection {
  margin-left: auto;
  padding: 8px 12px;
  font-size: 14px;
}
.lookup-card {
  padding: 18px 34px;
  background-color: #fff5e3;
  background-image: radial-gradient(circle, #e6d5b8 0, #e6d5b8 3px, transparent 4px);
  background-size: 34px 34px;
}
.scan-symbol {
  display: block;
  width: 132px;
  height: 132px;
  margin: 18px auto 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #263d70;
}
.scan-symbol svg { display: block; width: 100%; height: 100%; }
h2 { font-size: 78px; font-weight: 800; }
.hint { margin: 12px 0 0; font-size: 40px; }
.result-status { margin: 0 0 10px; font-size: 22px; }
.result-name { font-size: 58px; font-weight: 800; }
.result-variation { font-size: 24px; }
.result-price { margin: 16px 0 0; font-size: 150px; font-weight: 900; }
.demo-banner { font-size: 14px; }
.demo-banner > span:first-child { margin-right: 8px; }
.terminal-setup { padding: 24px; }
.terminal-setup h2 { font-size: 36px; }
.terminal-setup .hint { font-size: 19px; }

@media (max-height: 600px) {
  .brand-row { min-height: 68px; padding: 5px 22px; }
  .brand-mark { width: 56px; height: 56px; flex-basis: 56px; }
  h1 { font-size: 27px; }
  .lookup-card { padding: 8px 24px; }
  h2 { font-size: 70px; }
  .hint { margin-top: 8px; font-size: 36px; }
  .scan-symbol { width: 116px; height: 116px; margin-top: 10px; }
  .result-status { margin-bottom: 6px; font-size: 20px; }
  .result-name { font-size: 54px; line-height: 1.04; -webkit-line-clamp: 2; }
  .result-variation { margin-top: 4px; font-size: 20px; }
  .result-price { margin-top: 9px; font-size: 132px; }
  .terminal-setup { padding: 12px 18px; }
  .terminal-setup h2 { font-size: 30px; }
  .terminal-setup .hint { font-size: 16px; }
}

@media (max-width: 700px) {
  .brand-row { padding-right: 12px; padding-left: 12px; }
  .brand-row > div { width: 54%; }
  h1 { font-size: 21px; }
  .connection { max-width: 106px; padding: 5px 7px; font-size: 11px; white-space: normal; }
  .lookup-card { padding-right: 12px; padding-left: 12px; }
  h2 { font-size: 50px; }
  .hint { font-size: 29px; }
  .scan-symbol { width: 110px; height: 110px; }
  .result-name { font-size: 44px; }
  .result-price { font-size: 110px; }
}
@media (max-width: 420px) {
  .brand-mark { width: 48px; height: 48px; flex-basis: 48px; }
  h1 { font-size: 17px; }
  .connection { max-width: 75px; font-size: 10px; }
  h2 { font-size: 39px; }
  .hint { font-size: 23px; }
  .result-name { font-size: 34px; }
  .result-price { font-size: 86px; }
}
