: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; } }



/* ===== Kenyan Originals look ("Shoot Your Shot by KO"): bold colour blocks, textile
   patterns, stencil display type, round stamps and sticker shapes with black outlines. */
@font-face { font-family: "Big Shoulders Stencil Display"; font-weight: 800; font-display: swap; src: url(fonts/big-shoulders-stencil-800.woff2) format("woff2"); }
@font-face { font-family: "League Spartan"; font-weight: 700; font-display: swap; src: url(fonts/league-spartan-700.woff2) format("woff2"); }
@font-face { font-family: "Permanent Marker"; font-weight: 400; font-display: swap; src: url(fonts/permanent-marker-400.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 {
  --ko-ink: #0A0A0A; --ko-magenta: #F23C86; --ko-magenta-d: #D9286F; --ko-purple: #7547C4;
  --ko-teal: #23B5B0; --ko-yellow: #F9D50A; --ko-lime: #8AB82A; --ko-orange: #F08A1E; --ko-red: #E0246F;
  --ko-display: "Big Shoulders Stencil Display", Impact, "Arial Narrow", sans-serif;
  --ko-label: "League Spartan", "Arial Black", sans-serif;
  --ko-hand: "Permanent Marker", cursive;
  --ko-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Cg fill='none' stroke='%23D9286F' stroke-width='2.2'%3E%3Cpath d='M0 24a24 24 0 0 1 48 0M8 24a16 16 0 0 1 32 0M16 24a8 8 0 0 1 16 0M-24 12a24 24 0 0 1 48 0M-16 12a16 16 0 0 1 32 0M-8 12a8 8 0 0 1 16 0M24 12a24 24 0 0 1 48 0M32 12a16 16 0 0 1 32 0M40 12a8 8 0 0 1 16 0'/%3E%3C/g%3E%3C/svg%3E");
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
html, body { background: var(--ko-ink); }

#start {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 24px; overflow-y: auto;
  background: var(--ko-magenta) var(--ko-pattern); background-size: 48px 24px;
}
.ko-top { width: 100%; max-width: 460px; display: flex; flex-wrap: wrap; gap: 6px; }
.ko-chip { display: inline-block; border-radius: 999px; padding: 4px 9px 3px; background: var(--ko-yellow); color: var(--ko-ink); font: 600 10px/1.25 Inter, sans-serif; border: 2px solid var(--ko-ink); }
.ko-chip-dark { background: var(--ko-ink); color: #fff; }
#start .card { position: relative; width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 10px 0 0; }

.ko-hero { position: relative; display: grid; grid-template-columns: 44% 1fr; align-items: center; gap: 4px; margin-top: 8px; min-height: 250px; }
.ko-can { position: relative; transform: rotate(-7deg); justify-self: center; width: min(138px, 35vw); }
.ko-can img { display: block; width: 100%; height: auto; filter: drop-shadow(6px 7px 0 var(--ko-ink)); animation: ko-pop .45s ease-out both; }
.ko-flavour {
  position: absolute; left: -14px; bottom: 26px; transform: rotate(-4deg);
  background: var(--ko-teal); color: #fff; border: 3px solid var(--ko-ink); box-shadow: 3px 3px 0 var(--ko-ink);
  font: 700 12px/1 var(--ko-label); letter-spacing: .06em; text-transform: uppercase; padding: 7px 9px 4px; border-radius: 6px; white-space: nowrap;
}
.ko-headline { position: relative; z-index: 2; }
#start .ko-title {
  margin: 0; color: #fff; font: 800 clamp(58px, 17vw, 84px)/.84 var(--ko-display); text-transform: uppercase; letter-spacing: .01em;
  text-shadow: 4px 4px 0 var(--ko-ink), 4px 0 0 var(--ko-ink), 0 4px 0 var(--ko-ink);
}
#start .ko-by { margin: 6px 0 0 4px; color: var(--ko-yellow); font: 400 30px/1 var(--ko-hand); transform: rotate(-6deg); text-shadow: 2px 2px 0 var(--ko-ink); }
.ko-stamp { position: absolute; width: 86px; height: 86px; filter: drop-shadow(3px 4px 0 rgba(10,10,10,.85)); }
.ko-stamp-kenya { left: -6px; top: -4px; transform: rotate(-12deg); width: 80px; height: 80px; animation: ko-pop .5s .15s ease-out both; z-index: 3; }
.ko-stamp-fruit { left: calc(44% - 50px); top: 52%; transform: rotate(10deg); width: 66px; height: 66px; animation: ko-pop .5s .25s ease-out both; z-index: 3; }
#start .ko-strip {
  margin: 18px 0 0 !important; align-self: flex-start; background: var(--ko-ink); color: #fff !important; padding: 9px 12px 6px; transform: rotate(-1.5deg);
  font: 700 13px/1.1 var(--ko-label) !important; letter-spacing: .06em; text-transform: uppercase;
}
.ko-steps { list-style: none; padding: 0 !important; margin: 18px 0 20px !important; display: flex; flex-direction: column; gap: 10px; }
.ko-steps li {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px;
  border: 3px solid var(--ko-ink); box-shadow: 4px 4px 0 var(--ko-ink); font-size: 13px !important; line-height: 1.4 !important;
}
.ko-steps b { display: block; font: 800 22px/1 var(--ko-display); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 3px; }
.ko-teal { background: var(--ko-teal); color: #fff !important; }
.ko-purple { background: var(--ko-purple); color: #fff !important; }
.ko-yellow { background: var(--ko-yellow); color: var(--ko-ink) !important; }
.ko-num { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ko-ink); color: var(--ko-yellow); display: grid; place-items: center; font: 800 22px/1 var(--ko-display); }
.ko-btn, #btn-start.ko-btn {
  min-height: 56px; border-radius: 999px; border: 3px solid var(--ko-ink) !important; background: var(--ko-yellow) !important; color: var(--ko-ink) !important;
  box-shadow: 0 5px 0 var(--ko-ink); font: 800 28px/1 var(--ko-display) !important; text-transform: uppercase; letter-spacing: .05em; padding: 12px 22px 10px; transition: transform 75ms;
}
.ko-btn:active { transform: translateY(5px) scale(.98); box-shadow: 0 0 0 var(--ko-ink); }
.ko-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ko-btn:disabled { opacity: .5; }
#btn-start.ko-play { width: 100%; font-size: 32px !important; }
#start-msg { color: #fff !important; font-size: 13px !important; text-shadow: 1px 1px 0 var(--ko-ink); }
#start-msg.err { color: #fff !important; background: var(--ko-ink); padding: 6px 8px; border-radius: 8px; }
@keyframes ko-pop { 0% { scale: .6; opacity: 0 } 60% { scale: 1.08; opacity: 1 } 100% { scale: 1 } }
@media (prefers-reduced-motion: reduce) { .ko-can img, .ko-stamp { animation: none; } }

/* 18+ gate */
#age-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: var(--ko-purple) var(--ko-pattern); background-size: 48px 24px; }
#age-gate { --ko-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Cg fill='none' stroke='%23643AB0' stroke-width='2.2'%3E%3Cpath d='M0 24a24 24 0 0 1 48 0M8 24a16 16 0 0 1 32 0M16 24a8 8 0 0 1 16 0M-24 12a24 24 0 0 1 48 0M-16 12a16 16 0 0 1 32 0M-8 12a8 8 0 0 1 16 0M24 12a24 24 0 0 1 48 0M32 12a16 16 0 0 1 32 0M40 12a8 8 0 0 1 16 0'/%3E%3C/g%3E%3C/svg%3E"); }
.ko-age-card { width: 100%; max-width: 380px; background: var(--ko-ink); color: #fff; border-radius: 22px; padding: 24px 20px 20px; box-shadow: 7px 8px 0 rgba(10,10,10,.6); text-align: center; }
.ko-age-kicker { margin: 0; color: var(--ko-teal); font: 700 12px/1 var(--ko-label); letter-spacing: .1em; text-transform: uppercase; }
.ko-age-card h2 { margin: 10px 0 8px; color: var(--ko-yellow); font: 800 56px/.9 var(--ko-display); text-transform: uppercase; }
.ko-age-copy { margin: 0 0 18px; color: #ddd; font-size: 14px; line-height: 1.45; }
.ko-age-btns { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.ko-btn-ghost { background: transparent !important; color: #fff !important; border-color: #fff !important; box-shadow: 0 5px 0 #444; }
#age-msg { min-height: 1.4em; margin: 12px 0 0; color: var(--ko-magenta); font-size: 13px; }

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