/* Be the beat. A dark courtship chamber, amber beats for him, pink for her, his brain map above.
   Serif for the title and the explanation, mono for the numbers, plain sans for the rest. */
:root { --bg:#0b0f14; --panel:#141a22; --edge:#2b3440; --ink:#f0f6fc; --dim:#a9b3be; --amber:#ffd166;
  --pink:#ff7aa8; --red:#ff7b72;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--ink); text-decoration-color: var(--amber); text-underline-offset: 3px; }

#game { height: 100vh; height: 100svh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
  max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }

.top { display: flex; align-items: center; gap: 8px; flex: none; }
.top h1 { flex: 1; margin: 0; font: italic 600 1.7rem/1 var(--serif); letter-spacing: -.005em; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  padding: 0 14px; border-radius: 8px; border: 1px solid var(--edge); background: var(--panel); color: var(--ink);
  font: 600 .95rem/1 system-ui, sans-serif; text-decoration: none; cursor: pointer; touch-action: manipulation; }
#speed { flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 3px; padding: 4px 10px; }
#speed.locked { border-color: transparent; background: none; cursor: default; padding-right: 2px; }
.speed-kicker { color: var(--dim); font: 600 .62rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
#speedValue { font: 600 .85rem/1 var(--mono); white-space: nowrap; color: var(--dim); }
#speed:not(.locked) #speedValue { color: var(--ink); }
.chip:focus-visible, #buzz:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.chip[disabled] { opacity: .45; }
.chip[hidden], [hidden] { display: none !important; }

#stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  border-radius: 6px; overflow: hidden; border: 1px solid #1c232c; background: #0f1216; }
#brainBox { position: relative; flex: 0 0 22%; min-height: 76px; overflow: hidden; background: #0b0f14;
  border-bottom: 1px solid #1c232c; transition: background .18s ease; }
#brainBox.lit { background: #1c1a14; box-shadow: inset 0 0 0 2px rgba(255,209,102,.45); }
#brain { position: absolute; left: 50%; top: 50%; pointer-events: none; filter: brightness(1.7) contrast(1.16) saturate(1.15); }
#brainBox .bv-over { display: none !important; }
#brainLabel { position: absolute; z-index: 1; left: 8px; bottom: 6px; margin: 0; padding: 2px 6px;
  border-radius: 3px; background: rgba(11,15,20,.78); color: #d6dde5; font: 600 .7rem/1.2 var(--mono); }

#meter { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px; }
#meter .heart { color: var(--pink); font-size: 1.25rem; line-height: 1; transition: transform .15s; }
#meter .heart.beat { transform: scale(1.35); }
#meter .meter-main { flex: 1; min-width: 0; }
#meter .meter-words { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 5px;
  color: var(--dim); font: 600 .78rem/1 system-ui, sans-serif; }
#meter #beatCount { color: var(--ink); white-space: nowrap; font: 700 .9rem/1 var(--mono); font-variant-numeric: tabular-nums; }
#meter .bar { position: relative; height: 10px; border-radius: 2px; background: #262c35; overflow: hidden; }
#fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--pink); transition: width .18s ease-out; }
#meter.up .bar { outline: 2px solid rgba(255,122,168,.8); outline-offset: 1px; }
#meter.down .bar { outline: 2px solid rgba(255,123,114,.8); outline-offset: 1px; }
#scene { flex: 1 1 auto; min-height: 0; width: 100%; display: block; }

/* The result sits over the brain map and the meter, which are done for the round, so the flies stay in view. */
#card { position: absolute; left: 0; right: 0; top: 0; padding: 12px 14px 12px; z-index: 2;
  background: #0d1117; border-bottom: 1px solid var(--edge); }
#card p { margin: 0 0 4px; }
#verdict { font: italic 600 1.75rem/1.1 var(--serif); margin-bottom: 6px !important; }
#verdict.yes { color: var(--pink); }
#verdict.no { color: var(--dim); }
#line1 { font-size: 1.05rem; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
#line2 { font-size: .95rem; line-height: 1.35; }
#card .dim { color: var(--dim); font-size: .92rem; line-height: 1.35; }
#card .dim.num { font: 600 .85rem/1.3 var(--mono); }
#card .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#card[hidden] { display: none; }

#laneBox { flex: none; height: 122px; border-radius: 6px; background: #10151c; border: 1px solid #1c232c; overflow: hidden; }
#lane { width: 100%; height: 100%; display: block; }
#hint { flex: none; margin: -2px 0 0; text-align: center; color: var(--ink); font-size: .92rem; line-height: 1.3; min-height: 2.6em;
  transition: opacity .4s; }
#hint.gone { opacity: 0; }
#hint.alarm { color: var(--pink); font-weight: 600; }

#buzz { flex: none; height: clamp(104px, 15svh, 142px); border-radius: 14px; border: 0; cursor: pointer;
  color: #1b1405; background: var(--amber); box-shadow: 0 6px 0 #9c6f1c; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; touch-action: manipulation;
  transition: transform .06s, box-shadow .06s; -webkit-tap-highlight-color: transparent; }
#buzz.down { transform: translateY(5px); box-shadow: 0 1px 0 #9c6f1c; }
#buzz[disabled] { cursor: default; filter: saturate(.3) brightness(.7); }
#buzzBig { font: 800 1.9rem/1 system-ui, sans-serif; letter-spacing: .01em; }
#buzzSmall { font: 600 .85rem/1 var(--mono); opacity: .7; }

/* Why? opens over the game and closes with the button, Escape, or a tap outside. */
#why { width: min(640px, calc(100vw - 24px)); max-height: calc(100svh - 32px); padding: 0; border: 1px solid var(--edge);
  border-radius: 6px; background: #f6f1e7; color: #1d1a16; overflow: auto; }
#why::backdrop { background: rgba(5,7,10,.72); }
.whyhead { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 20px; background: #f6f1e7; border-bottom: 1px solid #d8cfbf; }
.whyhead h2 { margin: 0; font: italic 600 1.35rem/1.1 var(--serif); }
.whyhead .chip { background: #1d1a16; color: #f6f1e7; border-color: #1d1a16; }
.whytext { padding: 6px 20px 20px; font: 1.05rem/1.55 var(--serif); max-width: 62ch; }
.whytext b { font-weight: 700; }
.whytext a { color: #1d1a16; text-decoration-color: #b07a12; }
.whytext .links, .whytext .credits { color: #5d564b; font: .82rem/1.5 var(--mono); }
.whytext .links a { display: inline-block; min-height: 44px; line-height: 44px; }

@media (min-width: 700px) {
  .top h1 { font-size: 2rem; }
  #laneBox { height: 132px; }
}
@media (max-height: 640px) {
  #brainBox { flex-basis: 18%; min-height: 58px; }
  #laneBox { height: 92px; }
  #hint { display: none; }
}
@media (max-width: 350px) {
  .top h1 { font-size: 1.4rem; }
  .speed-kicker { font-size: .55rem; }
  #speedValue { font-size: .74rem; }
  .top .chip:not(#speed) { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { #fill { transition: none; } }
