/* 生气的大叔 · 酒桌小游戏。纯前端，无请求。版式参照用户录屏。 */
@font-face { font-family: 'UncleFredoka'; src: url('/fonts/fredoka-bold-latin.woff') format('woff'); font-weight: 700; font-display: swap; unicode-range: U+0020-007E, U+2026, U+2014, U+2019, U+201C, U+201D; }
html, body { margin: 0; height: 100%; background: #262626; overscroll-behavior: none; }
.u {
  --vh: 1vh;
  --W: min(100vw, 520px, calc(var(--vh) * 62));
  --ink: #17110b;
  --wood-text: #fff;
  position: fixed; inset: 0; overflow: hidden;
  background: #8a4f24 url('/img/uncle/wood.jpg') center / cover;
  font-family: 'UncleFredoka', ui-rounded, 'Nunito', 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', 'Noto Sans Thai', 'Microsoft YaHei', sans-serif;
  font-weight: 700; color: #fff; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; -webkit-touch-callout: none;
}
@supports (height: 1dvh) { .u { --vh: 1dvh; } }
.u * { box-sizing: border-box; }
:where(.u) button { font: inherit; color: inherit; cursor: pointer; padding: 0; border: 0; background: none; touch-action: manipulation; }
.u img { -webkit-user-drag: none; pointer-events: none; }
.u[data-lang="th"] { font-family: 'UncleFredoka', 'Noto Sans Thai', 'Sarabun', ui-rounded, system-ui, -apple-system, sans-serif; }

/* dark face bands */
.u-band { position: absolute; left: 0; right: 0; z-index: 2; background: #262626 url('/img/uncle/band.png') center / auto 100% repeat-x; pointer-events: none; }
.u-band-top { top: 0; height: calc(var(--vh) * 9.6); border-bottom: 2px solid #111; }
.u-band-bot { bottom: 0; height: calc(var(--vh) * 9.7); border-top: 2px solid #111; }
.u-col { position: absolute; top: 0; bottom: 0; left: 50%; width: var(--W); transform: translateX(-50%); z-index: 3; }
.u.is-shake .u-col { animation: u-shake .42s linear; }
@keyframes u-shake { 0%,100% { transform: translateX(-50%); } 12% { transform: translate(calc(-50% - 7px), 3px); } 28% { transform: translate(calc(-50% + 8px), -3px); } 44% { transform: translate(calc(-50% - 6px), 2px); } 60% { transform: translate(calc(-50% + 5px), -2px); } 80% { transform: translate(calc(-50% - 2px), 1px); } }

/* round icon buttons sitting in the bands */
.u-ib { position: absolute; z-index: 40; top: calc(var(--vh) * 4.8 - 18px); width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.62); border: 2px solid rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; }
.u-ib:active { background: rgba(255,255,255,.28); }
.u-ib svg { width: 20px; height: 20px; }
.u-back { left: max(10px, calc(50% - var(--W) / 2 + 10px)); }
.u-mute { right: max(10px, calc(50% - var(--W) / 2 + 10px)); }
.u-share {
  width: auto; height: 32px; padding: 0 8px 0 6px; border-radius: 999px; gap: 3px;
  right: max(54px, calc(50% - var(--W) / 2 + 54px));
  color: #e4c37a; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.u-share svg { width: 16px; height: 16px; stroke: currentColor; }
.u-share-lab { line-height: 1; }
.u-mute .off { display: none; }
.u.is-muted .u-mute .on { display: none; }
.u.is-muted .u-mute .off { display: block; }

/* wooden sign */
.u-sign { position: absolute; z-index: 30; left: 0; right: 0; top: calc(var(--vh) * 9.8); height: calc(var(--vh) * 6.7); min-height: 40px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#b87440 0, #a4622f 12%, #94562a 80%, #5e3115 100%); border-top: 2px solid #d49a64; border-bottom: 4px solid #3f200c; box-shadow: 0 5px 8px rgba(0,0,0,.45); padding: 0 8px; }
.u-sign::before { content: ''; position: absolute; inset: 0; background: url('/img/uncle/wood.jpg') center / cover; opacity: .28; mix-blend-mode: multiply; pointer-events: none; }
.u-sign-t { position: relative; max-width: 100%; white-space: nowrap; color: #fff; text-shadow: 0 2px 0 rgba(60,25,5,.9), 0 0 6px rgba(60,25,5,.6); letter-spacing: .02em; line-height: 1.1; text-align: center; }
.u-sweat { position: absolute; right: 6px; top: -6px; height: calc(100% + 14px); width: auto; display: none; transform-origin: 50% 90%; }
.u.is-nervous .u-sweat { display: block; animation: u-nerv .22s linear infinite alternate; }
@keyframes u-nerv { from { transform: rotate(-5deg) translateY(0); } to { transform: rotate(5deg) translateY(2px); } }

/* title screen: one fixed composition (465 x 702 units, the proportions of the reference title screen), scaled uniformly by --k */
.u-title { position: absolute; left: 0; right: 0; top: calc(var(--vh) * 9.6); bottom: calc(var(--vh) * 9.7); display: none; }
.u[data-screen="title"] .u-title { display: block; }
.u[data-screen="game"] .u-game { display: block; }
.u-game { position: absolute; inset: 0; display: none; }
.u-tstage { position: absolute; left: 50%; top: 48%; width: 465px; height: 702px; transform: translate(-50%, -50%) scale(var(--k, .8)); transform-origin: 50% 50%; }
.u-tstage > * { position: absolute; }
.u-lidbox { left: 48px; top: 0; width: 370px; height: 362px; }
.u-lidbox::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -22px; height: 24px; background: #f4f4f4; border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 5px 5px; z-index: -1; }
.u-lid {
  position: absolute; inset: 0; border: 4px solid var(--ink); border-radius: 14px; overflow: hidden; background: #e8dfd0;
  background-image: linear-gradient(#e8dfd0 0 14.4%, var(--ink) 14.4% 15.6%, #f4f4f4 15.6% 21.2%, var(--ink) 21.2% 22.4%, #523142 22.4% 74%, var(--ink) 74% 75.2%, #f4f4f4 75.2% 81.4%, var(--ink) 81.4% 82.6%, #e8dfd0 82.6% 100%);
  display: flex; align-items: center; justify-content: center;
}
.u-lid img { width: 84%; height: auto; border-radius: 1px; }
.u-nums, .u-modes { display: flex; align-items: stretch; background: #2a2a2a; border: 4px solid var(--ink); border-radius: 20px; padding: 3px; }
.u-nums { left: 24px; top: 387px; width: 417px; height: 77px; }
.u-nums-l { flex: 0 0 22%; display: flex; align-items: center; justify-content: center; font-size: 29px; color: #fff; }
.u-nums button { flex: 1; margin-left: 2px; background: #6b6b6b; color: #111; font-size: 30px; }
.u-nums button:nth-child(2) { border-radius: 8px 0 0 8px; }
.u-nums button:last-child { border-radius: 0 14px 14px 0; }
.u-nums button.is-on, .u-modes button.is-on { background: #ffff00; }
.u-modes { left: 108px; top: 475px; width: 249px; height: 80px; }
.u-modes button { flex: 1; background: #6b6b6b; display: flex; align-items: center; justify-content: center; position: relative; }
.u-modes button:first-child { border-radius: 12px 0 0 12px; }
.u-modes button:last-child { border-radius: 0 14px 14px 0; margin-left: 2px; }
.u-modes img { height: 76%; width: auto; max-width: 90%; object-fit: contain; }
.u-modes .trio { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 0 6px; }
.u-modes .trio img { height: 62%; margin-left: -10px; }
.u-modes .trio img:first-child { margin-left: 0; }
.u-modes button:not(.is-on) img { filter: grayscale(.55) brightness(.8); }
.u-plank { left: 132px; width: 200px; height: 66px; display: flex; align-items: center; justify-content: center; font-size: 36px;
  color: #fff; letter-spacing: .03em; text-shadow: 0 2px 0 rgba(50,20,4,.95);
  background: linear-gradient(#a25f2c, #8a4d21 55%, #7b4219); border-top: 3px solid #c78a55; border-bottom: 4px solid #3c1d09; border-left: 2px solid #b9764a; border-right: 2px solid #3c1d09; box-shadow: 0 4px 5px rgba(0,0,0,.4); }
.u-plank:active { transform: translateY(2px); box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.u-plank[data-a="start"] { top: 567px; }
.u-plank[data-a="setting"] { top: 639px; height: 63px; }
.u-help { left: 358px; top: 565px; width: 58px; height: 58px; border-radius: 50%; border: 4px solid rgba(255,255,255,.9); color: rgba(255,255,255,.95); font-size: 38px; display: flex; align-items: center; justify-content: center; }
.u-bubble { left: 338px; top: 630px; width: 94px; padding: 8px 8px 9px; border-radius: 14px; background: #fff; color: #333; font-size: 13px; font-weight: 600; line-height: 1.22; text-align: center; }
.u-bubble::before { content: ''; position: absolute; left: -9px; bottom: 14px; border: 8px solid transparent; border-right-color: #fff; border-left: 0; }

/* game: tray + lid */
.u-stage { position: absolute; z-index: 20; left: 0; right: 0; top: calc(var(--vh) * 22.5); height: calc(var(--vh) * 54); display: flex; align-items: center; justify-content: center; }
.u-box { position: relative; width: calc(var(--W) * .987); height: min(calc(var(--W) * .987 * 1.17), calc(var(--vh) * 52.4)); }
.u-tray { position: absolute; inset: 0; background: #fff; border: 3px solid var(--ink); border-radius: 6px; }
.u-tray svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.u-grid { position: absolute; inset: 0; display: grid; z-index: 2; transition: opacity .15s; }
.u-face { position: relative; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.u-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(0,0,0,.18)); }
.u-face.is-gone { visibility: hidden; pointer-events: none; }
.u-face.is-fly { pointer-events: none; z-index: 5; }
.u-face.is-mark::after { content: ''; position: absolute; inset: 6%; border: 4px solid #e8222a; border-radius: 45%; animation: u-mark .5s ease-in-out infinite alternate; }
@keyframes u-mark { from { opacity: .35; transform: scale(.96); } to { opacity: 1; transform: scale(1.04); } }
.u-lidg { position: absolute; inset: 0; z-index: 12; transition: transform .52s cubic-bezier(.55,.05,.85,.45), opacity .2s linear .4s; }
.u-lidg .u-lid { transition: filter .08s; }
.u-lidg:active .u-lid { filter: brightness(.82); }
.u-lidg.is-open { transform: translateY(-120%); opacity: 0; pointer-events: none; }
.u-lidg.is-off { display: none; }
.u-angry { position: absolute; z-index: 6; left: 50%; top: 50%; width: 100%; height: 103%; margin: 0; pointer-events: none; display: none; transform: translate(-50%, -48.5%); }
.u-angry.is-on { display: block; }
.u-angry-in { position: absolute; inset: 0; transform-origin: 50% 55%; animation: u-pop .32s cubic-bezier(.2,.9,.3,1.25) both, u-rage .3s .32s steps(2, jump-none) infinite; }
.u-angry img { width: 100%; height: 100%; object-fit: contain; }
@keyframes u-pop { from { transform: translate(var(--ox,0), var(--oy,0)) scale(.12); } to { transform: translate(0,0) scale(1); } }
@keyframes u-rage { 0% { transform: scale(1.0) rotate(-1.4deg); } 100% { transform: scale(1.035) rotate(1.4deg); } }
.u-banner { position: absolute; z-index: 9; left: 50%; bottom: -1.5%; transform: translateX(-50%) rotate(-3deg) scale(0); transform-origin: 50% 50%; width: 92%; padding: 6px 10px 7px; text-align: center; background: linear-gradient(#e0262c, #b3141a); border: 3px solid #fff; border-radius: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.45), 0 0 0 3px var(--ink); display: none; }
.u-banner.is-on { display: block; animation: u-ban .4s .3s cubic-bezier(.2,.9,.3,1.3) forwards; }
@keyframes u-ban { to { transform: translateX(-50%) rotate(-3deg) scale(1); } }
.u-banner b { display: block; font-size: clamp(20px, calc(var(--W) * .075), 34px); line-height: 1.15; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.u-banner i { display: block; font-style: normal; font-size: clamp(14px, calc(var(--W) * .048), 22px); line-height: 1.2; margin-top: 1px; opacity: .96; }
.u.is-review .u-angry, .u.is-review .u-banner { display: none; }
.u-over { position: absolute; left: 50%; bottom: calc(var(--vh) * -.2); transform: translate(-50%, 100%); z-index: 14; display: none; gap: 6px; padding-top: 8px; white-space: nowrap; }
.u-over.is-on { display: flex; animation: u-rise .35s .9s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes u-rise { from { opacity: 0; transform: translate(-50%, 130%); } to { opacity: 1; transform: translate(-50%, 100%); } }
.u-over button { min-width: calc(var(--W) * .27); height: 40px; padding: 0 10px; font-size: clamp(13px, calc(var(--W) * .042), 18px); letter-spacing: .04em; color: #fff; text-shadow: 0 2px 0 rgba(50,20,4,.95);
  background: linear-gradient(#a25f2c, #8a4d21 55%, #7b4219); border-top: 2px solid #c78a55; border-bottom: 3px solid #3c1d09; border-left: 1px solid #b9764a; border-right: 1px solid #3c1d09; box-shadow: 0 3px 4px rgba(0,0,0,.4); }
.u-over button:active { transform: translateY(2px); }
.u-flash { position: absolute; inset: 0; z-index: 60; background: #e00; opacity: 0; pointer-events: none; }
.u-flash.is-on { animation: u-flash .5s ease-out; }
@keyframes u-flash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* modal */
.u-modal { position: absolute; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
.u-modal.is-on { display: flex; }
.u-card { width: min(calc(var(--W) * .88), 400px); padding: 18px 16px 16px; background: linear-gradient(#9a5a2b, #7f4720); border: 4px solid var(--ink); border-radius: 14px; box-shadow: inset 0 0 0 2px #c78a55, 0 8px 24px rgba(0,0,0,.6); text-align: center; }
.u-card h3 { margin: 0 0 12px; font-size: 22px; text-shadow: 0 2px 0 rgba(50,20,4,.9); }
.u-card p { margin: 0 0 14px; font-size: 16px; line-height: 1.45; font-weight: 600; text-shadow: 0 1px 0 rgba(50,20,4,.8); }
.u-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; font-size: 18px; }
.u-seg { display: flex; border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
.u-seg button { min-width: 54px; height: 38px; padding: 0 10px; background: #6b6b6b; color: #111; font-size: 15px; }
.u-seg button + button { border-left: 2px solid #2a2a2a; }
.u-seg button.is-on { background: #ffff00; }
.u-ok { margin-top: 4px; width: 100%; height: 46px; font-size: 20px; color: #fff; text-shadow: 0 2px 0 rgba(50,20,4,.95); background: linear-gradient(#4a8f3a, #3a742c); border: 3px solid var(--ink); border-radius: 10px; }
.u-ok:active { filter: brightness(.9); }
.u-toast {
  position: absolute; z-index: 90; left: 50%; bottom: calc(var(--vh) * 12);
  transform: translateX(-50%) translateY(8px);
  max-width: calc(var(--W) - 24px); padding: 8px 14px; border-radius: 999px;
  background: rgba(0,0,0,.82); border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: 14px; letter-spacing: .02em; line-height: 1.2;
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity .2s ease, transform .2s ease;
}
.u-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .u-angry-in { animation: u-pop .01s both; } .u.is-shake .u-col { animation: none; } .u-toast { transition: none; } }
