:root {
  --bg: #0f1713;
  --panel: #18241e;
  --panel2: #213129;
  --line: #2f4539;
  --ink: #f2ecdc;
  --muted: #a9b8a8;
  --felt: #1f4d3a;
  --felt2: #173d2e;
  --brass: #d8b45a;
  --red: #e0574f;
  --blue: #4f8fe0;
  --koz: #8e6bc4;
  --card: #fffaf0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: radial-gradient(ellipse at top, #1d2b23, var(--bg) 60%) fixed; color: var(--ink); font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: Georgia, serif; margin: 0 0 .4em; }
small { color: var(--muted); }
.big { padding: .65em 1.15em; border-radius: 10px; border: 2px solid var(--line); background: var(--panel2); font-weight: 700; box-shadow: 0 3px 0 #0007; transition: transform .08s, background .15s; }
.big:hover:not(:disabled) { background: #2b4236; }
.big:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #0007; }
.big.primary { background: var(--brass); border-color: #a3832f; color: #1d1608; }
.big.primary:hover:not(:disabled) { background: #e6c46d; }
.big.ghost { background: transparent; }
.big:disabled, .tiny:disabled, .buy:disabled, .services button:disabled { opacity: .45; cursor: not-allowed; }
.tiny { padding: .2em .6em; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); font-size: 12px; font-weight: 600; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 13px; }

.title, .help { max-width: 760px; margin: 6vh auto; padding: 1rem; text-align: center; }
.logo { font-family: Georgia, serif; font-weight: 900; font-size: clamp(60px, 13vw, 116px); letter-spacing: .08em; color: var(--card); text-shadow: 0 5px 0 var(--felt), 0 9px 24px #000a; background: none; border: 0; line-height: 1; }
.logo.small { font-size: 24px; text-shadow: 0 2px 0 var(--felt); }
.tag { font-size: 18px; color: var(--muted); margin: .6rem 0 1.6rem; }
.titlecard { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 1.4rem; display: grid; gap: 1rem; box-shadow: 0 10px 40px #0008; }
.stakes { border: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding: 0; margin: 0; }
.stakes legend { color: var(--muted); margin-bottom: .4rem; }
.stake { border: 2px solid var(--line); border-radius: 12px; padding: .7rem; display: grid; gap: .2rem; cursor: pointer; text-align: left; }
.stake input { position: absolute; opacity: 0; }
.stake.on { border-color: var(--brass); background: #2a2a17; }
.seed { display: flex; gap: .5rem; align-items: center; justify-content: center; color: var(--muted); }
.seed input { background: #0c130f; border: 1px solid var(--line); color: var(--ink); padding: .45em .7em; border-radius: 8px; width: 12em; }
.fine { color: var(--muted); font-size: 12px; margin-top: 1.5rem; }
.help { text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 1.6rem 2rem; }
.help li { margin: .6em 0; }

.top { display: flex; align-items: center; gap: 1.2rem; padding: .5rem 1rem; background: #0b120e; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.stat { display: grid; line-height: 1.15; }
.stat small { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat.gold b { color: var(--brass); }
.stat.seed { margin-left: auto; }
.stat .bar { display: block; height: 5px; background: #0006; border-radius: 3px; margin-top: 3px; overflow: hidden; width: 160px; }
.stat .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #f3d98a); transition: width .4s; }
.layout { display: grid; grid-template-columns: 270px 1fr; gap: 1rem; padding: 1rem; max-width: 1500px; margin: 0 auto; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } .side { order: 2; } }
.side { display: grid; gap: .8rem; align-content: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.panel h3 { font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.charm, .fortune { display: flex; justify-content: space-between; gap: .5rem; background: var(--panel2); border-radius: 9px; padding: .45rem .6rem; border-left: 4px solid #7d8f7d; }
.charm p, .fortune p { margin: .1rem 0 0; font-size: 12.5px; color: #cfd8c8; }
.charm.r2 { border-left-color: var(--blue); }
.charm.r3 { border-left-color: var(--brass); }
.fortune { border-left-color: var(--koz); }
.fortune.targeting { outline: 2px dashed var(--brass); }
.cbtn { display: flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.levels { display: flex; gap: .35rem; flex-wrap: wrap; }
.lv { background: var(--card); color: #1f2a24; border-radius: 6px; padding: .05em .45em; font-weight: 800; }
.lv.red { color: #b3261e; }
.lv.lvkoz { background: var(--koz); color: #fff; }
.enhanced { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: .4rem; }

/* cards */
.card { --w: 64px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: 8px; background: var(--card); border: 1px solid #c9bfa6; position: relative; display: inline-block; color: #1f2a24; box-shadow: 0 2px 4px #0005; padding: 0; flex: none; transition: transform .12s, box-shadow .12s, opacity .12s; font-family: Georgia, serif; }
.card.red { color: #b3261e; }
.card .r { position: absolute; left: 5px; top: 2px; font-weight: 900; font-size: calc(var(--w) * .27); line-height: 1; }
.card .s { position: absolute; left: 6px; top: calc(var(--w) * .3); font-size: calc(var(--w) * .22); line-height: 1; }
.card .pipbig { position: absolute; right: 5px; bottom: 2px; font-size: calc(var(--w) * .55); line-height: 1; opacity: .9; }
.card.small { --w: 30px; border-radius: 4px; box-shadow: none; }
.card.small .s { display: none; }
.card.small .pipbig { font-size: 14px; right: 3px; bottom: 1px; }
.card.small .r { font-size: 11px; left: 3px; top: 1px; }
.card .badge { position: absolute; right: -5px; top: -5px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #0b120e; }
.card.small .badge { width: 9px; height: 9px; border-width: 1px; right: -3px; top: -3px; }
.e-gold { background: linear-gradient(160deg, #fff6d6, #f1d78a); } .e-gold .badge { background: var(--brass); }
.e-glass { background: linear-gradient(160deg, #f4fbff, #cfe9f6); } .e-glass .badge { background: #8fd3f4; }
.e-stone { background: linear-gradient(160deg, #e6e3dc, #bdb7aa); } .e-stone .badge { background: #8a857b; }
.e-wild { background: linear-gradient(160deg, #f1e8ff, #d6c3f2); } .e-wild .badge { background: var(--koz); }
.card.trumpcard { box-shadow: inset 0 0 0 2px var(--koz), 0 2px 4px #0005; }
.card.back { background: repeating-linear-gradient(45deg, #7a2e22 0 6px, #8d3a2c 6px 12px); border: 3px solid var(--card); }
button.card { cursor: pointer; }
button.card.legal:hover { transform: translateY(-14px) rotate(-2deg); box-shadow: 0 10px 18px #000a; }
button.card.legal { transform: translateY(-6px); }
.card.dim { opacity: .45; filter: saturate(.5); cursor: not-allowed; }
.card.sel { outline: 3px solid var(--brass); transform: translateY(-3px); }
.card.win { box-shadow: 0 0 0 3px var(--brass), 0 0 18px #d8b45a99; }
.backs { display: flex; }
.backs i { width: 14px; height: 22px; border-radius: 3px; background: repeating-linear-gradient(45deg, #7a2e22 0 3px, #8d3a2c 3px 6px); border: 1px solid var(--card); margin-right: -7px; }

/* map */
.map h2, .shop h2, .end h2 { font-size: 28px; }
.sub { color: var(--muted); margin-top: 0; }
.tables { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 760px) { .tables { grid-template-columns: 1fr; } }
.table-card { background: radial-gradient(ellipse at top, var(--felt), var(--felt2)); border: 3px solid #5a3b22; border-radius: 18px; padding: 1rem; display: grid; gap: .6rem; align-content: start; }
.table-card.current { border-color: var(--brass); transform: translateY(-3px); box-shadow: 0 0 0 4px #d8b45a22; }
.table-card.locked { opacity: .65; }
.table-card.done { opacity: .4; }
.table-card.boss { border-color: #7a2e22; }
.faces { display: flex; gap: .8rem; margin: 0; }
.faces span { display: grid; justify-items: center; font-size: 30px; }
.faces small { font-size: 11px; }
.rule { margin: 0; font-size: 14px; background: #0004; border-radius: 8px; padding: .4rem .6rem; }
.facts { list-style: none; padding: 0; margin: 0; font-size: 13.5px; color: var(--muted); }
.done-mark { color: var(--muted); font-style: italic; }

/* table */
.tablewrap { display: grid; gap: .6rem; }
.felt { position: relative; height: min(58vh, 560px); min-height: 430px; background: radial-gradient(ellipse at center, #2a6a50, var(--felt) 55%, var(--felt2)); border: 12px solid #5a3b22; border-radius: 200px / 120px; box-shadow: inset 0 0 60px #0008, 0 14px 40px #000a; }
.seat { position: absolute; display: grid; justify-items: center; gap: .3rem; z-index: 2; }
.seat2 { top: 6%; left: 50%; transform: translateX(-50%); }
.seat3 { left: 3%; top: 38%; }
.seat1 { right: 3%; top: 38%; }
.plaque { display: flex; gap: .5rem; align-items: center; background: #0b120ecc; border: 1px solid var(--line); border-radius: 12px; padding: .3rem .6rem; }
.plaque .face { font-size: 28px; }
.plaque small { display: block; }
.seat.turn .plaque { border-color: var(--brass); box-shadow: 0 0 12px #d8b45a66; }
.seat.partner .plaque { border-color: var(--blue); }
.ptag { color: var(--blue) !important; display: inline !important; margin-left: .3em; }
.decl { color: var(--brass); font-weight: 800; }
.peek { display: flex; flex-wrap: wrap; gap: 2px; max-width: 230px; justify-content: center; }
.bubble { background: var(--card); color: #1f2a24; border-radius: 12px; padding: .3rem .7rem; font-style: italic; max-width: 220px; font-size: 13px; animation: pop .25s ease-out; }
.trick { position: absolute; left: 50%; top: 50%; width: 250px; height: 230px; transform: translate(-50%, -52%); }
.slot { position: absolute; }
.slot.s2 { top: 0; left: 50%; transform: translateX(-50%); }
.slot.s0 { bottom: 0; left: 50%; transform: translateX(-50%); }
.slot.s3 { left: 0; top: 50%; transform: translateY(-50%) rotate(-6deg); }
.slot.s1 { right: 0; top: 50%; transform: translateY(-50%) rotate(6deg); }
.slot .card { animation: deal .22s ease-out; }
.slot.faded .card { opacity: .55; }
.slot.faded .card.win { opacity: 1; }
.contract { position: absolute; left: 5%; top: 7%; z-index: 3; display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-items: center; background: #0b120ecc; border: 1px solid var(--line); border-radius: 12px; padding: .35rem .7rem; min-width: 190px; }
.contract small { display: block; font-size: 11px; }
.contract b { font-size: 15px; }
.contract .meter { grid-column: 1 / -1; height: 6px; background: #0007; border-radius: 3px; overflow: hidden; }
.contract .meter i { display: block; height: 100%; background: var(--brass); transition: width .3s; }
.contract.secured { border-color: var(--brass); } .contract.secured .meter i { background: #7bd389; }
.contract.impossible { border-color: var(--red); } .contract.impossible .meter i { background: var(--red); }
.koz-suit { font-size: 30px; line-height: 1; color: var(--card); text-shadow: 0 2px 6px #0008; }
.koz-suit.red { color: #ff8a80; }
.rev { background: var(--red); color: #fff; border-radius: 4px; padding: 0 .4em; font-weight: 800; }
.panel-c { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); background: #0b120ef0; border: 2px solid var(--line); border-radius: 14px; padding: .8rem 1rem; z-index: 4; text-align: center; max-width: 92%; box-shadow: 0 10px 30px #000a; }
.panel-c p { margin: 0 0 .5rem; }
.alog { color: var(--muted); font-size: 13px; }
.bids { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; margin-bottom: .6rem; }
.bid { width: 42px; height: 42px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel2); font-weight: 900; font-size: 17px; }
@media (hover: hover) { .bid:hover { background: var(--brass); color: #1d1608; } }
.bid { display: grid; place-items: center; line-height: 1; }
.bid small { font-size: 10px; color: #c9a8ff; }
.bid.dare { border-color: var(--koz); box-shadow: 0 0 0 3px #8e6bc466; }
.suitbtn { width: 70px; height: 76px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: #1f2a24; font-size: 34px; line-height: 1; display: grid; place-items: center; }
.suitbtn small { font-size: 11px; color: #4a5a4a; }
.suitbtn.red { color: #b3261e; }
.suitbtn:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--brass); }
.you { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.koz { flex: 1 1 340px; background: linear-gradient(90deg, #2b1f3d, #1f1a2b); border: 1px solid #4a3a66; border-radius: 12px; padding: .5rem .8rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.koz b { color: #c9a8ff; font-family: Georgia, serif; }
.koz span { font-style: italic; }
.koz em { color: #c9a8ff; font-style: normal; font-weight: 800; }
.koz small { margin-left: auto; }
.pot { display: flex; align-items: center; gap: .35rem; }
.pot small { margin-left: .4rem; }
.chips, .mult, .xm { font-weight: 900; font-size: 21px; padding: .05em .5em; border-radius: 8px; font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: center; display: inline-block; color: #fff; }
.chips { background: var(--blue); } .mult { background: var(--red); } .xm { background: var(--koz); }
.x { color: var(--muted); font-weight: 900; }
.hand { display: flex; justify-content: center; padding: 12px 0 4px; min-height: 120px; }
.hand .card { --w: 68px; margin-right: -14px; }
.hand.myturn { filter: drop-shadow(0 0 6px #d8b45a55); }
@media (max-width: 760px) { .hand .card { --w: 46px; margin-right: -16px; } .felt { border-radius: 40px; min-height: 380px; } .seat3, .seat1 { top: 30%; } }
.log { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .9rem; font-size: 13px; color: #cfd8c8; }
.log summary { cursor: pointer; color: var(--muted); }
.log ol { margin: .4rem 0 0; padding-left: 1.2rem; max-height: 220px; overflow: auto; }

.overlay { position: absolute; left: 22%; right: 22%; top: 50%; transform: translateY(-50%); max-height: 94%; overflow: auto; background: #0b120ef4; border: 2px solid var(--line); border-radius: 18px; display: grid; place-content: center; text-align: center; gap: .45rem; padding: 1.2rem; z-index: 6; box-shadow: 0 20px 60px #000c; animation: pop .25s ease-out; }
@media (max-width: 760px) { .overlay { left: 3%; right: 3%; } }
.overlay.win { border-color: var(--brass); }
.overlay.lose { border-color: var(--red); }
.overlay h2 { font-size: 30px; }
.overlay.win h2 { color: var(--brass); }
.overlay.lose h2 { color: var(--red); }
.how { margin: 0; font-weight: 700; }
.potline { display: flex; gap: .4rem; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; }
.potline b { font-size: 30px; color: var(--brass); }
.note { margin: 0; color: #c9a8ff; font-weight: 700; }

.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.offer { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: .8rem; display: grid; gap: .35rem; align-content: start; transition: transform .12s; }
.offer:hover { transform: translateY(-3px) rotate(-.4deg); }
.offer.r2 { border-color: var(--blue); } .offer.r3 { border-color: var(--brass); box-shadow: 0 0 18px #d8b45a33; }
.offer.o-fortune { border-color: var(--koz); } .offer.o-star { border-color: #4ea398; }
.offer p { margin: 0; font-size: 13px; color: #cfd8c8; }
.offer.sold { opacity: .4; }
.buy { margin-top: .3rem; padding: .5em; border-radius: 9px; background: var(--brass); color: #1d1608; border: 0; font-weight: 800; box-shadow: 0 3px 0 #7a5a12; }
.services { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.services button:not(.big) { padding: .5em 1em; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); font-weight: 700; }
.services .big { margin-left: auto; }
.deckview { margin-top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; display: grid; gap: .4rem; }
.suitrow { display: flex; gap: 3px; flex-wrap: wrap; }
.deckview button.card:hover { transform: translateY(-3px); }

.end { text-align: center; background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 2rem; max-width: 560px; margin: 2rem auto; }
.end.win { border-color: var(--brass); }
.end .facts { font-size: 16px; margin: 1rem 0 1.4rem; }
#toast { position: fixed; top: 4.5rem; bottom: auto; left: 50%; transform: translate(-50%, 200%); opacity: 0; background: var(--card); color: #1f2a24; padding: .6rem 1rem; border-radius: 10px; font-weight: 700; transition: transform .2s, opacity .2s; z-index: 20; pointer-events: none; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast { transform: translate(-50%, -200%); }
@keyframes pop { from { scale: .94; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes deal { from { transform: translateY(20px) scale(.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.overlay.neutral { border-color: #7d8f7d; } .overlay.neutral h2 { color: var(--ink); }
.overlay.setwin { border-color: #7bd389; } .overlay.setwin h2 { color: #7bd389; }
.overlay .note { opacity: 0; animation: notein .3s ease-out forwards; }
@keyframes notein { from { opacity: 0; transform: translateY(6px) scale(1.2); } to { opacity: 1; transform: none; } }
.overlay .stamp { position: absolute; right: 8%; top: 10%; font: 900 34px Georgia, serif; color: #fff; background: var(--red); padding: 0 .4em; border-radius: 8px; transform: rotate(10deg); animation: stamp .35s cubic-bezier(.3,1.8,.5,1); }
@keyframes stamp { from { transform: scale(2.6) rotate(-10deg); opacity: 0; } }
.kozpop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); font: 900 40px Georgia, serif; color: #fff; text-shadow: 0 3px 0 var(--koz), 0 6px 18px #000; animation: stamp .3s cubic-bezier(.3,1.8,.5,1); z-index: 5; pointer-events: none; }
.card .badge { width: auto; min-width: 16px; height: 16px; padding: 0 3px; font: 800 9px/14px system-ui; color: #1d1608; font-style: normal; text-align: center; border-radius: 8px; }
.card.small .badge { min-width: 9px; height: 9px; font-size: 0; padding: 0; }
.e-glass { box-shadow: 0 0 0 2px #8fd3f4, 0 0 12px #8fd3f4aa; }
.e-gold { box-shadow: 0 0 0 2px var(--brass), 0 0 12px #d8b45a88; }
.e-wild { box-shadow: 0 0 0 2px var(--koz), 0 0 12px #8e6bc488; }
@media (max-width: 760px) {
  .felt { height: 60vh; min-height: 360px; }
  .seat1, .seat3 { top: 4%; }
  .seat3 { left: 2%; } .seat1 { right: 2%; }
  .seat2 { top: 22%; }
  .seat .backs, .seat .peek { display: none; }
  .plaque { padding: .2rem .4rem; } .plaque .face { font-size: 20px; } .plaque b { font-size: 12px; }
  .contract { left: 50%; transform: translateX(-50%); top: auto; bottom: 2%; min-width: 0; }
  .trick { width: 210px; height: 200px; }
  .trick .card { --w: 48px; }
  .hand { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 8; overflow-x: auto; justify-content: flex-start; }
}
@media (max-width: 760px) { .you { margin-bottom: 8px; } .hand { padding-top: 18px; } }
