/* ======================================================================
   Mäxchen
   ====================================================================== */

/* ---------- Menu card & logo ---------- */
.gc-mx {
  background: radial-gradient(circle at 50% 45%, #2f7a5a, #174632 75%);
  position: relative;
}
.gc-mx-cup { position: absolute; width: 40px; left: 18px; top: 8px; transform: rotate(-16deg); filter: drop-shadow(0 3px 3px rgba(0,0,0,.4)); }
.gc-mx-cup svg { width: 100%; display: block; }
.gc-mx-dice { position: absolute; right: 16px; bottom: 14px; display: flex; gap: 3px; }
.gc-mx-dice .mini-die.big { width: 17px; height: 17px; border-radius: 4px; }
.gc-mx-dice .mini-die:first-child { transform: rotate(-12deg); }
.gc-mx-dice .mini-die:last-child { transform: rotate(9deg) translateY(2px); }

.mx-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mx-logo-cup { width: 74px; transform: rotate(-12deg); filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); animation: mx-logo-shake 3.2s ease-in-out infinite; }
.mx-logo-cup svg { width: 100%; display: block; }
.mx-logo-word {
  font-weight: 900; font-size: 46px; letter-spacing: 1px; line-height: 1;
  color: #f1c79a; -webkit-text-stroke: 2px #4a220e; paint-order: stroke fill;
  text-shadow: 0 3px 0 #2a1205;
}
@keyframes mx-logo-shake {
  0%, 70%, 100% { transform: rotate(-12deg); }
  74% { transform: rotate(-20deg) translateY(-3px); }
  78% { transform: rotate(-4deg) translateY(-3px); }
  82% { transform: rotate(-18deg); }
  86% { transform: rotate(-8deg); }
}

/* Lives picker: 5 columns */
.seg.mx-lives .seg-btn { padding: 8px 2px; text-align: center; align-items: center; }
.seg.mx-lives .seg-btn b::after { content: none; }

/* ---------- Player chips: hearts instead of points ---------- */
.mx-hearts { display: flex; gap: 1px; font-size: 12px; line-height: 1; }
.mx-hearts i { font-style: normal; color: rgba(255,255,255,.18); }
.mx-hearts i::before { content: "♥"; }
.mx-hearts i.on { color: var(--danger); }
.mx-chip.out { opacity: .45; }
.mx-chip.out .name { text-decoration: line-through; }
.mx-chip.hit { animation: mx-hit 700ms ease-out; }
@keyframes mx-hit {
  0% { background: rgba(239,68,68,.55); transform: translateX(0); }
  15% { transform: translateX(-4px); }
  30% { transform: translateX(4px); }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(2px); }
  100% { background: var(--panel); transform: none; }
}
.mx-chip.me .name::after { content: " (du)"; color: var(--muted); font-weight: 400; }

/* ---------- Game screen ---------- */
#screen-mx-game.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "top" "stage" "status" "act";
  padding: var(--safe-top) max(10px, var(--safe-right)) 0 max(10px, var(--safe-left));
  --mx-size: clamp(170px, min(86vw, calc(100dvh - 330px - var(--safe-top) - var(--safe-bottom))), 380px);
}
#screen-mx-game .topbar { grid-area: top; padding: 8px 0 6px; }
.mx-stage {
  grid-area: stage; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
#screen-mx-game .status { grid-area: status; display: block; text-align: center; font-size: 15px; line-height: 1.35; padding: 6px 4px 2px; min-height: 2.7em; }
#screen-mx-game .actionbar { grid-area: act; }
.mx-actions .btn.main { flex: 1; }

/* Claim banner */
.mx-claim {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px;
  min-height: 52px; padding: 8px 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 14px; text-align: center; max-width: 100%;
}
.mx-c-lab { color: var(--muted); font-size: 13px; }
.mx-claim b { font-size: 26px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.mx-claim b.muted { font-size: 16px; font-weight: 600; color: var(--muted); }
.mx-c-vs { color: var(--muted); font-size: 22px; padding: 0 4px; }
.mx-pair { display: inline-flex; gap: 4px; }
.mx-pair .mini-die:first-child { transform: rotate(-6deg); }
.mx-pair .mini-die:last-child { transform: rotate(5deg); }
.mx-pair.max .mini-die { box-shadow: 0 0 0 2px #f5b301, 0 2px 0 rgba(0,0,0,.25); }
.mx-claim .mx-pair .mini-die.big { width: 26px; height: 26px; border-radius: 6px; }
.mx-claim.pop { animation: mx-pop 360ms ease-out; }
@keyframes mx-pop { 0% { transform: scale(.9); } 60% { transform: scale(1.05); } 100% { transform: none; } }

/* History of announcements in this round */
.mx-history { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; min-height: 22px; font-size: 13px; color: var(--muted); }
.mx-history span { padding: 2px 8px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mx-history i { font-style: normal; opacity: .6; }

/* ---------- Table with dice cup ---------- */
#mx-table.dice-tray { --bowl-size: var(--mx-size); width: var(--mx-size); cursor: default; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#mx-table.can-peek { cursor: grab; }
#mx-table.can-peek.cup-peek { cursor: grabbing; }
#mx-table .die { transition: opacity 160ms, transform 380ms cubic-bezier(.2,.8,.3,1.1); }
#mx-table.cup-down .die { opacity: 0; transition: opacity 120ms 180ms, transform 380ms cubic-bezier(.2,.8,.3,1.1); }

.mx-cup {
  position: absolute; left: 50%; top: 50%; width: 50cqw; z-index: 4;
  transform: translate(-50%, -54%);
  transition: transform 300ms cubic-bezier(.3,.7,.3,1.15), opacity 200ms;
  filter: drop-shadow(0 2.5cqw 3cqw rgba(0,0,0,.55));
  pointer-events: none;
}
.mx-cup-svg { width: 100%; display: block; }
#mx-table.cup-peek .mx-cup { transform: translate(-50%, -54%) translate(0, -38cqw) rotate(-10deg) scale(.92); }
#mx-table.cup-up .mx-cup { transform: translate(-50%, -54%) translate(30cqw, -34cqw) rotate(28deg) scale(.55); opacity: .92; }
#mx-table.shake .mx-cup { animation: mx-shake 720ms ease-in-out; }
@keyframes mx-shake {
  0%   { transform: translate(-50%, -54%); }
  12%  { transform: translate(-50%, -54%) translate(-5cqw, -6cqw) rotate(-14deg); }
  25%  { transform: translate(-50%, -54%) translate(5cqw, -9cqw) rotate(13deg); }
  38%  { transform: translate(-50%, -54%) translate(-5cqw, -7cqw) rotate(-12deg); }
  51%  { transform: translate(-50%, -54%) translate(4cqw, -8cqw) rotate(10deg); }
  64%  { transform: translate(-50%, -54%) translate(-2cqw, -4cqw) rotate(-5deg); }
  82%  { transform: translate(-50%, -54%) translate(0, 1cqw); }
  100% { transform: translate(-50%, -54%); }
}

.mx-peek-hint {
  position: absolute; left: 0; right: 0; bottom: 5cqw; z-index: 5;
  text-align: center; font-size: clamp(11px, 5cqw, 15px); font-weight: 700; line-height: 1.2;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8);
  opacity: 0; transition: opacity 160ms; pointer-events: none;
}
#mx-table.can-peek.cup-down .mx-peek-hint { opacity: .9; }

/* Reveal verdict */
.mx-verdict {
  position: absolute; left: 50%; bottom: 6cqw; z-index: 6;
  transform: translate(-50%, 10px) scale(.8); opacity: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2cqw 5cqw; border-radius: 4cqw; white-space: nowrap;
  background: rgba(10, 14, 20, .86); border: 2px solid var(--line);
  transition: transform 260ms cubic-bezier(.3,.7,.3,1.4), opacity 180ms;
  pointer-events: none;
}
.mx-verdict.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.mx-verdict b { font-size: clamp(18px, 10cqw, 34px); font-weight: 900; line-height: 1; }
.mx-verdict span { font-size: clamp(11px, 4.6cqw, 15px); color: var(--muted); }
.mx-verdict.lie { border-color: var(--danger); }
.mx-verdict.lie b { color: #ff6b6b; }
.mx-verdict.truth { border-color: #34c77b; }
.mx-verdict.truth b { color: #4ade80; }
.mx-verdict.give b { color: var(--accent); }

/* ---------- Claim sheet ---------- */
.mx-claims {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px;
  padding: 4px 2px 8px;
}
.mx-claim-btn {
  appearance: none; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 8px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform 90ms, border-color 120ms, background 120ms;
  position: relative;
}
.mx-claim-btn:active { transform: scale(.95); }
.mx-claim-btn:hover { border-color: rgba(255,255,255,.3); }
.mx-claim-btn b { font-size: 15px; font-weight: 800; }
.mx-claim-btn em { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: #4ade80; }
.mx-claim-btn.truth { border-color: #34c77b; background: rgba(52, 199, 123, .12); }
.mx-claim-btn.max { border-color: #f5b301; background: rgba(245, 179, 1, .12); }
.mx-claim-btn.max b { color: #ffd23f; }

/* ---------- Layouts ---------- */
/* Landscape: table big in the middle, announcement on the left, history on the right */
@media (min-aspect-ratio: 4001/3000) {
  #screen-mx-game.active {
    --mx-size: clamp(150px, calc(100dvh - 128px - var(--safe-top) - var(--safe-bottom)), 460px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top top" "stage stage" "status act";
    column-gap: 14px;
    padding: max(4px, var(--safe-top)) max(12px, var(--safe-right)) max(6px, var(--safe-bottom)) max(12px, var(--safe-left));
  }
  #screen-mx-game .topbar { padding: 0 0 4px; }
  .mx-stage {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "claim table hist"; align-items: center; justify-items: center; gap: 14px;
  }
  .mx-claim { grid-area: claim; flex-direction: column; justify-self: end; max-width: 240px; }
  #mx-table { grid-area: table; }
  .mx-history { grid-area: hist; justify-self: start; flex-direction: column; max-height: 100%; overflow: hidden; }
  .mx-history i { transform: rotate(90deg); }
  #screen-mx-game .status { text-align: left; align-self: center; font-size: 14px; min-height: 0; padding: 0; }
  #screen-mx-game .actionbar { padding: 6px 0 0; background: none; gap: 8px; }
  #screen-mx-game .actionbar .main { height: 50px; font-size: 16px; }
  #screen-mx-game .toasts { left: 0; right: 0; top: calc(max(4px, var(--safe-top)) + 50px); }
}
@media (min-aspect-ratio: 4001/3000) and (min-width: 1000px) and (min-height: 620px) {
  #screen-mx-game.active { --mx-size: clamp(300px, calc(100dvh - 210px), 520px); padding: 20px 32px; }
  .mx-claim b { font-size: 34px; }
  .mx-claim .mx-pair .mini-die.big { width: 34px; height: 34px; border-radius: 8px; }
  #screen-mx-game .status { font-size: 16px; }
}
/* Portrait */
@media (max-aspect-ratio: 4/3) {
  #screen-mx-game .toasts { top: auto; bottom: calc(var(--safe-bottom) + 84px); flex-direction: column-reverse; }
}

/* Lives: stepper 1–10 + quick choice */
.mx-lives-step { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 2px 0 10px; }
.mx-lv-btn { width: 48px; height: 48px; padding: 0; font-size: 26px; font-weight: 800; border-radius: 14px; }
.mx-lv-val { display: flex; flex-direction: column; align-items: center; min-width: 120px; line-height: 1.1; }
.mx-lv-val b { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mx-lv-val span { font-size: 12px; color: var(--muted); }
.mx-lv-val small { color: var(--danger); font-size: 11px; letter-spacing: -1px; max-width: 140px; text-align: center; }
.seg.mx-lives { grid-template-columns: repeat(4, 1fr); }
.seg.mx-lives .seg-btn small { color: var(--muted); font-size: 11px; letter-spacing: 0; }
.mx-hearts .mx-lv-n { font-size: 12px; font-weight: 800; margin-left: 2px; color: var(--text); }
.mx-home-lives { width: min(420px, 100%); margin: 18px auto 0; text-align: left; }
