/* Game-room feel: springy controls, living cards, seat cues. Motion only when the device allows it. */

/* Static parts (no motion) */
.table-seat { position: relative; }
.seat-bubble {
  position: absolute;
  top: -16px;
  left: 50%;
  z-index: 2;
  padding: 1px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: #252046;
  font: 800 11px/1.4 inherit;
  font-style: normal;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 2px 2px 0 var(--ink);
}
.seat-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: #fff;
  transform: rotate(45deg);
}
.seat-passed { filter: grayscale(.45); }
.seat-turn {
  position: absolute;
  top: -10px;
  right: -6px;
  z-index: 2;
  padding: 0 7px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #f8d633;
  color: #252046;
  font: 800 10px/1.5 inherit;
  font-style: normal;
}
#roomMain .card-game-stage .table-seat-active { box-shadow: 0 0 0 3px #f8d633, 0 6px 18px #f8d63366; }

#turnBanner {
  position: fixed;
  top: 32%;
  left: 50%;
  z-index: 60;
  padding: 14px 26px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #f8d633;
  color: #252046;
  box-shadow: 6px 6px 0 var(--ink);
  font: 800 clamp(22px, calc(5vw / var(--site-zoom, 1)), 34px)/1.1 inherit;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
#turnBanner[hidden] { display: none; }

/* Hand: a gentle fan; lift on hover, spring up when selected. */
#roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card {
  transform: translateY(calc(var(--arc, 0px) + var(--lift, 0px))) rotate(var(--fan, 0deg));
  transform-origin: 50% 130%;
}
#roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card[aria-pressed="true"] {
  --lift: -18px;
  box-shadow: 0 10px 20px #7a4fc155, 0 0 0 2px #bd8fff;
}
#roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card.card-hint { --lift: -5px; }
@media (hover: hover) {
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card:hover:not(.card-dragging) { --lift: -9px; z-index: 2; }
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card[aria-pressed="true"]:hover { --lift: -20px; }
}
@media (max-width: 680px) {
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card { --fan: 0deg !important; --arc: 0px !important; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Controls spring when pressed. */
  button, .game, .lobby-player, .room-code {
    transition: transform 220ms cubic-bezier(.34, 1.56, .64, 1), box-shadow 200ms ease, background-color 160ms ease, filter 160ms ease;
  }
  button:active:not(:disabled) { transform: translate(2px, 2px) scale(.95); }
  .lobby-player:hover { transform: translateY(-4px) rotate(-2deg); }
  .lobby-player:nth-child(even):hover { transform: translateY(-4px) rotate(2deg); }

  /* Cards in your hand */
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card {
    transition: transform 300ms cubic-bezier(.34, 1.56, .64, 1), box-shadow 200ms ease, background 150ms ease, outline-color 150ms ease;
  }
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card:active:not(.card-dragging) { --lift: -4px; }
  #roomMain .card-game-stage .thirteen-hand > .playing-cards .playing-card.card-flying {
    position: relative;
    z-index: 9;
    transition: transform 300ms cubic-bezier(.55, 0, .25, 1), opacity 300ms ease !important;
    will-change: transform;
  }
  .deal-in .playing-card, .card-deal {
    animation: card-deal 520ms cubic-bezier(.2, 1.2, .35, 1) both;
    animation-delay: calc(var(--i, 0) * 40ms);
    will-change: transform, opacity;
  }
  @keyframes card-deal {
    from { opacity: 0; transform: translate(0, -140px) rotate(-30deg) scale(.55); }
  }

  /* Cards landing on the table */
  .thirteen-play-enter { animation: none !important; }
  .thirteen-play-enter .playing-card, .card-drop {
    animation: card-land 420ms cubic-bezier(.3, 1.4, .6, 1) both;
    animation-delay: calc(var(--i, 0) * 55ms);
    will-change: transform, opacity;
    backface-visibility: hidden;
  }
  .thirteen-play-enter .playing-card:nth-child(2) { --i: 1; }
  .thirteen-play-enter .playing-card:nth-child(3) { --i: 2; }
  .thirteen-play-enter .playing-card:nth-child(4) { --i: 3; }
  .thirteen-play-enter .playing-card:nth-child(5) { --i: 4; }
  @keyframes card-land {
    0% { opacity: 0; transform: translate3d(0, 40px, 0) scale(1.25) rotate(-10deg); }
    65% { opacity: 1; transform: translate3d(0, -4px, 0) scale(.97) rotate(1.5deg); }
    100% { transform: translate3d(0, 0, 0); }
  }
  .thirteen-previous-enter { animation: fade-back 380ms ease-out both; }
  @keyframes fade-back { from { opacity: 1; transform: translateY(-6px) scale(1.08); } }

  /* Seats */
  #roomMain .card-game-stage .table-seat-active::after {
    content: '';
    position: absolute;
    inset: -5px;
    border: 3px solid #f8d633;
    border-radius: inherit;
    pointer-events: none;
    animation: seat-ring 1.6s ease-out infinite;
    will-change: transform, opacity;
  }
  @keyframes seat-ring { from { opacity: .9; transform: scale(.98); } to { opacity: 0; transform: scale(1.12); } }
  .seat-turn { animation: bob 1.2s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-3px); } }
  .seat-bubble-new { animation: bubble-pop 380ms cubic-bezier(.34, 1.56, .64, 1) both; }
  @keyframes bubble-pop { from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.4); } }

  /* The main button pulses when it's your move. */
  body.my-turn #roomMain .stage-card > .actions button:first-child { position: relative; }
  body.my-turn #roomMain .stage-card > .actions button:first-child::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 3px solid #7a4fc1;
    border-radius: inherit;
    pointer-events: none;
    animation: cta-ring 1.8s ease-out infinite;
    will-change: transform, opacity;
  }
  @keyframes cta-ring { from { opacity: .7; transform: scale(.97); } to { opacity: 0; transform: scale(1.1); } }

  /* A new game or round pops in; scores bump when they change. */
  .stage-pop { animation: stage-pop 460ms cubic-bezier(.34, 1.56, .64, 1) both; }
  @keyframes stage-pop { from { opacity: .4; transform: translateY(10px) scale(.97); } }
  .score-bump { animation: score-bump 800ms cubic-bezier(.34, 1.56, .64, 1); }
  @keyframes score-bump { 30% { transform: scale(1.22) rotate(-3deg); background: #b6f06b; } }
  #turnBanner:not([hidden]) { animation: banner 1500ms cubic-bezier(.34, 1.56, .64, 1) both; }
  @keyframes banner {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
    28% { transform: translate(-50%, -50%) scale(1) rotate(0); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(.9); }
  }
  #toast { animation: toast-pop 340ms cubic-bezier(.34, 1.56, .64, 1); }
  @keyframes toast-pop { from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.8); } }
}

/* Card table: green baize with a fine weave, framed in polished wood. Applies to 13 and Texas Hold'em. */
:root #roomMain .card-game-stage.card-game-stage .table-felt.table-felt {
  border: 12px solid transparent;
  background:
    radial-gradient(circle at 1px 1px, #ffffff12 0.8px, transparent 1.3px) 0 0 / 5px 5px padding-box,
    repeating-linear-gradient(45deg, #0000000f 0 1px, transparent 1px 4px) padding-box,
    repeating-linear-gradient(-45deg, #ffffff08 0 1px, transparent 1px 4px) padding-box,
    radial-gradient(ellipse at 50% 35%, #3aa96d 0%, #23824f 52%, #155c37 100%) padding-box,
    repeating-linear-gradient(97deg, #00000018 0 2px, transparent 2px 6px, #ffffff0d 6px 7px, transparent 7px 13px) border-box,
    linear-gradient(160deg, #c08850 0%, #8a5428 30%, #a8713f 55%, #6d3e1c 80%, #94602f 100%) border-box;
  box-shadow:
    inset 0 0 0 2px #0f3d26,
    inset 0 10px 26px #00000059,
    inset 0 -6px 16px #ffffff12,
    0 0 0 2px #3b2210,
    0 10px 22px #1d102855;
  color: #eef7e8;
}
:root #roomMain .card-game-stage.card-game-stage .table-felt :is(h3, p, .last-play-label, .table-pot, strong) { color: #eef7e8; text-shadow: 0 1px 2px #0006; }
:root #roomMain .card-game-stage .table-felt > .thirteen-previous { border-left-color: #ffffff40; }
:root #roomMain .card-game-stage .table-felt .table-card-slot { border-color: #ffffff40; background: #ffffff10; }
@media (max-width: 680px) {
  :root #roomMain .card-game-stage.card-game-stage .table-felt.table-felt { border-width: 8px; }
}

/* Hold'em: what each player just did */
.seat-bubble-raise { background: #f8d633; }
.seat-bubble-fold { background: #e6e1ee; color: #6b6585; }
.seat-bubble-raise::after { background: #f8d633; }
.seat-bubble-fold::after { background: #e6e1ee; }
.seat-bubble-allin, .seat-bubble-allin::after { background: #ff7a59; color: #fff; }
.seat-bubble-win, .seat-bubble-win::after { background: #f8d633; }
.seat-bubble-win { font-size: 13px; padding: 2px 11px; }
.seat-bubble-shown, .seat-bubble-shown::after { background: #dff3ff; }
/* Hands shown at the end, sitting on the seat */
.seat-cards { display: block; margin-top: 4px; }
.seat-cards .playing-cards { display: flex; justify-content: center; gap: 3px; flex-wrap: nowrap; }
.seat-cards .playing-card { width: 30px; height: 42px; min-width: 0; font-size: 11px; }
.table-pot-win strong { color: #ffe066 !important; }
@media (prefers-reduced-motion: no-preference) {
  .seat-bubble-win { animation: bubble-pop 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
  .table-pot-win strong { animation: bubble-pop 520ms cubic-bezier(.34, 1.56, .64, 1) both; }
}
/* Hold'em raise slider next to its button */
.poker-raise { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--ui-inset, #fff0c1); }
.poker-raise input[type=range] { width: clamp(90px, calc(18vw / var(--site-zoom, 1)), 180px); accent-color: #f8a933; }
.poker-raise button { margin: 0; }
/* Board games: what the bots did on their turns */
.bot-log { display: grid; gap: 4px; margin: 10px auto; padding: 8px 12px; max-width: 640px; border: 1px dashed var(--ui-border, #a994bd); border-radius: 12px; background: var(--ui-inset, #fff0c1); list-style: none; text-align: left; font-size: 13px; }

/* Wavelength: shared dial + slider for the guessers */
.wave-axis { display: flex; justify-content: space-between; gap: 12px; max-width: 420px; margin: 4px auto 0; font-weight: 800; font-size: 15px; }
.wave-axis span:first-child { color: #2f7fd0; }
.wave-axis span:last-child { color: #e0334f; text-align: right; }
.wave-dial-box { max-width: 420px; margin: 6px auto 0; }
.wave-dial { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 12px #2a165033); }
.wave-needle { transition: x2 120ms ease, y2 120ms ease; }
.wave-slider { display: flex; align-items: center; gap: 12px; max-width: 420px; margin: 10px auto 4px; }
.wave-slider output { min-width: 52px; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: #252046; font: 800 20px/1 ui-monospace, Menlo, monospace; text-align: center; }
#waveRange {
  flex: 1;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#waveRange::-webkit-slider-runnable-track { height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, #5fb4ff, #7ee08a, #ffcf3a, #ff9a3d, #ff5f7e); }
#waveRange::-moz-range-track { height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, #5fb4ff, #7ee08a, #ffcf3a, #ff9a3d, #ff5f7e); }
#waveRange::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; margin-top: -11px; border: 3px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: 0 4px 8px #0004; }
#waveRange::-moz-range-thumb { width: 28px; height: 28px; border: 3px solid var(--ink); border-radius: 50%; background: #fff; }
.wave-by { margin: 0; font-size: 12px; opacity: .7; }

/* Two Truths and a Lie: tap the sentence you think is the lie */
.truth-ask { margin: 4px 0 10px; font-weight: 700; }
.truth-cards { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.truth-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--ui-panel, #fffdf7);
  color: var(--ui-text, #252046);
  text-align: left;
  box-shadow: 3px 3px 0 var(--ink);
}
.truth-card b { display: grid; place-items: center; grid-row: span 2; width: 40px; height: 40px; border-radius: 12px; background: #c6abff; color: #252046; font-size: 18px; }
.truth-card span { font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.truth-card em { grid-column: 2; font-style: normal; font-size: 12px; font-weight: 800; color: #7a4fc1; }
.truth-card small { grid-column: 2; font-size: 12px; opacity: .75; }
button.truth-card:hover { background: #f1e9ff; }
.truth-mine { background: #fff3a8 !important; box-shadow: 0 0 0 3px #f8d633, 3px 3px 0 var(--ink); }
.truth-mine b { background: #f8d633; }
.truth-lie { background: #ffe1e6; border-color: #e0334f; }
.truth-lie b { background: #ff5f7e; color: #fff; }
.truth-lie em { color: #c21f45; }
.truth-true { background: #e4f8ea; }
.truth-true b { background: #7ee08a; }
.truth-true em { color: #1f7a4d; }
.truth-count { margin: 10px 0 0; font-size: 13px; opacity: .75; }
@media (prefers-reduced-motion: no-preference) {
  .truth-lie { animation: truth-shake 500ms ease; }
  @keyframes truth-shake { 20%, 60% { transform: translateX(-5px) rotate(-1deg); } 40%, 80% { transform: translateX(5px) rotate(1deg); } }
}
.truth-lie.truth-mine { background: #ffe1e6 !important; box-shadow: 0 0 0 3px #ff5f7e, 3px 3px 0 var(--ink); }
.truth-true.truth-mine { background: #e4f8ea !important; }
/* Ranking game: the guess next to the real order */
.rank-score { font-weight: 900; font-size: 18px; text-align: center; }
.rank-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0; text-align: left; }
.rank-compare h4 { margin: 0 0 6px; font-size: 13px; }
.rank-compare p { display: flex; gap: 8px; align-items: center; margin: 0 0 5px; padding: 6px 10px; border: 2px solid var(--ink, #252046); border-radius: 10px; background: var(--ui-inset, #fff7dc); overflow-wrap: anywhere; }
.rank-compare b { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink, #252046); color: #fff; font-size: 12px; }
.rank-compare .rank-hit { background: #c8f2c2; }
.rank-compare .rank-miss { background: #ffd6d0; }
@media (max-width: 480px) { .rank-compare { gap: 6px; } .rank-compare p { padding: 5px 6px; font-size: 13px; } }
/* One-word story: how much of it writers can see */
.story-hidden { text-align: center; font-style: italic; opacity: .85; }
.story-count { font-size: 12px; font-weight: 700; opacity: .75; }
.story-show { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.story-show button { padding: 6px 12px; font-size: 13px; }
.story-show .story-show-on button { background: #f8d633; }
.song-random { margin-top: 8px; font-size: 13px; padding: 7px 14px; }
/* Size control (− 150% +). Desktop: scales everything while a game is open; the home page stays 100%. Phones: the game screen only. */
:root { --site-zoom: 1; }
/* Only the game area is scaled, so the header, menu and chat keep their size and the game fits the space between them. */
body[data-game-scene] :is(#play, #roomMain) { --site-zoom: var(--size, 1); zoom: var(--size, 1); }
.game-size { display: none; align-items: center; border: 2px solid var(--ink, #252046); border-radius: 999px; background: #fff9e8; box-shadow: 2px 2px 0 var(--ink, #252046); overflow: hidden; flex: none; }
.game-size button { margin: 0; padding: 5px 9px; min-width: 30px; border: 0; border-radius: 0; box-shadow: none; background: transparent; font-size: 14px; font-weight: 900; line-height: 1; transform: none; }
.game-size button[data-size="0"] { min-width: 50px; font-size: 11px; border-left: 2px solid var(--ink, #252046); border-right: 2px solid var(--ink, #252046); }
.game-size button[data-size="reset"] { font-size: 15px; border-left: 2px solid var(--ink, #252046); }
.game-size button:hover:not(:disabled) { background: #f8d633; transform: none; box-shadow: none; }
@media (min-width: 900px) { body[data-game-scene] header .game-size { display: flex; } }
@media (max-width: 899px) {
  body > .game-size { position: fixed; right: 4px; top: 50%; z-index: 20; flex-direction: column; border-radius: 14px; transform: translateY(-50%); opacity: .9; }
  body[data-game-scene] > .game-size { display: flex; }
  .game-size button { min-width: 34px; padding: 8px 4px; }
  .game-size button[data-size="0"] { min-width: 34px; font-size: 10px; border: 0; border-top: 2px solid var(--ink, #252046); border-bottom: 2px solid var(--ink, #252046); }
}

/* Ranking game: topic line and the idea buttons under the form. */
.rank-topic { margin: 0 0 6px; font-size: 15px; }
.rank-topic span { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; opacity: .7; }
.rank-topic b { font-size: 18px; }
.rank-ideas { margin-top: 16px; padding-top: 12px; border-top: 2px dashed var(--line, #0002); text-align: left; }
.rank-ideas > p { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.rank-idea-list { display: flex; flex-wrap: wrap; gap: 6px; }
html body .rank-idea { min-height: 36px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: none; }
html body .rank-idea.picked { background: var(--ui-active, #dbcbff); }
html body .rank-idea-more { min-width: 40px; }
