/* Baccarat reading pages (house rules, squeeze, roads, stories) and the third-card drill. */

/* ---------- squeezable card (shared with baccarat.css; copied so these pages need not load the table's stylesheet) ---------- */

.bc {
  position: relative;
  flex-shrink: 0;
  width: var(--cw);
  height: var(--ch);
  --p: 0;
  border-radius: calc(var(--cw) * 0.08);
  filter: drop-shadow(-1px 3px 4px rgba(0, 0, 0, 0.45));
  user-select: none;
  -webkit-user-select: none;
}

.bc.third {
  margin: 0 calc((var(--ch) - var(--cw)) / 2);
  transform: rotate(90deg);
}

.bc-in,
.bc-face,
.bc-back {
  position: absolute;
  inset: 0;
}

.bc svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bc-back {
  transition: opacity 0.2s;
}

/* squeeze.js sets the back's clip-path (and the curl's) inline, so the fold can
   run straight from any edge or diagonally from any corner. */

.bc[data-state="up"] .bc-back {
  opacity: 0;
}

/* the lifted flap along the fold */
.bc-curl {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.bc[data-state="peel"] .bc-curl {
  display: block;
}

/* Thumbs pressed on the corner indices while a card is squeezed, so the value
   has to be read from the pips. They lift away once the card is turned over. */
.bc-thumbs {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.bc-thumb {
  position: absolute;
  width: 28%;
  aspect-ratio: 40 / 84;
  transform-origin: 50% 21%;
  opacity: 0;
  filter: drop-shadow(1px 3px 3px rgba(0, 0, 0, 0.45));
  -webkit-mask-image: linear-gradient(180deg, #000 52%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 52%, transparent 96%);
  transition: opacity 0.35s ease, translate 0.35s ease;
}

.bc-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The tip pad sits on the index; the thumb reaches in from outside the card. */
.bc-thumb.tl {
  left: 11%;
  top: 17.5%;
  transform: translate(-50%, -21%) rotate(140deg);
}

.bc-thumb.br {
  left: 89%;
  top: 82.5%;
  transform: translate(-50%, -21%) rotate(-40deg);
}

.bc.held .bc-thumb {
  opacity: 1;
}

.bc.held[data-state="up"] .bc-thumb {
  opacity: 0;
}

.bc.held[data-state="up"] .bc-thumb.tl {
  translate: -18% -10%;
}

.bc.held[data-state="up"] .bc-thumb.br {
  translate: 18% 10%;
}

/* A card squeezed from underneath: the indices are at the bottom left... */
.bc-thumb.bl {
  left: 11%;
  top: 82.5%;
  transform: translate(-50%, -21%) rotate(40deg);
}

.bc.held[data-state="up"] .bc-thumb.bl {
  translate: -18% 10%;
}

/* ...and the top right. */
.bc-thumb.tr {
  left: 89%;
  top: 17.5%;
  transform: translate(-50%, -21%) rotate(-140deg);
}

.bc.held[data-state="up"] .bc-thumb.tr {
  translate: 18% -10%;
}

.bc.big {
  --cw: min(36vw, 172px);
  --ch: calc(var(--cw) * 1.4);
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(-2px 8px 12px rgba(0, 0, 0, 0.55));
}

.bc.big.grab {
  cursor: grabbing;
}

.bc.big:focus-visible {
  outline: 3px solid var(--brass-hi);
  outline-offset: 4px;
}

.bc.big[data-state="up"] {
  cursor: default;
  animation: sq-done 0.4s ease-out;
}

@keyframes sq-done {
  50% { transform: scale(1.05); }
}

.bc.big.third[data-state="up"] {
  animation-name: sq-done-third;
}

@keyframes sq-done-third {
  50% { transform: rotate(90deg) scale(1.05); }
}

/* ---------- reading pages ---------- */

.doc-photo {
  margin: 22px 0 0;
}

.doc-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1344 / 752;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 106, 0.35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  background: #12070a;
}

.doc-photo figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.doc-photo.is-broken {
  display: none;
}

.bac-doc .doc-hero {
  max-width: 820px;
}

/* ---------- squeeze diagrams ---------- */

.sq-fig {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 22px;
  margin: 16px 0 20px;
  padding: 18px 16px 14px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.28);
  background:
    radial-gradient(120% 140% at 50% 0%, var(--felt-hi), var(--felt) 55%, var(--felt-deep));
}

.sqf-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sqf-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.sqf-label {
  margin: 0 !important;
  max-width: 26ch;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 700;
  color: var(--brass-hi);
}

.sqc {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.sqc-card {
  position: relative;
  width: 64px;
  aspect-ratio: 100 / 140;
  border-radius: 5px;
  filter: drop-shadow(-1px 3px 4px rgba(0, 0, 0, 0.45));
}

.sqc-face,
.sqc-back {
  position: absolute;
  inset: 0;
}

.sqc-card svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sqc-fold {
  position: absolute;
  pointer-events: none;
}

.sqc figcaption {
  font-family: "Bodoni Moda", serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ivory);
}

/* ---------- try a squeeze ---------- */

.sqw {
  margin: 14px 0 20px;
  padding: 22px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 106, 0.3);
  background:
    radial-gradient(120% 120% at 50% 0%, var(--felt-hi), var(--felt) 55%, var(--felt-deep));
  text-align: center;
}

.sqw-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(min(36vw, 172px) * 1.4 + 8px);
}

.sqw-msg {
  margin: 14px 0 10px !important;
  min-height: 1.6em;
  font-weight: 700;
  font-size: 16px;
  color: var(--brass-hi);
}

.sqw-ctrl {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 18px;
}

.sqw-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.sqw-opt input {
  width: 18px;
  height: 18px;
  accent-color: var(--brass);
}

.sqw-hint {
  margin: 12px auto 0 !important;
  max-width: 52ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(244, 235, 214, 0.75);
}

/* ---------- roads ---------- */

.road-fig {
  margin: 14px 0 18px;
}

.rd-panel {
  margin: 0 0 10px;
}

.rd-name {
  margin: 0 0 4px !important;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brass-hi);
}

.rd-name:empty {
  display: none;
}

.rd-scroll {
  overflow-x: auto;
  padding: 6px;
  border-radius: 8px;
  background: #fbf8f1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  scrollbar-width: thin;
}

.rd-svg {
  display: block;
  max-width: none;
}

.rd-svg .rg line {
  stroke: rgba(40, 30, 20, 0.16);
  stroke-width: 1;
}

.rd-svg text {
  font-family: system-ui, sans-serif;
}

.rw {
  margin: 14px 0 22px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 106, 0.3);
  background: rgba(10, 4, 5, 0.6);
}

.rw-ctrl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.rw-add {
  display: flex;
  gap: 8px;
}

.rw-btn {
  min-width: 92px;
  min-height: 46px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s, filter 0.15s;
}

.rw-btn:hover {
  filter: brightness(1.1);
}

.rw-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.rw-btn:focus-visible {
  outline: 3px solid var(--brass-hi);
  outline-offset: 2px;
}

.rw-b {
  background: #c22339;
}

.rw-p {
  background: #2459c9;
}

.rw-t {
  background: #1f8a4d;
}

.rw-pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 14px;
}

.rw-pairs label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.rw-pairs input {
  width: 18px;
  height: 18px;
  accent-color: var(--brass);
}

.rw-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.rw-tools .btn {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 13.5px;
}

.rw-hint {
  margin: 10px 0 6px !important;
  font-size: 12.5px;
  color: var(--muted);
}

.rw-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 10px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.rw-stats b {
  font-weight: 700;
}

.rw-stats .c-b {
  color: #ff7d8e;
}

.rw-stats .c-p {
  color: #8fb2ff;
}

.rw-stats .c-t {
  color: #7fe0ad;
}

.rw-n {
  color: var(--brass-hi);
  font-weight: 700;
}

.rd-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
}

.rd-pair .rd-panel {
  flex: 1 1 260px;
  min-width: 0;
}

.rw-ask {
  margin-top: 6px;
}

.rw-ask-title {
  margin: 0 0 6px !important;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brass-hi);
}

.rw-ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.rw-ask .ask {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: #fbf8f1;
}

.rw-ask .ask-b {
  color: #b3122e;
}

.rw-ask .ask-p {
  color: #1f4fb8;
}

.ask-icons {
  display: inline-flex;
  gap: 4px;
}

.ask-icons svg,
.ask-icons .ask-none {
  display: inline-block;
  width: 16px;
  height: 16px;
}

.ask-icons .ask-none {
  border-radius: 50%;
  border: 1px dashed rgba(0, 0, 0, 0.25);
}

.rw-legend {
  margin: 6px 0 0 !important;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- third-card drill ---------- */

.td {
  margin: 0 0 30px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 106, 0.3);
  background: rgba(10, 4, 5, 0.6);
}

.td-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.td-modes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(244, 235, 214, 0.07);
  border: 1px solid rgba(212, 175, 106, 0.25);
}

.td-modes button {
  min-height: 38px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ivory);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.td-modes button[aria-checked="true"] {
  background: var(--brass);
  color: #23110b;
}

.td-modes button:focus-visible {
  outline: 2px solid var(--brass-hi);
  outline-offset: 1px;
}

.td-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  cursor: pointer;
}

.td-opt input {
  width: 18px;
  height: 18px;
  accent-color: var(--brass);
}

.td-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.td-felt {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 210px;
  padding: 22px 14px 18px;
  border-radius: 16px;
  background:
    radial-gradient(130% 120% at 50% 0%, var(--felt-hi), var(--felt) 55%, var(--felt-deep));
  box-shadow: inset 0 0 0 2px rgba(212, 175, 106, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.35);
}

.td-felt.ok {
  animation: td-ok 0.5s ease-out;
}

.td-felt.ng {
  animation: td-ng 0.45s ease-out;
}

@keyframes td-ok {
  30% { box-shadow: inset 0 0 0 3px #7fe0ad, inset 0 0 40px rgba(127, 224, 173, 0.35); }
}

@keyframes td-ng {
  20%, 60% { transform: translateX(-4px); box-shadow: inset 0 0 0 3px #ff8a8f, inset 0 0 40px rgba(0, 0, 0, 0.35); }
  40%, 80% { transform: translateX(4px); }
}

.td-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.td-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--brass-hi);
}

.td-p .td-name {
  color: #a9c3ff;
}

.td-b .td-name {
  color: #ffa3ae;
}

.td-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
}

.tdc {
  display: block;
  flex-shrink: 0;
  width: 62px;
  aspect-ratio: 100 / 140;
  filter: drop-shadow(-1px 3px 4px rgba(0, 0, 0, 0.45));
  animation: td-in 0.25s ease-out;
}

.tdc svg {
  display: block;
  width: 100%;
  height: 100%;
}

.tdc.third {
  margin: 0 12px;
  transform: rotate(90deg);
  animation-name: td-in-third;
}

@keyframes td-in {
  from { opacity: 0; transform: translateY(-10px); }
}

@keyframes td-in-third {
  from { opacity: 0; transform: rotate(90deg) translateX(-10px); }
}

.td-total {
  min-width: 2.2em;
  min-height: 1.3em;
  font-family: "Bodoni Moda", serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.2;
  text-align: center;
  color: var(--ivory);
}

.td-q {
  margin: 14px 0 10px;
  min-height: 1.6em;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--ivory);
}

.td-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.td-ans {
  min-height: 56px;
  font-size: 17px;
  font-weight: 700;
  justify-content: center;
  gap: 10px;
}

.td-draw {
  background: linear-gradient(180deg, #1f8a4d, #146638);
  color: #fff;
  border-color: rgba(127, 224, 173, 0.6);
}

.td-stand {
  background: linear-gradient(180deg, #7d1c2b, #5a1220);
  color: #fff;
  border-color: rgba(255, 163, 174, 0.55);
}

.td kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  opacity: 0.8;
}

.td-verdict {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.3);
  background: rgba(244, 235, 214, 0.06);
}

.td-verdict p {
  margin: 0 0 6px;
  line-height: 1.6;
}

.td-vh {
  font-weight: 700;
  font-size: 17px;
}

.td-vh.is-ok {
  color: var(--good);
}

.td-vh.is-ng {
  color: var(--bad);
}

.td-why {
  font-size: 14.5px;
}

.td-res {
  font-size: 13.5px;
  color: var(--muted);
}

.td-res:empty {
  display: none;
}

.td-next {
  margin-top: 6px;
  gap: 10px;
}

.td-keys {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.td-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 6px;
}

.td-stats div {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(244, 235, 214, 0.06);
  border: 1px solid rgba(212, 175, 106, 0.2);
}

.td-stats dt {
  font-size: 11.5px;
  color: var(--muted);
}

.td-stats dd {
  margin: 0;
  font-family: "Bodoni Moda", serif;
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--brass-hi);
}

.td-score {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
}

.tb-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--brass-hi);
}

.tb-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 106, 0.28);
}

.tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  background: rgba(10, 4, 5, 0.55);
}

.tb th,
.tb td {
  padding: 4px 3px;
  text-align: center;
  border-bottom: 1px solid rgba(212, 175, 106, 0.14);
}

.tb thead th {
  background: rgba(212, 175, 106, 0.12);
  color: var(--brass-hi);
  font-weight: 700;
  white-space: nowrap;
}

.tb tbody th {
  color: var(--brass-hi);
  font-weight: 700;
}

.tb-corner {
  font-size: 9.5px !important;
  line-height: 1.2;
  text-align: left !important;
}

.tb-corner span {
  display: block;
}

.tb-corner span + span {
  text-align: right;
  opacity: 0.8;
}

.tb td.d {
  color: #7fe0ad;
  font-weight: 700;
}

.tb td.s {
  color: rgba(244, 235, 214, 0.35);
}

.tb tr.hl th,
.tb th.hl {
  background: rgba(212, 175, 106, 0.3);
}

.tb td.on {
  background: var(--brass);
  color: #23110b;
  font-weight: 700;
}

.tb-note {
  margin: 6px 0 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.td-reset {
  min-height: 36px;
  padding: 4px 14px;
  font-size: 12.5px;
}

.doc-solo {
  max-width: 820px;
}

.doc-solo .doc {
  max-width: none;
}

/* moved pages */

.moved-box {
  margin: 60px auto;
  text-align: center;
}

.moved-box h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  color: var(--brass-hi);
}

/* ---------- phones ---------- */

@media (max-width: 900px) {
  .td-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .sq-fig {
    gap: 14px 12px;
    padding: 14px 8px 10px;
    justify-content: center;
  }

  .sqc-card {
    width: 40px;
  }

  .sqf-cards {
    gap: 6px;
  }

  .rw {
    padding: 12px;
  }

  .rw-add {
    width: 100%;
  }

  .rw-btn {
    flex: 1;
    min-width: 0;
  }

  .rw-tools {
    margin-left: 0;
  }

  .td {
    margin: 0 -4px 26px;
    padding: 12px 10px;
  }

  .td-modes {
    width: 100%;
    border-radius: 14px;
  }

  .td-modes button {
    flex: 1 1 auto;
    padding: 6px 8px;
    font-size: 12.5px;
  }

  .td-felt {
    gap: 6px;
    min-height: 180px;
    padding: 30px 6px 14px;
  }

  .td-cards {
    gap: 3px;
    min-height: 74px;
  }

  .tdc {
    width: 46px;
  }

  .tdc.third {
    margin: 0 9px;
  }

  .td-total {
    font-size: 26px;
  }

  .td-q {
    font-size: 16px;
  }
}

/* Side-bet tables: payouts and house edges stay on one line each. */
.doc table.data.sb td:nth-child(n+3) {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .doc table.data.sb {
    font-size: 13px;
  }

  .doc table.data.sb th,
  .doc table.data.sb td {
    padding: 7px 8px;
  }
}

@media (max-width: 760px) {
  .bac-doc .doc table.data thead th {
    white-space: normal;
  }
}

.road-fig[data-compact] .rd-scroll {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}
