/* Three materials, each with one job, all taken from the original artwork:
   the table photo is the ground, green enamel (the pub sign) asks and navigates, cream paper carries anything you read or pick.
   Keep in step with ui/Theme.kt (Android) and PubStyle.swift (iOS). */
:root {
  --wood: #1C1109;
  --enamel: #14591A;
  --enamel-deep: #0D4011;
  --letter: #F1E3A0;          /* the cream lettering on the sign */
  --paper: #F3EAD3;
  --paper-edge: #D8CAA5;
  --ink: #221A10;
  --ink-soft: #6A5B45;
  --brass: #E3B04B;
  --brass-deep: #B98422;
  --red: #B5332B;             /* the star on the beer mat */
  --slate: #17241C;
  --frame: #6B4423;
  --frame-shade: #452A14;
  --serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: clamp(15px, calc(8px + 1.1vmin), 22px); }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--wood); color: var(--letter);
  font-family: var(--serif); overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--letter); outline-offset: 2px; }
svg.ic { width: 1.1em; height: 1.1em; flex: none; fill: currentColor; vertical-align: -.18em; }

#bg {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(rgba(0,0,0,.3), rgba(0,0,0,.5)), url(img/bg_pub.webp) center / cover no-repeat, var(--wood);
}
body.dim #bg { background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.62)), url(img/bg_pub.webp) center / cover no-repeat, var(--wood); }
body.dimmer #bg { background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.66)), url(img/bg_pub.webp) center / cover no-repeat, var(--wood); }

#app { position: fixed; inset: 0; z-index: 1; }
#overlay { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#overlay > * { pointer-events: auto; }

#splash {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; background: var(--wood); transition: opacity .35s;
}
#splash img { width: 10rem; height: 10rem; border-radius: 10px; }
#splash p { margin: 0; font-style: italic; font-size: 1.05rem; color: rgba(241,227,160,.75); }
#splash.gone { opacity: 0; pointer-events: none; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  padding: calc(.75rem + var(--safe-t)) calc(1rem + var(--safe-r)) calc(.75rem + var(--safe-b)) calc(1rem + var(--safe-l));
}
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

/* ---------- enamel: the sign and its buttons ---------- */
.sign, .plate {
  background: var(--enamel); color: var(--letter); border-radius: 6px;
  /* the thin cream keyline set in from the edge, as on the logo */
  box-shadow: inset 0 0 0 4px var(--enamel), inset 0 0 0 5px rgba(241,227,160,.5), 0 2px 0 rgba(0,0,0,.6), 0 8px 18px rgba(0,0,0,.35);
}
.plate {
  display: flex; align-items: center; justify-content: center; gap: .5rem; text-align: center;
  min-height: 3.1rem; padding: .6rem 1.1rem; font-weight: bold; font-size: 1.0625rem; line-height: 1.25;
  transition: transform .06s;
}
.plate.brass {
  background: var(--brass); color: var(--ink);
  box-shadow: inset 0 0 0 4px var(--brass), inset 0 0 0 5px rgba(34,26,16,.55), 0 2px 0 var(--brass-deep), 0 3px 0 rgba(0,0,0,.6), 0 8px 18px rgba(0,0,0,.35);
}
.plate.big { min-height: 4.1rem; font-size: 1.7rem; letter-spacing: .06em; }
.plate.small { min-height: 2.5rem; padding: .35rem .85rem; font-size: .9rem; }
.plate:active:not(:disabled) { transform: translateY(2px); }
.plate:disabled { opacity: .4; }

/* ---------- paper: slips and sheets ---------- */
.sheet {
  background: var(--paper); color: var(--ink); border-radius: 3px;
  box-shadow: 0 1px 0 var(--paper-edge), 0 2px 0 rgba(0,0,0,.55), 0 10px 22px rgba(0,0,0,.4);
}
.sheet h1, .sheet h2, .sheet h3 { margin: 0; color: var(--enamel-deep); }
.rule { height: 0; border: 0; border-top: 1px solid var(--ink); margin: 0; opacity: .7; }
.rule.double { border-top: 3px double var(--ink); }

/* a menu-style line: label ........ value */
.line { display: flex; align-items: baseline; gap: .4rem; }
.line .dots { flex: 1; min-width: 1rem; border-bottom: 2px dotted rgba(34,26,16,.4); transform: translateY(-.25em); }
.line .val { font-weight: bold; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- text buttons ---------- */
.link {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; padding: 0 .25rem;
  font-size: 1rem; color: var(--letter); text-decoration: underline; text-decoration-color: rgba(241,227,160,.45);
  text-underline-offset: .22em; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.link:active { color: #fff; }
.sheet .link { color: var(--enamel-deep); text-decoration-color: rgba(13,64,17,.4); text-shadow: none; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
  color: var(--letter); font-size: 1.35rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.8));
}
.iconbtn:active { color: #fff; }

.title { margin: 0; font-weight: bold; font-size: 1.9rem; line-height: 1.2; }
.row { display: flex; gap: .625rem; }
.row > * { flex: 1; }
.muted { color: rgba(241,227,160,.72); font-size: .875rem; }
.sheet .muted { color: var(--ink-soft); }

/* ---------- home ---------- */
.home { gap: 1rem; align-items: center; justify-content: flex-start; overflow-y: auto; }
.home > * { flex-shrink: 0; }
.home .hero { width: 100%; max-width: 26rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.home .logo { width: 10.5rem; height: 10.5rem; border-radius: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.5), 0 14px 26px rgba(0,0,0,.5); }
.home .play { width: 100%; }
.purse {
  display: flex; align-items: center; justify-content: center; gap: 1.1rem; min-height: 2.75rem; padding: 0 .5rem;
  font-size: 1.05rem; font-weight: bold; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.85);
}
.purse span { display: inline-flex; align-items: center; gap: .35rem; }
.purse .coin { color: var(--brass); }
.purse small { font-weight: normal; font-size: .8rem; opacity: .75; }
.who { margin-top: -.35rem; font-size: .9rem; }
.who b { text-decoration: none; }
.sound-toggle { position: absolute; top: calc(.4rem + var(--safe-t)); right: calc(.4rem + var(--safe-r)); }

/* the rounds chalkboard */
.rounds { width: 100%; max-width: 34rem; display: flex; flex-direction: column; gap: .4rem; }
.slate {
  background: var(--slate); color: #EFEBDD; border-radius: 2px; padding: .8rem .9rem .7rem;
  border: 6px solid var(--frame); border-right-color: var(--frame-shade); border-bottom-color: var(--frame-shade);
  box-shadow: 0 2px 0 rgba(0,0,0,.6), 0 10px 22px rgba(0,0,0,.4), inset 0 0 0 1px rgba(0,0,0,.5);
}
.slate header { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .45rem; }
.slate h2 { margin: 0; font-size: 1.3rem; font-style: italic; font-weight: normal; }
.slate .presets { display: flex; gap: .9rem; }
.slate .presets .link { min-height: 2rem; font-size: .85rem; color: #EFEBDD; text-shadow: none; padding: 0; }
.slate .presets .link[aria-pressed="true"] { text-decoration: none; color: var(--brass); }
.checks { display: grid; grid-template-columns: 1fr 1fr; column-gap: .9rem; }
.check {
  display: flex; align-items: center; gap: .55rem; min-height: 2.6rem; text-align: left; font-size: .95rem; line-height: 1.15;
  color: #EFEBDD; border-bottom: 1px dashed rgba(239,235,221,.16);
}
.check .box { position: relative; flex: none; width: 1.05rem; height: 1.05rem; border: 1.5px solid currentColor; border-radius: 1px; }
.check .box svg { position: absolute; left: -.08rem; bottom: .05rem; width: 1.5rem; height: 1.5rem; fill: none; stroke: var(--brass); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; display: none; }
.check[aria-checked="true"] .box svg { display: block; }
.check[aria-checked="false"] { color: rgba(239,235,221,.5); }
.check .n { margin-left: auto; font-size: .75rem; opacity: .55; font-variant-numeric: tabular-nums; }
.slate footer { margin-top: .6rem; font-size: .85rem; font-style: italic; color: rgba(239,235,221,.7); }
.foot { display: flex; justify-content: space-between; gap: 1rem; padding: 0 .2rem; }

@media (max-width: 21rem) { .check .n { display: none; } }

@media (min-aspect-ratio: 1/1) {
  .home { flex-direction: row; align-items: center; justify-content: center; gap: 2rem; }
  .home .hero { flex: .8; max-width: 22rem; }
  .home .rounds { flex: 1.2; }
  .home .logo { width: 8.5rem; height: 8.5rem; }
  .plate.big { min-height: 3.6rem; }
  .sound-toggle { right: auto; left: calc(.4rem + var(--safe-l)); }
}

/* ---------- game ---------- */
.game { gap: .6rem; }
.hud { display: flex; align-items: center; gap: .9rem; min-height: 2.75rem; text-shadow: 0 1px 2px rgba(0,0,0,.9); }
.hud .iconbtn { margin-left: -.6rem; margin-right: -.5rem; }
.hud .sp { flex: 1; }
.hud .qn { font-size: 1rem; }
.hud .qn b { font-size: 1.2rem; }
.hud .streak { font-size: 1rem; font-weight: bold; color: var(--brass); font-variant-numeric: tabular-nums; }
.hud .streak.flat { color: rgba(241,227,160,.55); font-weight: normal; }
.hud .score { text-align: right; line-height: 1; }
.hud .score small { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; margin-bottom: .2rem; }
.hud .score b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }

/* the clock drains like a pint: lager with a line of head on the leading edge */
.timer { display: flex; align-items: center; gap: .6rem; }
.timer .track { flex: 1; height: .5rem; background: rgba(0,0,0,.6); box-shadow: inset 0 1px 0 rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.08); }
.timer .fill { height: 100%; width: 100%; background: var(--brass); border-right: 3px solid #FFF6DA; }
.timer .num { min-width: 1.6rem; text-align: right; font-weight: bold; font-size: 1.25rem; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.9); }
.timer.crit .fill { background: var(--red); }
.timer.crit .num { color: #FF8F7E; }

.game-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .7rem; }
.question { flex: 1; min-height: 0; overflow: hidden; display: flex; padding: 1.1rem 1.2rem; }
.question .inner { width: 100%; max-height: 100%; overflow-y: auto; margin: auto; text-align: center; }
.question .cat {
  display: inline-block; padding-bottom: .4rem; margin-bottom: .7rem; border-bottom: 1px solid rgba(241,227,160,.45);
  font-size: .75rem; letter-spacing: .16em; text-transform: uppercase;
}
.question .cat i { font-style: normal; opacity: .65; }
.question .qtext { margin: 0; font-weight: bold; font-size: 1.6rem; line-height: 1.24; text-wrap: balance; }
.question .qtext.md { font-size: 1.4rem; }
.question .qtext.sm { font-size: 1.2rem; line-height: 1.3; }

.side { display: flex; flex-direction: column; gap: .6rem; }
.answers { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.slip {
  display: flex; align-items: stretch; min-height: 3.4rem; text-align: left; transition: transform .06s;
  background: var(--paper); color: var(--ink); border-radius: 3px;
  box-shadow: 0 1px 0 var(--paper-edge), 0 3px 0 rgba(0,0,0,.55);
}
.slip .k {
  flex: none; width: 2.7rem; display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.15rem; color: var(--enamel); border-right: 1px solid rgba(34,26,16,.28);
}
.slip .t { flex: 1; display: flex; align-items: center; padding: .5rem .8rem; font-weight: bold; font-size: 1.0625rem; line-height: 1.22; }
.slip:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--paper-edge); }
.slip.out { background: rgba(243,234,211,.22); box-shadow: none; }
.slip.out .k { color: rgba(243,234,211,.5); border-right-color: transparent; }
.slip.out .t { color: rgba(243,234,211,.55); font-weight: normal; text-decoration: line-through; }

.bomb {
  align-self: center; display: inline-flex; align-items: center; gap: .55rem; min-height: 2.9rem; padding: 0 1.1rem 0 .9rem;
  font-size: 1rem; font-weight: bold; color: var(--letter); background: rgba(12,8,4,.72); border-radius: 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(241,227,160,.3);
}
.bomb svg { font-size: 1.25rem; }
.bomb .left { font-weight: normal; opacity: .75; font-variant-numeric: tabular-nums; }
.bomb:active:not(:disabled) { background: rgba(12,8,4,.9); }
.bomb:disabled { opacity: .4; }

@media (min-aspect-ratio: 1/1) {
  .game-body { flex-direction: row; gap: .9rem; }
  .game-body .question { flex: 1; }
  .game-body .side { flex: 1.1; min-height: 0; }
  .answers { flex: 1; grid-auto-rows: 1fr; min-height: 0; }
  .bomb { align-self: flex-end; }
}
@media (min-aspect-ratio: 1/1) and (max-height: 30rem) {
  .answers { grid-template-columns: 1fr 1fr; }
  .slip .k { width: 2.2rem; }
}

/* ---------- overlays / dialogs ---------- */
.veil {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(1rem + var(--safe-t)) calc(1rem + var(--safe-r)) calc(1rem + var(--safe-b)) calc(1rem + var(--safe-l));
  background: rgba(10,6,3,.82); animation: fade .2s;
}
.veil.feedback { background: rgba(10,6,3,.95); cursor: pointer; z-index: 10; }
.feedback .stack { display: flex; flex-direction: column; align-items: center; gap: .6rem; max-height: 100%; min-height: 0; text-align: center; }
.feedback img {
  display: block; width: min(35rem, 100%); aspect-ratio: 3 / 2; max-height: 52vh; object-fit: cover; min-height: 0;
  border-radius: 4px; box-shadow: 0 10px 26px rgba(0,0,0,.7); margin-bottom: .4rem;
}
.feedback .headline { font-weight: bold; font-size: 1.7rem; }
.feedback .headline.ok { color: var(--brass); }
.feedback .ans { font-size: 1.15rem; }
.feedback .ans b { display: block; font-size: 1.4rem; margin-top: .15rem; }
.feedback .tap { margin-top: .5rem; font-size: .8rem; font-style: italic; color: rgba(241,227,160,.55); }

.dialog { width: min(27rem, 100%); max-height: 100%; display: flex; flex-direction: column; gap: .8rem; padding: 1.2rem 1.25rem 1.25rem; }
.dialog h3 { font-size: 1.5rem; }
.dialog .body { display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; font-size: .97rem; line-height: 1.42; }
.dialog .body p { margin: 0; }
.dialog ol { margin: 0; padding: 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: .65rem; }
.dialog ol li { counter-increment: n; display: flex; gap: .7rem; }
.dialog ol li::before { content: counter(n); flex: none; width: 1.1rem; font-weight: bold; font-size: 1.15rem; line-height: 1.2; color: var(--enamel); }
.dialog label { font-size: .9rem; color: var(--ink-soft); }
.dialog input {
  font: inherit; font-size: 1.35rem; font-weight: bold; padding: .25rem 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  background: none; color: var(--ink); -webkit-user-select: text; user-select: text; outline: none;
}
.dialog input:focus { border-bottom-color: var(--enamel); }
.offer { display: flex; align-items: center; gap: .6rem; }
.offer .line { flex: 1; }
.pause { width: min(22rem, 100%); display: flex; flex-direction: column; gap: .8rem; padding: 1.3rem 1.25rem; text-align: center; }
.pause .link { align-self: center; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- result / scores ---------- */
.result { align-items: center; justify-content: center; gap: 1rem; }
.result .scroll-inner { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; margin: auto; }
.tab { width: min(24rem, 100%); padding: 1.3rem 1.4rem 1.2rem; display: flex; flex-direction: column; gap: .55rem; }
.tab h1 { font-size: 1.1rem; font-weight: normal; font-style: italic; text-align: center; color: var(--ink-soft); }
.tab .big-score { text-align: center; font-size: 4.4rem; font-weight: bold; line-height: 1; font-variant-numeric: tabular-nums; color: var(--enamel-deep); }
.tab .unit { text-align: center; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); margin: -.2rem 0 .5rem; }
.tab .verdict { text-align: center; font-weight: bold; margin-top: .25rem; }
.tab .verdict.best { color: var(--red); }
.result .actions { width: min(24rem, 100%); display: flex; flex-direction: column; gap: .3rem; }
@media (min-aspect-ratio: 1/1) {
  .result .scroll-inner { flex-direction: row; justify-content: center; align-items: center; gap: 2rem; }
  .result .actions { width: min(18rem, 38%); }
}

.scores { align-items: center; gap: .6rem; }
.scores .sheet { width: min(27rem, 100%); flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem 1.3rem; overflow: hidden; }
.scores h1 { font-size: 1.6rem; }
.scores .list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; }
.scores .item .rank { width: 1.5rem; font-weight: bold; color: var(--enamel); }
.scores .item .name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .item small { font-size: .75rem; color: var(--ink-soft); white-space: nowrap; }
.scores .item .val { font-size: 1.2rem; }
.scores .item:first-child .val { color: var(--red); }
.scores .empty { font-style: italic; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .plate, .slip, #splash { transition: none; }
  .veil { animation: none; }
}
