:root {
  --night: #1b1140;
  --night-2: #2a1a5e;
  --felt: #0e9f6e;
  --felt-dark: #067a55;
  --ink: #221a3a;
  --muted: #6b6485;
  --paper: #fffdf8;
  --line: #ebe4f5;
  --gold: #ffc93c;
  --gold-deep: #e09b00;
  --gold-soft: #fff4cf;
  --coral: #ff5d73;
  --sky: #4cc9f0;
  --violet: #8b5cf6;
  --orange: #ff9f1c;
  --mint: #3ddc97;
  --red: #e11d48;
  --ok: #0e9f6e;
  --ok-soft: #dcfbec;
  --no-soft: #ffe3e8;
  --cw: 52px;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(255, 93, 115, .38), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(76, 201, 240, .32), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(139, 92, 246, .45), transparent 60%),
    linear-gradient(160deg, var(--night), var(--night-2));
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.5 ui-rounded, 'SF Pro Rounded', 'Nunito', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3, h4, p { margin: 0; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; color: #fff; max-width: 980px; margin: 0 auto;
}
.top h1 {
  font-size: 24px; font-weight: 900; letter-spacing: .2px;
  background: linear-gradient(90deg, var(--gold), var(--coral) 55%, var(--sky));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top h1 { display: flex; align-items: center; gap: 10px; }
.logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0, 0, 0, .35); flex: none; }
.top nav { display: flex; gap: 4px; background: rgba(255, 255, 255, .12); padding: 5px; border-radius: 999px; }
.top nav button { border: 0; background: none; color: #e9e3ff; padding: 7px 18px; border-radius: 999px; font-weight: 800; transition: transform .12s; }
.top nav button:hover { transform: translateY(-1px); }
.top nav button.on { background: linear-gradient(135deg, var(--gold), var(--orange)); color: #3a2400; box-shadow: 0 3px 0 var(--gold-deep); }

main { max-width: 980px; margin: 0 auto; padding: 4px 16px 48px; display: grid; gap: 16px; }

.panel { background: var(--paper); border-radius: var(--radius); padding: 22px; box-shadow: 0 10px 30px rgba(10, 4, 40, .35); position: relative; overflow: hidden; }
.panel::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--coral), var(--orange), var(--gold), var(--mint), var(--sky), var(--violet)); }
.panel h2 { font-size: 24px; font-weight: 900; margin-bottom: 6px; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 1px; font-size: 12px; color: var(--violet); font-weight: 800; margin-top: 10px; }
.streak { display: inline-block; margin-left: 6px; background: var(--gold-soft); color: #7a4b00; border-radius: 99px; padding: 1px 10px; letter-spacing: .5px; }
.streak.hot { background: linear-gradient(135deg, var(--orange), var(--coral)); color: #fff; animation: pop .35s ease-out; }
.link { border: 0; background: none; color: var(--violet); font-weight: 800; padding: 0; }

.progress { height: 14px; background: var(--line); border-radius: 99px; margin: 12px 0 16px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--sky), var(--violet)); border-radius: 99px; transition: width .5s; }

.lesson-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 12px; }
.lesson-card {
  --c: var(--violet);
  display: flex; gap: 12px; align-items: center; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px;
  box-shadow: 0 4px 0 var(--line); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.lesson-card:hover { border-color: var(--c); box-shadow: 0 6px 0 var(--c); transform: translateY(-2px); }
.lesson-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--c); }
.lesson-card .num {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 900; font-size: 22px; transform: rotate(-4deg);
}
.lesson-card:hover .num { animation: wobble .6s ease-in-out; }
.lesson-card.c0 { --c: var(--coral); } .lesson-card.c1 { --c: var(--violet); } .lesson-card.c2 { --c: var(--sky); }
.lesson-card.c3 { --c: var(--orange); } .lesson-card.c4 { --c: #ec4899; } .lesson-card.c5 { --c: var(--mint); } .lesson-card.c6 { --c: var(--gold-deep); }
.lesson-card.done { background: var(--ok-soft); border-color: var(--mint); box-shadow: 0 4px 0 var(--mint); }
.lesson-card.done .num { background: var(--ok); }
.lesson-card small { display: block; color: var(--muted); line-height: 1.35; }

.cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cta.tall { padding: 36px 24px; }
.cta > div { flex: 1 1 280px; }

.btn {
  border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 16px; font-weight: 800;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s, box-shadow .08s, filter .12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .35; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, var(--coral), var(--orange)); border-color: transparent; color: #fff; box-shadow: 0 4px 0 #c9462f; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 #c9462f; }
.btn.small { padding: 5px 12px; background: var(--gold-soft); border-color: var(--gold); box-shadow: 0 3px 0 var(--gold-deep); }

.lesson p { margin: 12px 0; max-width: 68ch; }
.tip { background: var(--gold-soft); border-left: 6px solid var(--gold); border-radius: 12px; padding: 10px 14px; margin: 14px 0; max-width: 72ch; }
.lesson table { border-collapse: separate; border-spacing: 0; margin: 12px 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.lesson th, .lesson td { border-bottom: 1px solid var(--line); padding: 7px 14px; text-align: left; }
.lesson tr:last-child td { border-bottom: 0; }
.lesson th { background: linear-gradient(135deg, var(--violet), #6d4be0); color: #fff; }
.cardrow { margin: 14px 0; }
.cardrow figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 68ch; }
.row { display: flex; flex-wrap: wrap; gap: 4px; }
.quiz { background: #f6f1ff; border: 2px solid #ddd0ff; border-radius: 16px; padding: 14px; margin: 16px 0; }
.quiz h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--violet); }
.quiz .q { font-weight: 800; margin: 4px 0 10px; }
.quiz .row { margin-bottom: 10px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 2px solid #ddd0ff; background: #fff; border-radius: 12px; padding: 8px 14px; font-weight: 800; box-shadow: 0 3px 0 #ddd0ff; transition: transform .08s; }
.opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--violet); }
.opt.right { background: var(--ok-soft); border-color: var(--ok); color: #06694a; box-shadow: 0 3px 0 var(--ok); opacity: 1; animation: pop .35s ease-out; }
.opt.wrong { background: var(--no-soft); border-color: var(--red); color: var(--red); box-shadow: 0 3px 0 var(--red); animation: shake .3s; }
.fb { margin: 10px 0 0 !important; padding: 9px 12px; border-radius: 12px; }
.fb.ok { background: var(--ok-soft); }
.fb.no { background: var(--no-soft); }
.lesson-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 2px dashed var(--line); }
.badge.ok { color: var(--ok); font-weight: 900; font-size: 18px; animation: pop .4s ease-out; }

.rule-banner { background: linear-gradient(135deg, var(--violet), #ec4899); color: #fff; border-radius: 14px; padding: 10px 14px; font-weight: 800; }
.drill-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.drill-slot { text-align: center; }
.drill-slot small { display: block; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.lesson .btn.primary { margin-top: 12px; }

/* cards */
.card {
  width: var(--cw); height: calc(var(--cw) * 1.4); flex: none;
  background: linear-gradient(160deg, #fff, #f6f2ff); border: 1px solid #cfc6e6; border-radius: 9px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1; color: #1b1630; box-shadow: 0 2px 4px rgba(20, 8, 60, .28);
  transition: transform .12s, box-shadow .12s;
}
.card.red { color: var(--red); }
.card .r { font-size: calc(var(--cw) * .42); font-weight: 900; }
.card .s { font-size: calc(var(--cw) * .44); }
.card .jk { font-size: calc(var(--cw) * .22); font-weight: 900; letter-spacing: .5px; margin-top: 3px; }
.card.joker { background: linear-gradient(135deg, var(--coral), var(--orange), var(--gold), var(--mint), var(--sky), var(--violet)); color: #fff; border-color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.card.big { --cw: 68px; }
.card.win { outline: 4px solid var(--gold); box-shadow: 0 0 22px 6px rgba(255, 201, 60, .85); animation: winner .7s ease-out both; z-index: 2; }
.card.lose { outline: 4px solid var(--red); animation: shake .3s; }
.card.dim { opacity: .45; }
.card.pop { animation: deal .28s cubic-bezier(.2, 1.4, .4, 1) both; }
button.card:not(:disabled):not([aria-disabled]):hover { transform: translateY(-8px) rotate(-2deg); box-shadow: 0 10px 16px rgba(20, 8, 60, .35); }

/* table */
.play { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.scorebar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; color: #fff; }
.score { border-radius: 16px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.score.us { background: linear-gradient(135deg, #1fb6ff, #6d5cf6); box-shadow: 0 4px 0 #3b33b8; }
.score.them { background: linear-gradient(135deg, #ff7a59, #e11d74); box-shadow: 0 4px 0 #a3134f; }
.score small { opacity: .95; }
.score b { font-size: 30px; font-weight: 900; line-height: 1.1; }
.contract { text-align: center; }
.contract b, .contract small { display: block; }
.contract b { font-size: 18px; font-weight: 900; }
.contract small { opacity: .85; }
.books { display: inline-block; margin-top: 4px; background: linear-gradient(135deg, var(--gold), var(--orange)); color: #3a2400; font-weight: 900; border-radius: 99px; padding: 1px 12px; font-size: 13px; }

.felt {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 10px, transparent 10px 20px),
    radial-gradient(ellipse at center, #22c58b, var(--felt) 55%, var(--felt-dark));
  border: 8px solid #ffb703; border-radius: 34px; padding: 12px; color: #fff;
  box-shadow: inset 0 0 0 4px #8a4b00, inset 0 0 40px rgba(0, 0, 0, .35), 0 10px 30px rgba(10, 4, 40, .45);
  display: grid; gap: 8px; align-items: center; justify-items: center;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: '. n .' 'w t e' '. s .';
}
.seat { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 30px; text-align: center; font-weight: 800; }
.seat.n { grid-area: n; } .seat.w { grid-area: w; } .seat.e { grid-area: e; } .seat.s { grid-area: s; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 23px; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.seat.n .avatar { outline: 3px solid var(--sky); } .seat.s .avatar { outline: 3px solid var(--sky); }
.seat.w .avatar { outline: 3px solid var(--coral); } .seat.e .avatar { outline: 3px solid var(--coral); }
.seat.turn .avatar { outline-color: var(--gold); animation: bounce .7s ease-in-out infinite; box-shadow: 0 0 16px 4px rgba(255, 201, 60, .8); }
.seat.turn b { color: #fff3b0; }
.tag { font-size: 11px; background: rgba(0, 0, 0, .28); border-radius: 99px; padding: 0 8px; font-weight: 700; }
.tag.gold { background: linear-gradient(135deg, var(--gold), var(--orange)); color: #3a2400; font-weight: 900; }
.backs { display: flex; }
.backs i { width: 9px; height: 26px; margin-left: -3px; border-radius: 3px; background: linear-gradient(160deg, #ec4899, var(--violet)); border: 1px solid #fff; }
.bubble { background: #fff; color: var(--ink); border-radius: 12px; padding: 2px 10px; font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); animation: pop .3s ease-out; }
.bubble.think { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 700; box-shadow: none; animation: pulse 1.1s ease-in-out infinite; }

.trick {
  grid-area: t; position: relative; display: grid; gap: 4px;
  grid-template-columns: repeat(3, var(--cw)); grid-template-rows: repeat(3, var(--cw));
  grid-template-areas: '. n .' 'w . e' '. s .'; padding: 4px 0;
}
.slot { display: grid; place-items: center; }
.slot.n { grid-area: n; } .slot.w { grid-area: w; } .slot.e { grid-area: e; } .slot.s { grid-area: s; }
.trick .note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; z-index: 3;
  background: linear-gradient(135deg, var(--gold), var(--orange)); color: #3a2400; padding: 4px 14px; border-radius: 99px;
  font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 var(--gold-deep); animation: notepop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

.actions { background: var(--paper); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; text-align: center; box-shadow: 0 8px 24px rgba(10, 4, 40, .3); }
.prompt { font-weight: 800; }
.bid-grid { display: grid; gap: 8px; width: min(100%, 420px); }
.bid-row { display: grid; grid-template-columns: 34px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.bid-row .lvl { font-weight: 900; font-size: 18px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; }
.btn.bid { padding: 8px 4px; text-transform: capitalize; color: #fff; border-color: transparent; text-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn.bid[data-type='up'] { background: linear-gradient(135deg, #38bdf8, #2563eb); box-shadow: 0 4px 0 #1e40af; }
.btn.bid[data-type='down'] { background: linear-gradient(135deg, #c084fc, #7c3aed); box-shadow: 0 4px 0 #5b21b6; }
.btn.bid[data-type='nt'] { background: linear-gradient(135deg, #fbbf24, #f97316); box-shadow: 0 4px 0 #c2410c; }
.btn.bid:disabled { filter: grayscale(.9); box-shadow: none; }
.bid-grid.nums { grid-template-columns: repeat(7, minmax(0, 1fr)); width: min(100%, 520px); }
.bid-grid.nums .btn.bid { min-width: 0; padding: 12px 2px; font-size: 19px; font-weight: 900; background: linear-gradient(135deg, #38bdf8, #2563eb); box-shadow: 0 4px 0 #1e40af; }
.bid-grid.nums .btn.bid.nil { background: linear-gradient(135deg, #c084fc, #7c3aed); box-shadow: 0 4px 0 #5b21b6; font-size: 16px; }
.bid-grid.nums .btn.bid:disabled { box-shadow: none; opacity: .45; }
.btn.pass { background: #efeaf7; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.choice .btn small { display: block; font-weight: 600; color: var(--muted); }
.btn.suit { font-size: 30px; line-height: 1.1; min-width: 76px; }
.btn.suit:hover:not(:disabled) { transform: translateY(-3px) scale(1.05); }
.btn.suit.red { color: var(--red); }
.btn.suit small { font-size: 12px; }
.banner { display: grid; gap: 6px; justify-items: center; }
.banner b { font-size: 20px; font-weight: 900; }
.banner.win b { background: linear-gradient(90deg, var(--coral), var(--orange), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 24px; animation: pop .5s ease-out; }

.hand { display: flex; justify-content: center; flex-wrap: wrap; row-gap: 8px; padding: 6px 0 2px 8px; }
.hand .card { margin-left: -8px; }
.hand.static { justify-content: flex-start; margin: 14px 0; }
.hand .card.trump { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold), 0 0 12px rgba(255, 201, 60, .7); }
.hand .card.off { filter: brightness(.6) saturate(.6); }
.hand .card.sel { transform: translateY(-12px) rotate(-3deg); box-shadow: 0 0 0 3px var(--coral), 0 8px 14px rgba(20, 8, 60, .35); }

.coach { background: var(--paper); border-radius: var(--radius); padding: 14px; box-shadow: 0 8px 24px rgba(10, 4, 40, .3); }
.coach header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coach h3 { font-size: 19px; font-weight: 900; margin-right: auto; }
.whistle { display: inline-block; animation: wobble 3s ease-in-out infinite; }
.switch { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 700; }
.switch input { accent-color: var(--violet); width: 16px; height: 16px; }
.coach ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.coach li { padding: 9px 12px; border-radius: 12px; background: #f1ecfb; border-left: 6px solid var(--violet); font-size: 15px; }
.coach li.tip { border-color: var(--orange); background: var(--gold-soft); }
.coach li.good { border-color: var(--mint); background: var(--ok-soft); }
.coach li:first-child { animation: slidein .3s ease-out; }
.coach li:not(:first-child) { opacity: .7; }

.rules { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 14px 0 0; }
.rules dt { font-weight: 900; color: var(--violet); }
.rules dd { margin: 0; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -16px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
.confetti i:nth-child(3n) { border-radius: 50%; width: 9px; height: 9px; }
.confetti i:nth-child(4n) { width: 6px; height: 18px; }

@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .9; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes notepop { 0% { transform: translate(-50%, -50%) scale(.4); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes deal { 0% { transform: scale(1.5) rotate(10deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes winner { 0% { transform: none; } 40% { transform: translateY(-12px) scale(1.15) rotate(-4deg); } 100% { transform: translateY(-4px) scale(1.06); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes bounce { 50% { transform: translateY(-5px); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  :root { --cw: 44px; }
  main { padding: 4px 16px 40px; }
  .top h1 { font-size: 21px; }
  .panel { padding: 16px; }
  .scorebar { grid-template-columns: 1fr 1fr; }
  .contract { grid-column: 1 / -1; grid-row: 1; }
  .score small { font-size: 12px; }
  .hand { padding-left: 4px; }
  .hand .card { margin-left: -4px; }
  .rules { grid-template-columns: 1fr; gap: 2px; }
  .rules dd { margin-bottom: 8px; }
  .card.big { --cw: 60px; }
  .avatar { width: 34px; height: 34px; font-size: 19px; }
}

/* sound toggle, settings, coach suggestions, table talk, review, new drills */
.top nav button.icon { padding: 7px 10px; }
.settings { display: grid; gap: 14px; margin: 16px 0; }
.settings h3 { font-size: 17px; font-weight: 900; margin-top: 4px; }
.setting { display: grid; gap: 6px; justify-items: start; }
.setting small { color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #efeaf7; padding: 4px; border-radius: 14px; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 11px; font-weight: 800; color: var(--muted); }
.seg button.on { background: linear-gradient(135deg, var(--violet), #6d28d9); color: #fff; box-shadow: 0 3px 0 #4c1d95; }
.btn.small.plain { background: #efeaf7; border-color: var(--line); box-shadow: 0 3px 0 var(--line); }

.suggest-note { text-align: left; width: min(100%, 560px); margin: 0; font-size: 15px; }
.card.suggest, .btn.suggest { outline: 3px dashed var(--ok); outline-offset: 2px; }
.hand .card.suggest { transform: translateY(-6px); }
.btn.bid.suggest { outline-color: #fff; box-shadow: 0 0 0 3px var(--ok), 0 4px 0 rgba(0, 0, 0, .25); }
.card.both { outline: 4px solid var(--gold); }

.seat { position: relative; }
.talk {
  position: absolute; top: -4px; left: calc(50% + 24px); z-index: 6; width: max-content; max-width: min(46vw, 230px); line-height: 1.2; pointer-events: none;
  background: #fff; color: var(--ink); font-weight: 900; font-size: 14px; padding: 4px 12px; border-radius: 14px 14px 14px 3px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25); animation: talk 2.6s ease-out both;
}
.seat.e .talk { left: auto; right: calc(50% + 24px); border-radius: 14px 14px 3px 14px; }

.card.mini { --cw: 30px; border-radius: 6px; box-shadow: 0 1px 2px rgba(20, 8, 60, .25); }
.card.mini.trump { border-color: var(--gold-deep); box-shadow: 0 0 0 2px var(--gold); }
.card.mini.took { outline: 3px solid var(--gold-deep); box-shadow: 0 0 8px 2px rgba(255, 201, 60, .9); }
.minis { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; }
.review h3 { font-size: 18px; font-weight: 900; margin: 20px 0 6px; }
.review h2 { margin-bottom: 4px; }
.moments { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.moments li { background: var(--gold-soft); border-left: 6px solid var(--orange); border-radius: 12px; padding: 10px 12px; line-height: 2; }
.moments li p { line-height: 1.5; color: #4a4263; font-size: 15px; }
.moments.soft li { background: #f1ecfb; border-color: var(--violet); }
.cost { display: inline-block; background: var(--red); color: #fff; font-weight: 900; font-size: 13px; line-height: 1.4; padding: 1px 10px; border-radius: 99px; white-space: nowrap; }
.deal-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.books-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.books-list li { display: flex; align-items: flex-end; gap: 8px; background: #f6f2ff; border-radius: 12px; padding: 6px 10px; }
.books-list .bk { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 900; font-size: 13px; display: grid; place-items: center; align-self: center; flex: none; }
.books-list .pl { display: grid; justify-items: center; gap: 2px; }
.books-list .pl small { font-size: 10px; color: var(--muted); font-weight: 700; }
.legend { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 4px 0 10px; }
.key { display: inline-block; width: 14px; height: 18px; border-radius: 4px; background: #fff; margin-left: 6px; }
.key.both { outline: 3px solid var(--gold); } .key.lose { outline: 3px solid var(--red); } .key.suggest { outline: 2px dashed var(--ok); }
.lesson .hand.static.wide { row-gap: 10px; }

@keyframes talk { 0% { transform: scale(.4); opacity: 0; } 8% { transform: scale(1.08); opacity: 1; } 12% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 560px) {
  .deal-row { grid-template-columns: 1fr; gap: 2px; }
  .card.mini { --cw: 26px; }
  .talk { font-size: 12px; padding: 3px 9px; }
}

/* comfort settings */
body.big-cards { --cw: 64px; }
body.big-cards .hand .card { margin-left: -16px; }
body.big-cards .hand { padding-left: 16px; }
body.four-color .card.s-C, body.four-color .btn.suit.s-C { color: #12854a; }
body.four-color .card.s-D, body.four-color .btn.suit.s-D { color: #1667d9; }
.sample { margin-top: 8px; gap: 4px; display: flex; }

/* guided hand */
.guide { display: grid; gap: 4px; text-align: left; background: linear-gradient(135deg, rgba(76, 201, 240, .18), rgba(179, 136, 255, .18)); border: 2px solid var(--sky); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; }
.guide b { font-weight: 900; }
.guided-cta { border: 2px solid var(--sky); }
.sport { display: grid; gap: 4px; justify-items: center; margin: 6px 0; }
.coach li .minis { display: inline-flex; vertical-align: middle; }
.card.mini.marked { box-shadow: 0 0 0 3px var(--sky); }

/* progress */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: rgba(179, 136, 255, .12); border: 1px solid var(--line); }
.stat b { font-size: 24px; font-weight: 900; }
.stat span { font-weight: 700; }
.stat small { color: var(--muted, #6b6690); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 64px; margin: 6px 0 14px; }
.bars i { flex: 1; max-width: 22px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, var(--sky), var(--violet)); }
.drill-stats { list-style: none; padding: 0; margin: 6px 0 12px; display: grid; gap: 6px; }
.drill-stats li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tip.weak .btn { margin-top: 8px; display: inline-block; }
@media (max-width: 560px) {
  body.big-cards { --cw: 54px; }
  body.big-cards .hand .card { margin-left: -18px; }
  body.big-cards .hand { padding-left: 18px; }
}

/* ---------- cast, talk back, today's hand, pass and play, install ---------- */
.cast { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 14px 0; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(124, 92, 255, .08); }
.who .avatar { flex: none; }
.who b { display: block; }
.who small { display: block; opacity: .75; line-height: 1.3; }
.backtalk { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; }
.backtalk small { font-weight: 800; opacity: .7; text-transform: uppercase; letter-spacing: .6px; font-size: 11px; }
.backtalk .btn { font-size: 12.5px; }
.daily { border: 2px solid var(--gold); }
.streak { font-size: 13px; font-weight: 800; color: var(--orange); white-space: nowrap; }
.install img { border-radius: 18px; flex: none; box-shadow: 0 0 0 2px var(--gold); }
.passbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; opacity: .9; }
.hidden-hand { width: 100%; text-align: center; padding: 26px 12px; font-weight: 700; opacity: .7; }

/* card-room table: oval felt with a padded rim, big portraits, and a fanned hand read by its corners */
.card .pip { display: none; }
.felt {
  border: 0; border-radius: 50% / 44%; padding: 26px 30px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(ellipse at center, #1fb37f, var(--felt) 55%, #05583e);
  box-shadow: inset 0 0 0 3px rgba(255, 201, 60, .55), inset 0 0 46px rgba(0, 0, 0, .45), 0 0 0 12px #1a1030, 0 0 0 14px #4b3a86, 0 18px 34px rgba(5, 2, 25, .6);
  margin: 14px;
}
.felt .avatar { width: 58px; height: 58px; background: #fff; box-shadow: 0 0 0 3px #fff, 0 5px 10px rgba(0, 0, 0, .45); outline-offset: 3px; }
.felt .trick { --cw: 60px; padding-bottom: calc(var(--cw) * .4); }
.felt .trick .card { box-shadow: 0 5px 10px rgba(0, 0, 0, .4); }
.felt .slot.w .card { transform: rotate(-7deg); } .felt .slot.e .card { transform: rotate(7deg); }
.felt .slot.n .card { transform: rotate(3deg); } .felt .slot.s .card { transform: rotate(-3deg); }
.felt .slot .card.win { transform: none; }

.play .hand:not(.static) { --cw: 76px; padding: 10px 0 2px calc(var(--cw) * .54); row-gap: 10px; }
.play .hand:not(.static) .card {
  margin-left: calc(var(--cw) * -.54); position: relative; overflow: hidden; border-radius: 10px;
  align-items: flex-start; justify-content: flex-start; padding: 6px 0 0 6px; gap: 1px;
  box-shadow: -2px 3px 7px rgba(10, 4, 40, .4);
}
.play .hand:not(.static) .card .r { font-size: calc(var(--cw) * .33); letter-spacing: -1px; min-width: calc(var(--cw) * .3); text-align: center; }
.play .hand:not(.static) .card .s { font-size: calc(var(--cw) * .3); min-width: calc(var(--cw) * .3); text-align: center; }
.play .hand:not(.static) .card .jk { font-size: calc(var(--cw) * .16); }
.play .hand:not(.static) .card .pip { display: block; position: absolute; right: 7%; bottom: 5%; font-size: calc(var(--cw) * .7); opacity: .9; }
.play .hand:not(.static) button.card:not(:disabled):not([aria-disabled]):hover { transform: translateY(-14px); }
body.big-cards .play .hand:not(.static) { --cw: 88px; }
@media (max-width: 560px) {
  .felt { padding: 18px 14px; margin: 12px 10px; border-radius: 46% / 40%; }
  .felt .avatar { width: 46px; height: 46px; }
  .felt .trick { --cw: 48px; }
  .play .hand:not(.static) { --cw: 56px; padding-left: calc(var(--cw) * .56); }
  .play .hand:not(.static) .card { margin-left: calc(var(--cw) * -.56); padding: 4px 0 0 4px; }
  body.big-cards .play .hand:not(.static) { --cw: 62px; padding-left: calc(var(--cw) * .6); }
  body.big-cards .play .hand:not(.static) .card { margin-left: calc(var(--cw) * -.6); }
}

/* court cards and jokers carry a portrait; the corner index sits on a chip so it still reads */
.card.art:not(.mini) {
  background: #fdf3dc var(--art) 0 6% / 122% auto no-repeat; border-color: #b8860b;
  align-items: flex-start; justify-content: flex-start; padding: 3px 0 0 3px; gap: 0; overflow: hidden;
}
.card.art:not(.mini) .r, .card.art:not(.mini) .s, .card.art:not(.mini) .jk {
  background: rgba(255, 252, 240, .94); min-width: calc(var(--cw) * .34); text-align: center; text-shadow: none; letter-spacing: 0;
}
.card.art:not(.mini) .r { font-size: calc(var(--cw) * .3); border-radius: 5px 5px 0 0; padding-top: 2px; }
.card.art:not(.mini) .s { font-size: calc(var(--cw) * .28); border-radius: 0 0 5px 5px; padding-bottom: 2px; }
.card.art:not(.mini) .pip, .play .hand:not(.static) .card.art .pip { display: none; }
.card.joker.art:not(.mini) { color: #3a1d6e; }
.card.joker.art:not(.mini) .jk { font-size: calc(var(--cw) * .17); margin: 0; border-radius: 0 0 5px 5px; padding: 1px 2px 2px; }
.play .hand:not(.static) .card.art { padding: 4px 0 0 4px; gap: 0; }
.backs i { width: 12px; height: 30px; margin-left: -5px; background: #4b2a8a url(img/cards/back.jpg) center / cover; border: 1px solid #ffe9a8; }
/* room to spare on a wide screen: open the fan so the portraits show, and deal bigger cards to the table */
@media (min-width: 900px) {
  .felt .trick { --cw: 70px; }
  .play .hand:not(.static) { padding-left: calc(var(--cw) * .16); }
  .play .hand:not(.static) .card { margin-left: calc(var(--cw) * -.16); }
}

/* ---------- cards that move ---------- */
/* a played card slides in from the seat that played it and lands at that seat's tilt */
.felt .slot.n .card.pop { animation: from-n .32s cubic-bezier(.2, .9, .3, 1) both; }
.felt .slot.s .card.pop { animation: from-s .32s cubic-bezier(.2, .9, .3, 1) both; }
.felt .slot.w .card.pop { animation: from-w .32s cubic-bezier(.2, .9, .3, 1) both; }
.felt .slot.e .card.pop { animation: from-e .32s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes from-n { from { transform: translateY(-110px) rotate(-14deg) scale(.8); opacity: 0; } to { transform: rotate(3deg); opacity: 1; } }
@keyframes from-s { from { transform: translateY(130px) rotate(12deg) scale(1.15); opacity: 0; } to { transform: rotate(-3deg); opacity: 1; } }
@keyframes from-w { from { transform: translateX(-150px) rotate(-30deg) scale(.8); opacity: 0; } to { transform: rotate(-7deg); opacity: 1; } }
@keyframes from-e { from { transform: translateX(150px) rotate(30deg) scale(.8); opacity: 0; } to { transform: rotate(7deg); opacity: 1; } }
/* the finished book is swept to whoever won it */
.felt .trick.sweep .card { animation: none; transition: transform .4s ease-in, opacity .4s ease-in; opacity: 0; }
.felt .trick.sweep .note { transition: opacity .3s; opacity: 0; }
.felt .trick.sweep.to-n .card { transform: translateY(-130px) scale(.35) rotate(20deg); }
.felt .trick.sweep.to-s .card { transform: translateY(150px) scale(.35) rotate(-20deg); }
.felt .trick.sweep.to-w .card { transform: translateX(-170px) scale(.35) rotate(-25deg); }
.felt .trick.sweep.to-e .card { transform: translateX(170px) scale(.35) rotate(25deg); }
/* a new hand is dealt out one card at a time */
.play.dealing .hand .card { animation: dealin .32s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i, 0) * 38ms - var(--age, 0ms)); }
@keyframes dealin { from { transform: translateY(-150px) rotate(24deg) scale(.7); opacity: 0; } }

/* ---------- card art: aces, trim on the number cards, and a closer look ---------- */
.card.art, .card.art * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* number cards get a thin kente band top and bottom, in the colours of the card back */
.card:not(.art):not(.mini):not(.joker) {
  background:
    repeating-linear-gradient(90deg, #d99a1c 0 5px, #1b1630 5px 7px, #b3261e 7px 12px, #1b1630 12px 14px, #1e7d4f 14px 19px, #1b1630 19px 21px) top / 100% 4px no-repeat,
    repeating-linear-gradient(90deg, #1e7d4f 0 5px, #1b1630 5px 7px, #b3261e 7px 12px, #1b1630 12px 14px, #d99a1c 14px 19px, #1b1630 19px 21px) bottom / 100% 4px no-repeat,
    linear-gradient(160deg, #fffdf6, #f7efdc);
  border-color: #b8860b;
}
.zoom {
  position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px;
  background: rgba(12, 6, 36, .86); color: #fff; text-align: center; animation: slidein .18s ease-out;
}
.zoom img { max-width: min(78vw, 380px); max-height: 72vh; border-radius: 18px; border: 4px solid #ffe9a8; box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }
.zoom b { font-size: 22px; font-weight: 900; }
.zoom small { opacity: .75; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; max-width: 88vw;
  background: #1a1030; color: #fff; font-weight: 800; padding: 11px 18px; border-radius: 99px; box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}

/* ---------- you: name, picture, record ---------- */
.name { font: inherit; font-weight: 800; padding: 9px 14px; border-radius: 12px; border: 2px solid var(--line); width: min(100%, 220px); background: #fff; color: inherit; }
.name:focus { outline: 3px solid var(--violet); outline-offset: 1px; }
.faces { display: flex; flex-wrap: wrap; gap: 10px; }
.face { border: 0; padding: 0; background: none; border-radius: 50%; width: 62px; height: 62px; box-shadow: 0 0 0 3px var(--line); }
.face img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.face.on { box-shadow: 0 0 0 4px var(--violet), 0 0 0 7px var(--gold); }
.record { margin: 4px 0 12px; padding: 9px 14px; border-radius: 12px; background: var(--gold-soft); border: 1px solid var(--gold); }

/* ---------- large print, simple table ---------- */
body.simple { font-size: 19px; }
body.simple .btn { font-size: 19px; padding: 13px 20px; }
body.simple .btn.small { font-size: 17px; padding: 9px 16px; }
body.simple .prompt { font-size: 22px; }
body.simple .bid-row .btn { padding: 13px 4px; }
@media (max-width: 560px) { body.simple .bid-row .btn { font-size: 15px; padding: 16px 2px; white-space: nowrap; } }
body.simple .coach li { font-size: 18px; }
body.simple .scorebar .score b { font-size: 34px; }
body.simple .seat > b { font-size: 17px; }
body.simple .backtalk, body.simple .backs, body.simple .coach li:not(:first-child), body.simple .switch, body.simple .tip.suggest-note + .tip { display: none; }

/* ---------- online: a private table ---------- */
.online .join, .unlock .join { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.unlock input.unlock-code { width: min(100%, 15em); text-align: center; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: 17px; }
.unlock .perks { margin: 4px 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; font-weight: 700; }
.unlock .perks li::before { content: '✓ '; color: var(--ok); font-weight: 900; }
.unlock .unlockcode { font-size: clamp(20px, 6.2vw, 34px); letter-spacing: .08em; padding: 14px 10px; margin: 6px 0; width: 100%; }
input.code { width: 7.5em; text-align: center; text-transform: uppercase; letter-spacing: .25em; font-weight: 900; font-size: 18px; }
.warn { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 107, 107, .16); border: 1px solid rgba(255, 107, 107, .5); font-weight: 700; text-align: center; }
.tablecode { margin: 10px 0 14px; text-align: center; font-size: clamp(40px, 13vw, 68px); font-weight: 900; letter-spacing: .18em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); background: #ffe9a8; border-radius: 16px; padding: 14px 8px 14px calc(8px + .18em); user-select: all; }
.lobby h3 { margin: 18px 0 8px; font-size: 15px; }
.sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.sides > div { display: grid; gap: 8px; align-content: start; }
.sides > div > small { opacity: .7; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.who > span:nth-child(2) { flex: 1; min-width: 0; }
.who.open { background: none; border: 2px dashed rgba(128, 128, 128, .45); }
.who .plus { display: grid; place-items: center; width: 100%; height: 100%; font-size: 22px; font-weight: 900; opacity: .5; }
.houserules { margin: 0 0 14px; }
.houserules summary { cursor: pointer; font-weight: 700; }
.lobby .prompt { margin: 0; align-self: center; }
.play > .warn, .play > .away { margin: 0 0 8px; text-align: center; }
body.simple .tablecode { font-size: clamp(48px, 15vw, 80px); }
/* These sit straight on the dark table surround, not on a light panel. */
.play > .passbar > span:first-child, .play > .away.muted, .play > .warn { color: #f4efff; opacity: 1; }

/* ---------- reactions at a family table ---------- */
.reacts { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.reacts button { font-size: 24px; line-height: 1; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); cursor: pointer; transition: transform .12s; }
.reacts button:active { transform: scale(.86); }
.reacts button:focus-visible { outline: 3px solid var(--gold); }
body.simple .reacts button { width: 56px; height: 56px; font-size: 28px; }
.avatar { position: relative; }
.react { position: absolute; right: -14px; top: -16px; z-index: 7; font-size: 30px; line-height: 1; pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .4)); animation: react 2.2s ease-out both; }
@keyframes react { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 12% { transform: scale(1.35) rotate(8deg); opacity: 1; } 22% { transform: scale(1); } 80% { transform: translateY(-6px); opacity: 1; } 100% { transform: translateY(-22px); opacity: 0; } }

/* ---------- first visit ---------- */
.welcome { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 28px 18px; }
.welcome img { border-radius: 24px; box-shadow: 0 0 0 3px var(--gold); }
.welcome h2 { margin: 6px 0 0; font-size: 28px; }
.welcome p { margin: 0; }
.welcome .name { width: min(100%, 280px); font-size: 20px; text-align: center; padding: 12px 14px; }
.welcome .ask { margin-top: 10px; font-size: 18px; }
.welcome .paths { display: grid; gap: 10px; width: min(100%, 420px); }
.welcome .paths .btn { display: block; text-align: left; padding: 14px 16px; font-size: 18px; }
.welcome .paths .btn small { display: block; font-weight: 600; font-size: 14px; opacity: .8; margin-top: 2px; }
.welcome .small { font-size: 13px; }
.key { display: inline-block; min-width: 1.5em; text-align: center; padding: 0 5px; border: 1.5px solid currentColor; border-radius: 6px; font-weight: 800; }

@media (prefers-reduced-motion: reduce) { .react { animation-duration: .01s; animation-fill-mode: none; } }

/* Narrow phones: the side players' card backs are squeezed so both seats stay on the felt. */
@media (max-width: 430px) {
  .seat.w .backs i, .seat.e .backs i { width: 10px; margin-left: -6px; }
  .seat.w .backs, .seat.e .backs { padding-left: 6px; }
}

/* the buy button: gold, big, hard to miss */
.btn.buy { background: linear-gradient(135deg, var(--gold), var(--orange)); border-color: transparent; color: #3a2400; font-size: 19px; padding: 14px 26px; box-shadow: 0 5px 0 var(--gold-deep), 0 12px 26px rgba(255, 159, 28, .4); }
.btn.buy:active:not(:disabled) { box-shadow: 0 1px 0 var(--gold-deep); }
.unlock .btn.buy { width: min(100%, 22em); font-size: 21px; padding: 16px 20px; animation: buyglow 2.4s ease-in-out infinite; }
.shopbar { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; justify-content: center; width: 100%; border: 0; padding: 11px 16px; font-size: 17px; font-weight: 800; color: #3a2400; background: linear-gradient(135deg, var(--gold), var(--orange)); box-shadow: 0 3px 0 var(--gold-deep); cursor: pointer; }
.shopbar b { background: #fff; border-radius: 999px; padding: 3px 12px; }
.shopbar:hover { filter: brightness(1.05); }
@keyframes buyglow { 50% { box-shadow: 0 5px 0 var(--gold-deep), 0 0 0 8px rgba(255, 201, 60, .35); } }
@media (prefers-reduced-motion: reduce) { .unlock .btn.buy { animation: none; } }
.shopbar i { font-style: normal; }
.shopbar.slim { padding: 6px 12px; font-size: 15px; flex-wrap: nowrap; }
.shopbar.slim i { display: none; }

/* house rules, table looks and family touches */
.play .hand .card.facedown:not(.art):not(.mini):not(.joker) { background: #4b2a8a url(img/cards/back.jpg) center / cover; border-color: #ffe9a8; }
.saying { margin: 14px 0; padding: 12px 16px; border-left: 5px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--gold-soft); display: grid; gap: 4px; }
.saying small { text-transform: uppercase; letter-spacing: .8px; font-weight: 800; color: var(--gold-deep); }
.saying b { font-size: 1.15em; }
.record p { margin: 0; }
.record ul { margin: 6px 0 0; padding-left: 18px; }
.felt .plaque { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 800; letter-spacing: .6px; color: rgba(255, 255, 255, .5); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); pointer-events: none; }
.felt .trick { position: relative; }
body[data-theme='backyard'] { --felt: #c8372d; --felt-dark: #7d1810; }
body[data-theme='backyard'] .felt {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .2) 0 16px, transparent 16px 32px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .2) 0 16px, transparent 16px 32px),
    radial-gradient(ellipse at center, #e0564b, var(--felt) 55%, var(--felt-dark));
}
body[data-theme='kitchen'] { --felt: #a8672f; --felt-dark: #5e3513; }
body[data-theme='kitchen'] .felt {
  background:
    repeating-linear-gradient(92deg, rgba(60, 28, 6, .14) 0 3px, transparent 3px 22px),
    radial-gradient(ellipse at 50% 38%, rgba(255, 255, 255, .14), transparent 60%),
    radial-gradient(ellipse at center, #c98646, var(--felt) 55%, var(--felt-dark));
}
body[data-theme='porch'] { --felt: #2f6f9f; --felt-dark: #173f63; }
body[data-theme='porch'] .felt {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 26px),
    radial-gradient(ellipse at 50% 38%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(ellipse at center, #4b93c6, var(--felt) 55%, var(--felt-dark));
}
body[data-theme='reunion'] { --felt: #6a3fb0; --felt-dark: #371a6b; }
body[data-theme='reunion'] .felt {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 201, 60, .22), transparent 60%),
    radial-gradient(ellipse at center, #8a5fd0, var(--felt) 55%, var(--felt-dark));
}
body[data-theme='lights'] { --felt: #1fa83f; --felt-dark: #0b6a25; }
body[data-theme='lights'] .felt {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, .28), transparent 55%),
    radial-gradient(ellipse at center, #45d163, var(--felt) 55%, var(--felt-dark));
  box-shadow: 0 0 0 4px #f4c542, 0 0 0 7px #8a5a0a, 0 10px 28px rgba(60, 20, 120, .55);
}
body[data-theme='lights'] .felt .avatar { box-shadow: 0 0 0 2px #f4c542; }

/* ---------- polish pass: bigger players, a real rim, deal and big moments ---------- */

/* players: large portraits, a gold ring that glows on whoever's turn it is */
.felt { --av: clamp(60px, 9.5vh, 96px); position: relative; gap: 4px; padding-top: 18px; padding-bottom: 18px; }
.felt .avatar { width: var(--av); height: var(--av); outline-width: 4px; }
.felt .seat b { font-size: 15px; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); }
.felt .seat.turn .avatar { outline-color: #ffd54a; animation: ring 1.3s ease-in-out infinite; }
.felt .seat.talking .avatar { animation: nod .5s ease-in-out 2; }
@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #ffd54a, 0 0 14px 8px rgba(255, 201, 60, .55), 0 5px 10px rgba(0, 0, 0, .45); }
  50% { box-shadow: 0 0 0 3px #fff, 0 0 0 10px #ffd54a, 0 0 30px 16px rgba(255, 201, 60, .9), 0 5px 10px rgba(0, 0, 0, .45); }
}
@keyframes nod { 50% { transform: translateY(-4px) rotate(-3deg); } }
/* speech bubbles grow out of the face, with a tail pointing back at it */
.felt .talk {
  top: 2px; left: calc(50% + var(--av) / 2 + 8px); font-size: 15px; padding: 7px 13px; border-radius: 16px; max-width: min(48vw, 250px);
  transform-origin: 0 60%; box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 8px 18px rgba(0, 0, 0, .3);
}
.felt .talk::before { content: ''; position: absolute; left: -9px; top: 14px; border: 8px solid transparent; border-right-color: #fff; border-left-width: 0; }
.felt .seat.e .talk { left: auto; right: calc(50% + var(--av) / 2 + 8px); border-radius: 16px; transform-origin: 100% 60%; }
.felt .seat.e .talk::before { left: auto; right: -9px; border: 8px solid transparent; border-left-color: #fff; border-right-width: 0; }
.felt .seat.n .talk, .felt .seat.s .talk { z-index: 8; }
.felt .react { font-size: 38px; }

/* the table: a wooden rail round the cloth, a soft light from above, the crest in the middle */
.felt { --rim: 16px; --rim-a: #9a5a26; --rim-b: #4a2409; --rim-line: rgba(255, 214, 120, .65); margin: 20px 18px; box-shadow: inset 0 0 0 3px var(--rim-line), inset 0 0 0 5px rgba(0, 0, 0, .25), inset 0 0 52px rgba(0, 0, 0, .5), 0 24px 34px rgba(5, 2, 25, .6); }
.felt::before {
  content: ''; position: absolute; inset: calc(var(--rim) * -1); border-radius: inherit; padding: var(--rim); pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .38), transparent 22%, transparent 70%, rgba(0, 0, 0, .4)),
    repeating-linear-gradient(96deg, rgba(0, 0, 0, .13) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, var(--rim-a), var(--rim-b));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.felt::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse 62% 55% at 50% 44%, rgba(255, 250, 220, .2), transparent 70%), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .28));
}
.felt { z-index: 0; }
.felt::before, .felt::after { z-index: -1; }
.felt .trick::before {
  content: ''; position: absolute; inset: 50% auto auto 50%; width: calc(var(--cw) * 1.9); aspect-ratio: 1; transform: translate(-50%, -54%);
  background: url(img/logo-192.png) center / contain no-repeat; opacity: .15; filter: saturate(.5); pointer-events: none;
  -webkit-mask: radial-gradient(circle, #000 48%, transparent 70%); mask: radial-gradient(circle, #000 48%, transparent 70%);
}
body[data-theme='backyard'] .felt { --rim-a: #c9c2b4; --rim-b: #7d776a; --rim-line: rgba(255, 255, 255, .6); }
body[data-theme='kitchen'] .felt { --rim-a: #d9a25c; --rim-b: #7a4a1c; }
body[data-theme='porch'] .felt { --rim-a: #f4f1ea; --rim-b: #a9a59b; --rim-line: rgba(255, 255, 255, .7); }
body[data-theme='reunion'] .felt { --rim-a: #3b2466; --rim-b: #170b33; --rim-line: #f4c542; }
body[data-theme='lights'] .felt { --rim-a: #ffe07a; --rim-b: #b97d0e; --rim-line: #fff3b0; box-shadow: inset 0 0 0 3px var(--rim-line), inset 0 0 40px rgba(0, 60, 10, .45), 0 24px 34px rgba(60, 20, 120, .55); }
body[data-theme='lights'] .felt .avatar { box-shadow: 0 0 0 3px #f4c542, 0 5px 10px rgba(0, 0, 0, .45); }

/* cards: rounder corners, and the one you are about to play lifts off the fan */
.card { border-radius: 11px; }
.play .hand:not(.static) .card { border-radius: 12px; transition: transform .16s cubic-bezier(.2, .9, .3, 1.3), box-shadow .16s; }
.play .hand:not(.static) button.card:not(:disabled):not([aria-disabled]):hover,
.play .hand:not(.static) button.card:not(:disabled):not([aria-disabled]):focus-visible,
.play .hand:not(.static) button.card:not(:disabled):not([aria-disabled]):active { transform: translateY(-20px) scale(1.06); z-index: 5; box-shadow: 0 0 0 3px var(--gold), 0 18px 22px rgba(10, 4, 40, .55); }
.play .hand:not(.static) .card.suggest { transform: translateY(-10px); box-shadow: 0 12px 16px rgba(10, 4, 40, .45); }
.play .hand:not(.static) .card.off { filter: brightness(.72) saturate(.7); }
.play .hand .card.facedown:not(.art):not(.mini):not(.joker), .backs i { box-shadow: inset 0 0 0 1px rgba(60, 20, 0, .5), 0 2px 4px rgba(0, 0, 0, .35); }
.backs i { border-radius: 4px; }

/* card motion: cards travel from the seat that played them, and the deck deals out from the middle */
.felt .slot.n .card.pop, .felt .slot.s .card.pop, .felt .slot.w .card.pop, .felt .slot.e .card.pop { animation-duration: .42s; }
@keyframes from-n { from { transform: translateY(-170px) rotate(-18deg) scale(.6); opacity: .2; } 70% { opacity: 1; } to { transform: rotate(3deg); opacity: 1; } }
@keyframes from-s { from { transform: translateY(210px) rotate(14deg) scale(1.25); opacity: .2; } 70% { opacity: 1; } to { transform: rotate(-3deg); opacity: 1; } }
@keyframes from-w { from { transform: translateX(-230px) rotate(-34deg) scale(.6); opacity: .2; } 70% { opacity: 1; } to { transform: rotate(-7deg); opacity: 1; } }
@keyframes from-e { from { transform: translateX(230px) rotate(34deg) scale(.6); opacity: .2; } 70% { opacity: 1; } to { transform: rotate(7deg); opacity: 1; } }
.felt .trick.sweep .card { transition: transform .5s cubic-bezier(.5, 0, .8, .4), opacity .5s ease-in; }
.felt .trick.sweep.to-n .card { transform: translateY(-190px) scale(.3) rotate(24deg); }
.felt .trick.sweep.to-s .card { transform: translateY(220px) scale(.3) rotate(-24deg); }
.felt .trick.sweep.to-w .card { transform: translateX(-250px) scale(.3) rotate(-30deg); }
.felt .trick.sweep.to-e .card { transform: translateX(250px) scale(.3) rotate(30deg); }
.dealfly { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 4; }
.dealfly i {
  position: absolute; left: -22px; top: -31px; width: 44px; height: 62px; border-radius: 6px; opacity: 0;
  background: #4b2a8a url(img/cards/back.jpg) center / cover; border: 1px solid #ffe9a8; box-shadow: 0 3px 6px rgba(0, 0, 0, .4);
  animation: flick .42s ease-in both; animation-delay: calc(var(--i) * 62ms - var(--age, 0ms));
}
.dealfly i.n { --dx: 0px; --dy: -200px; } .dealfly i.s { --dx: 0px; --dy: 230px; }
.dealfly i.w { --dx: -260px; --dy: 0px; } .dealfly i.e { --dx: 260px; --dy: 0px; }
@keyframes flick { 0% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(200deg) scale(.6); } }
.play.dealing .hand .card { animation-duration: .4s; animation-delay: calc(var(--i, 0) * 55ms - var(--age, 0ms)); }

/* big moments */
.moment { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; text-align: center; padding: 20px; cursor: pointer; background: radial-gradient(ellipse at center, rgba(40, 14, 90, .82), rgba(8, 2, 28, .93)); animation: momentbg 2.6s ease both; }
.moment div { display: grid; gap: 10px; animation: momentin 2.6s cubic-bezier(.2, 1.3, .4, 1) both; }
.moment b {
  font-size: clamp(54px, 15vw, 150px); font-weight: 900; line-height: 1; letter-spacing: 1px; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6c9 0%, #ffd54a 38%, #e09b00 62%, #fff0a6 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #7a4a00) drop-shadow(0 0 26px rgba(255, 201, 60, .7));
}
.moment span { font-size: clamp(18px, 4vw, 30px); font-weight: 800; color: #fff3c4; text-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.moment.plain b { background: none; color: #d9d3ea; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .5)); font-size: clamp(44px, 11vw, 110px); }
.moment.plain span { color: #cfc8e2; }
@keyframes momentbg { 0% { opacity: 0; } 10%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes momentin { 0% { transform: scale(.2) rotate(-8deg); } 14% { transform: scale(1.12) rotate(2deg); } 22%, 85% { transform: none; } 100% { transform: scale(1.3); } }

/* pick your table */
.table-pick { display: grid; gap: 16px; margin: 16px 0; }
.pick-row { display: grid; gap: 6px; }
.pick-row > small { text-transform: uppercase; letter-spacing: .8px; font-weight: 900; color: var(--muted); font-size: 12px; }
.pick-row > em { font-style: normal; color: var(--muted); font-size: 14px; }
.pick-faces, .looks { display: flex; flex-wrap: wrap; gap: 12px; }
.pick { border: 0; background: none; padding: 4px; display: grid; justify-items: center; gap: 6px; width: 112px; border-radius: 16px; color: var(--muted); cursor: pointer; transition: transform .12s; }
.pick img { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #d8d0ea, 0 6px 12px rgba(20, 8, 60, .25); filter: saturate(.75); opacity: .78; transition: inherit; }
.pick b { font-size: 14px; line-height: 1.15; text-align: center; }
.pick:hover img { opacity: 1; filter: none; }
.pick.on { color: var(--ink); }
.pick.on img { opacity: 1; filter: none; transform: scale(1.06); box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--gold), 0 0 18px 4px rgba(255, 201, 60, .7), 0 6px 12px rgba(20, 8, 60, .3); }
.pick:focus-visible, .look:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.look { border: 0; background: none; padding: 4px; display: grid; justify-items: center; gap: 4px; width: 92px; color: var(--muted); cursor: pointer; border-radius: 12px; }
.look i { width: 76px; height: 48px; border-radius: 50% / 46%; background: radial-gradient(ellipse at 50% 35%, var(--l1), var(--l2)); box-shadow: 0 0 0 4px var(--l3), 0 4px 8px rgba(20, 8, 60, .3); }
.look b { font-size: 12px; line-height: 1.15; text-align: center; }
.look.on { color: var(--ink); }
.look.on i { box-shadow: 0 0 0 4px var(--l3), 0 0 0 7px var(--gold), 0 4px 8px rgba(20, 8, 60, .3); }
.look[data-look='classic'] { --l1: #1fb37f; --l2: #05583e; --l3: #6b3a16; }
.look[data-look='backyard'] { --l1: #e0564b; --l2: #8f231b; --l3: #a9a294; }
.look[data-look='kitchen'] { --l1: #c98646; --l2: #5e3513; --l3: #a8672f; }
.look[data-look='porch'] { --l1: #4b93c6; --l2: #173f63; --l3: #dcd8cf; }
.look[data-look='reunion'] { --l1: #8a5fd0; --l2: #371a6b; --l3: #2a1750; }
.look[data-look='lights'] { --l1: #45d163; --l2: #0b6a25; --l3: #f4c542; }
.btn.big { font-size: 20px; padding: 14px 30px; }
.more-toggle { margin-top: 14px; }

/* coach: the latest note, the rest on a tap */
.coach .more-notes { margin-top: 8px; }
body.simple .more-notes { display: none; }

@media (max-width: 560px) {
  .felt { --av: clamp(50px, 8vh, 64px); --rim: 11px; margin: 16px 12px; padding-top: 14px; padding-bottom: 14px; }
  .felt .avatar { width: var(--av); height: var(--av); outline-width: 3px; }
  .felt .seat b { font-size: 13px; }
  .felt .talk { font-size: 13px; padding: 5px 10px; max-width: 44vw; }
  .dealfly i.w { --dx: -140px; } .dealfly i.e { --dx: 140px; } .dealfly i.n { --dy: -150px; } .dealfly i.s { --dy: 170px; }
  .pick { width: 96px; } .pick img { width: 78px; height: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  .felt .seat.turn .avatar, .felt .seat.talking .avatar { animation: none; box-shadow: 0 0 0 3px #fff, 0 0 0 8px #ffd54a, 0 0 18px 8px rgba(255, 201, 60, .7); }
  .moment, .moment div { animation-name: momentbg; }
  .dealfly { display: none; }
}

/* top and bottom seats sit sideways (face in the middle, name beside it) so big portraits do not make the table taller */
.felt { grid-template-areas: 'n n n' 'w t e' 's s s'; }
.felt .seat.n, .felt .seat.s { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 12px; row-gap: 3px; width: 100%; align-content: center; justify-items: start; }
.felt .seat.n > .avatar, .felt .seat.s > .avatar { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
.felt .seat.n > :not(.avatar):not(.talk), .felt .seat.s > :not(.avatar):not(.talk) { grid-column: 3; }
.felt .trick { padding-bottom: calc(var(--cw) * .2); }

/* Phones with a camera cut-out or a home bar: keep the header and the last row clear of them. */
.top { padding-top: calc(14px + env(safe-area-inset-top)); }
body { padding-bottom: env(safe-area-inset-bottom); }

/* Touch screens have no hover: without this the spot you last tapped keeps a card lifted. */
@media (hover: none) {
  button.card:not(:disabled):not([aria-disabled]):hover,
  .play .hand:not(.static) button.card:not(:disabled):not([aria-disabled]):hover { transform: none; z-index: auto; box-shadow: 0 2px 4px rgba(20, 8, 60, .28); }
}
