/* ============================================================
   Joker's Daily Tile — a warm Vegas lounge: green felt, brass trim,
   a low lamp overhead. The table surface is painted with translucent
   washes over the shell's card color, so the felt follows whatever
   theme the shell is running instead of fighting it.
   ============================================================ */

.jdt-wrap { position: relative; display: flex; flex-direction: column; gap: 9px; }

/* ---------- shared surfaces ---------- */
.jdt-felt,
.jdt-card,
.jdt-handzone,
.jdt-hud,
.jdt-meter {
  border: 1px solid rgba(200,164,90,.28);
  border-radius: 14px;
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.10));
  background-color: rgba(255,255,255,.045);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 6px 18px rgba(0,0,0,.20);
}

/* ---------- start screen ---------- */
.jdt-start { position: relative; padding: 18px 16px 16px; text-align: center; overflow: hidden; }
.jdt-start .jdt-lamp {
  position: absolute; left: 50%; top: -70px; width: 420px; height: 300px; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,206,130,.30), rgba(255,206,130,0) 70%);
  pointer-events: none;
}
.jdt-kicker { position: relative; margin: 0 0 12px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
/* A small hand of real tiles fanned under the lamp — the same faces the table
   deals. The fan tile carries its own ivory body because .jdt-tile's sizing
   rules are scoped to the grid, and an unconstrained .tl svg renders huge. */
.jdt-fan { position: relative; height: 88px; width: 300px; margin: 0 auto 10px; }
.jdt-fan .jdt-fan-tile {
  position: absolute; left: 50%; bottom: 0; width: 54px; height: 72px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 9px; transform-origin: 50% 130%;
  background: linear-gradient(165deg, #fdfcf7, #e9e0cc);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 3px 7px rgba(0,0,0,.32);
}
.jdt-fan .jdt-fan-tile .tl { position: relative; width: 94%; height: 96%; display: block; background: none; border: 0; box-shadow: none; }
.jdt-fan .jdt-fan-tile .tl svg { width: 100%; height: 100%; display: block; }
.jdt-fan .jdt-fan-tile .tl .tl-img { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.jdt-fan .jdt-fan-tile .tl .cnr {
  position: absolute; top: 1px; left: 3px; z-index: 3; display: block !important;
  font-family: var(--sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 10px; font-weight: 800; line-height: 1.2; color: #3A2E20; background: none; box-shadow: none;
}
.jdt-start-cards { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }

.jdt-bigcard {
  position: relative; display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 14px 14px 13px; text-align: left; cursor: pointer; font: inherit; color: var(--g-fg);
  border: 1px solid rgba(200,164,90,.34); border-radius: 14px;
  background-image: linear-gradient(165deg, rgba(255,255,255,.10), rgba(0,0,0,.14));
  background-color: rgba(255,255,255,.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 6px 16px rgba(0,0,0,.22);
  transition: transform .12s ease, border-color .18s ease, box-shadow .18s ease;
}
.jdt-bigcard:hover { transform: translateY(-2px); border-color: rgba(224,184,74,.70); }
.jdt-bigcard:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.jdt-bigcard.is-quiet { opacity: .92; }
.jdt-bigcard-tag {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: #f0cf87; background: rgba(200,164,90,.16); border: 1px solid rgba(200,164,90,.30);
  border-radius: 999px; padding: 2px 8px;
}
.jdt-bigcard-title { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.jdt-bigcard-sub { font-size: 12px; color: var(--g-muted); }

.jdt-players { position: relative; margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.jdt-players-label { font-size: 12px; color: var(--g-muted); }
.jdt-seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; border: 1px solid var(--g-line); background: rgba(0,0,0,.16); }
.jdt-pill {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--g-muted);
  padding: 5px 11px; border: 0; border-radius: 999px; background: transparent;
}
.jdt-pill.is-sel { color: #1d1408; background: linear-gradient(180deg, #f2d79a, #d9b263); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.jdt-start-note { position: relative; margin: 12px auto 0; max-width: 520px; font-size: 12px; line-height: 1.55; color: var(--g-muted); }

/* ---------- HUD ---------- */
.jdt-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; flex-wrap: wrap; }
.jdt-hud-left, .jdt-hud-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.jdt-stat { display: flex; flex-direction: column; gap: 1px; min-width: 46px; }
.jdt-stat .k { font-size: 10px; letter-spacing: .10em; text-transform: uppercase; color: var(--g-muted); }
.jdt-stat .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.jdt-stat-stars .v { color: #f0cf87; letter-spacing: .04em; font-size: 13px; }

/* ---------- Charleston meter ---------- */
.jdt-meter { display: flex; align-items: center; gap: 9px; padding: 5px 12px; }
.jdt-meter-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--g-muted); }
.jdt-meter-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(0,0,0,.30); overflow: hidden; }
.jdt-meter-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #d9b263, #f4dda2); transition: width .35s ease; }
.jdt-meter-num { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--g-muted); }

/* ---------- the target card ---------- */
.jdt-card { padding: 9px 14px 9px; text-align: center; position: relative; overflow: hidden; }
.jdt-card::after {
  content: ''; position: absolute; inset: 5px; border: 1px solid rgba(200,164,90,.20);
  border-radius: 10px; pointer-events: none;
}
.jdt-card-head { display: flex; flex-direction: column; gap: 1px; }
.jdt-card-kicker { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--g-muted); }
.jdt-card-name { font-size: 16px; font-weight: 700; letter-spacing: .04em; color: #f4dda2; }
.jdt-card-slots { display: flex; justify-content: center; gap: 6px; margin: 7px 0 6px; flex-wrap: wrap; }
.jdt-card-hint { margin: 0; font-size: 12px; color: var(--g-muted); }

/* An empty slot on the card: a dashed brass outline waiting to be filled. */
.jdt-slot {
  width: var(--jdt-slot, 42px); aspect-ratio: 3 / 4; border-radius: 8px;
  border: 1px dashed rgba(200,164,90,.45); background: rgba(0,0,0,.16);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.jdt-slot.is-filled {
  border-style: solid; border-color: rgba(224,184,74,.75);
  /* A filled slot carries the same ivory body as a .jdt-tile. A translucent
     wash worked on the parchment day table but read as "no background" on the
     dark felt — the face floated on green. Real tiles in both themes now. */
  background: linear-gradient(165deg, #fdfcf7, #e9e0cc);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 4px rgba(0,0,0,.30);
}
.jdt-slot .tl { width: 100%; height: 100%; display: block; background: none; border: 0; box-shadow: none; }
/* The pools and card both host .jdt-slot tiles. Without these, the hand-made
   PNG faces (bam/dot/joker/flower) render at their native 992px and only the
   top-left sliver shows inside the ~42px slot — a picked tile looks like it
   changed color. Mirror the .jdt-tile rules so every slot scales the same. */
.jdt-slot .tl svg { width: 100%; height: 100%; display: block; }
.jdt-slot .tl .tl-img { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.jdt-slot .tl .cnr {
  position: absolute; top: 1px; left: 3px; z-index: 3; display: block !important;
  font-family: var(--sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 10px; font-weight: 800; line-height: 1.2; color: #3A2E20; background: none; box-shadow: none;
}

/* ---------- the felt + tile pool ---------- */
.jdt-felt {
  position: relative; padding: 8px 12px 12px;
  background-image:
    radial-gradient(120% 78% at 50% -6%, rgba(255,214,150,.15), rgba(255,214,150,0) 62%),
    linear-gradient(180deg, rgba(16,62,42,.58), rgba(7,34,24,.72));
}
.jdt-felt::before {
  /* felt nap: two crossed gradients read as brushed cloth under the lamp */
  content: ''; position: absolute; inset: 0; border-radius: 13px; pointer-events: none; opacity: .5;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px);
}
.jdt-pool-label {
  position: relative; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(240,225,200,.72); margin: 0 0 7px;
}
.jdt-pool {
  position: relative; display: grid; gap: 6px; justify-content: center;
  /* Capping the tile width keeps a 9-tile warm-up from turning into a wall of
     dinner plates, and keeps the controls on screen behind a full pool. */
  grid-template-columns: repeat(var(--jdt-cols, 6), minmax(0, 76px));
}

/* ---------- tiles ---------- */
.jdt-tile {
  position: relative; width: 100%; aspect-ratio: 3 / 4; padding: 0; border: 0;
  border-radius: 9px; cursor: pointer; font: inherit; color: inherit;
  background: linear-gradient(165deg, #fdfcf7, #e9e0cc);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 4px rgba(0,0,0,.30), 0 6px 12px rgba(0,0,0,.20);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: transform .13s ease, box-shadow .18s ease, filter .18s ease;
  animation: jdtDeal .28s ease both;
}
.jdt-tile:hover { transform: translateY(-3px); }
.jdt-tile:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.jdt-tile.is-sel { transform: translateY(-7px); filter: brightness(1.04); box-shadow: 0 0 0 2px #f0cf87, 0 10px 18px rgba(0,0,0,.35); }
.jdt-tile.is-gone { opacity: 0; transform: scale(.7) translateY(10px); pointer-events: none; }
.jdt-tile.is-hint { animation: jdtHint 1s ease-in-out 3; }
.jdt-tile.is-bad { animation: jdtShake .34s ease; }

.jdt-tile .tl { position: relative; width: 94%; height: 96%; display: block; background: none; border: 0; box-shadow: none; }
.jdt-tile .tl svg { width: 100%; height: 100%; display: block; }
.jdt-tile .tl .tl-img { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.jdt-tile .tl .cnr {
  position: absolute; top: 1px; left: 3px; z-index: 3; display: block !important;
  font-family: var(--sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 10px; font-weight: 800; line-height: 1.2; color: #3A2E20; background: none; box-shadow: none;
}
/* A joker keeps its own voice: brass rim, no corner numeral. */
.jdt-tile.is-joker { background: linear-gradient(165deg, #fff8e6, #f0dfae); box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 0 0 1px rgba(200,164,90,.55), 0 6px 14px rgba(0,0,0,.28); }

@keyframes jdtDeal { from { opacity: 0; transform: translateY(-14px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes jdtHint { 0%,100% { transform: none; } 50% { transform: translateY(-8px) scale(1.06); box-shadow: 0 0 0 2px #f0cf87, 0 10px 18px rgba(0,0,0,.35); } }
@keyframes jdtShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- hand zone ---------- */
.jdt-handzone { padding: 8px 12px 10px; }
.jdt-hand { display: flex; gap: 6px; min-height: var(--jdt-hand-h, 58px); align-items: center; flex-wrap: wrap; }
.jdt-hand .jdt-slot { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
/* Hand slots are the only way to put a tile back, so they must read as
   tappable — a quiet lift on hover/focus instead of a flat copy of the card. */
.jdt-hand .jdt-slot:hover, .jdt-hand .jdt-slot:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px rgba(224,184,74,.55), 0 8px 14px rgba(0,0,0,.30);
}
.jdt-hand-empty { font-size: 12px; color: var(--g-muted); }

/* ---------- controls ---------- */
.jdt-ctrl { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.jdt-ctrl .mj-btn:disabled { opacity: .45; cursor: default; }
/* One-shot pulse when the hand becomes submittable, so the player never
   sits on a finished hand wondering why nothing happens. */
#jdtSubmit.jdt-ready { animation: jdtReady 1.1s ease; }
@keyframes jdtReady {
  0% { box-shadow: 0 0 0 0 rgba(224,184,74,.7); }
  70% { box-shadow: 0 0 0 14px rgba(224,184,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,184,74,0); }
}
.jdt-ctrl-wrap { margin-top: 12px; }
.jdt-feed { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--g-muted); min-height: 18px; }

/* The play column is the anchor for the floating praise banner. */
.jdt-play { position: relative; }

/* A fresh line of praise each hand, in case the player misses the fireworks. */
.jdt-praise {
  position: absolute; left: 50%; top: 16%; z-index: 22; pointer-events: none;
  transform: translate(-50%, 0) scale(.8);
  font: 700 22px/1 var(--g-serif, Georgia, serif); color: #f4dda2;
  text-shadow: 0 2px 10px rgba(0,0,0,.55); opacity: 0; white-space: nowrap;
}
.jdt-praise.show { animation: jdtPraise 1.5s ease forwards; }
@keyframes jdtPraise {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  68% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

/* Hand tiles fold away on submit before the next deal is dealt. */
.jdt-hand.is-collapsing .jdt-slot { animation: jdtCollapse .3s ease forwards; }
@keyframes jdtCollapse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.3) translateY(-14px); opacity: 0; }
}

/* ---------- Charleston sweep ---------- */
.jdt-charleston {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(6,22,15,.62); backdrop-filter: blur(2px); border-radius: 14px;
}
.jdt-ch-card { text-align: center; padding: 18px 26px; border-radius: 14px; border: 1px solid rgba(200,164,90,.35); background: rgba(10,32,22,.82); }
.jdt-ch-title { font-size: 18px; font-weight: 700; letter-spacing: .10em; text-transform: uppercase; color: #f4dda2; }
.jdt-ch-pass { margin-top: 4px; font-size: 12px; color: var(--g-muted); }
.jdt-ch-track { margin-top: 12px; display: flex; gap: 10px; justify-content: center; }
.jdt-ch-pack {
  width: 34px; height: 46px; border-radius: 7px; border: 1px solid rgba(200,164,90,.45);
  background: linear-gradient(165deg, #fdfcf7, #e3dac4); animation: jdtPass .42s ease-in-out infinite;
}
.jdt-ch-pack:nth-child(2) { animation-delay: .14s; }
.jdt-ch-pack:nth-child(3) { animation-delay: .28s; }
@keyframes jdtPass { 0%,100% { transform: translateX(-16px) rotate(-4deg); } 50% { transform: translateX(16px) rotate(4deg); } }

/* ---------- overlays (pass device, results) ---------- */
.jdt-overlay {
  position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(6,22,15,.66); backdrop-filter: blur(3px); border-radius: 14px;
}
.jdt-ov-card {
  width: 100%; max-width: 420px; text-align: center; padding: 20px 20px 18px;
  border-radius: 16px; border: 1px solid rgba(200,164,90,.40);
  background-image: linear-gradient(180deg, rgba(255,255,255,.07), rgba(0,0,0,.18));
  background-color: rgba(12,38,26,.92);
  box-shadow: 0 18px 44px rgba(0,0,0,.45);
}
.jdt-ov-card.is-wide { max-width: 520px; }
.jdt-ov-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #f0cf87; }
.jdt-ov-title { margin: 6px 0 10px; font-size: 22px; }
.jdt-ov-stats { display: flex; justify-content: center; gap: 16px; margin: 10px 0 4px; flex-wrap: wrap; }
.jdt-ov-stat { display: flex; flex-direction: column; gap: 1px; }
.jdt-ov-stat .k { font-size: 10px; letter-spacing: .10em; text-transform: uppercase; color: var(--g-muted); }
.jdt-ov-stat .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.jdt-ov-note { margin: 10px 0 0; font-size: 12px; color: var(--g-muted); }
.jdt-ov-line { margin: 4px 0 0; font-size: 13px; color: var(--g-fg); }
.jdt-ov-card .mj-btn { margin-top: 14px; }
.jdt-medal { font-size: 30px; letter-spacing: .06em; color: #f4dda2; text-shadow: 0 0 18px rgba(240,207,135,.35); }

.jdt-lb { margin-top: 14px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.jdt-lb-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border-radius: 10px; border: 1px solid var(--g-line); background: rgba(255,255,255,.05);
}
.jdt-lb-row.is-top { border-color: rgba(224,184,74,.65); background: rgba(224,184,74,.12); }
.jdt-lb-rank { font-size: 15px; width: 22px; text-align: center; }
.jdt-lb-name { flex: 1; font-size: 13px; font-weight: 600; }
.jdt-lb-stars { font-size: 13px; color: #f0cf87; }
.jdt-lb-meta { font-size: 11px; color: var(--g-muted); font-variant-numeric: tabular-nums; }

/* ---------- help ---------- */
.jdt-help {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(6,18,12,.62); backdrop-filter: blur(3px);
}
.jdt-help-card {
  position: relative; width: 100%; max-width: 620px; max-height: 86vh; overflow: auto;
  padding: 22px 24px 20px; border-radius: 16px; border: 1px solid rgba(200,164,90,.34);
  background-color: var(--g-card); color: var(--g-fg); box-shadow: var(--g-shadow-lg);
}
.jdt-help-card h2 { margin: 0 0 10px; font-size: 20px; }
.jdt-help-card h3 { margin: 16px 0 4px; font-size: 14px; letter-spacing: .04em; color: var(--g-heading); }
.jdt-help-card p { margin: 0 0 8px; font-size: 13px; line-height: 1.62; color: var(--g-fg); }
.jdt-help-lead { font-size: 14px; }
.jdt-help-note { margin-top: 14px !important; font-size: 12px !important; color: var(--g-muted) !important; }
.jdt-help-x {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--g-line); background: var(--g-card); color: var(--g-fg);
  font-size: 18px; line-height: 1; cursor: pointer;
}

/* ---------- narrow screens ---------- */
@media (max-width: 560px) {
  .jdt-play { --jdt-slot: 50px; }   /* bigger tiles to tap on a phone */
  .jdt-hand { min-height: 66px; }
  .jdt-hud { gap: 6px; padding: 7px 10px; }
  .jdt-hud-left, .jdt-hud-right { gap: 10px; }
  .jdt-stat .v { font-size: 14px; }
  .jdt-card-name { font-size: 15px; }
  .jdt-start { padding: 14px 12px 12px; }
  .jdt-bigcard-title { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .jdt-tile, .jdt-ch-pack { animation: none !important; }
  .jdt-tile, .jdt-bigcard { transition: none; }
}
