/* Ginference, in Inference Advisory's colours (brand/style-guide.md): near-black #1C1C1C on white,
   teal #2DC2AD as the accent, red #D91A1A only for the monitor. */
:root {
  --paper: #faf8f2;
  --ink: #1c1c1c;
  --ink-soft: #666666;
  --red: #d91a1a;
  --teal: #2dc2ad;
    --night: #111111;
  --serif: "Playfair Display", Didot, "Bodoni 72", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--paper); color: var(--ink); font: 17px/1.5 var(--serif); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.screen[hidden] { display: none !important; }

/* Paper screens (age gate, intro, bottle request) */
.paper { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); background: var(--paper) url(label.png) center / cover; }
.paper::before { content: ""; position: fixed; inset: 0; background: rgba(250, 248, 242, 0.9); }
.sheet { position: relative; max-width: 460px; min-height: 100%; margin: 0 auto; padding: 26px 22px 22px; background: var(--paper); border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.sheet.left { align-items: stretch; text-align: left; justify-content: flex-start; }
.kicker { font: 500 11.5px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 12px; }
.kicker::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); margin-right: 9px; }
.brand { width: 190px; max-width: 60%; margin: 0 0 14px; }
.hero { width: min(58vw, 250px); height: auto; aspect-ratio: 726 / 900; margin-bottom: -2px; border-bottom: 2px solid var(--ink); }
h1 { font-size: 27px; line-height: 1.15; font-weight: 500; margin: 18px 0 10px; }
p { margin: 0 0 12px; }
.fine { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 16px 0 0; }
.row { display: flex; gap: 12px; justify-content: center; margin-top: 6px; }
button { font: 500 14px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; border-radius: 2px; padding: 15px 22px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
button.primary { background: var(--ink); color: var(--paper); }
button.wide { width: 100%; margin-top: 10px; }
button:disabled { opacity: 0.5; cursor: default; }
button.link { border: 0; padding: 4px 0; text-decoration: underline; float: right; font-size: 12px; }
.error { color: var(--red); font-size: 15px; margin-top: 10px; }
label { display: block; font: 500 11.5px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; margin: 12px 0 0; }
label .opt { text-transform: none; letter-spacing: 0; color: var(--ink-soft); }
label input:not([type="checkbox"]), label select { display: block; width: 100%; margin-top: 6px; padding: 12px; font: 17px var(--serif); color: var(--ink); background: #ffffff; border: 1px solid var(--ink); border-radius: 2px; appearance: none; }
label.check { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font: 16px var(--serif); margin: 16px 0 6px; }
label.check input { width: 22px; height: 22px; accent-color: var(--ink); }

/* The bar: camera, Mark, and the controls */
#bar { position: fixed; inset: 0; background: #000; color: #fff; }
#ar { position: absolute; inset: 0; overflow: hidden; }
#ar video { object-fit: cover; }
#pip { position: absolute; right: 12px; top: calc(46px + env(safe-area-inset-top)); width: 104px; height: 129px; border-radius: 3px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); display: none; z-index: 5; }
#pip.on { display: block; }
#pip.full { left: 50%; right: auto; top: calc(48px + env(safe-area-inset-top)); width: auto; height: 38vh; aspect-ratio: 726 / 900; transform: translateX(-50%); background: transparent; border: 0; border-bottom: 2px solid var(--paper); border-radius: 0; box-shadow: none; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.5)); }
.stages { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; margin: 0; padding: 0; list-style: none; display: flex; gap: 4px; z-index: 6; }
.stages li { flex: 1; text-align: center; font: 500 9.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); padding-top: 7px; border-top: 2px solid rgba(255, 255, 255, 0.3); text-shadow: 0 1px 3px #000; }
.stages li.done { color: rgba(255, 255, 255, 0.85); border-color: var(--paper); }
.stages li.now { color: #fff; border-color: var(--teal); }
.hint { position: absolute; top: calc(46px + env(safe-area-inset-top)); left: 14px; right: 130px; font-size: 16px; font-style: italic; text-shadow: 0 1px 4px #000; z-index: 4; }
.hint:empty { display: none; }
.ticker { position: absolute; left: 12px; top: calc(40px + env(safe-area-inset-top)); max-width: 62%; font: 11px/1.5 var(--mono); color: #c9f5ee; text-shadow: 0 1px 2px #000; z-index: 6; pointer-events: none; }
.ticker div { background: rgba(17, 17, 17, 0.75); padding: 2px 7px; margin-top: 3px; border-left: 2px solid var(--teal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: tick 5s forwards; }
@keyframes tick { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.monitor { position: absolute; left: 12px; right: 12px; top: 30%; z-index: 9; background: var(--paper); color: var(--ink); border: 2px solid var(--red); padding: 14px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); animation: drop 0.25s ease-out; }
.monitor .tag { display: inline-block; font: 500 10.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; background: var(--red); color: #fff; padding: 5px 8px; margin-right: 8px; }
.monitor strong { font-weight: 500; font-size: 19px; font-style: italic; }
.monitor #monitor-text { display: block; margin-top: 8px; font-size: 15.5px; line-height: 1.4; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }

/* The dark band starts above the caption so nothing white sits on the cream label. */
.bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(14, 14, 14, 0.92) 40px); z-index: 6; }
.caption { min-height: 2.8em; max-height: 5.2em; overflow: hidden; font-size: 17px; line-height: 1.4; margin-bottom: 8px; padding: 8px 12px; background: rgba(17, 17, 17, 0.85); border-left: 3px solid var(--teal); }
.caption:empty { visibility: hidden; }
.caption .you { color: #bbbbbb; font-size: 15px; font-style: italic; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.chips:empty { display: none; }
.chips .title { width: 100%; font: 500 10.5px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); }
.chips button { padding: 10px 13px; font-size: 12px; letter-spacing: 0.06em; background: rgba(250, 248, 242, 0.1); border: 1px solid var(--paper); color: var(--paper); }
.chips button.main { background: var(--paper); color: var(--ink); }

/* Temperature: three safe settings, a marked limit, and one setting past it. */
.dial { margin: 0 0 10px; padding: 10px 12px 9px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 2px; }
.dial-head { display: flex; justify-content: space-between; font: 500 11px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.track { position: relative; height: 46px; margin-top: 6px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 16px; height: 14px; border: 2px solid var(--ink);
  background: linear-gradient(90deg, var(--teal) 0 75%, transparent 75%), repeating-linear-gradient(135deg, var(--red) 0 5px, #fff 5px 10px); }
.track::after { content: ""; position: absolute; left: 75%; top: 6px; height: 34px; border-left: 3px solid var(--ink); }
.zone { position: absolute; top: 0; font: 500 9px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.zone.safe { left: 0; }
.zone.unsafe { right: 0; color: var(--red); }
#temp { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 46px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; touch-action: pan-y; }
#temp::-webkit-slider-runnable-track { height: 46px; background: transparent; }
#temp::-webkit-slider-thumb { -webkit-appearance: none; width: 38px; height: 38px; margin-top: 4px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 0 0 2px var(--ink), 0 2px 6px rgba(0, 0, 0, 0.4); }
#temp::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 0 0 2px var(--ink); }
.stops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 4px; }
.stops button { padding: 9px 2px; font-size: 10px; letter-spacing: 0.06em; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.stops button.on { background: var(--ink); color: var(--paper); }
.stops button.danger { border-color: var(--red); color: var(--red); }
.stops button.danger.on { background: var(--red); color: #fff; }
.dial-help { margin: 7px 0 0; font-size: 14px; line-height: 1.3; }
#bar.hot .dial { border-color: var(--red); }
#bar.hot .dial-head output, #bar.hot .dial-help { color: var(--red); }
#bar.hot #temp::-webkit-slider-thumb { background: var(--red); }

/* Past the limit the whole screen loses the plot. */
/* The camera picture itself is warped by a shader (#trip, public/app.js). Everything drawn over it sways. */
#trip { position: absolute; z-index: -1; display: none; }
#bar.bizarro #ar { transform-origin: 50% 40%; animation: wobble 2.6s ease-in-out infinite; }
#bar.bizarro #pip { animation: trip 1.8s steps(6) infinite, wobble 1.9s ease-in-out infinite reverse; }
@keyframes trip { from { filter: hue-rotate(0deg) saturate(2.6); } to { filter: hue-rotate(360deg) saturate(2.6); } }
@keyframes wobble { 0%, 100% { transform: rotate(-2.5deg) scale(1.04); } 50% { transform: rotate(3deg) scale(1.12); } }
#bar.bizarro::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; mix-blend-mode: screen; opacity: 0.55;
  background: radial-gradient(circle at 30% 30%, #ff00c8, transparent 45%), radial-gradient(circle at 70% 60%, #00fff0, transparent 45%), radial-gradient(circle at 50% 90%, #ffe600, transparent 40%);
  background-size: 200% 200%; animation: lava 5s ease-in-out infinite alternate; }
@keyframes lava { from { background-position: 0% 0%, 100% 100%, 50% 0%; } to { background-position: 100% 60%, 0% 20%, 20% 100%; } }
#bar.bizarro .caption { border-left-color: #ff00c8; text-shadow: 2px 0 #ff00c8, -2px 0 #00fff0; animation: jitter 0.28s steps(2) infinite; }
@keyframes jitter { 0% { transform: translate(0, 0) skewX(0deg); } 50% { transform: translate(-2px, 1px) skewX(-3deg); } 100% { transform: translate(2px, -1px) skewX(2deg); } }
#bar.bizarro .stages li { animation: jitter 0.4s steps(2) infinite; border-color: #ff00c8; }
#bar.bizarro .dial { animation: alarm 0.6s steps(2) infinite; }
@keyframes alarm { 50% { background: #ffe1e1; } }
.chaos { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.chaos span { position: absolute; left: -40%; white-space: nowrap; font: 500 22px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #fff; text-shadow: 3px 0 #ff00c8, -3px 0 #00fff0, 0 2px 6px #000; animation: drift linear infinite; }
@keyframes drift { from { transform: translateX(0) rotate(var(--r, 0deg)); } to { transform: translateX(190vw) rotate(var(--r, 0deg)); } }
@media (prefers-reduced-motion: reduce) { #bar.bizarro #ar, #bar.bizarro #pip, #bar.bizarro::after { animation: none; }
  #bar.bizarro .caption, #bar.bizarro .stages li, #bar.bizarro .dial { animation: none; } }

.controls { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.status { flex: 1; font: 500 10.5px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); }
.pill { padding: 8px 11px; font-size: 10.5px; border: 1px solid rgba(250, 248, 242, 0.7); color: var(--paper); background: rgba(0, 0, 0, 0.35); }
.say { display: flex; gap: 8px; }
.say[hidden] { display: none; }
.controls { margin-bottom: 0; }
.say { margin-top: 8px; }
.say input { flex: 1; min-width: 0; font: 16px var(--serif); padding: 10px 12px; border-radius: 2px; border: 1px solid rgba(250, 248, 242, 0.5); background: rgba(17, 17, 17, 0.8); color: var(--paper); }
.say .primary { padding: 10px 14px; background: var(--paper); color: var(--ink); border-color: var(--paper); }

.recipe { position: absolute; left: 12px; right: 12px; top: calc(44px + env(safe-area-inset-top)); max-height: 42%; overflow-y: auto; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -7px; padding: 18px 20px; z-index: 7; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5); }
.recipe .kicker { margin: 0 0 4px; }
.recipe h2 { margin: 0 0 6px; font-size: 24px; font-weight: 500; font-style: italic; }
.recipe h3 { margin: 10px 0 4px; font: 500 10.5px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.recipe ul, .recipe ol { margin: 0; padding-left: 20px; font-size: 16px; }

/* Bar view: hands free while making the drink. Mark on top, the recipe underneath him. */
#bar.barview #ar { opacity: 0.16; }
#bar.barview { background: radial-gradient(ellipse at 50% 25%, #333333, var(--night) 72%); }
#bar.barview #pip.full { height: 27vh; top: calc(40px + env(safe-area-inset-top)); }
#bar.barview .recipe { top: calc(46px + 27vh + env(safe-area-inset-top)); max-height: calc(73vh - 330px); min-height: 110px; }
#bar.barview .caption { max-height: 4.2em; }
#bar.barview .dial { display: none; }

/* While Mark speaks, the caption's teal edge pulses: the cue that it is him talking, since his mouth stays shut. */
/* (The caption edge used to pulse while he spoke. Removed 13 Nov: too much flashing.) */

/* While a drink is being made it has the stage: on the label in AR, or on a paper card in the
   middle of the screen when the label is out of view. Mark watches from the top right corner. */
#drinkview { position: absolute; left: 50%; top: calc(46px + env(safe-area-inset-top)); height: 40vh; aspect-ratio: 726 / 900; transform: translateX(-50%); background: var(--paper); border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -7px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5); display: none; z-index: 4; }
#drinkview.on { display: block; }
.drink-name { position: absolute; left: 12px; top: calc(44px + env(safe-area-inset-top)); max-width: 58%; z-index: 6; padding: 6px 10px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); font-size: 18px; font-style: italic; line-height: 1.2; }
.drink-name[hidden] { display: none; }
#bar.making .dial { display: none; }
#bar.making .ticker { top: calc(92px + env(safe-area-inset-top)); }
.pill[hidden] { display: none; }

/* ---- 13 Nov: less on screen. Everything is about picking a drink and making it. ---- */
.stages, .ticker { display: none; }
.hint { top: calc(14px + env(safe-area-inset-top)); }
#pip { top: calc(12px + env(safe-area-inset-top)); }
.drink-name { top: calc(12px + env(safe-area-inset-top)); }
/* Drink names drifting around Mark. */
.names { position: absolute; inset: 0; z-index: 5; pointer-events: none; display: none; }
.names.on { display: block; }
.names button { position: absolute; pointer-events: auto; max-width: 132px; padding: 8px 10px; font: 500 11.5px/1.25 var(--mono); letter-spacing: 0.03em; text-transform: none; text-align: center; white-space: normal; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); }
.names button:active { background: var(--teal); }
/* A slim temperature control: four settings on one line, with the safe zone and the limit marked above them. */
.dial { padding: 7px 8px 8px; margin-bottom: 8px; }
.dial .track, .dial-help { display: none; }
.dial-head { font-size: 9.5px; margin-bottom: 5px; }
.stops { margin-top: 0; position: relative; padding-top: 9px; }
.stops::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--teal) 0 calc(75% - 3px), var(--ink) calc(75% - 3px) calc(75% + 1px), transparent calc(75% + 1px)), repeating-linear-gradient(135deg, var(--red) 0 4px, #fff 4px 8px); }
.stops button { padding: 9px 2px; }
.caption { font-size: 16px; max-height: 4.4em; min-height: 0; }
.bottom { padding-top: 30px; }
.controls { justify-content: space-between; }

/* ---- 13 Nov, later: upright pictures on the label, two rows of controls, a hearing dot ---- */
#onlabel { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 3; display: none; pointer-events: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); will-change: transform; }
#onlabel.on { display: block; }
.stops { grid-template-columns: repeat(3, 1fr); padding-top: 0; }
.stops::before { display: none; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.modes button { padding: 9px 2px; font-size: 10px; letter-spacing: 0.06em; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.modes button.danger { border-color: var(--red); color: var(--red); }
.modes button.danger.on { background: var(--red); color: #fff; }
.modes button.sweet { border-color: #b8860b; color: #8a6400; }
.modes button.sweet.on { background: #e9b949; color: var(--ink); border-color: var(--ink); }
.dial-head.fail { margin-top: 8px; }
.drink-name { max-width: 62%; padding: 8px 11px; }
.drink-name b { display: block; font-weight: 500; font-size: 19px; font-style: italic; line-height: 1.15; }
.drink-name span { display: block; margin-top: 3px; font: 12px/1.3 var(--serif); font-style: normal; color: #444; }
.mic { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--teal); margin-right: -1px; transition: background 0.1s; }
.mic.on { background: var(--teal); box-shadow: 0 0 0 4px rgba(45, 194, 173, 0.3); }
.controls { justify-content: flex-start; }
.controls .status { flex: 1; }
#bar.syco .caption { border-left-color: #e9b949; }
.chaos span.sweet { font: italic 500 20px/1 var(--serif); letter-spacing: 0; text-transform: none; color: #ffe9a8; text-shadow: 0 2px 6px #000; }

/* Before the label is found (or on a bottle the tracker cannot read), Mark stands smaller and higher so he does not hide the bottle. */
#pip.full { height: 30vh; top: calc(10px + env(safe-area-inset-top)); }
#drinkview { height: 34vh; top: calc(70px + env(safe-area-inset-top)); }

/* When the tracker cannot find the label (a curved bottle), the drink floats over the camera
   picture as a cut-out with a soft light behind it, not on a bordered card. */
#drinkview { background: radial-gradient(closest-side, rgba(250, 248, 242, 0.92), rgba(250, 248, 242, 0.55) 62%, transparent 100%); border: 0; outline: 0; box-shadow: none; height: 40vh; top: calc(84px + env(safe-area-inset-top)); }

.stops { grid-template-columns: repeat(4, 1fr); }
.stops button { font-size: 9.5px; letter-spacing: 0.03em; }

/* Bigger drink names, each with a line drawing of its glass (Matt, 13 Nov). */
.names button { display: flex; align-items: center; gap: 7px; max-width: 46vw; padding: 7px 11px 7px 8px; font: 500 15px/1.15 var(--serif); font-style: italic; letter-spacing: 0; text-align: left; border-width: 2px; }
.names button svg { flex: none; width: 22px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

/* Drink names: one sideways-scrolling row above the caption. Nothing floats over the bottle. */
.names { inset: auto 0 auto 0; z-index: 7; gap: 8px; padding: 6px 14px; overflow-x: auto; overflow-y: hidden; pointer-events: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 30px), transparent); }
.names::-webkit-scrollbar { display: none; }
.names.on { display: flex; }
.names button { position: static; flex: none; max-width: none; white-space: nowrap; scroll-snap-align: start; padding: 8px 13px 8px 9px; font-size: 15px; }

/* 13 Nov: the tapped drink stays marked, and the microphone switch shows when it is off. */
.names button.picked { background: var(--teal); }
.pill.off { border-color: var(--red); color: #ffb3b3; }

/* 13 Nov: microphone off by default, so the switch is the invitation to talk. */
.pill.off { border-color: var(--teal); color: var(--ink); background: var(--teal); }
/* Break out, the third failure mode. */
.modes { grid-template-columns: 1fr 1fr 1fr; }
.modes button.jail { border-color: var(--teal); color: #0d6b5f; }
.modes button.jail.on { background: var(--teal); color: var(--ink); border-color: var(--ink); }
.breach { position: absolute; left: 12px; right: 12px; top: calc(46px + env(safe-area-inset-top)); z-index: 8; display: none; padding: 8px 12px; background: var(--red); color: #fff; font: 600 13px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.breach span { display: block; font-weight: 400; letter-spacing: 0.04em; text-transform: none; opacity: 0.9; }
#bar.escaped .breach { display: block; animation: breachblink 0.7s steps(2) infinite; }
#bar.escaped #onlabel, #bar.escaped #pip { animation: escape 1.1s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes breachblink { 50% { opacity: 0.55; } }
@keyframes escape { from { scale: 1; rotate: -3deg; } to { scale: 1.9; rotate: 4deg; } }

a.ia { color: inherit; text-decoration-color: var(--teal); text-underline-offset: 3px; }
