/* Le République — card-room felt. Desktop only; the table is laid out for ~1100px and up. */
:root {
  --felt-1: #2f7a4a;
  --felt-2: #1d4f30;
  --ink: #eef6ee;
  --red: #c62828;
  --gold: #c9a227;
  --cream: #f7f1dc;
  --yellow: #ffd54f;
  --label: #ffe082;
  --jester: #5b2a86;
  --card-w: 62px;
  --card-h: 86px;
  --peek: 36px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.felt-page {
  background: #161a17;
  color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-width: 1100px;
}
button { font: inherit; }
h1, h2 { margin: 0; font-weight: 700; }

/* ---------------------------------------------------------- panels: login, home */
.panel {
  background: radial-gradient(ellipse at center, var(--felt-1), var(--felt-2));
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(201, 162, 39, .35);
  padding: 28px 32px;
}
.panel.home, .panel.login { width: 440px; margin: 10vh auto; display: flex; flex-direction: column; gap: 14px; }
.panel h1 { font-family: Georgia, "Times New Roman", serif; font-size: 34px; letter-spacing: .01em; color: var(--cream); }
.sub { margin: -6px 0 4px; opacity: .8; }
.box { background: rgba(0, 0, 0, .18); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.box h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.field, .login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input[type=text], input[type=password], input:not([type]) {
  font: inherit; padding: 9px 11px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .25); color: var(--ink); outline: none;
}
input:focus { border-color: var(--yellow); }
#code { width: 120px; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; }
.modes { display: flex; gap: 18px; }
.radio { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.err { color: #ffab91; min-height: 1em; margin: 0; }
.btn {
  border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; font-weight: 700;
  background: rgba(255, 255, 255, .14); color: var(--ink);
}
.btn:hover { background: rgba(255, 255, 255, .22); }
.btn.primary { background: var(--yellow); color: #222; }
.btn.primary:hover { background: #ffe082; }
.btn[disabled] { opacity: .65; cursor: default; }
.home .btn.primary, .login .btn.primary { align-self: flex-start; }

/* ---------------------------------------------------------- the table */
.tbl {
  position: relative;
  max-width: 1180px;
  margin: 14px auto;
  border-radius: 16px;
  padding: 12px 18px 10px;
  background: radial-gradient(ellipse at center, var(--felt-1), var(--felt-2));
  box-shadow: 0 10px 40px rgba(0, 0, 0, .55), inset 0 0 0 3px rgba(0, 0, 0, .2);
}
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; padding: 4px 2px; opacity: .92; }
.bar > span { flex: 1; }
.bar > span:nth-child(2) { text-align: center; }
.bar > span:last-child { text-align: right; }
.bar .who { font-weight: 700; }
.bar .turn { font-weight: 700; color: var(--label); }
.bar .away { font-style: normal; font-weight: 400; opacity: .75; }
.bar .code { opacity: .7; letter-spacing: .04em; }

.hand { display: flex; gap: 8px; justify-content: center; padding: 6px 0; min-height: 68px; }
.hand.opp { gap: 5px; min-height: 64px; }
.hand.mine { min-height: 124px; padding-top: 14px; }

/* cards */
.card {
  width: var(--card-w); height: var(--card-h); border-radius: 6px; position: relative; flex: none;
  user-select: none;
}
.card.face { background: #fff; color: #111; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.card.face.red { color: var(--red); }
.card .corner { position: absolute; left: 5px; top: 3px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.card .corner b { font-size: 16px; font-weight: 700; letter-spacing: -.04em; }
.card .corner i { font-style: normal; font-size: 14px; margin-top: 1px; }
.card .corner.br { left: auto; top: auto; right: 5px; bottom: 3px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; padding-top: 6px; }
.card.back {
  background: repeating-linear-gradient(45deg, #7b1e1e 0 4px, #9a2a2a 4px 8px);
  border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.card.slot { border: 2px dashed #d7efdc; background: rgba(0, 0, 0, .1); opacity: .5; }
/* Empty slots beyond a side's cards show as strips, one per slot still open. */
.card.slot.strip { height: calc(var(--peek) - 6px); border-radius: 5px; }
.stack.bottom .card.slot.strip { margin-top: 6px; }
.stack.top .card.slot.strip { margin-bottom: 6px; }
.hand.opp .card { width: 40px; height: 56px; border-width: 2px; }
.hand.mine .card { width: 74px; height: 104px; }
.hand.mine .card .corner b { font-size: 19px; }
.hand.mine .card .corner i { font-size: 16px; }
.hand.mine .card .pip { font-size: 38px; }
.hand.mine .card.pickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.hand.mine .card.pickable:hover { transform: translateY(-4px); }
.hand.mine .card.sel, .hand.mine .card.sel:hover { transform: translateY(-14px); box-shadow: 0 0 0 3px var(--yellow), 0 6px 14px rgba(0, 0, 0, .5); }
body:not([data-turn=me]) .hand.mine .card { filter: saturate(.85) brightness(.96); }

/* lanes */
.lanes { display: grid; grid-template-columns: repeat(6, 1fr) 96px; gap: 10px; padding: 4px 0; }
.lane {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; border-radius: 10px;
  transition: background .15s ease, opacity .15s ease;
}
.lane.playable { cursor: pointer; background: rgba(255, 213, 79, .08); box-shadow: inset 0 0 0 1px rgba(255, 213, 79, .35); }
.lane.playable:hover { background: rgba(255, 213, 79, .18); }
.lane.full { opacity: .45; cursor: not-allowed; }
.hl { height: 16px; font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--label); }
.stack { display: flex; flex-direction: column; align-items: center; }
.stack .card.face + .card.face { margin-top: calc(var(--peek) - var(--card-h)); }
.card.fresh { animation: fresh 1.8s ease-out; }
@keyframes fresh {
  0%, 60% { box-shadow: 0 0 0 3px var(--yellow), 0 0 18px 4px rgba(255, 213, 79, .7); }
  100% { box-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
}

.royal-slot { position: relative; margin: 6px 0; }
.royal {
  width: 80px; height: 110px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--cream); color: #111; border: 3px solid var(--gold); box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  position: relative; z-index: 2; transition: none;
}
.royal b { font-family: Georgia, "Times New Roman", serif; font-size: 32px; line-height: 1; }
.royal i { font-style: normal; font-size: 22px; line-height: 1; }
.royal .red { color: var(--red); }
.royal .jest { color: var(--jester); }
.royal i.name { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.royal .pts { font-size: 11px; opacity: .7; }

/* reveal */
.lane.rv .hl { color: #fff; }
.lane.won-bottom .stack.bottom .card.face, .lane.won-top .stack.top .card.face { box-shadow: 0 0 0 2px var(--yellow), 0 0 14px 2px rgba(255, 213, 79, .65); }
.lane.won-bottom .hl.bottom, .lane.won-top .hl.top { color: var(--yellow); }
.lane.won-bottom .royal { transform: translateY(16px) scale(.92); }
.lane.won-top .royal { transform: translateY(-16px) scale(.92); }
.lane.won-bottom .royal, .lane.won-top .royal { box-shadow: 0 0 0 2px var(--yellow), 0 4px 16px rgba(0, 0, 0, .5); z-index: 3; }
.lane.dead .stack, .lane.dead .hl { filter: grayscale(1); opacity: .5; }
.lane.dead .royal { opacity: .12; filter: grayscale(1); }
.tag {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #444; color: #fff; border: 1px solid #888; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 7px; border-radius: 4px; white-space: nowrap;
}

/* draw pile */
.pile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-left: 1px dashed rgba(207, 232, 212, .35); padding-left: 10px; }
.deck { position: relative; width: 64px; height: 90px; margin-top: 12px; }
.deck .card { position: absolute; width: 58px; height: 82px; }
.pl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.pn { font-size: 14px; font-weight: 700; }

/* match tally */
.tally { display: flex; gap: 18px; align-items: stretch; padding: 8px 12px; margin-bottom: 4px; border-radius: 9px; background: rgba(0, 0, 0, .18); font-size: 12px; }
.tl { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tcap { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.trow { display: grid; grid-template-columns: 90px 1fr 32px; align-items: center; gap: 10px; }
.tn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt { font-size: 17px; font-weight: 700; text-align: right; }
.track { position: relative; height: 18px; border-radius: 4px; background: rgba(127, 127, 127, .25); display: flex; }
.seg { height: 100%; display: flex; align-items: center; padding-left: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; flex: none; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg + .seg { border-left: 1px solid rgba(0, 0, 0, .35); }
.seg.o { background: var(--red); color: #fff; }
.seg.o.alt { background: #e05252; }
.seg.y { background: var(--yellow); color: #222; }
.seg.y.alt { background: #ffe58f; }
.goal { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed #fff; }
.goal span { position: absolute; left: 4px; top: -3px; font-size: 10px; font-weight: 700; }
.histwrap { align-self: center; }
.hist { border-collapse: collapse; font-size: 11px; }
.hist th, .hist td { padding: 2px 6px; text-align: left; white-space: nowrap; }
.hist th { font-size: 10px; opacity: .75; font-weight: 400; }
.hist tr.now td { font-style: italic; opacity: .8; }
.chip { display: inline-block; margin-left: 3px; padding: 0 3px; border-radius: 3px; font-size: 10px; font-weight: 700; border: 1px solid currentColor; }
.chip.red { color: #ff8a80; }
.chip sub { font-size: 8px; opacity: .7; margin-left: 1px; }

/* overlays: waiting room, pause, results */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 10; }
.overlay .panel { pointer-events: auto; }
.result.panel {
  min-width: 380px; max-width: 520px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  background: rgba(14, 38, 23, .94); backdrop-filter: blur(2px);
  box-shadow: 0 12px 50px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(201, 162, 39, .55);
}
.result h2 { font-family: Georgia, "Times New Roman", serif; font-size: 26px; color: var(--cream); }
.result .detail { margin: 0; opacity: .85; }
.result .dim { opacity: .6; }
.result .link { width: 300px; }
.pts-line { display: flex; gap: 8px; align-items: center; width: 100%; }
.pts-line span:first-child { width: 110px; font-weight: 700; }
.pts-line .tot { margin-left: auto; font-size: 18px; font-weight: 700; }
.choice { display: flex; gap: 0; }
.seg-btn { border-radius: 0; }
.seg-btn:first-child { border-radius: 8px 0 0 8px; }
.seg-btn:last-child { border-radius: 0 8px 8px 0; }
.seg-btn.on { background: var(--cream); color: #222; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #222; color: #fff; padding: 9px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the end-of-round panel sits where your hand was, so the revealed board stays in view */
.hand.mine.strip { padding: 8px 0 4px; }
.strip-panel.result.panel {
  max-width: none; min-width: 0; width: min(820px, 100%); padding: 14px 22px;
  display: grid; grid-template-columns: 1fr auto; column-gap: 24px; row-gap: 6px; align-items: center;
}
.strip-panel > h2 { grid-column: 1 / -1; font-size: 22px; }
.strip-panel > .btn, .strip-panel > .choice { grid-column: 2; justify-self: end; }
.strip-panel > .pts-line, .strip-panel > .detail { grid-column: 1; }
.strip-panel .pts-line span:first-child { width: 90px; }
.strip-panel .pts-line .tot { margin-left: 18px; }

.result.waiting { position: relative; }
.close {
  position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; opacity: .75;
}
.close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* ---------------------------------------------------------- whose turn */
.pill { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .03em; vertical-align: 1px; }
.pill.me { background: var(--yellow); color: #222; animation: pillPulse 1.4s ease-in-out infinite; }
.pill.opp { background: rgba(198, 40, 40, .9); color: #fff; }
@keyframes pillPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 213, 79, .7); } 50% { box-shadow: 0 0 0 6px rgba(255, 213, 79, 0); } }
.tbl.turn-me { box-shadow: 0 10px 40px rgba(0, 0, 0, .55), 0 0 0 3px var(--yellow), 0 0 26px 2px rgba(255, 213, 79, .35); }
.tbl.turn-me .bar.bottom .turn { font-size: 16px; }
.tbl.turn-opp .hand.opp .card { box-shadow: 0 0 0 2px rgba(255, 138, 128, .55), 0 1px 3px rgba(0, 0, 0, .45); }

/* ---------------------------------------------------------- drag and drop */
.hand.mine .card.pickable { touch-action: none; }
.hand.mine .card.dragging { opacity: .25; }
.card.ghost { position: fixed; z-index: 200; width: 74px; height: 104px; pointer-events: none; transform: rotate(-4deg); box-shadow: 0 14px 30px rgba(0, 0, 0, .55); }
.card.ghost .pip { font-size: 38px; }
.lane.drop-target { background: rgba(255, 213, 79, .28); box-shadow: inset 0 0 0 2px var(--yellow); }

/* ---------------------------------------------------------- top toolbar */
.topbar { max-width: 1180px; margin: 10px auto 0; display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.topbar .brand { font-family: Georgia, "Times New Roman", serif; font-size: 18px; color: var(--cream); }
.tools { display: flex; gap: 8px; align-items: center; }
.btn.ghostly { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); }
#sound-volume { width: 110px; accent-color: var(--yellow); }
#sound-volume:disabled { opacity: .4; }
.panel.home { margin-top: 6vh; }

/* ---------------------------------------------------------- modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 300; }
.modal.panel { position: relative; width: 780px; max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { font-family: Georgia, "Times New Roman", serif; font-size: 26px; color: var(--cream); }
.modal h3 { margin: 6px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--label); }
.modal p { margin: 4px 0; line-height: 1.5; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.royal-row { display: flex; gap: 8px; margin: 6px 0; }
.royal-row .royal { width: 58px; height: 80px; border-width: 2px; }
.royal-row .royal b { font-size: 22px; }
.royal-row .royal i { font-size: 15px; }
.royal-row .royal i.name { font-size: 8px; }
.royal-row .royal .pts { font-size: 9px; }
.hands-table, .points-table { border-collapse: collapse; width: 100%; }
.hands-table th, .points-table th { text-align: left; font-size: 11px; font-weight: 600; opacity: .7; padding: 4px 8px; }
.hands-table td { padding: 7px 8px; border-top: 1px solid rgba(255, 255, 255, .1); vertical-align: middle; }
.hands-table .rank { font-size: 18px; font-weight: 800; color: var(--yellow); width: 28px; }
.hands-table .what { font-size: 11px; opacity: .75; }
.mini-hand { display: flex; gap: 3px; }
.card.mini { width: 34px; height: 48px; border-radius: 4px; }
.card.mini .corner { left: 3px; top: 2px; }
.card.mini .corner b { font-size: 11px; }
.card.mini .corner i { font-size: 10px; }
.card.mini .corner.br { display: none; }
.card.mini .pip { font-size: 16px; padding-top: 10px; }
.meter { width: 120px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .15); margin-bottom: 3px; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--yellow); }
.points-table td, .points-table th { text-align: center; padding: 4px 6px; }
.points-table td { font-weight: 800; font-size: 15px; color: var(--yellow); }

/* ---------------------------------------------------------- end of round */
.score-table { grid-column: 1; border-collapse: collapse; font-size: 13px; }
.score-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; opacity: .7; text-align: left; padding: 2px 10px 2px 0; }
.score-table td { padding: 3px 12px 3px 0; }
.score-table .nm { font-weight: 700; min-width: 90px; }
.score-table .lanes-won, .score-table .points-won, .score-table .tot { font-size: 17px; font-weight: 800; }
.score-table .tot { color: var(--yellow); }
.strip-panel > .offer-banner { grid-column: 1 / -1; }
.offer-banner { margin: 0; font-size: 18px; font-weight: 800; color: var(--yellow); animation: offerIn .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes offerIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.result.offer { animation: offerGlow 1.1s ease-in-out infinite; }
@keyframes offerGlow {
  0%, 100% { box-shadow: 0 12px 50px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(201, 162, 39, .55); }
  50% { box-shadow: 0 12px 50px rgba(0, 0, 0, .6), inset 0 0 0 3px var(--yellow), 0 0 30px 6px rgba(255, 213, 79, .5); }
}
.btn.pulse { animation: btnPulse 1s ease-in-out infinite; }
@keyframes btnPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 213, 79, .8); } 50% { box-shadow: 0 0 0 9px rgba(255, 213, 79, 0); } }

.rules-link { margin: -4px 0 2px; font-size: 13px; opacity: .9; }
.linkish { background: none; border: 0; padding: 0; color: var(--yellow); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
