/* Craps demo. Classes use the cr- prefix; shared table pieces come from /demos/_tables/table.css (tb-). */

.cr-screen { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 16px; align-items: start; padding: 12px 16px 14px; }
.cr-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cr-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ---------- the table ---------- */
.cr-tablewrap { position: relative; padding-top: 8px; }
.cr-trayhost { position: absolute; z-index: 5; top: 0; left: 57%; transform: translateX(-50%); }
.cr-trayhost .tb-tray-col { width: 15px; height: 30px; }
.cr-table { --rail: 24px; }
.cr-felt { overflow: visible; }
.cr-board { position: relative; width: 100%; aspect-ratio: 1220 / 520; --chip: 28px; --ds: 34px; user-select: none; -webkit-user-select: none; }
.cr-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }

/* printed felt */
.cr-ln { fill: none; stroke: rgba(255, 255, 255, .74); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.cr-ln.thin { stroke: rgba(255, 255, 255, .42); stroke-width: 1.2px; }
.cr-ln.cr-area { fill: rgba(0, 0, 0, .04); }
.cr-ln.cr-ring { stroke: rgba(240, 210, 140, .9); stroke-width: 1.6px; }
.cr-wall-edge { stroke: #6e4a27; stroke-width: 3px; vector-effect: non-scaling-stroke; }
.cr-t { font-family: Inter, system-ui, sans-serif; font-weight: 900; fill: var(--tb-ink); text-transform: uppercase; }
.cr-t.cr-big { fill: rgba(250, 248, 240, .92); }
.cr-t.cr-mid { font-weight: 800; fill: var(--tb-ink); }
.cr-t.cr-small { font-family: 'IBM Plex Mono', monospace; font-weight: 600; fill: var(--tb-chalk); }
.cr-t.cr-red { fill: #f0524f; letter-spacing: .2em; }
.cr-t.cr-gold { fill: #f3cf74; }
.cr-t.cr-num { fill: #fbf6e6; font-weight: 900; }
.cr-t.cr-fnum { fill: #fbf6e6; font-weight: 800; }
.cr-pd { fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .8); stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.cr-pp { fill: rgba(255, 255, 255, .92); }

/* hot areas (click targets laid over the print) */
.cr-hots { position: absolute; inset: 0; z-index: 2; }
.cr-hot { position: absolute; border-radius: 6px; cursor: pointer; outline: none; transition: background .18s, box-shadow .18s; }
.cr-hot:hover, .cr-hot:focus-visible { background: rgba(255, 228, 160, .09); box-shadow: inset 0 0 0 2px rgba(255, 214, 130, .55); }
.cr-hot.closed { cursor: not-allowed; }
.cr-hot.closed:hover { background: rgba(0, 0, 0, .12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14); }
.cr-hot.win { background: rgba(53, 227, 154, .16); box-shadow: inset 0 0 0 2px rgba(53, 227, 154, .9), 0 0 26px rgba(53, 227, 154, .35); animation: crwin 1s ease-out; }
.cr-hot.lose { background: rgba(255, 90, 110, .12); box-shadow: inset 0 0 0 2px rgba(255, 90, 110, .65); }
.cr-hot.push { background: rgba(230, 233, 239, .1); box-shadow: inset 0 0 0 2px rgba(230, 233, 239, .6); }
@keyframes crwin { 0% { background: rgba(53, 227, 154, .4); } }
.cr-board.locked .cr-hot { pointer-events: none; }
.cr-oz { display: grid; place-items: center; border-radius: 999px; border: 2px dashed transparent; opacity: 0; transition: opacity .25s, border-color .25s; z-index: 3; }
.cr-oz span { font: 700 9px 'IBM Plex Mono', monospace; letter-spacing: .14em; color: rgba(255, 220, 140, .9); background: rgba(5, 20, 12, .7); padding: 1px 5px; border-radius: 4px; transform: translateY(calc(var(--chip) * -.15)); }
.cr-oz.avail { opacity: 1; border-color: rgba(255, 214, 120, .75); animation: croz 2s ease-in-out infinite; }
.cr-oz.avail:hover { background: rgba(255, 214, 120, .14); box-shadow: none; }
.cr-oz.live:not(.avail) span { display: none; }
@keyframes croz { 50% { border-color: rgba(255, 214, 120, .35); } }

/* chip piles */
.cr-piles { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.cr-board .cr-pile { position: absolute; width: var(--chip); height: var(--chip); transform: translate(-50%, -50%); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; --ct: calc(var(--chip) * .11); }
.cr-board .cr-pile .tb-pile { flex: none; }
.cr-board .cr-pile .tb-stack-amt { position: absolute; top: calc(100% + 1px); left: 50%; transform: translateX(-50%); margin: 0; font-size: 9.5px; padding: 0 5px; line-height: 1.4; }
.cr-board .cr-pile.new .tb-stack-amt { border-color: var(--you); color: var(--you); }
.cr-board .cr-pile.odds { z-index: 2; }

/* puck */
.cr-puck { position: absolute; z-index: 5; width: calc(var(--chip) * 1.35); height: calc(var(--chip) * 1.35); transform: translate(-50%, -50%); perspective: 300px; pointer-events: none;
  transition: left .75s cubic-bezier(.3, .7, .25, 1), top .75s cubic-bezier(.3, .7, .25, 1); }
.cr-puck i { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 900 calc(var(--chip) * .34) Inter, sans-serif; letter-spacing: .04em; font-style: normal; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .6s cubic-bezier(.3, .7, .25, 1); box-shadow: 0 4px 8px rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(0, 0, 0, .25); }
.cr-puck .off { background: radial-gradient(circle at 40% 35%, #3a3d45, #101114 70%); color: #f4f1ea; border: 2px solid #f4f1ea; }
.cr-puck .on { background: radial-gradient(circle at 40% 35%, #ffffff, #dcd8cf 75%); color: #111; border: 2px solid #111; transform: rotateY(180deg); }
.cr-puck.is-on .off { transform: rotateY(-180deg); }
.cr-puck.is-on .on { transform: rotateY(0deg); }

/* dice */
.cr-dice { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.cr-dwrap { position: absolute; width: var(--ds); height: var(--ds); margin: calc(var(--ds) / -2) 0 0 calc(var(--ds) / -2); }
.cr-dwrap .tb-die { --ds: inherit; }
.cr-shooter { position: absolute; width: 1px; height: 1px; pointer-events: none; }
.cr-wallhit { position: absolute; z-index: 1; pointer-events: none; opacity: 0; }
.cr-wallhit.x { right: 0; top: 0; bottom: 0; width: 2.62%; background: linear-gradient(90deg, rgba(255, 230, 170, .5), transparent); }
.cr-wallhit.y { left: 0; right: 0; top: 0; height: 2.72%; background: linear-gradient(0deg, rgba(255, 230, 170, .5), transparent); }
.cr-wallhit.hit { animation: crhit .5s ease-out; }
@keyframes crhit { 0% { opacity: 1; } 100% { opacity: 0; } }
.cr-total { position: absolute; z-index: 8; transform: translate(-50%, -50%) scale(.8); opacity: 0; display: flex; flex-direction: column; align-items: center; padding: 5px 12px 6px; border-radius: 12px; background: rgba(6, 10, 8, .82); border: 1px solid rgba(255, 255, 255, .18); pointer-events: none; transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .3, 1.3); }
.cr-total.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cr-total b { font: 900 26px/1 Inter, sans-serif; color: #fff; letter-spacing: -.02em; }
.cr-total small { font: 600 9.5px 'IBM Plex Mono', monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--s-dim); margin-top: 2px; white-space: nowrap; }
.cr-total.good { border-color: var(--tb-win); } .cr-total.good small { color: var(--tb-win); }
.cr-total.bad { border-color: var(--tb-lose); } .cr-total.bad small { color: var(--tb-lose); }

/* hover tip on the felt */
.cr-tip { position: absolute; z-index: 9; transform: translate(-50%, calc(-100% - 6px)); display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 9px; background: rgba(8, 10, 12, .94); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .8);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; font-size: 12px; }
.cr-tip.below { transform: translate(-50%, 6px); }
.cr-tip.show { opacity: 1; }
.cr-tip b { font-weight: 800; color: #fff; }
.cr-tip span { font: 600 11.5px 'IBM Plex Mono', monospace; color: var(--you); }
.cr-tip em { font-style: normal; font-size: 11px; color: var(--tb-lose); }
.cr-tip em.ok { color: var(--s-dim); }

/* ---------- controls ---------- */
.cr-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: var(--s-panel); border: 1px solid var(--s-line); }
.cr-rack .tb-rchip { --chip: 46px; }
.cr-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-go { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cr-newbets { display: flex; flex-direction: column; align-items: flex-end; }
.cr-newbets small { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--s-dim); }
.cr-newbets b { font-size: 18px; font-weight: 700; }
.cr-roll { min-width: 136px; }
.cr-roll.wait { filter: saturate(.35) brightness(.8); }

/* ---------- lower row ---------- */
.cr-lower { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: stretch; }
.cr-paycard { padding: 10px 14px 8px; }
.cr-prs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 18px; grid-auto-flow: column; grid-template-rows: repeat(5, auto); }
.cr-pr { padding: 4px 6px; margin: 0 -6px; font-size: 12px; align-items: baseline; }
.cr-pr + .cr-pr { box-shadow: none; }
.cr-prs .cr-pr { border-top: 1px solid var(--s-line); }
.cr-pr span { white-space: nowrap; }
.cr-pr b { font-size: 11.5px; display: flex; gap: 10px; align-items: baseline; text-align: right; }
.cr-pr b em { font-style: normal; min-width: 50px; text-align: right; color: var(--s-dim); font-weight: 500; }
.cr-pr.on b em { color: var(--you); }
.cr-pr.off span, .cr-pr.off b { color: var(--s-faint); }
.cr-fair .tb-fair { padding: 10px 12px; gap: 7px; }

/* ---------- side ---------- */
.cr-now { position: relative; padding: 12px 14px 12px; border-left: 3px solid var(--you); transition: border-color .2s; min-height: 148px; }
.cr-now.hover { border-left-color: #7fd6ff; }
.cr-now.bad { border-left-color: var(--tb-lose); }
.cr-now-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cr-phase { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #20232c; border: 1px solid var(--s-line); font: 700 10.5px 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--s-text); }
.cr-phase::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #111; box-shadow: 0 0 0 1.5px #f4f1ea; }
.cr-phase.on::before { background: #fff; box-shadow: 0 0 0 1.5px #111, 0 0 0 3px #fff; }
.cr-now h4 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.cr-now.bad h4 { color: #ffb3bd; }
.cr-now p { font-size: 12.5px; line-height: 1.5; color: var(--s-dim); }
.cr-now-f { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 11.5px; color: var(--s-dim); }
.cr-now-f:empty { display: none; }
.cr-now-f b { color: var(--s-text); font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.cr-now-f .yes { color: var(--tb-win); } .cr-now-f .no { color: var(--tb-lose); }
.cr-ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.cr-ph-r { font-size: 11px; color: var(--s-dim); white-space: nowrap; }
.cr-worklist { display: flex; flex-direction: column; max-height: 236px; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.cr-wrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; padding: 6px 0; border-top: 1px solid var(--s-line); animation: dkfeed .35s cubic-bezier(.2, .9, .3, 1); }
.cr-wrow:first-child { border-top: 0; }
.cr-wn { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-wn i { font-style: normal; font-size: 10.5px; color: var(--you); font-weight: 600; }
.cr-wrow b { font-size: 12.5px; text-align: right; }
.cr-wrow small { font-size: 11px; color: var(--s-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-st { font-style: normal; justify-self: end; font: 700 9.5px 'IBM Plex Mono', monospace; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; background: rgba(53, 227, 154, .12); color: var(--tb-win); }
.cr-st.off { background: rgba(255, 255, 255, .06); color: var(--s-dim); }
.cr-st.new { background: rgba(255, 178, 30, .14); color: var(--you); }
.cr-st.one { background: rgba(127, 214, 255, .1); color: #8fd8ff; }
.cr-wrow.off .cr-wn, .cr-wrow.off b { color: var(--s-dim); }
.cr-empty { font-size: 12px; color: var(--s-faint); padding: 4px 0 6px; line-height: 1.45; }
.cr-hist { display: flex; flex-wrap: wrap; gap: 5px; min-height: 44px; }
.cr-hr { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 34px; padding: 4px 0 4px; border-radius: 7px; background: var(--s-panel2); border: 1px solid var(--s-line); border-top: 2px solid #3a3f4c; animation: dkfeed .35s cubic-bezier(.2, .9, .3, 1); }
.cr-hr b { font: 800 13px/1 Inter, sans-serif; }
.cr-hr i { display: flex; gap: 2px; }
.cr-md { width: 10px; height: 10px; display: block; }
.cr-md rect { fill: #e9e6de; } .cr-md circle { fill: #15161a; }
.cr-hr.out { border-top-color: var(--tb-lose); } .cr-hr.out b { color: #ff8a98; }
.cr-hr.made, .cr-hr.nat { border-top-color: var(--tb-win); } .cr-hr.made b, .cr-hr.nat b { color: var(--tb-win); }
.cr-hr.pt { border-top-color: var(--you); } .cr-hr.pt b { color: var(--you); }
.cr-hr.crap { border-top-color: #7a808f; }
.cr-counts { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; height: 54px; margin-top: 10px; align-items: end; }
.cr-cb { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.cr-cb i { position: absolute; left: 0; right: 0; bottom: 14px; border-radius: 3px 3px 0 0; max-height: calc(100% - 14px); }
.cr-cb i.exp { border: 1px dashed rgba(255, 255, 255, .22); border-bottom: 0; }
.cr-cb i.act { left: 3px; right: 3px; background: linear-gradient(180deg, var(--you), #b77a07); transition: height .4s; }
.cr-cb.seven i.act { background: linear-gradient(180deg, #ff6b7c, #b3263a); }
.cr-cb small { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font: 600 9.5px 'IBM Plex Mono', monospace; color: var(--s-dim); }

/* operator drawer extras */
.cr-edgetable { margin-top: 14px; }
.cr-edgetable h5 { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--s-dim); margin-bottom: 4px; }
.cr-edgetable div { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid var(--s-line); font-size: 12.5px; }
.cr-edgetable b { font: 600 12px 'IBM Plex Mono', monospace; }
.cr-stage .tb-drawer .s-seg { flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .cr-screen { grid-template-columns: minmax(0, 1fr); }
  .cr-side { display: grid; grid-template-columns: 1fr 1fr; }
  .cr-side > #crBal { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .cr-prs { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); }
}
@media (max-width: 760px) {
  .cr-lower { grid-template-columns: minmax(0, 1fr); }
  .cr-screen { display: flex; flex-direction: column; align-items: stretch; }
  .cr-main, .cr-side { display: contents; }
  .cr-tablewrap { order: 1; } .cr-controls { order: 2; } #crBal { order: 3; } .cr-now { order: 4; } .cr-work { order: 5; } .cr-lower { order: 6; } .cr-fair { order: 7; }
}
@media (max-width: 640px) {
  .cr-screen { padding: 10px; gap: 10px; }
  .cr-table { --rail: 12px; }
  .cr-tablewrap { padding-top: 8px; }
  .cr-trayhost { display: none; }
  .cr-prs { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  .cr-controls { padding: 10px; gap: 10px; }
  .cr-rack .tb-rchip { --chip: 42px; }
  .cr-rack .tb-rack { gap: 6px; }
  .cr-go { margin-left: 0; width: 100%; justify-content: space-between; }
  .cr-roll { flex: 1; max-width: 220px; }
  .cr-board .cr-pile .tb-stack-amt { font-size: 8.5px; padding: 0 3px; }
  .cr-total b { font-size: 20px; }
}
