:root {
  --ink: #f4f1ea;
  --muted: #b9b3a6;
  --panel: rgba(12, 12, 14, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #ff7a1a;
  --ok: #4ade80;
  --warn: #facc15;
  --off: #8a8578;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* Size and position are set from script to match the camera's shape (see fitCanvas).
   Avoid 100vh: on Android Chrome it includes the area under the address bar. */
#camerafeed {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}

[hidden] { display: none !important; }

#hud {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: calc(env(safe-area-inset-left) + 10px);
  min-width: 190px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#hud .row { display: flex; justify-content: space-between; gap: 14px; }
#hud span { color: var(--muted); }
#hud b { font-weight: 600; }
#hud b.ok { color: var(--ok); }
#hud b.warn { color: var(--warn); }
#hud b.off { color: var(--off); }

#hint {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}

#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
}
#controls button { padding: 9px 12px; font-size: 13px; }

button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}
button[aria-pressed="false"] { color: var(--off); }
button:active { transform: scale(0.97); }

#start {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(120% 80% at 50% 0%, #2a1a0c 0%, #000 70%);
}
#start .card { max-width: 420px; }
#start .eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
#start h1 { margin: 0 0 12px; font-size: 30px; }
#start p, #start li { color: var(--muted); font-size: 15px; line-height: 1.5; }
#start ol { padding-left: 20px; margin: 12px 0 22px; }
#start strong { color: var(--ink); }
#btn-start {
  width: 100%;
  background: var(--accent);
  border-color: transparent;
  color: #1a0d00;
  font-size: 16px;
  min-height: 52px;
}
#btn-start:disabled { opacity: 0.6; }
#start-msg { min-height: 1.5em; margin-top: 12px; }
#start-msg.err { color: #fca5a5; }

/* Lens switcher, for phones that open on the wrong lens (e.g. the 0.6× ultra-wide). */
#btn-lens {
  position: fixed;
  right: calc(env(safe-area-inset-right) + 12px);
  top: calc(env(safe-area-inset-top) + 12px);
  z-index: 20;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: #fff;
  font: 600 13px/1 system-ui, sans-serif;
}
#btn-lens[hidden] { display: none; }

/* Scan guide: a translucent picture of the side to aim at, over the camera view while
   searching. Fades out once the can is found. */
#scan-guide {
  position: fixed;
  left: 50%;
  top: 46%;
  width: min(46vw, 34vh);
  aspect-ratio: 3 / 4;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 5;
}
#scan-guide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22% / 9%;
  opacity: 0.42;
  filter: saturate(1.15);
}
#scan-guide::after { /* corner brackets, like a viewfinder */
  content: '';
  position: absolute;
  inset: -10px;
  --c: rgba(255, 255, 255, 0.85);
  background:
    linear-gradient(var(--c) 0 0) top left / 26px 3px, linear-gradient(var(--c) 0 0) top left / 3px 26px,
    linear-gradient(var(--c) 0 0) top right / 26px 3px, linear-gradient(var(--c) 0 0) top right / 3px 26px,
    linear-gradient(var(--c) 0 0) bottom left / 26px 3px, linear-gradient(var(--c) 0 0) bottom left / 3px 26px,
    linear-gradient(var(--c) 0 0) bottom right / 26px 3px, linear-gradient(var(--c) 0 0) bottom right / 3px 26px;
  background-repeat: no-repeat;
}
#scan-guide.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: guide-breathe 2.4s ease-in-out 0.35s infinite;
}
@keyframes guide-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.035); }
}
@media (prefers-reduced-motion: reduce) { #scan-guide.show { animation: none; } }



/* ===== Red Bull Scramboo look (same palette, fonts and "sticker" style as the Scramboo game) */
@font-face { font-family: Jost; font-weight: 700; font-display: swap; src: url(fonts/jost-700.woff2) format("woff2"); }
@font-face { font-family: "Josefin Sans"; font-weight: 700; font-display: swap; src: url(fonts/josefin-sans-700.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-400.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-600.woff2) format("woff2"); }
:root {
  --rb-ink: #171717; --rb-navy: #121F45; --rb-slate: #223971; --rb-red: #CC1E4A;
  --rb-yellow: #FFC906; --rb-light: #F4F5F5; --rb-ash: #D4D6D8;
  --display: Jost, Futura, "Trebuchet MS", sans-serif;
  --btnfont: "Josefin Sans", Jost, sans-serif;
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
html, body { background: var(--rb-navy); }

#start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 0;
  overflow-y: auto;
  background: radial-gradient(120% 80% at 50% 35%, #2b4a94 0%, var(--rb-slate) 38%, var(--rb-navy) 100%);
}
#start::before { /* faint dot "paper" texture */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 6px 6px;
}
.rb-top { position: relative; width: 100%; max-width: 460px; display: flex; justify-content: flex-start; }
.rb-chip {
  display: inline-block; border-radius: 999px; padding: 4px 9px 3px; background: var(--rb-yellow); color: var(--rb-ink);
  font: 600 10px/1.25 Inter, sans-serif;
}
#start .card {
  position: relative; z-index: 1; width: 100%; max-width: 460px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 14px 0 150px;
}
.rb-bulls { width: min(330px, 78vw); height: auto; margin-top: 6px; animation: rb-pop .45s ease-out both; }
#start .rb-title {
  margin: 4px 0 0; font: 700 clamp(34px, 10vw, 52px)/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: #fff;
}
.rb-title span { color: var(--rb-yellow); }
.rb-tag {
  margin: 14px 0 0 !important; font: 700 clamp(20px, 5.8vw, 26px)/1.1 var(--display) !important;
  text-transform: uppercase; letter-spacing: .02em; color: #fff; text-wrap: balance;
}
.rb-tag span { color: var(--rb-yellow); }
.rb-steps { list-style: none; padding: 0 !important; margin: 20px 0 22px !important; width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.rb-steps li {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px;
  border: 3px solid var(--rb-ink); background: var(--rb-slate); box-shadow: 0 3px 0 var(--rb-ink);
  color: var(--rb-ash) !important; font-size: 13px !important; line-height: 1.4 !important;
}
.rb-steps b { display: block; color: #fff; font: 700 16px/1.15 var(--display); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.rb-num {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--rb-ink); background: var(--rb-yellow); color: var(--rb-ink);
  display: grid; place-items: center; font: 700 18px/1 var(--display);
}
/* chunky sticker button: ink outline, hard drop shadow that presses in */
.rb-btn, #btn-start.rb-btn {
  width: 100%; min-height: 58px; border-radius: 999px; border: 3px solid var(--rb-ink) !important;
  background: var(--rb-red) !important; color: #fff !important; box-shadow: 0 5px 0 var(--rb-ink);
  font: 700 21px/1 var(--btnfont) !important; text-transform: uppercase; letter-spacing: .06em; padding: 14px 20px 10px;
  transition: transform 75ms;
}
.rb-btn:active { transform: translateY(5px) scale(.98); box-shadow: 0 0 0 var(--rb-ink); }
.rb-btn:focus-visible { outline: 3px solid var(--rb-yellow); outline-offset: 2px; }
#start-msg { color: var(--rb-ash) !important; font-size: 13px !important; }
#start-msg.err { color: #ffb3c4 !important; }
.rb-city { /* Nairobi skyline along the bottom, as on the Scramboo landing page */
  position: fixed; left: 0; right: 0; bottom: 0; height: 130px; opacity: .6; pointer-events: none;
  background: url(bg/city.png) repeat-x center bottom / auto 100%; image-rendering: pixelated;
}
@keyframes rb-pop { 0% { transform: scale(.6); opacity: 0 } 60% { transform: scale(1.08); opacity: 1 } 100% { transform: scale(1) } }
@media (prefers-reduced-motion: reduce) { .rb-bulls { animation: none; } }

/* In-AR controls in the same sticker style */
#hint {
  background: var(--rb-slate); color: #fff; border: 2px solid var(--rb-ink); box-shadow: 0 3px 0 var(--rb-ink);
  font: 700 13px/1 var(--btnfont); text-transform: uppercase; letter-spacing: .05em; padding: 11px 16px 8px;
}
#btn-lens {
  background: var(--rb-slate) !important; color: #fff !important; border: 2px solid var(--rb-ink) !important;
  box-shadow: 0 3px 0 var(--rb-ink); font: 700 12px/1 var(--btnfont) !important; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 13px 7px !important; min-height: 0;
}
#scan-guide::after { --c: var(--rb-yellow); }
#scan-guide img { border: 3px solid var(--rb-ink); }
