/* Direction: a roadside casse-croûte. A backlit yellow menu board, a wheeled rolling-letter sign for the news, a blue picnic table.
   Palette tokens are named after what they are. */
@font-face { font-family: Chango; src: url(fonts/chango-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; src: url(fonts/barlow-semi-condensed-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; src: url(fonts/barlow-semi-condensed-latin-600-normal.woff2) format('woff2'); font-display: swap; }
:root {
  --sauce: #3f1e0a; --sauce-2: #6a3512; --patate: #f7c325; --patate-lit: #ffdf63; --patate-dim: #e6b21c;
  --grain: #fff6dc; --bleu: #2a55c8; --bleu-nuit: #18348a; --ketchup: #b9240f; --pickle: #2c7a3e;
  --disp: Chango, 'Arial Black', sans-serif; --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif; --body: 'Barlow Semi Condensed', 'Trebuchet MS', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bleu-nuit); color: var(--sauce); font: 500 16px/1.3 var(--body); overscroll-behavior: none; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
#stagebox :focus-visible, #tabs :focus-visible { outline-color: #fff; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#app { height: 100vh; height: 100dvh; display: grid; grid-template: "stage" minmax(0, 40fr) "sign" auto "board" minmax(0, 60fr) / minmax(0, 1fr); }

/* ---------- Scene ---------- */
#stagebox { grid-area: stage; position: relative; overflow: hidden; background: #7dbdf0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; top: max(6px, env(safe-area-inset-top)); left: 0; right: 0; padding: 0 56px; text-align: center; pointer-events: none; color: #fff; }
#empireName { font: 700 15px/1.1 var(--cond); letter-spacing: .01em; text-shadow: 0 1px 0 rgba(30,14,4,.8), 0 0 6px rgba(30,14,4,.45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bank { font: 400 clamp(26px, 8vw, 40px)/1.08 var(--disp); white-space: nowrap; text-shadow: 0 2px 0 var(--sauce), 2px 3px 0 var(--sauce), -1px 2px 0 var(--sauce); }
#bank.long { font-size: clamp(17px, 5vw, 26px); line-height: 1.5; }
#rate { font: 700 16px/1.1 var(--cond); text-shadow: 0 1px 0 rgba(30,14,4,.9), 0 0 5px rgba(30,14,4,.5); }
#buffs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 3px; }
.buff { font: 700 14px/1 var(--cond); background: var(--ketchup); color: #fff; padding: 3px 7px; }
#sceneBtns { position: absolute; top: max(6px, env(safe-area-inset-top)); right: 6px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.icon { width: 40px; height: 40px; display: grid; place-items: center; background: rgba(24,52,138,.82); color: #fff; }
.icon svg { width: 22px; height: 22px; fill: currentColor; }
#btnMute .off { display: none; } #btnMute.muted .on { display: none; } #btnMute.muted .off { display: inline; }
#tray { position: absolute; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; z-index: 2; }
#goldenBtn { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; z-index: 4; animation: goldenFloat 2.6s ease-in-out infinite; filter: drop-shadow(0 0 10px #ffe680) drop-shadow(0 0 22px #ffb700); touch-action: none; }
#goldenBtn svg { width: 100%; height: 100%; display: block; }
@keyframes goldenFloat { 0%, 100% { transform: translate(-14px, 4px) rotate(-8deg) scale(1); } 50% { transform: translate(14px, -8px) rotate(8deg) scale(1.1); } }
#toasts { position: absolute; left: 8px; right: 52px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; pointer-events: none; z-index: 3; }
.toast { background: var(--grain); color: var(--sauce); font: 700 16px/1.15 var(--cond); padding: 5px 9px; border-left: 5px solid var(--ketchup); box-shadow: 2px 2px 0 var(--sauce); animation: toastIn .18s ease-out; max-width: 100%; }
.toast.stage { border-left-color: var(--bleu); }
@keyframes toastIn { from { transform: translateX(-16px); opacity: 0; } }
#rewardBtn { position: absolute; left: 8px; bottom: 8px; z-index: 3; background: var(--grain); padding: 6px 9px; font: 700 14px/1.1 var(--cond); max-width: 60%; text-align: left; box-shadow: 2px 2px 0 var(--sauce); }

/* ---------- The rolling-letter sign ---------- */
#sign { grid-area: sign; background: var(--sauce); padding: 5px 6px; }
#signPanel { background: #fdfbef; position: relative; display: flex; align-items: stretch; box-shadow: inset 0 0 0 3px var(--ketchup), inset 0 0 22px rgba(247,195,37,.35); height: 81px; background-image: repeating-linear-gradient(to bottom, transparent 0 22px, rgba(63,30,10,.11) 22px 23px); background-position: 0 3px; }
#signText { flex: 1; min-width: 0; text-align: left; padding: 6px 4px 6px 11px; display: flex; align-items: center; overflow: hidden; }
#signLine { display: block; font: 700 clamp(16.5px, 2.2vh, 19px)/23px var(--cond); color: #18120d; }
#signLine.tip { color: var(--bleu-nuit); }
#signLine.in { animation: signIn .32s cubic-bezier(.2, .8, .3, 1); }
@keyframes signIn { from { transform: translateY(100%); opacity: 0; } }
.icon-star { width: 42px; flex: none; display: grid; place-items: center; color: #b8ad90; }
.icon-star svg { width: 22px; height: 22px; fill: currentColor; }
.icon-star.on { color: var(--ketchup); }
.icon-star:disabled { visibility: hidden; }

/* ---------- The menu board ---------- */
#board { grid-area: board; min-height: 0; display: flex; flex-direction: column; background: var(--patate); }
#panes { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.pane { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 10px; overscroll-behavior: contain; }
#tabs { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bleu); padding-bottom: env(safe-area-inset-bottom); }
.tab { font: 700 15px/1 var(--cond); color: #fff; padding: 13px 2px 12px; position: relative; min-height: 46px; }
.tab[aria-selected="true"] { background: var(--patate); color: var(--sauce); }
.tab .badge { display: inline-block; min-width: 17px; padding: 2px 4px; margin-left: 3px; background: var(--ketchup); color: #fff; font: 700 12px/13px var(--cond); }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--patate-dim); }
.topbar .lbl { flex: 1; font: 600 15px/1.15 var(--body); }
.seg { display: flex; flex: none; border: 2px solid var(--sauce); }
.seg button { font: 700 15px/1 var(--cond); padding: 7px 11px; min-width: 42px; }
.seg button[aria-pressed="true"] { background: var(--sauce); color: var(--patate-lit); }

.row { display: grid; width: 100%; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 9px; align-items: center; padding: 7px 10px; text-align: left; border-bottom: 2px solid rgba(63,30,10,.2); }
.row .ic { width: 42px; height: 42px; color: var(--sauce); }
.row .ic svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.row .ic svg .a { fill: var(--ketchup); }
.row .mid { min-width: 0; }
.row .top { display: flex; align-items: baseline; gap: 5px; }
.row .nm { font: 700 18px/1.1 var(--cond); min-width: 0; }
.row .dots { flex: 1; min-width: 8px; border-bottom: 3px dotted rgba(63,30,10,.5); transform: translateY(-3px); }
.row .pr { font: 700 18px/1.1 var(--cond); color: var(--ketchup); white-space: nowrap; }
.row .de { font: 500 14px/1.2 var(--body); margin-top: 1px; color: #54300f; }
.row .eff { font: 600 14px/1.2 var(--body); color: var(--bleu-nuit); }
.row .ct { font: 400 25px/1 var(--disp); min-width: 34px; text-align: right; color: var(--sauce); }
.row.can { background: var(--patate-lit); }
.row.can:active { background: #fff0a6; }
.row.no .nm, .row.no .de, .row.no .eff, .row.no .ic, .row.no .ct { opacity: .62; }
.row.no .pr { color: #6d4a1f; }
.row.flash { animation: rowFlash .28s ease-out; }
@keyframes rowFlash { from { background: #fff; } }
.row.locked { cursor: default; grid-template-columns: 44px minmax(0, 1fr); }
.row.locked .ic { opacity: .4; }
.row.locked .nm { font-family: var(--disp); font-weight: 400; font-size: 15px; }
.bar { height: 6px; background: rgba(63,30,10,.2); margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--ketchup); width: 0; }
.bar.g i { background: var(--pickle); }

.daily { background: var(--grain); padding: 8px 10px; border-bottom: 3px solid var(--sauce); }
.daily h3 { margin: 0; font: 400 15px/1.2 var(--disp); color: var(--ketchup); }
.daily p { margin: 2px 0 0; font: 600 15px/1.2 var(--body); }
.btn { display: inline-block; font: 700 18px/1.1 var(--cond); padding: 11px 16px; min-height: 44px; background: var(--ketchup); color: #fff; box-shadow: 0 3px 0 var(--sauce); text-align: center; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sauce); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.alt { background: var(--bleu); }
.btn.ghost { background: transparent; color: var(--sauce); box-shadow: inset 0 0 0 2px var(--sauce); }
.daily .btn { margin-top: 6px; padding: 8px 12px; min-height: 40px; }

.sect { padding: 11px 10px 6px; }
.sect h3 { margin: 0 0 3px; font: 400 18px/1.2 var(--disp); color: var(--sauce); }
.sect p { margin: 3px 0 6px; font: 500 15px/1.28 var(--body); max-width: 62ch; }
.sect .big { font: 700 21px/1.15 var(--cond); color: var(--ketchup); }
.morerow { display: block; width: 100%; text-align: left; padding: 10px; border-bottom: 2px solid rgba(63,30,10,.2); min-height: 48px; }
.morerow b { font: 700 18px/1.1 var(--cond); display: block; }
.morerow span { font: 500 14px/1.2 var(--body); color: #54300f; }
.morerow:active { background: var(--patate-lit); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font: 500 15px/1.3 var(--body); margin: 0; }
.stats dt { margin: 0; } .stats dd { margin: 0; font: 700 16px/1.25 var(--cond); text-align: right; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px 8px; margin: 6px 0; }
.foot { padding: 10px; font: 500 13px/1.3 var(--body); color: #54300f; }
.foot button { text-decoration: underline; }

.trophy { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 7px; padding: 6px 10px; border-bottom: 2px solid rgba(63,30,10,.14); align-items: center; }
.trophy .nm { font: 700 16px/1.1 var(--cond); }
.trophy .de { font: 500 13px/1.15 var(--body); color: #54300f; }
.trophy svg { width: 24px; height: 24px; fill: rgba(63,30,10,.25); display: block; }
.trophy.got svg { fill: var(--ketchup); }
.trophy:not(.got) .nm { opacity: .6; }

/* ---------- Panels ---------- */
#panel { position: fixed; inset: 0; z-index: 20; background: rgba(24,14,8,.65); display: flex; align-items: center; justify-content: center; padding: 14px; }
.card { background: var(--grain); max-width: 460px; width: 100%; max-height: 92vh; max-height: 92dvh; overflow: auto; padding: 16px; box-shadow: 6px 6px 0 var(--ketchup); }
.card h2 { margin: 0 0 7px; font: 400 23px/1.15 var(--disp); color: var(--ketchup); }
#pBody p { margin: 6px 0; font: 500 16px/1.3 var(--body); }
#pBody .news-item { padding: 6px 0; border-bottom: 1px solid rgba(63,30,10,.2); font: 600 16px/1.22 var(--cond); margin: 0; }
#pBody h3 { font: 400 15px/1.2 var(--disp); margin: 12px 0 2px; color: var(--sauce-2); }
#pBody textarea { width: 100%; min-height: 110px; font: 500 13px/1.25 ui-monospace, Menlo, Consolas, monospace; padding: 7px; border: 2px solid var(--sauce); background: #fff; color: #111; word-break: break-all; resize: vertical; }
#pBtns { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
#pToast { margin: 7px 0 0; min-height: 1.2em; font: 600 15px/1.2 var(--body); color: var(--ketchup); }

/* ---------- Tray tug ---------- */
#duel { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--sauce); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.duel-side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; touch-action: none; }
#duelP1 { background: var(--bleu); } #duelP2 { background: var(--ketchup); }
#duelP2 .who, #duelP2 .tap { transform: rotate(180deg); }
.duel-side .who { font: 700 20px/1 var(--cond); } .duel-side .tap { font: 400 clamp(32px, 9vw, 60px)/1 var(--disp); }
.duel-side:active { filter: brightness(1.2); }
#duelTrack { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; flex-direction: column; }
#duelTray { position: absolute; left: 50%; top: 50%; width: min(38vw, 26vh, 220px); height: auto; margin-left: calc(min(38vw, 26vh, 220px) / -2); margin-top: calc(min(38vw, 26vh, 220px) * -.43); }
#duelMsg { position: relative; z-index: 2; max-width: 92%; background: var(--grain); padding: 8px 12px; font: 700 20px/1.2 var(--cond); text-align: center; box-shadow: 3px 3px 0 var(--sauce); }
#duelMsg:empty { display: none; }
#duelBtns .ghost { background: var(--grain); box-shadow: 0 3px 0 var(--sauce); }
#duelBtns { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; pointer-events: auto; }
#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--ketchup); color: #fff; padding: 8px 12px; font: 600 15px/1.2 var(--body); text-align: center; }

/* ---------- Landscape and desktop: the sign stays under the scene, the board stands beside it ---------- */
@media (min-aspect-ratio: 1/1) {
  #app { grid-template: "stage board" minmax(0, 1fr) "sign board" auto / minmax(0, 1fr) clamp(290px, 42vw, 540px); }
  #duel { flex-direction: row-reverse; }
  #duelP2 .who, #duelP2 .tap { transform: none; }
  #duelTray { width: min(26vw, 44vh, 240px); margin-left: calc(min(26vw, 44vh, 240px) / -2); margin-top: calc(min(26vw, 44vh, 240px) * -.43); }
}
@media (min-aspect-ratio: 1/1) and (max-height: 460px) {
  #app { grid-template: "stage board" minmax(0, 1fr) "sign sign" auto / minmax(0, 1fr) clamp(290px, 46vw, 460px); }
  #signPanel { height: 46px; background-image: repeating-linear-gradient(to bottom, transparent 0 18px, rgba(63,30,10,.11) 18px 19px); }
  #signText { padding: 2px 4px 2px 9px; }
  #signLine { font-size: 15px; line-height: 19px; }
  #sign { padding: 3px; }
  #bank { font-size: 24px; } #bank.long { font-size: 16px; } #rate { font-size: 14px; } #empireName { font-size: 13px; }
  .tab { padding: 9px 2px 8px; min-height: 36px; font-size: 14px; }
  .icon { width: 34px; height: 34px; } #sceneBtns { flex-direction: row; left: 4px; right: auto; top: 4px; gap: 4px; }
  #hud { padding: 0 8px 0 80px; text-align: left; }
  #buffs { justify-content: flex-start; }
  .row { padding: 4px 8px; }
}
@media (min-width: 900px) and (min-height: 600px) {
  #signLine { font-size: 21px; line-height: 25px; }
  #signPanel { height: 92px; background-image: repeating-linear-gradient(to bottom, transparent 0 24px, rgba(63,30,10,.11) 24px 25px); }
  #empireName { font-size: 18px; } #bank { font-size: 46px; } #bank.long { font-size: 30px; } #rate { font-size: 20px; }
  .row { padding: 9px 14px; }
  .row .nm, .row .pr { font-size: 20px; } .row .de { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  #goldenBtn, .toast, .row.flash, #signLine.in { animation: none; }
}
