@font-face { font-family: "Crimson Pro"; src: url("../fonts/CrimsonPro.ttf") format("truetype"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson Pro"; src: url("../fonts/CrimsonPro-Italic.ttf") format("truetype"); font-weight: 200 900; font-style: italic; font-display: swap; }

:root {
  --ink: #1b1209;
  --paper: #eadfc4;
  --paper-2: #d9c9a2;
  --brass: #d9b25a;
  --brass-d: #8a6420;
  --smoke: #cfc6b4;
  --serif: "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #060403; overflow: hidden; }
body { font-family: var(--serif); color: var(--smoke); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 2px solid #ffe28a; outline-offset: 2px; }

#viewport { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; background: #07050a; overflow: hidden; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#lamp > svg { height: 220px; }
.stackpile svg, .bet svg, .pot svg, .flying svg, .price svg { position: static; display: block; margin: 0 auto; }

/* ---------- fire ---------- */
#fire .glow { position: absolute; left: 1020px; top: 200px; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,150,60,.42), rgba(255,110,30,.14) 55%, transparent);
  mix-blend-mode: screen; animation: flick 3.4s infinite ease-in-out; }
#fire .flame { position: absolute; bottom: 430px; width: 84px; height: 150px; border-radius: 50% 50% 46% 46% / 70% 70% 30% 30%;
  background: radial-gradient(ellipse at 50% 80%, #fff3b0 0%, #ffb43a 38%, #e5521a 72%, transparent 76%);
  filter: blur(2px); transform-origin: 50% 100%; mix-blend-mode: screen; }
#fire .f1 { left: 1306px; animation: lick 1.3s infinite ease-in-out; }
#fire .f2 { left: 1384px; height: 200px; animation: lick 1.7s .2s infinite ease-in-out; }
#fire .f3 { left: 1462px; animation: lick 1.1s .5s infinite ease-in-out; }
@keyframes lick { 0%,100% { transform: scale(1, 1) skewX(0); } 25% { transform: scale(.88, 1.12) skewX(4deg); } 55% { transform: scale(1.08, .92) skewX(-5deg); } 80% { transform: scale(.94, 1.06) skewX(3deg); } }
@keyframes flick { 0%,100% { opacity: .88; } 30% { opacity: 1; } 55% { opacity: .78; } 80% { opacity: .95; } }

/* ---------- books ---------- */
#shelf { pointer-events: none; }
.book { position: absolute; pointer-events: auto; border-radius: 2px 2px 1px 1px; transform-origin: 50% 100%;
  transition: transform .18s ease, filter .18s ease; box-shadow: inset 2px 0 3px rgba(255,255,255,.14), inset -3px 0 4px rgba(0,0,0,.45), 0 1px 0 rgba(0,0,0,.6); }
.book span { position: absolute; left: 50%; top: 50%; writing-mode: vertical-rl; transform: translate(-50%, -50%) rotate(180deg);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; color: #e6c978; text-shadow: 0 1px 0 rgba(0,0,0,.7); font-weight: 600; max-height: 92%; overflow: hidden; }
.book::before, .book::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: rgba(230,201,120,.55); }
.book::before { top: 8px; } .book::after { bottom: 8px; }
.book.dummy { pointer-events: none; }
.book:not(.dummy):hover, .book:not(.dummy):focus-visible { transform: translateY(-9px) rotate(-1.5deg); filter: brightness(1.35); }
.book.read::after { height: 10px; bottom: -2px; background: #8a1d1d; width: 5px; left: 50%; }
.book.knocked { animation: knocked 1.1s ease-in forwards; }
@keyframes knocked { 0% { transform: rotate(0); } 40% { transform: translateY(-6px) rotate(8deg); } 100% { transform: translate(40px, 330px) rotate(78deg); opacity: 0; } }

/* ---------- light and cones ---------- */
.cone { position: absolute; top: 130px; width: 420px; height: 560px; transform-origin: 50% 0; mix-blend-mode: screen; opacity: .085; filter: blur(5px);
  background: linear-gradient(180deg, rgba(255,236,170,.9), rgba(255,236,170,0) 85%); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); animation: flick 5s infinite ease-in-out; }
.c1 { left: 390px; } .c2 { left: 590px; animation-delay: 1.2s; } .c3 { left: 790px; animation-delay: 2.4s; }
#cones { mix-blend-mode: screen; clip-path: polygon(392px 318px, 1208px 318px, 1396px 700px, 204px 700px); }
#light { background:
  radial-gradient(ellipse 62% 70% at 50% 52%, transparent 36%, rgba(0,0,0,.55) 100%),
  linear-gradient(180deg, rgba(60,40,10,.10), rgba(20,10,0,.18)); mix-blend-mode: multiply; }
#light::after { content: ""; position: absolute; inset: -50px; opacity: .22; mix-blend-mode: overlay; animation: grain 1.1s steps(6) infinite;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1.1 -.3'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
@keyframes grain { 0% { transform: translate(0,0); } 20% { transform: translate(-30px,18px); } 40% { transform: translate(24px,-22px); } 60% { transform: translate(-14px,-30px); } 80% { transform: translate(26px,26px); } 100% { transform: translate(0,0); } }
#smoke { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; pointer-events: none; mix-blend-mode: screen; opacity: .8; }

/* ---------- guests ---------- */
.guest { position: absolute; width: 220px; height: 300px; transform-origin: 50% 100%; transition: filter .4s, opacity .5s, transform .4s; filter: brightness(.72) saturate(.85) contrast(1.05); }
.guest.thinking { filter: brightness(.95) saturate(1) contrast(1.05); }
.guest.out { opacity: 0; transform: translateY(14px); }
.guest.folded { filter: brightness(.5) saturate(.6); }
.guest.sway svg { animation: sway 6s infinite ease-in-out; transform-origin: 50% 100%; }
@keyframes sway { 0%,100% { transform: rotate(0deg) } 50% { transform: rotate(.9deg) translateY(1px) } }
.guest .ember { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: radial-gradient(#ffd27a, #ff6a1a 60%, transparent 70%); mix-blend-mode: screen; opacity: .55; transition: opacity .3s, transform .3s; }
.guest.thinking .ember { opacity: 1; transform: scale(1.8); animation: puff 1.4s infinite; }
@keyframes puff { 0%,100% { transform: scale(1.4); } 50% { transform: scale(2.2); } }
.guest .bark { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); padding: 5px 12px; white-space: nowrap; font-style: italic; font-size: 20px; color: #f3e6c4;
  background: rgba(14,9,5,.82); border: 1px solid rgba(217,178,90,.45); border-radius: 12px; opacity: 0; transition: opacity .35s; pointer-events: none; }
.guest .bark.on { opacity: 1; }
.guest .tellfx { position: absolute; inset: 0; pointer-events: none; }

/* ---------- on the cloth ---------- */
#felt > * { position: absolute; }
.card { width: var(--cw, 70px); height: calc(var(--cw, 70px) * 1.4); perspective: 700px; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 5px rgba(0,0,0,.55)); }
.card-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3,.7,.3,1); transform: rotateY(180deg); }
.card.up .card-in { transform: rotateY(0); }
.card .face, .card .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: calc(var(--cw, 70px) * .07); }
.card .face { background: linear-gradient(160deg, #f4ecd6, #e3d6b4); box-shadow: inset 0 0 0 1px rgba(60,40,10,.35), inset 0 0 14px rgba(120,80,20,.28); color: #1b1814; font-family: var(--serif); }
.card .face.red { color: #9b1c1c; }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .95; font-size: calc(var(--cw, 70px) * .27); }
.card .corner b { font-weight: 700; } .card .corner i { font-style: normal; font-size: .85em; }
.card .tl { left: 7%; top: 5%; } .card .br { right: 7%; bottom: 5%; transform: rotate(180deg); }
.card .mid { position: absolute; inset: 0; font-size: calc(var(--cw, 70px) * .3); }
.card .mid s { position: absolute; text-decoration: none; transform: translate(-50%, -50%); }
.card .court .mid, .card .face.court .mid { display: grid; place-items: center; }
.card .face.court .mid em { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 2.1em; font-style: normal; font-weight: 600; opacity: .9; }
.card .face.court .mid u { position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%); text-decoration: none; font-size: 1.5em; }
.card .face.court::before { content: ""; position: absolute; inset: 14% 17%; border: 1.5px solid currentColor; opacity: .5; border-radius: 3px; }
.card .back { transform: rotateY(180deg); background:
  radial-gradient(circle at 50% 50%, rgba(217,178,90,.9) 0 3px, transparent 4px),
  repeating-linear-gradient(45deg, rgba(217,178,90,.22) 0 1px, transparent 1px 7px),
  repeating-linear-gradient(-45deg, rgba(217,178,90,.22) 0 1px, transparent 1px 7px),
  linear-gradient(160deg, #6b1a1f, #3b0c10);
  box-shadow: inset 0 0 0 3px #e8dcc0, inset 0 0 0 4px #3b0c10, inset 0 0 0 6px rgba(217,178,90,.5); }
.card.mine { --cw: 104px; }
.card.opp { --cw: 52px; }
.card.com { --cw: 74px; }
.card.fold { opacity: .0; transition: opacity .4s, transform .5s; }
.card.glow .face { box-shadow: inset 0 0 0 1px rgba(60,40,10,.35), 0 0 0 3px #ffe28a, 0 0 22px 4px rgba(255,226,138,.65); }
.card.dim { filter: brightness(.55) drop-shadow(0 3px 4px rgba(0,0,0,.5)); }

.pot, .bet, .stackpile { transform: translate(-50%, -100%); pointer-events: none; }
.amount { position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); font-weight: 700; font-size: 20px; color: #f2e0a8; text-shadow: 0 1px 2px #000, 0 0 8px rgba(0,0,0,.8); white-space: nowrap; letter-spacing: .02em; }
.amount small { font-size: 14px; opacity: .8; margin-right: 1px; }
.tag.row { display: flex; gap: 10px; align-items: baseline; white-space: nowrap; }
.tag { transform: translate(-50%, 0); text-align: center; line-height: 1.05; pointer-events: none; text-shadow: 0 1px 3px #000, 0 0 12px #000; }
.tag .nm { font-size: 17px; letter-spacing: .14em; text-transform: uppercase; color: #e8dcc0; font-weight: 600; }
.tag .st { font-size: 20px; color: #f2e0a8; font-weight: 700; }
.tag.folded { opacity: .5; }
.tag.active .nm { color: #ffe9a8; text-shadow: 0 0 12px rgba(255,220,130,.9); }
.chit { transform: translate(-50%, -50%) rotate(-2deg) scale(.9); padding: 3px 11px; background: linear-gradient(#efe4c8, #d6c59c); color: #2a1a0a; font-weight: 700; font-size: 19px; border-radius: 3px; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 3px 6px rgba(0,0,0,.6); opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap; pointer-events: none; }
.chit.on { opacity: 1; transform: translate(-50%, -50%) rotate(-2deg) scale(1); }
.chit.allin { background: linear-gradient(#f0c9a0, #c0603a); }
.button-token { transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d8cdb2 70%); color: #2a1a0a; display: grid; place-items: center; font-weight: 800; font-size: 17px; box-shadow: 0 3px 5px rgba(0,0,0,.6), inset 0 0 0 2px rgba(0,0,0,.18); transition: left .6s ease, top .6s ease; }
.flying { position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 5; }
.mycaption { transform: translate(-50%, -50%); font-style: italic; font-size: 24px; color: #e9dcba; text-shadow: 0 1px 3px #000, 0 0 12px #000; white-space: nowrap; pointer-events: none; opacity: .92; }
.price { transform: translate(-50%, -50%); pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px; background: rgba(12,8,4,.72); border: 1px solid rgba(217,178,90,.35); border-radius: 18px; color: #e9dcba; font-size: 18px; font-style: italic; }
.price svg { display: block; }

/* ---------- buttons and controls ---------- */
.brass { white-space: nowrap; padding: 10px 26px; color: #1a0f05; font-weight: 700; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; border-radius: 6px;
  background: linear-gradient(180deg, #f1d38a, #c39a45 52%, #8a6420); box-shadow: 0 3px 0 #3d2a0a, 0 6px 14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.55); transition: transform .08s, filter .15s; }
.brass:hover { filter: brightness(1.12); } .brass:active { transform: translateY(2px); box-shadow: 0 1px 0 #3d2a0a, 0 3px 8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.55); }
.brass[disabled] { filter: grayscale(.8) brightness(.55); cursor: default; }
.brass.dark { background: linear-gradient(180deg, #4a3a2a, #2a1c10 60%, #150d07); color: #e9dcba; box-shadow: 0 3px 0 #0a0603, 0 6px 14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.15); }

#controls { position: absolute; right: 24px; bottom: 22px; width: 620px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
#controls .row { display: flex; gap: 12px; pointer-events: auto; }
#controls .brass { min-width: 136px; }
#controls .raisebox { pointer-events: auto; background: rgba(12,8,4,.8); border: 1px solid rgba(217,178,90,.4); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: 100%; box-shadow: 0 8px 30px rgba(0,0,0,.7); }
.raisebox .line { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.raisebox .mini { padding: 4px 10px; font-size: 17px; min-width: 0; border-radius: 5px; letter-spacing: .04em; }
.raisebox .coinbtn { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(217,178,90,.25); transition: background .15s, transform .08s; }
.raisebox .coinbtn:hover { background: rgba(255,255,255,.12); } .raisebox .coinbtn:active { transform: translateY(2px); }
.raisebox .coinbtn b { font-size: 15px; color: #f2e0a8; margin-top: -2px; }
.raisebox .to { font-size: 30px; font-weight: 700; color: #f6e7b8; letter-spacing: .02em; }
.raisebox .to small { font-size: 16px; font-weight: 500; opacity: .75; margin-right: 6px; letter-spacing: .12em; text-transform: uppercase; }
#controls kbd { font-family: inherit; font-size: 12px; opacity: .6; margin-left: 4px; }

#toast { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font-style: italic; font-size: 22px; color: #e9dcba; text-shadow: 0 1px 4px #000; opacity: 0; transition: opacity .6s; padding: 4px 18px; background: rgba(8,5,3,.55); border-radius: 18px; white-space: nowrap; }
#toast.on { opacity: 1; }

#menu { position: absolute; right: 16px; top: 14px; display: flex; gap: 8px; z-index: 30; }
#menu button { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e9c978, #8a6420); color: #1a0f05; font-size: 21px; font-weight: 700; box-shadow: 0 3px 8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.5); display: grid; place-items: center; }
#menu button[aria-pressed="false"] { filter: grayscale(.7) brightness(.7); }
#menu button:hover { filter: brightness(1.15); }

/* ---------- paper (quotes, rank card, ledger) ---------- */
#paper, #cheat { position: absolute; z-index: 20; width: 460px; padding: 30px 36px 28px; color: var(--ink); font-size: 26px; line-height: 1.28; border-radius: 3px; cursor: pointer;
  background: radial-gradient(ellipse at 20% 10%, #f6ecd0, #dccba0 80%), #e3d4ae; box-shadow: 0 18px 44px rgba(0,0,0,.75), inset 0 0 40px rgba(110,70,20,.35); transform-origin: 20% 0; }
#paper { left: 430px; top: 110px; animation: unfold .45s cubic-bezier(.2,.8,.2,1); }
#paper[hidden], #cheat[hidden] { display: none; }
#paper q { display: block; font-style: italic; quotes: "“" "”"; }
#paper cite { display: block; margin-top: 16px; font-size: 17px; letter-spacing: .12em; text-transform: uppercase; font-style: normal; opacity: .65; }
#paper .bm { position: absolute; right: 22px; top: -6px; width: 18px; height: 44px; background: #8a1d1d; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
#paper .count { position: absolute; right: 14px; bottom: 8px; font-size: 14px; opacity: .5; }
@keyframes unfold { from { opacity: 0; transform: scale(.92) rotate(-1.5deg) translateY(-10px); } to { opacity: 1; transform: none; } }
#cheat { left: 560px; top: 90px; width: 480px; padding: 24px 28px; font-size: 20px; }
#cheat h3 { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 16px; opacity: .65; margin-bottom: 10px; }
#cheat ol { list-style: none; display: grid; gap: 6px; }
#cheat li { display: flex; align-items: center; gap: 12px; }
#cheat li .ex { margin-left: auto; font-size: 18px; letter-spacing: .06em; opacity: .85; font-family: var(--serif); }
#cheat li .ex .r { color: #9b1c1c; }
#cheat li b { width: 22px; text-align: right; opacity: .5; font-weight: 600; }

/* ---------- title card ---------- */
#title { background: radial-gradient(ellipse at 50% 55%, rgba(8,5,3,.62), rgba(5,3,2,.94)); display: grid; place-items: center; pointer-events: auto; z-index: 40; transition: opacity .9s; }
#title.gone { opacity: 0; pointer-events: none; }
.titlecard { text-align: center; }
.titlecard h1 { font-size: 92px; font-weight: 500; letter-spacing: .06em; color: #f1dfb0; text-shadow: 0 2px 0 #000, 0 0 40px rgba(217,178,90,.3); font-variant: small-caps; }
.titlecard p { font-style: italic; font-size: 28px; opacity: .75; margin: 6px 0 34px; }
.titlecard .brass { font-size: 26px; padding: 14px 40px; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #fire .flame, #fire .glow, .cone, #light::after, .guest.sway svg { animation: none; }
}

.linkish { display: block; margin: 18px auto 0; font-style: italic; font-size: 20px; color: #cfc6b4; opacity: .7; text-decoration: underline dotted; }
.linkish:hover { opacity: 1; }

.price[hidden], .mycaption[hidden] { display: none; }

/* only the painted cat is clickable, not the empty box around her */
.cat-svg { pointer-events: none; overflow: visible; filter: drop-shadow(0 0 4px rgba(170,150,200,.35)); }
.cat-svg * { pointer-events: visiblePainted; }
.cat-svg .zz { animation: zz 3s infinite ease-in-out; }
@keyframes zz { 0%,100% { opacity: .2; transform: translateY(0); } 50% { opacity: .9; transform: translateY(-6px); } }
.cat-svg .tail { transform-origin: 30% 80%; animation: tail 3.4s infinite ease-in-out; }
@keyframes tail { 0%,100% { transform: rotate(0); } 50% { transform: rotate(5deg); } }
.cat-svg .eyes { animation: blink 6s infinite; transform-origin: center; }
@keyframes blink { 0%,94%,100% { opacity: 1; } 96% { opacity: .1; } }
