@font-face { font-family: 'Fraunces'; font-weight: 400 700; font-display: swap; src: url(/fonts/fraunces.woff2) format('woff2') }
@font-face { font-family: 'Inter'; font-weight: 400 600; font-display: swap; src: url(/fonts/inter.woff2) format('woff2') }
:root { --ink: #f4f1ff; --dim: #9ea4c8; --gold: #ffd98a; --ember: #ff9d7d; --line: rgba(170,180,255,.16);
  --s0: #c98a00; --s1: #0b93b8; --s2: #8672e8; --s3: #d85f45; --crowd: #6f7fd0;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, sans-serif; --ease: cubic-bezier(.2,.8,.2,1) }
* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100%; overflow: hidden; background: #05060f; color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased }
canvas { position: fixed; inset: 0; width: 100%; height: 100% }
[hidden] { display: none !important }
small, h3 { font: 600 10.5px/1.4 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--dim) }
button, input { font: 500 14px var(--sans); color: var(--ink) }
button { min-height: 44px; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 99px; padding: 11px 22px; cursor: pointer;
  transition: background .25s, border-color .25s, box-shadow .35s var(--ease), transform .2s var(--ease) }
button:hover:not(:disabled) { background: rgba(255,255,255,.11); border-color: rgba(255,217,138,.55); transform: translateY(-1px) }
button:active:not(:disabled) { transform: scale(.97) }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px }
button:disabled { opacity: .45; cursor: default }
.primary { background: linear-gradient(135deg, #ffe7ae, #ffc46b); border-color: transparent; color: #221637; font-weight: 600; box-shadow: 0 8px 28px rgba(255,196,107,.28) }
.primary:hover:not(:disabled) { background: linear-gradient(135deg, #fff0cb, #ffd085); box-shadow: 0 10px 38px rgba(255,196,107,.5) }
.ghost { background: transparent; color: var(--dim) }

#hud { position: fixed; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; pointer-events: none }
.chip b { display: block; font: 500 30px var(--serif); color: var(--gold); font-variant-numeric: tabular-nums }
.chip.right { text-align: right }
nav { position: fixed; z-index: 3; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px }
nav button { width: 44px; height: 44px; padding: 0; font-size: 16px; background: rgba(12,14,36,.7) }
nav button.off { opacity: .4; text-decoration: line-through }

.panel { position: fixed; left: 50%; bottom: 16px; translate: -50% 0; width: min(640px, calc(100vw - 20px)); max-height: 62vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 28px 20px; border-radius: 26px; border: 1px solid transparent;
  background: linear-gradient(165deg, rgba(30,32,70,.82), rgba(11,12,32,.9)) padding-box, linear-gradient(160deg, rgba(190,200,255,.42), rgba(190,200,255,.05) 40%, rgba(255,196,140,.28)) border-box;
  backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 30px 90px rgba(0,0,0,.6);
  animation: rise .65s var(--ease) backwards; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent }
@keyframes rise { from { opacity: 0; translate: -50% 34px; scale: .97 } }
@media (min-width: 901px) { .panel { width: min(660px, 50vw) } #end { max-height: 66vh } }
/* the question scrolls inside its card; answering controls stay put */
#game:not([hidden]) { display: flex; flex-direction: column; overflow: hidden }
#game > * { flex: none } #game > #qScroll { flex: 0 1 auto; min-height: 56px; overflow-y: auto; overscroll-behavior: contain; margin: 12px 0 14px; scrollbar-width: thin }
#qScroll #qText { margin: 0 } #qScroll .clue { margin: 10px 0 0 }
#qScroll.more { -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent) }

@media (max-width: 900px) {
  .panel { bottom: calc(8px + var(--kb, 0px) + env(safe-area-inset-bottom)); max-height: calc(var(--vh, 100vh) * .68); padding: 16px 16px 14px; border-radius: 22px; backdrop-filter: blur(10px) }
  #title, #reveal, #game, #end { max-height: calc(var(--vh, 100vh) - 150px) }
  #end { max-height: calc(var(--vh, 100vh) * .72) }
  nav { flex-direction: row; top: calc(12px + env(safe-area-inset-top)); bottom: auto; right: 50%; translate: 50% 0 } nav button { width: 44px; height: 44px }
  #hud { top: calc(10px + env(safe-area-inset-top)) } .chip b { font-size: 26px }
  #qText { font-size: 17px; line-height: 1.55 } .top small { letter-spacing: .1em; white-space: nowrap } #tier { font-size: 11px }
  #form input { padding: 12px 16px } #form button { padding: 12px 18px }
  #foot { flex-wrap: nowrap } #foot button { padding: 11px 14px; font-size: 13px; white-space: nowrap } #worth { text-align: center; font-size: 11px; line-height: 1.35 }
}
@media (max-width: 360px) { #qNum { display: none } #worth { display: none } #foot { justify-content: space-between } }
/* keyboard up, or a phone on its side */
@media (max-height: 520px) { #title, #reveal, #game, #end, .panel { max-height: calc(var(--vh, 100vh) - 68px) }
  h1 { font-size: 30px; margin: 0 } .lead { font-size: 14px } #title .row, #reveal .row { position: sticky; bottom: -14px; margin-top: 8px; padding: 6px 0 }
  h2 { font-size: 22px; margin: 2px 0 4px } #rWhy { font-size: 14px } #sum { margin-top: 8px }
  #meter { margin-bottom: 8px } #game > #qScroll { margin: 6px 0; min-height: 40px } #qText { font-size: 15.5px; line-height: 1.45 } #msg { min-height: 0; margin-top: 2px }
  #form input { padding: 9px 16px } #hud small { display: none } .chip b { font-size: 20px } }
/* wide but short: score and sound move to the sides, the card takes the height */
@media (max-height: 520px) and (min-width: 600px) { .panel, #title, #reveal, #game, #end { width: calc(100vw - 150px); max-height: calc(var(--vh, 100vh) - 14px); bottom: calc(7px + var(--kb, 0px)) }
  nav { flex-direction: column; top: auto; bottom: 10px; right: 12px; translate: none } }

.center, #title { text-align: center }
h1 { font: 600 clamp(36px, 5.4vw, 58px)/1.05 var(--serif); letter-spacing: -.015em; margin: 6px 0 4px;
  background: linear-gradient(180deg, #fff 30%, #b9c4ff); -webkit-background-clip: text; background-clip: text; color: transparent }
.lead { color: var(--dim); font-size: 16px } .lead em { color: var(--gold); font-style: normal }
details { margin: 14px 0 0; text-align: left } summary { padding: 10px 0; cursor: pointer; text-align: center; color: var(--dim); font-size: 13px }
table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13.5px } td { padding: 6px 2px; border-bottom: 1px solid var(--line) } td:last-child { text-align: right; color: var(--gold); white-space: nowrap }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px }
#play { font-size: 16px; padding: 14px 46px }

#meter { position: relative; height: 6px; margin-bottom: 14px }
#zones { display: flex; gap: 3px; height: 100% } #zones span { border-radius: 9px; background: var(--c); opacity: .85 }
#needle { position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1px; border-radius: 3px; background: #fff; box-shadow: 0 0 12px #fff }
#meter i + i { display: none }
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px }
#tier { font: 600 12px var(--sans); letter-spacing: .06em; color: var(--c); font-variant-numeric: tabular-nums; text-align: right }
#qText { font: 400 clamp(17px, 1.65vw, 21px)/1.62 var(--serif); margin: 12px 0 16px; white-space: pre-line; text-wrap: pretty }
.clue { margin: 0 0 8px; padding: 9px 14px; border-radius: 12px; background: rgba(255,217,138,.09); border: 1px solid rgba(255,217,138,.28); color: var(--gold); animation: slide .45s var(--ease) }
@keyframes slide { from { opacity: 0; translate: 0 10px } }
form { display: flex; gap: 8px }
input { flex: 1; min-width: 0; font-size: 16px; padding: 13px 20px; border-radius: 99px; border: 1px solid var(--line); background: rgba(5,6,20,.65); outline: none; transition: border-color .25s, box-shadow .35s var(--ease) }
input:focus { border-color: rgba(255,217,138,.7); box-shadow: 0 0 0 4px rgba(255,217,138,.12) }
#msg { min-height: 1.6em; margin-top: 6px; text-align: center; color: var(--ember); font-size: 13.5px }
#foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap } #worth { color: var(--dim); font-size: 12.5px }
.shake { animation: shake .4s } @keyframes shake { 20%, 60% { transform: translateX(-9px) } 40%, 80% { transform: translateX(9px) } }

h2 { font: 600 clamp(26px, 3vw, 36px)/1.15 var(--serif); margin: 6px 0 8px }
#rWhy { color: #d4d7f2; font-size: 15.5px }
#sum { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px }
#sum span, .tiles div { background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 14px; padding: 7px 14px }
#sum b { color: var(--gold); margin-left: 6px }
#eScore { color: var(--dim) }
#preview { margin: 14px auto 0; width: fit-content; max-width: 100%; white-space: pre-wrap; text-align: center; font: 14px/1.75 var(--sans); background: rgba(4,5,18,.6); border: 1px dashed var(--line); border-radius: 16px; padding: 12px 22px; user-select: all }
h3 { margin: 22px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line) }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px } .tiles b { display: block; font: 500 24px var(--serif) }
.verdict { text-align: center; font: 400 19px var(--serif); margin-bottom: 12px } .verdict b { color: var(--gold); font: 600 32px var(--serif) }
h4 { font: 600 13px var(--sans); margin: 20px 0 8px }
.bins { display: flex; gap: 2px; height: 92px; border-bottom: 1px solid var(--line) }
.bins button { flex: 1; min-width: 0; display: flex; align-items: flex-end; padding: 0; border: 0; border-radius: 0; background: transparent }
.bins button:hover:not(:disabled) { background: rgba(255,255,255,.07); transform: none }
.bins i { width: 100%; border-radius: 4px 4px 0 0; background: var(--crowd) } .bins .you i { background: var(--gold); box-shadow: 0 0 12px rgba(255,217,138,.8) }
.axis { display: flex; justify-content: space-between; color: var(--dim); font-size: 11.5px; margin-top: 3px }
.track { height: 9px; border-radius: 5px; background: rgba(255,255,255,.05); overflow: hidden } .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; transform-origin: left; animation: grow .7s var(--ease) backwards }
.track .me { background: var(--gold) } .track .them { background: var(--crowd) }
@keyframes grow { from { transform: scaleX(0) } }
.hop { display: grid; grid-template-columns: 24px 1fr 68px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px } .hop b, .vs b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums }
#night .axis { margin: 2px 78px 0 34px }
.vs { display: grid; grid-template-columns: 24px 1fr 68px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px } .vs .track + .track { margin-top: 2px } .vs em { font-style: normal; color: var(--dim); margin-left: 7px }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 8px; color: var(--dim); font-size: 12px } .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px }
.ranks { list-style: none } .ranks li { display: grid; grid-template-columns: minmax(104px, 130px) 1fr 46px; gap: 10px; align-items: center; padding: 3px 0; font-size: 12.5px; color: var(--dim) } .ranks li.you { color: var(--ink); font-weight: 600 } .ranks b { text-align: right; font-weight: 500 }
.fine { text-align: center; margin-top: 12px; font-size: 12px }
.dim { color: var(--dim); font-size: 13.5px }
.item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center }
.item em { display: block; font-style: normal; color: var(--dim); font-size: 12.5px } .item b { color: var(--gold); font-weight: 600 }
.item > span:first-child { font-size: 20px }
@media (prefers-reduced-motion: reduce) { .panel, .clue, .shake { animation: none } }
