/* =========================================
   Liar's Dice -- game styles
   =========================================
   Loaded via public/index.html alongside main.css / battle-ducks.css.
   Game-namespaced via .ld-* prefix; LD tokens scoped under the LD
   screen selectors below (house convention -- see battle-ducks.css).

   Visual direction (LIARS-DICE-DESIGN.md V1 §4): the phone is your dice
   cup. Dark felt table surface, ivory dice, a single warm accent.
   ========================================= */

.ld-player-screen, .ld-player-layout,
.ld-player-screen *, .ld-player-layout * {
  --ld-font: 'Nunito', system-ui, -apple-system, sans-serif;

  /* Table felt (dark surface the whole game plays on) */
  --ld-felt:        #1b4332;
  --ld-felt-deep:   #143326;
  --ld-felt-line:   rgba(255,255,255,0.10);

  /* Surfaces on felt */
  --ld-surface:     rgba(255,255,255,0.07);
  --ld-surface-hi:  rgba(255,255,255,0.14);

  /* Text on felt */
  --ld-text:        #f2efe6;
  --ld-text-muted:  #b9c4bb;

  /* Dice */
  --ld-die-face:    #faf6ea;
  --ld-die-edge:    #3b3b33;
  --ld-pip:         #26261f;
  --ld-die-hit:     #2ea75f;
  --ld-die-hit-edge:#1d7a43;
  --ld-pip-hit:     #ffffff;

  /* Accent (warm gold -- matches the platform brand family) */
  --ld-accent:      #f5c842;
  --ld-accent-deep: #c9990a;
  --ld-accent-text: #1a1a1a;

  /* Semantic */
  --ld-danger:      #e05555;
  --ld-danger-bg:   rgba(224,85,85,0.15);
  --ld-win:         #5cdb5c;
  --ld-win-bg:      rgba(92,219,92,0.14);
}

/* ── Screen shells ─────────────────────────────────────────────────────── */

.ld-player-screen,
.ld-player-layout {
  font-family: var(--ld-font, 'Nunito', sans-serif);
  background:
    radial-gradient(ellipse at 50% 0%, var(--ld-felt, #1b4332) 0%, var(--ld-felt-deep, #143326) 78%);
  color: var(--ld-text, #f2efe6);
  border-radius: 14px;
  padding: 18px 14px 26px;
  min-height: 74vh;
  /* LD-006: the phone layout must not smear across wide viewports */
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  /* FB2-5: keep bottom-anchored actions clear of the iOS home indicator */
  padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  box-shadow: inset 0 0 0 2px var(--ld-felt-line, rgba(255,255,255,0.10)),
              0 6px 22px rgba(0,0,0,0.35);
}

.ld-player-screen h1, .ld-player-screen h2, .ld-player-screen h3,
.ld-player-layout h1, .ld-player-layout h2, .ld-player-layout h3 {
  color: var(--ld-text, #f2efe6);
}

.ld-player-screen .text-muted,
.ld-player-layout .text-muted {
  color: var(--ld-text-muted, #b9c4bb) !important;
}

/* LD-001: scoped under the shell so they out-specify `.ld-player-screen h1..h3` */
.ld-player-screen .ld-win-text,
.ld-player-layout .ld-win-text    { color: var(--ld-win, #5cdb5c); }
.ld-player-screen .ld-danger-text,
.ld-player-layout .ld-danger-text { color: var(--ld-danger, #e05555); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.ld-btn-primary {
  background: var(--ld-accent, #f5c842);
  color: var(--ld-accent-text, #1a1a1a);
  border: none;
  border-radius: 10px;
}

/* LD-012: Bootstrap's grey outline vanishes on felt — retint for the table */
.ld-player-screen .btn-outline-secondary,
.ld-player-layout .btn-outline-secondary {
  color: var(--ld-text-muted, #b9c4bb);
  border-color: var(--ld-text-muted, #b9c4bb);
}
.ld-player-screen .btn-outline-secondary:hover,
.ld-player-layout .btn-outline-secondary:hover {
  color: var(--ld-accent-text, #1a1a1a);
  background: var(--ld-text-muted, #b9c4bb);
}
.ld-btn-primary:hover, .ld-btn-primary:focus {
  background: var(--ld-accent-deep, #c9990a);
  color: var(--ld-accent-text, #1a1a1a);
}

/* ── Practice banner ───────────────────────────────────────────────────── */

.ld-practice-banner {
  background: var(--ld-accent, #f5c842);
  color: var(--ld-accent-text, #1a1a1a);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 12px;
}

/* ── Tutorial ──────────────────────────────────────────────────────────── */

.ld-tutorial-screen { padding-top: 40px; }

.ld-tutorial-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.ld-tutorial-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ld-surface-hi, rgba(255,255,255,0.14));
}
.ld-tutorial-dot.ld-dot-active { background: var(--ld-accent, #f5c842); }

.ld-tutorial-card-display {
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 14px;
  padding: 26px 20px;
  max-width: 460px;
  margin: 0 auto;
}
.ld-tutorial-title { margin-bottom: 10px; }
.ld-tutorial-body  { color: var(--ld-text-muted, #b9c4bb); font-size: 1.02rem; line-height: 1.5; }

/* ── Rolling (your duck shakes the dice) ───────────────────────────────── */

.ld-roll-animation { padding-top: 60px; }

.ld-roll-stage {
  position: relative;
  display: inline-block;
  width: 190px;
  height: 170px;
}

.ld-roll-duck {
  position: absolute;
  inset: 20px 30px 0;
  animation: ld-duck-shake 0.45s ease-in-out infinite;
  transform-origin: 50% 80%;
}

@keyframes ld-duck-shake {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  20%      { transform: rotate(-8deg) translateX(-5px); }
  50%      { transform: rotate(6deg) translateX(4px); }
  80%      { transform: rotate(-4deg) translateX(-3px); }
}

/* Dice tumbling around the duck — offset phases so they feel loose */
.ld-roll-die { position: absolute; }
.ld-roll-die-1 { top: 4px; left: 8px;   animation: ld-die-tumble-a 0.9s ease-in-out infinite; }
.ld-roll-die-2 { top: 22px; right: 2px; animation: ld-die-tumble-b 0.7s ease-in-out infinite; }
.ld-roll-die-3 { bottom: 8px; left: 26px; animation: ld-die-tumble-a 0.8s ease-in-out infinite reverse; }

@keyframes ld-die-tumble-a {
  0%, 100% { transform: rotate(-14deg) translateY(0); }
  50%      { transform: rotate(18deg) translateY(-9px); }
}
@keyframes ld-die-tumble-b {
  0%, 100% { transform: rotate(12deg) translateY(-4px); }
  50%      { transform: rotate(-16deg) translateY(6px); }
}

.ld-shake-text {
  margin-top: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ld-text-muted, #b9c4bb);
  text-transform: uppercase;
}

/* ── Dice ──────────────────────────────────────────────────────────────── */

.ld-die { display: inline-block; line-height: 0; }
/* FB-1: block svgs — inline svgs sit on the text baseline and sag below
   the line they share with text (the "Current bid: 3 × [die]" pill). */
.ld-die svg { display: block; }

.ld-die-face        { fill: var(--ld-die-face, #faf6ea); stroke: var(--ld-die-edge, #3b3b33); }
.ld-die-face-hl     { fill: var(--ld-die-hit, #2ea75f);  stroke: var(--ld-die-hit-edge, #1d7a43); }
.ld-pip             { fill: var(--ld-pip, #26261f); }
.ld-pip-hl          { fill: var(--ld-pip-hit, #ffffff); }
.ld-die-face-hidden { fill: var(--ld-surface, rgba(255,255,255,0.07)); stroke: var(--ld-felt-line, rgba(255,255,255,0.10)); }
.ld-die-q           { fill: var(--ld-text-muted, #b9c4bb); }

.ld-my-dice {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 12px;
}
.ld-my-dice-last { box-shadow: 0 0 0 2px var(--ld-danger, #e05555); }
.ld-last-die     { animation: ld-last-die-pulse 1.6s ease-in-out infinite; }
/* 1s in YOUR tray desaturate when this round's opening bid disabled wilds */
.ld-die-nowild   { filter: grayscale(1); opacity: 0.5; }

@keyframes ld-last-die-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.ld-dice-info {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ld-text-muted, #b9c4bb);
}

/* ── Current bid ───────────────────────────────────────────────────────── */

.ld-current-bid-area { margin: 16px 0 6px; }

.ld-current-bid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 10px;
  padding: 8px 12px;
  flex-wrap: wrap;
}
.ld-bid-label   { color: var(--ld-text-muted, #b9c4bb); font-size: 0.9rem; }
.ld-bid-display { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.15rem; }
.ld-bid-by      { color: var(--ld-text-muted, #b9c4bb); font-size: 0.9rem; }

/* ── Bid controls ──────────────────────────────────────────────────────── */

.ld-player-layout { display: flex; flex-direction: column; }
.ld-player-dice-area { margin-top: 4px; }
/* LD-004: actions live in the thumb zone — pushed to the bottom of the felt */
.ld-bid-controls  { margin-top: auto; padding-top: 14px; text-align: center; }

/* ── Player strip (LD-003: the table, always visible) ─────────────────── */

.ld-player-strip {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ld-strip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 9px;
  padding: 4px 9px;
}
.ld-strip-row.ld-strip-turn { border-color: var(--ld-accent, #f5c842); }
.ld-strip-row.ld-strip-me   { background: var(--ld-surface-hi, rgba(255,255,255,0.14)); }
.ld-strip-duck { width: 26px; flex: none; line-height: 0; }
.ld-strip-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ld-strip-turn-tag {
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--ld-accent-text, #1a1a1a);
  background: var(--ld-accent, #f5c842);
  border-radius: 4px;
  padding: 1px 5px;
  flex: none;
}
.ld-strip-dice {
  flex: none;
  display: flex;
  gap: 2px;
}

/* ── Turn banner (LD-005: replaces ghost buttons when waiting) ─────────── */

.ld-turn-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-accent, #f5c842);
  border-radius: 12px;
  padding: 12px 16px;
}
.ld-turn-banner .ld-turn-duck { width: 34px; line-height: 0; }
.ld-turn-banner .ld-turn-text {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ld-text, #f2efe6);
}
.ld-turn-banner .ld-turn-sub {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ld-text-muted, #b9c4bb);
}

.ld-quantity-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 12px;
}
.ld-qty-btn {
  background: var(--ld-surface-hi, rgba(255,255,255,0.14));
  color: var(--ld-text, #f2efe6);
  border: none;
  border-radius: 10px;
  width: 52px; height: 52px;
  font-size: 1.2rem;
}
/* LD-009: a dead arrow should look dead — hollow, not just dimmed */
.ld-qty-btn:disabled { opacity: 0.18; background: transparent; }
.ld-qty-value {
  font-size: 2rem;
  font-weight: 900;
  min-width: 56px;
  color: var(--ld-accent, #f5c842);
}

.ld-value-row {
  display: flex;
  justify-content: center;
  gap: 4px; /* LD-002: six 34px dice must fit one row at 380px */
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ld-value-option {
  padding: 5px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}
.ld-value-option.ld-value-selected { border-color: var(--ld-accent, #f5c842); background: var(--ld-surface-hi, rgba(255,255,255,0.14)); }
.ld-value-option.ld-value-disabled { opacity: 0.28; pointer-events: auto; }

.ld-action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.ld-bid-btn, .ld-liar-btn {
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  border-radius: 12px;
  padding: 14px 0;
  flex: 1;
  max-width: 190px;
  border: none;
}
.ld-bid-btn {
  background: var(--ld-accent, #f5c842);
  color: var(--ld-accent-text, #1a1a1a);
}
.ld-bid-btn:hover:not(:disabled) { background: var(--ld-accent-deep, #c9990a); color: var(--ld-accent-text, #1a1a1a); }
.ld-liar-btn {
  background: var(--ld-danger, #e05555);
  color: #fff;
}
.ld-liar-btn:hover:not(:disabled) { background: #c74444; color: #fff; }
.ld-bid-btn:disabled, .ld-liar-btn:disabled { opacity: 0.4; }

.ld-waiting-turn .ld-action-row { opacity: 0.55; }

.ld-action-error {
  min-height: 22px;
  margin-top: 8px;
  color: var(--ld-danger, #e05555);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ── Challenge: splash + tally ─────────────────────────────────────────── */

.ld-player-liar-splash { padding-top: 90px; }

.ld-auto-note {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ld-text-muted, #b9c4bb);
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 999px;
  padding: 3px 12px;
}

/* LD-001: color scoped so it out-specifies the shell heading rule */
.ld-player-screen .ld-splash-liar {
  color: var(--ld-danger, #e05555);
}
.ld-splash-liar {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  animation: ld-splash-pop 0.35s ease-out;
}

@keyframes ld-splash-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.ld-player-tally { padding-top: 16px; }

.ld-tally-header { margin-bottom: 12px; }
.ld-tally-counter {
  font-size: 2.4rem;
  font-weight: 900;
}
.ld-tally-running { color: var(--ld-text, #f2efe6); transition: color 0.2s; }
.ld-tally-running.ld-tally-met { color: var(--ld-win, #5cdb5c); }
.ld-tally-separator, .ld-tally-needed { color: var(--ld-text-muted, #b9c4bb); }
.ld-tally-bid-label { color: var(--ld-text-muted, #b9c4bb); font-size: 0.9rem; }

.ld-tally-rows {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ld-tally-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 10px;
  padding: 6px 10px;
  opacity: 0.55;
  transition: opacity 0.25s, transform 0.25s;
}
.ld-tally-row.ld-tally-me,
.ld-tally-row.ld-tally-shown { opacity: 1; }
.ld-tally-row.ld-tally-shown { transform: translateX(2px); }

.ld-tally-duck { width: 40px; flex: none; }
.ld-tally-info { flex: 1; text-align: left; display: flex; align-items: center; gap: 8px; }
.ld-tally-name { font-weight: 700; }

.ld-tally-role {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  border-radius: 5px;
  padding: 2px 6px;
}
.ld-tally-bidder     { background: var(--ld-accent, #f5c842); color: var(--ld-accent-text, #1a1a1a); }
.ld-tally-challenger { background: var(--ld-danger, #e05555); color: #fff; }

.ld-tally-count  { min-width: 34px; font-size: 1.25rem; font-weight: 900; }
.ld-tally-hidden { color: var(--ld-text-muted, #b9c4bb); }
.ld-tally-number.ld-tally-hit { color: var(--ld-win, #5cdb5c); }
.ld-tally-revealed { animation: ld-count-pop 0.25s ease-out; }

@keyframes ld-count-pop {
  0%   { transform: scale(0.5); }
  70%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.ld-tally-verdict { margin-top: 16px; min-height: 90px; }

.ld-player-verdict {
  display: inline-block;
  border-radius: 14px;
  padding: 14px 26px;
  animation: ld-splash-pop 0.3s ease-out;
}
.ld-player-verdict h2 { margin: 0 0 4px; font-weight: 900; }
.ld-player-verdict p  { margin: 0; }
.ld-pv-liar     { background: var(--ld-danger-bg, rgba(224,85,85,0.15)); border: 2px solid var(--ld-danger, #e05555); }
.ld-pv-liar h2  { color: var(--ld-danger, #e05555); }
.ld-pv-not-liar    { background: var(--ld-win-bg, rgba(92,219,92,0.14)); border: 2px solid var(--ld-win, #5cdb5c); }
.ld-pv-not-liar h2 { color: var(--ld-win, #5cdb5c); }

/* The whimper: the challenger's own dice proved the bid */
.ld-selfown-note {
  margin-top: 6px !important;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ld-text-muted, #b9c4bb);
}

/* ── Game over ceremony (LD-007) ───────────────────────────────────────── */

.ld-go-duck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,200,66,0.22) 0%, rgba(245,200,66,0.05) 62%, transparent 72%);
  box-shadow: 0 0 0 3px var(--ld-accent, #f5c842),
              0 0 34px rgba(245,200,66,0.35);
  margin-bottom: 18px;
  animation: ld-go-glow 2.2s ease-in-out infinite;
}

@keyframes ld-go-glow {
  0%, 100% { box-shadow: 0 0 0 3px var(--ld-accent, #f5c842), 0 0 26px rgba(245,200,66,0.28); }
  50%      { box-shadow: 0 0 0 3px var(--ld-accent, #f5c842), 0 0 44px rgba(245,200,66,0.5); }
}

/* ── Eliminated / Spectator ────────────────────────────────────────────── */

.ld-elim-duck-wrapper { position: relative; display: inline-block; }
.ld-elim-duck-gray    { filter: grayscale(1) brightness(0.75); }
.ld-elim-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ld-danger, #e05555);
}

.ld-spectate { padding-top: 16px; }

.ld-spec-header {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ld-accent, #f5c842);
  font-weight: 900;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  /* FB-3: breathing room between header and the bid line */
  margin-bottom: 22px;
}

/* FB-3: more space around the bid/info block on the spectate screen */
.ld-spectate .ld-current-bid-area { margin: 0 0 20px; }

.ld-spec-rows {
  max-width: 460px;
  margin: 20px auto 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* FB-3: tall tables (up to 10 players) scroll instead of overflowing */
  max-height: 58vh;
  overflow-y: auto;
}
.ld-spec-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ld-surface, rgba(255,255,255,0.07));
  border: 1px solid var(--ld-felt-line, rgba(255,255,255,0.10));
  border-radius: 10px;
  padding: 6px 10px;
}
.ld-spec-row.ld-spec-turn { border-color: var(--ld-accent, #f5c842); }
.ld-spec-duck { width: 36px; flex: none; }
.ld-spec-name {
  flex: none;
  min-width: 86px;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.ld-spec-turn-tag {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--ld-accent-text, #1a1a1a);
  background: var(--ld-accent, #f5c842);
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 2px;
}
.ld-spec-dice {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  flex-wrap: wrap;
}
