/* Simos Camp — table games (Go Fish, Truth or Dare Classic / Spicy 18+, Chess). Owner: mgTable. Class prefix: mgt-.
 * The scene is drawn on .mgt-canvas; DOM is used for the status pill, action buttons and the cards/overlays.
 * Uses the shared tokens from css/base.css (dark-mode aware through the variables).
 */
.mgt-root {
  position: absolute; inset: 0; overflow: hidden; font-family: var(--font); color: var(--ink);
  touch-action: none; -webkit-user-select: none; user-select: none;
  background: #2596c2;
}
.mgt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.mgt-probe { position: absolute; left: 0; bottom: 0; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ---------- status pill (below the fullscreen title bar) ---------- */
.mgt-status {
  position: absolute; z-index: 4; top: calc(var(--safe-top) + 68px); left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 20px); padding: 7px 18px; border-radius: 999px;
  background: var(--paper); color: var(--ink); border: 3px solid var(--wood);
  box-shadow: 0 3px 0 var(--wood-deep), 0 8px 18px rgba(30, 50, 64, .22);
  font-weight: 600; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; transition: opacity .25s, background-color .25s, border-color .25s;
}
.mgt-status.mgt-empty { opacity: 0; }
.mgt-status.turn {
  background: linear-gradient(180deg, #5fdad8, var(--turq)); border-color: var(--turq-dark); color: #fff;
  text-shadow: 0 2px 0 rgba(21, 113, 134, .55); box-shadow: 0 3px 0 #157186, 0 8px 18px rgba(30, 50, 64, .22);
}
.mgt-status.warn { background: #fff4d6; border-color: var(--orange); color: #8a4b12; box-shadow: 0 3px 0 #c9771f, 0 8px 18px rgba(30, 50, 64, .2); }
.mgt-status.kind { background: #ffe8f0; border-color: var(--pink); color: #a42c58; box-shadow: 0 3px 0 #d9487a, 0 8px 18px rgba(30, 50, 64, .2); }
.mgt-status.win {
  background: linear-gradient(180deg, #fff0a8, var(--yellow)); border-color: #d9a520; color: #6b4a10;
  box-shadow: 0 3px 0 #b8861a, 0 8px 18px rgba(30, 50, 64, .22);
}
.mgt-status.mgt-pop { animation: mgt-pop .38s var(--ease-spring); }
@keyframes mgt-pop { 0% { transform: translateX(-50%) scale(.84); } 100% { transform: translateX(-50%) scale(1); } }

/* ---------- action buttons (Draw / Spin / Roll ...) ---------- */
.mgt-actions {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 16px);
  display: flex; justify-content: center; gap: 10px; padding: 0 12px; pointer-events: none;
}
.mgt-actions .sc-btn { pointer-events: auto; min-width: 150px; font-size: 18px; min-height: 50px; }
.mgt-pulse { animation: mgt-pulse 1.3s ease-in-out infinite; }
@keyframes mgt-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.mgt-pulse:active { animation: none; }

/* ---------- overlays (intro, results, suit picker) ---------- */
.mgt-overlay {
  position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 64px) 12px calc(var(--safe-bottom) + 12px);
  background: rgba(30, 50, 64, .4); pointer-events: auto; animation: mgt-fade .3s ease-out;
}
.mgt-overlay.mgt-out { animation: mgt-fadeout .26s ease-in forwards; pointer-events: none; }
.mgt-card {
  position: relative; width: min(440px, 100%); max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--panel-bg); color: var(--ink); border: 4px solid var(--wood); border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow); padding: 16px 18px 18px; text-align: center; animation: mgt-rise .45s var(--ease-spring);
}
.mgt-card::before {
  content: ''; position: absolute; left: 14px; right: 14px; top: 8px; height: 6px; border-radius: 6px; opacity: .55;
  background: repeating-linear-gradient(90deg, var(--blue) 0 10px, transparent 10px 16px);
}
.mgt-title { font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; line-height: 1.15; }
.mgt-ticon { font-size: 30px; display: inline-block; animation: sc-bob 2.4s ease-in-out infinite; }
.mgt-sub { color: var(--ink-soft); margin: 6px 0 4px; font-size: 15px; line-height: 1.35; }
.mgt-h { font-weight: 700; font-size: 19px; margin-top: 4px; }
.mgt-faces { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 14px 0 6px; flex-wrap: wrap; }
.mgt-who { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; max-width: 84px; }
.mgt-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 84px; }
.mgt-face {
  display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--turq-light); border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .14), 0 0 0 2px var(--wood);
}
.mgt-face canvas { width: 100%; height: 100%; display: block; }
.mgt-face b { color: #fff; font-size: 20px; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.mgt-winner .mgt-face { box-shadow: 0 0 0 3px var(--yellow), 0 0 18px rgba(255, 215, 94, .95); }
.mgt-winner::before { content: '👑'; font-size: 22px; margin-bottom: -6px; animation: sc-bob 1.6s ease-in-out infinite; }
.mgt-note { font-size: 13.5px; color: var(--ink-soft); background: var(--sand); border-radius: 12px; padding: 6px 10px; margin: 8px 0 2px; }
.mgt-rules { text-align: left; margin: 10px 0 2px; padding: 0 0 0 22px; font-size: 15px; line-height: 1.45; }
.mgt-rules li { margin: 4px 0; }
.mgt-rules li::marker { color: var(--turq-dark); }
.mgt-btnrow { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.mgt-btnrow + .mgt-btnrow { margin-top: 10px; }
.sc-btn.mgt-big { min-height: 52px; font-size: 18px; padding: 10px 24px; }
.mgt-resultcard.mgt-won { border-color: #d9a520; }
.mgt-resultcard.mgt-won .mgt-title { color: #b8741a; }
.mgt-gg:disabled { filter: none; opacity: .85; }

/* suit picker */
.mgt-suits { background: rgba(30, 50, 64, .3); }
.mgt-suitcard { width: min(360px, 100%); }
.mgt-suitgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.mgt-suit {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px;
  border-radius: 18px; border: 3px solid var(--suit); background: #fffdf7; color: var(--suit); font: 700 15px var(--font);
  cursor: pointer; box-shadow: 0 4px 0 var(--suit); transition: transform .12s var(--ease-spring), box-shadow .12s; pointer-events: auto;
}
.mgt-suit:hover { transform: translateY(-2px); }
.mgt-suit:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--suit); }
.mgt-suit i { position: absolute; top: 6px; left: 10px; font-style: normal; font-size: 11px; opacity: .55; }

/* ---------- truth or dare cards ---------- */
.mgt-todcard {
  position: absolute; z-index: 6; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 10px); max-width: 480px; margin: 0 auto;
  background: var(--panel-bg); color: var(--ink); border: 4px solid var(--wood); border-radius: 24px; box-shadow: var(--panel-shadow);
  padding: 12px 14px; animation: mgt-flip .5s var(--ease-spring); transform-origin: 50% 100%; pointer-events: auto;
}
.mgt-land .mgt-todcard { left: auto; right: 18px; top: calc(var(--safe-top) + 122px); bottom: auto; width: min(420px, 36vw); transform-origin: 100% 50%; }
.mgt-todcard.mgt-out { animation: mgt-flipout .26s ease-in forwards; pointer-events: none; }
.mgt-todcard.mgt-truth { border-color: var(--turq-dark); }
.mgt-todcard.mgt-dare { border-color: #d9487a; }
.mgt-todhead { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; }
.mgt-todhead b { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgt-tag { padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; background: var(--turq); border: 2px solid var(--turq-dark); letter-spacing: .5px; }
.mgt-dare .mgt-tag { background: var(--pink); border-color: #d9487a; }
.mgt-ptext { display: flex; gap: 10px; align-items: center; margin: 10px 2px 12px; font-size: 19px; font-weight: 600; line-height: 1.3; text-align: left; }
.mgt-picon { font-size: 34px; flex: none; animation: sc-bob 2.2s ease-in-out infinite; }
.mgt-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc-btn.mgt-answer { min-height: 48px; font-size: 15px; line-height: 1.15; padding: 6px 10px 6px 12px; white-space: normal; position: relative; }
.mgt-answer i { position: absolute; top: 3px; left: 8px; font-style: normal; font-size: 10px; opacity: .45; }
.mgt-todbtns { display: flex; gap: 10px; justify-content: center; margin: 12px 0 2px; }
.mgt-todbtns .sc-btn { flex: 1; max-width: 210px; }
.mgt-choice .mgt-todhead { justify-content: center; }
.mgt-choice .mgt-todhead b { flex: none; font-size: 20px; }
.mgt-skiprow { display: flex; justify-content: flex-end; margin-top: 10px; }
.sc-btn.mgt-skip { min-width: 96px; }
.mgt-theirs { opacity: .97; }
.mgt-waiting { color: var(--ink-soft); font-size: 14px; text-align: left; padding-left: 46px; animation: mgt-breathe 1.4s ease-in-out infinite; }

/* ---------- Go Fish: ask buttons & pass-the-device card ---------- */
.mgt-cards .mgt-actions { flex-wrap: wrap; gap: 8px; }
.mgt-actions .sc-btn.mgt-ask { min-width: 0; font-size: 16px; min-height: 46px; padding: 8px 16px; max-width: calc(50% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgt-land .mgt-actions .sc-btn.mgt-ask { max-width: 260px; }
.mgt-handover { background: rgba(30, 50, 64, .82); }
.mgt-handcard .mgt-faces { margin: 8px 0 2px; }
.mgt-actions .sc-btn.small { min-width: 0; min-height: 40px; font-size: 15px; }

/* ---------- intro: who's here, deck picker, spicy opt-in ---------- */
.mgt-who em { font-style: normal; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.mgt-here { color: #fff; background: var(--turq); border: 2px solid var(--turq-dark); }
.mgt-ai { color: var(--ink-soft); background: var(--sand); }
.sc-btn.mgt-herebtn { min-height: 28px; min-width: 0; padding: 2px 9px; font-size: 12px; }
.mgt-note.mgt-small, .mgt-sub.mgt-small { font-size: 12.5px; line-height: 1.35; }
.mgt-deck { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.mgt-deckbtn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; cursor: pointer; pointer-events: auto;
  border-radius: 18px; border: 3px solid var(--wood); background: var(--paper); color: var(--ink); font: 600 12.5px/1.25 var(--font);
  box-shadow: 0 3px 0 var(--wood-deep); transition: transform .12s var(--ease-spring), box-shadow .12s, background-color .2s;
}
.mgt-deckbtn b { font-size: 16px; font-weight: 700; }
.mgt-deckbtn span { color: var(--ink-soft); }
.mgt-deckbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--wood-deep); }
.mgt-deckbtn.mgt-on { border-color: var(--turq-dark); background: #e4fbf8; box-shadow: 0 3px 0 #157186, 0 0 0 3px rgba(46, 196, 198, .35); }
.mgt-deckbtn.mgt-spicy.mgt-on { border-color: #d9487a; background: #ffe8f0; box-shadow: 0 3px 0 #a42c58, 0 0 0 3px rgba(255, 107, 129, .3); }
.mgt-deckbtn.mgt-locked { opacity: .55; filter: grayscale(.5); cursor: not-allowed; }
.mgt-deckbtn.mgt-locked b::after { content: ' 🔒'; }
.mgt-consent { margin: 10px 0 2px; padding: 10px; border-radius: 16px; background: #fff0f5; border: 2px dashed #ff8fb1; }
.mgt-consent .mgt-h { font-size: 16px; margin: 0 0 8px; color: #a42c58; }
.mgt-optins { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mgt-optin {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer; pointer-events: auto;
  border: 2px solid #ffadc4; background: #fff; color: var(--ink); font: 600 13px var(--font); transition: background-color .2s, border-color .2s;
}
.mgt-optin i { font-style: normal; font-size: 11.5px; color: var(--ink-soft); }
.mgt-optin.mgt-in { background: #5cc98a; border-color: #3a9e66; color: #fff; }
.mgt-optin.mgt-in i { color: #fff; }
.mgt-optin .mgt-face { border-width: 2px; }
.mgt-spicycard { border-color: #d9487a; }
.mgt-spicycard::before { background: repeating-linear-gradient(90deg, #ff6b81 0 10px, transparent 10px 16px); }
.sc-btn.mgt-primary:disabled { opacity: .6; filter: grayscale(.3); }

/* ---------- truth or dare extras ---------- */
.sc-btn.mgt-heat {
  position: absolute; z-index: 5; right: 10px; top: calc(var(--safe-top) + 112px); min-width: 0; min-height: 34px; font-size: 13px; padding: 4px 12px;
  pointer-events: auto; border-color: #ff8fb1;
}
.mgt-skiprow { gap: 8px; }
.sc-btn.mgt-loud { min-width: 0; margin-right: auto; }

/* ---------- 📖 full rules (Go Fish, Chess): button next to the ✕, scrolling rules card ---------- */
.sc-btn.round.mgt-rulesbtn {
  position: absolute; z-index: 5; top: calc(var(--safe-top) + 10px); right: 64px;
  width: 46px; height: 46px; min-width: 0; min-height: 0; padding: 0; font-size: 20px; pointer-events: auto;
}
.mgt-rulescard { width: min(520px, 100%); text-align: left; padding-bottom: 0; }
.mgt-rulescard .mgt-title { justify-content: center; }
.mgt-rsec { margin-top: 12px; }
.mgt-rsec .mgt-h { font-size: 17px; }
.mgt-rsec .mgt-rules { margin-top: 4px; }
.mgt-rulescard .mgt-btnrow { position: sticky; bottom: 0; margin: 14px -18px 0; padding: 10px 18px 16px; background: var(--panel-bg); }

/* ---------- intro choices (camp bot level, chess clock), resume ---------- */
.mgt-choicerow { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 2px; flex-wrap: wrap; }
.mgt-choicelab { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.mgt-choices { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mgt-choice {
  padding: 5px 12px; border-radius: 999px; border: 2px solid var(--wood); background: var(--paper); color: var(--ink);
  font: 600 13px var(--font); cursor: pointer; pointer-events: auto; box-shadow: 0 2px 0 var(--wood-deep);
  transition: transform .12s var(--ease-spring), background-color .2s, border-color .2s;
}
.mgt-choice:active { transform: translateY(2px); box-shadow: none; }
.mgt-choice.mgt-on { background: #e4fbf8; border-color: var(--turq-dark); box-shadow: 0 2px 0 #157186, 0 0 0 3px rgba(46, 196, 198, .3); }
.mgt-note.mgt-resume { background: #e4fbf8; color: #157186; font-weight: 600; }
.sc-btn.mgt-newgame { min-height: 32px; font-size: 13px; }
/* promotion: the queen is preselected */
.mgt-suit.mgt-on { background: #fff7d6; box-shadow: 0 4px 0 var(--suit), 0 0 0 4px rgba(255, 215, 94, .7); }
/* chess: undo · draw · resign side by side */
.mgt-board .mgt-actions { gap: 8px; }
.mgt-board .mgt-actions .sc-btn.small { min-width: 0; padding: 6px 12px; font-size: 14px; }

/* ---------- keyframes ---------- */
@keyframes mgt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mgt-fadeout { from { opacity: 1; } to { opacity: 0; } }
@keyframes mgt-rise { 0% { transform: translateY(26px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes mgt-flip { 0% { transform: perspective(900px) rotateX(62deg) translateY(30px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes mgt-flipout { to { transform: perspective(900px) rotateX(50deg) translateY(30px); opacity: 0; } }
@keyframes mgt-breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

@media (max-width: 380px) {
  .mgt-ptext { font-size: 17px; }
  .sc-btn.mgt-answer { font-size: 14px; }
  .mgt-title { font-size: 21px; }
}
@media (max-height: 640px) {
  .mgt-ptext { margin: 6px 2px 8px; font-size: 17px; }
  .mgt-rules { font-size: 14px; }
}
