:root {
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f7f8ff;
  background: #0d0f18;
  --panel: rgba(29, 33, 50, .92);
  --line: rgba(255,255,255,.12);
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --red: #ef4252;
  --yellow: #f6c945;
  --green: #28bf77;
  --blue: #4389f4;
  --motion-scale: 1;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% 20%, #252b47 0%, #121522 45%, #090b12 100%); }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
.brandbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(7,9,15,.62); backdrop-filter: blur(18px); }
.brand-tools { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 12px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: 18px; }
.logo { font-size: 26px; font-weight: 950; letter-spacing: .08em; transform: skew(-7deg); }
.connection { font-size: 13px; color: #9aa2bd; }
.connection.online { color: #73d99d; }
.panel { width: min(520px, calc(100% - 28px)); margin: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; padding: 28px; box-shadow: var(--shadow); }
.hidden { display: none !important; }
h1 { margin: 8px 0 10px; font-size: clamp(34px, 7vw, 54px); line-height: .95; letter-spacing: -.04em; }
p { color: #b8bfd5; line-height: 1.55; }
label { display: grid; gap: 8px; margin-top: 24px; color: #cfd4e7; font-size: 14px; }
input, select { width: 100%; border: 1px solid var(--line); background: #111522; color: white; padding: 14px 16px; border-radius: 14px; outline: none; }
input:focus, select:focus { border-color: rgba(255,255,255,.35); }
button { background: #303750; padding: 13px 18px; border-radius: 14px; font-weight: 800; transition: transform .12s ease, filter .12s ease; }
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .42; cursor: default; }
.primary { background: white; color: #111522; }
.home-actions { display: grid; gap: 12px; margin-top: 18px; }
.joinline { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.bot-options { display: grid; gap: 8px; }
.bot-selects { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.bot-selects select { min-width: 0; }
#roomCode { text-transform: uppercase; letter-spacing: .16em; font-weight: 900; }
.hero-card { display: flex; justify-content: center; height: 88px; margin-bottom: 18px; }
.mini-card { width: 58px; height: 82px; margin-left: -12px; border-radius: 12px; border: 4px solid #f7f7fa; box-shadow: 0 8px 18px rgba(0,0,0,.24); display: grid; place-items: center; font-size: 28px; font-weight: 950; transform: rotate(var(--r,0deg)); }
.mini-card:nth-child(1){ --r:-15deg } .mini-card:nth-child(2){ --r:-5deg } .mini-card:nth-child(3){ --r:7deg } .mini-card:nth-child(4){ --r:15deg }
.red { background: var(--red)!important; } .yellow { background: var(--yellow)!important; color: #2f2810!important; } .green { background: var(--green)!important; } .blue { background: var(--blue)!important; }
.room-title { font-weight: 900; font-size: 26px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.muted { font-size: 14px; }
.players { display: grid; gap: 9px; margin: 22px 0; }
.player-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; background: #111522; border-radius: 14px; }
.player-row .state { color: #8f98b3; font-size: 13px; }
.player-row.ready .state { color: #71d79a; }
.game { flex: 1; min-height: 0; display: grid; grid-template-rows: auto 1fr auto auto; padding: 14px; gap: 10px; overflow: hidden; }
.opponents { display: flex; justify-content: center; gap: 10px; min-height: 64px; }
.opponent { background: rgba(24,28,43,.9); border: 1px solid var(--line); border-radius: 16px; padding: 9px 14px; min-width: 110px; text-align: center; }
.opponent.active { outline: 2px solid rgba(255,255,255,.75); }
.opponent .count { font-size: 12px; color: #a8b0c8; margin-top: 4px; }
.table-zone {
  --table-art: url("/assets/backgrounds/table_orbit.webp");
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background-image:
    radial-gradient(circle at 50% 44%, rgba(10,30,63,.16) 0%, rgba(6,16,37,.34) 62%, rgba(3,9,23,.56) 100%),
    var(--table-art);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 70px rgba(0,0,0,.22);
}
.table-zone[data-background="orbit"] { --table-art: url("/assets/backgrounds/table_orbit.webp"); }
.table-zone[data-background="felt"] { --table-art: url("/assets/backgrounds/table_felt.webp"); }
.table-zone[data-background="cosmic"] { --table-art: url("/assets/backgrounds/table_cosmic.webp"); }

.turn-info { font-weight: 900; text-align: center; }
.turn-direction {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 13px 7px 9px;
  border-radius: 999px;
  background: rgba(7,12,24,.42);
  border: 1px solid rgba(255,255,255,.13);
  color: #eef1ff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.direction-arrow {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}
.direction-text { font-size: 13px; font-weight: 850; }
.turn-direction[data-direction="counterclockwise"] .direction-arrow { transform: rotate(0deg); }
.center-cards { display: flex; align-items: center; justify-content: center; gap: 18px; }
.card, .deck { width: clamp(78px, 19vw, 112px); aspect-ratio: .68; border-radius: 16px; border: 5px solid #f5f5f7; box-shadow: 0 12px 28px rgba(0,0,0,.38); display: grid; place-items: center; font-weight: 950; font-size: clamp(28px, 8vw, 50px); position: relative; user-select: none; }
.card::after { content: ""; position: absolute; inset: 14%; border: 3px solid rgba(255,255,255,.7); border-radius: 50%; transform: rotate(-24deg); }
.card > span { z-index: 1; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.deck { background: linear-gradient(145deg,#2c324a,#151928); overflow: hidden; }
.deck::before { content: "L"; font-size: 54px; font-style: italic; transform: skew(-12deg); opacity: .9; }
.deck span { position: absolute; right: 7px; bottom: 5px; font-size: 12px; color: #d3d7e6; }
.event { min-height: 21px; color: #c7cedf; font-size: 13px; text-align: center; }
.controls { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.speed-control { margin: 0; display: flex; align-items: center; gap: 7px; padding: 5px 7px 5px 10px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid var(--line); color: #aeb6cf; font-size: 12px; }
.speed-control select { width: auto; min-width: 108px; padding: 8px 28px 8px 10px; border-radius: 9px; font-size: 12px; }
.last-call { background: #ff5a69; }
.last-call.armed { box-shadow: 0 0 0 3px rgba(255,255,255,.85) inset; transform: scale(1.04); }
.hand { min-height: 150px; display: flex; align-items: flex-end; justify-content: center; overflow-x: auto; overflow-y: hidden; padding: 8px 8px 2px; scrollbar-width: thin; }
.hand .card { flex: 0 0 auto; width: 84px; margin-left: -22px; transform-origin: bottom center; transition: transform .12s ease, filter .12s ease, opacity .12s ease; font-size: 34px; }
.hand .card:first-child { margin-left: 0; }
.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-12px); }
.hand .card:not(.playable) { opacity: .56; filter: saturate(.65); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal-card { width: min(360px,100%); border-radius: 22px; padding: 22px; background: #1d2132; border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-btn { height: 76px; border-radius: 16px; font-weight: 950; text-shadow: 0 2px 5px rgba(0,0,0,.35); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #fff; color: #151823; padding: 11px 16px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow); z-index: 30; max-width: calc(100% - 28px); text-align: center; }
@media (max-height: 650px) { .brandbar { height: 52px; } .hand { min-height: 115px; } .hand .card { width: 68px; } .game { padding: 8px; } }

/* v0.9 game-feel polish */
.asset-card {
  background: transparent !important;
  border: 0 !important;
  overflow: visible;
  padding: 0;
}
.asset-card::after { display: none; }
.asset-card > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
  pointer-events: none;
  user-select: none;
}
.deck {
  border: 0;
  background: url('/assets/cards/backs/card_back_main.svg') center/contain no-repeat;
  box-shadow: 0 12px 28px rgba(0,0,0,.38);
}
.deck::before { display: none; }
.deck span {
  right: -4px;
  bottom: -5px;
  min-width: 27px;
  min-height: 27px;
  display: grid;
  place-items: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: #fff;
  color: #071d46;
  border: 2px solid #071d46;
  font-weight: 950;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.recent-wrap {
  min-height: 57px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  border: 1px solid rgba(255,255,255,.08);
}
.recent-label {
  color: #98a3c2;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.recent-cards {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
}
.recent-cards img {
  width: 30px;
  height: 43px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.28));
  animation: recent-card-in .28s ease-out both;
}
.recent-empty { color: #7f8aa7; font-size: 12px; }
.flying-card {
  position: fixed;
  z-index: 100;
  width: 84px;
  height: 120px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.45));
  will-change: transform, opacity;
}
.top-card-pop { animation: top-card-pop .52s cubic-bezier(.2,.9,.25,1); }
.event-pulse { animation: event-pulse .48s ease-out; }
.opponent.active { animation: active-player-pulse 1.3s ease-in-out infinite alternate; }

@keyframes recent-card-in {
  from { opacity: 0; transform: translateY(-5px) scale(.82); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes top-card-pop {
  0% { transform: scale(.88) rotate(-3deg); filter: brightness(1.28); }
  65% { transform: scale(1.06) rotate(1deg); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}
@keyframes event-pulse {
  0% { opacity: .4; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes active-player-pulse {
  from { box-shadow: 0 0 0 rgba(255,255,255,0); }
  to { box-shadow: 0 0 18px rgba(255,255,255,.16); }
}

@media (max-width: 520px) {
  .recent-wrap { grid-template-columns: 1fr; gap: 4px; text-align: center; }
  .recent-label { font-size: 10px; }
  .recent-cards img { width: 26px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .recent-cards img,
  .top-card-pop,
  .event-pulse,
  .opponent.active { animation: none !important; }
  .hand .card { transition: none; }
}


/* v0.11 pacing, SFX feedback and game-feel */
.dealing .hand .card,
.dealing .top.asset-card { opacity: .08; filter: saturate(.5); }
.dealing .controls button { pointer-events: none; }

.action-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
  font-weight: 1000;
  font-size: clamp(32px, 10vw, 72px);
  line-height: .9;
  letter-spacing: -.05em;
  color: #fff;
  text-shadow: 0 4px 0 rgba(10,15,34,.55), 0 10px 30px rgba(0,0,0,.5);
  -webkit-text-stroke: 2px rgba(7,29,70,.65);
}
.action-burst[data-rank="draw1"], .action-burst[data-rank="draw2"], .action-burst[data-rank="draw5"], .action-burst[data-rank="wild2"], .action-burst[data-rank="wild4"], .action-burst[data-rank="wildcolor"] { color: #ffd85a; }
.action-burst[data-rank="wild"] { color: #fff4a8; }
.action-burst[data-rank="skipall"] { color: #ff9ec1; }
.action-burst-in { animation: action-burst-in calc(.72s * var(--motion-scale)) cubic-bezier(.15,.92,.2,1) both; }

.deck-bump { animation: deck-bump calc(.42s * var(--motion-scale)) cubic-bezier(.2,.9,.25,1); }
.draw-pulse { animation: draw-pulse calc(.5s * var(--motion-scale)) ease-out; }
.turn-shift { animation: turn-shift calc(.46s * var(--motion-scale)) cubic-bezier(.2,.9,.25,1); }
.direction-flip .direction-arrow { animation: direction-flip calc(.62s * var(--motion-scale)) cubic-bezier(.18,.88,.22,1); }
.new-card { animation: new-card-in calc(.55s * var(--motion-scale)) cubic-bezier(.18,.88,.2,1) both; }
.impact-heavy { animation: table-impact calc(.38s * var(--motion-scale)) ease-out; }
.last-call.armed { animation: last-call-ready calc(.72s * var(--motion-scale)) ease-in-out infinite alternate; }

.card-back-flight { filter: drop-shadow(0 16px 20px rgba(0,0,0,.44)); }
.win-spark {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  color: #ffd85a;
  font-size: 22px;
  font-weight: 1000;
  text-shadow: 0 3px 8px rgba(0,0,0,.35);
  animation-name: win-spark-fall;
  animation-timing-function: cubic-bezier(.15,.8,.25,1);
  animation-fill-mode: forwards;
}
.win-spark:nth-of-type(3n) { color: #4389f4; }
.win-spark:nth-of-type(4n) { color: #28bf77; }
.win-spark:nth-of-type(5n) { color: #ef4252; }

@keyframes action-burst-in {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.45) rotate(-6deg); }
  34% { opacity: 1; transform: translate(-50%,-50%) scale(1.18) rotate(2deg); }
  62% { transform: translate(-50%,-50%) scale(.98) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%,-56%) scale(1.05) rotate(0); }
}
@keyframes deck-bump {
  0%,100% { transform: translateY(0) rotate(0); }
  42% { transform: translateY(-7px) rotate(-2deg) scale(1.035); }
}
@keyframes draw-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.055); filter: brightness(1.28); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes turn-shift {
  0% { opacity: .35; transform: translateY(-6px) scale(.96); }
  60% { opacity: 1; transform: translateY(1px) scale(1.055); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes direction-flip {
  0% { transform: rotate(0deg) scale(.8); opacity: .5; }
  70% { transform: rotate(300deg) scale(1.18); opacity: 1; }
  100% { transform: rotate(360deg) scale(1); opacity: 1; }
}
@keyframes new-card-in {
  0% { opacity: .15; transform: translateY(-28px) scale(.72) rotate(6deg); }
  70% { opacity: 1; transform: translateY(-4px) scale(1.04) rotate(-1deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}
@keyframes table-impact {
  0%,100% { transform: translate(0,0); }
  28% { transform: translate(-2px,1px); }
  52% { transform: translate(2px,-1px); }
  76% { transform: translate(-1px,0); }
}
@keyframes last-call-ready {
  from { box-shadow: 0 0 0 2px rgba(255,255,255,.7) inset, 0 0 8px rgba(255,90,105,.15); }
  to { box-shadow: 0 0 0 3px rgba(255,255,255,.9) inset, 0 0 22px rgba(255,90,105,.42); transform: scale(1.055); }
}
@keyframes win-spark-fall {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.4) rotate(0); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(220deg); }
}

@media (max-width: 520px) {
  .bot-selects { grid-template-columns: 1fr; }
  .speed-control { width: 100%; justify-content: center; }
  .speed-control select { flex: 1; max-width: 180px; }
  .brandbar { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .action-burst-in,
  .deck-bump,
  .draw-pulse,
  .turn-shift,
  .direction-flip .direction-arrow,
  .new-card,
  .impact-heavy,
  .last-call.armed,
  .win-spark { animation: none !important; }
  .dealing .hand .card,
  .dealing .top.asset-card { opacity: 1; filter: none; }
}


/* v0.12 clarity: active color, final-card call, play-again UX */
.active-color-info {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(7, 12, 24, .46);
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
  font-size: 13px;
}
.active-color-label { color: #aeb7d2; font-weight: 700; }
.active-color-info strong { color: #fff; font-weight: 950; }
.active-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 7px rgba(0,0,0,.28);
}
.active-color-swatch[data-color="red"] { background: var(--red); }
.active-color-swatch[data-color="yellow"] { background: var(--yellow); }
.active-color-swatch[data-color="green"] { background: var(--green); }
.active-color-swatch[data-color="blue"] { background: var(--blue); }
.color-chosen-by { color: #dbe2f6; font-size: 12px; font-weight: 750; }
.active-color-info[data-color="red"] { box-shadow: 0 0 18px rgba(239,66,82,.15); }
.active-color-info[data-color="yellow"] { box-shadow: 0 0 18px rgba(246,201,69,.13); }
.active-color-info[data-color="green"] { box-shadow: 0 0 18px rgba(40,191,119,.14); }
.active-color-info[data-color="blue"] { box-shadow: 0 0 18px rgba(67,137,244,.15); }
.last-call { min-width: 108px; letter-spacing: .01em; }
#rematch { min-width: 132px; }
@media (max-width: 520px) {
  .active-color-info { font-size: 12px; gap: 6px; padding: 6px 10px; }
  .active-color-swatch { width: 16px; height: 16px; }
  .color-chosen-by { flex-basis: 100%; text-align: center; }
}

.top[data-active-color="red"] > img { filter: drop-shadow(0 0 12px rgba(239,66,82,.58)); }
.top[data-active-color="yellow"] > img { filter: drop-shadow(0 0 12px rgba(246,201,69,.55)); }
.top[data-active-color="green"] > img { filter: drop-shadow(0 0 12px rgba(40,191,119,.55)); }
.top[data-active-color="blue"] > img { filter: drop-shadow(0 0 12px rgba(67,137,244,.58)); }


/* v0.13 turn-flow clarity: visual bot countdown removed; direction stays visible */
@media (max-width: 520px) {
  .turn-direction { max-width: calc(100% - 18px); padding: 6px 10px 6px 7px; gap: 7px; }
  .direction-arrow { width: 25px; height: 25px; font-size: 22px; }
  .direction-text { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* v0.14 series scoring and persistent match table */
.scoreboard {
  width: min(620px, 100%);
  display: grid;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 16px;
  background: rgba(7, 12, 24, .34);
  border: 1px solid rgba(255,255,255,.11);
}
.scoreboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #aeb7d2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.scoreboard-head strong { color: #eef1ff; }
.score-rows {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.score-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 11px;
  background: rgba(255,255,255,.055);
  color: #cbd2e5;
  font-size: 12px;
}
.score-row.me { outline: 1px solid rgba(255,255,255,.35); }
.score-row.series-winner { box-shadow: 0 0 0 2px rgba(246,201,69,.75) inset; }
.score-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row strong { color: #fff; font-size: 14px; }
.score-gain { color: #71d79a; font-size: 11px; font-weight: 900; }

@media (max-width: 640px) {
  .table-zone { gap: 10px; padding: 12px; }
  .score-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-row { padding: 6px 7px; }
}

/* v0.15 persistent profile, league and fair-play cooldown */
.profile-card {
  margin: 18px 0 4px;
  padding: 14px 15px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  display: grid;
  gap: 12px;
}
.profile-rank { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-rank > strong { font-size: 14px; color: #eef1ff; }
.league-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 950; letter-spacing: .03em; background: #8a5b3b; color: #fff6e8; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.league-badge[data-league="silver"] { background: #778399; color: #fff; }
.league-badge[data-league="gold"] { background: #c89820; color: #241a04; }
.league-badge[data-league="platinum"] { background: #60a9a7; color: #061d23; }
.league-badge[data-league="diamond"] { background: #4c78d8; color: #fff; }
.league-badge[data-league="master"] { background: #774ec2; color: #fff; }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.profile-stats > span { min-width: 0; padding: 8px 5px; border-radius: 12px; background: rgba(8,12,23,.38); text-align: center; }
.profile-stats strong { display: block; font-size: 17px; line-height: 1.1; }
.profile-stats small { display: block; margin-top: 4px; color: #98a3c2; font-size: 10px; white-space: nowrap; }
.human-penalty { margin: 12px 0 2px; padding: 11px 13px; border-radius: 14px; border: 1px solid rgba(255,190,86,.28); background: rgba(126,75,14,.24); display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; }
.human-penalty strong { font-size: 12px; }
.human-penalty > span { font-weight: 950; color: #ffd274; font-variant-numeric: tabular-nums; }
.human-penalty small { grid-column: 1 / -1; color: #d8c59f; font-size: 11px; }
@media (max-width: 420px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-rank { align-items: flex-start; flex-direction: column; gap: 7px; }
}

/* v0.16 matchmaking player-count selector + explicit room exit */
.play-options {
  display: grid;
  grid-template-columns: minmax(132px, .72fr) minmax(0, 1.28fr);
  gap: 8px;
}
.play-options select { min-width: 0; }
.lobby-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.danger-ghost {
  background: rgba(255, 90, 105, .10);
  border: 1px solid rgba(255, 90, 105, .32);
  color: #ffd8dd;
}
.danger-ghost:hover { background: rgba(255, 90, 105, .16); }
@media (max-width: 420px) {
  .play-options { grid-template-columns: 1fr; }
  .lobby-actions { grid-template-columns: 1fr; }
}

/* v0.17 round settlement clarity + exit only between rounds */
.round-settlement {
  width: min(620px, 100%);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(7, 12, 24, .48);
  border: 1px solid rgba(113, 215, 154, .22);
}
.round-settlement.hidden { display: none; }
.settlement-title {
  color: #eef1ff;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.settlement-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: #cbd2e5;
  font-size: 11px;
}
.settlement-row.winner { background: rgba(113, 215, 154, .10); color: #effff5; }
.settlement-row strong { color: #fff; white-space: nowrap; }
.settlement-row.winner strong { color: #71d79a; }
.settlement-note { color: #9fa9c4; font-size: 10px; line-height: 1.35; }
.lobby-actions { grid-template-columns: 1fr; }

/* v0.18 optional light/dark double-sided deck */
.play-options {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) minmax(160px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
}
.private-create-options { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.flip-toggle {
  margin: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #111522;
  color: #e4e8f8;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.flip-toggle input { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: #9b7cff; }
.flip-toggle span { min-width: 0; line-height: 1.15; }
.lobby-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}
.lobby-mode[data-flip="on"] { background: rgba(112,76,190,.2); border-color: rgba(184,152,255,.4); color: #efe8ff; }
.flow-badges { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.side-indicator {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
.side-indicator[data-side="light"] { background: rgba(255,216,90,.12); color: #fff2b3; }
.side-indicator[data-side="dark"] { background: rgba(104,70,178,.3); color: #f0e8ff; border-color: rgba(190,159,255,.42); }
.side-indicator > span { font-size: 18px; line-height: 1; }
.side-indicator-pop { animation: side-indicator-pop calc(.7s * var(--motion-scale)) cubic-bezier(.18,.88,.2,1); }
body[data-game-side="dark"] .table-zone {
  background-image:
    radial-gradient(circle at 50% 45%, rgba(72,45,120,.28) 0%, rgba(16,13,35,.48) 58%, rgba(5,5,16,.72) 100%),
    var(--table-art);
  border-color: rgba(179,151,255,.24);
  box-shadow: inset 0 0 90px rgba(16,4,36,.42);
}
body[data-game-side="dark"] .brandbar { border-bottom-color: rgba(179,151,255,.2); }
.game.side-flip-dark .table-zone { animation: side-flip-dark calc(.82s * var(--motion-scale)) ease-out; }
.game.side-flip-light .table-zone { animation: side-flip-light calc(.82s * var(--motion-scale)) ease-out; }
.action-burst[data-rank="flip"] { color: #d8c4ff; }

@keyframes side-indicator-pop {
  0% { transform: scale(.72) rotate(-7deg); opacity: .4; }
  55% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
@keyframes side-flip-dark {
  0% { filter: brightness(1); transform: perspective(800px) rotateY(0deg); }
  42% { filter: brightness(1.45) saturate(.7); transform: perspective(800px) rotateY(7deg) scale(.985); }
  100% { filter: brightness(1); transform: perspective(800px) rotateY(0deg); }
}
@keyframes side-flip-light {
  0% { filter: brightness(.72); transform: perspective(800px) rotateY(0deg); }
  45% { filter: brightness(1.5); transform: perspective(800px) rotateY(-7deg) scale(.985); }
  100% { filter: brightness(1); transform: perspective(800px) rotateY(0deg); }
}

@media (max-width: 620px) {
  .play-options { grid-template-columns: 1fr 1fr; }
  .play-options #quick { grid-column: 1 / -1; }
  .private-create-options { grid-template-columns: 1fr; }
  .bot-selects { grid-template-columns: 1fr 1fr; }
  .bot-selects .flip-toggle { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .side-indicator-pop,
  .game.side-flip-dark .table-zone,
  .game.side-flip-light .table-zone { animation: none !important; }
}

/* v0.21 focused main menu + on-demand game setup */
.home-menu { width: min(540px, calc(100% - 28px)); }
.home-heading { text-align: center; }
.home-heading p { margin: 0 auto; max-width: 430px; }
.profile-card-compact { margin-top: 16px; }
.player-name-field { margin-top: 14px; }
.main-menu-actions { display: grid; gap: 10px; margin-top: 16px; }
.menu-action {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(145deg, rgba(49,56,82,.96), rgba(37,43,65,.96));
}
.menu-action.primary {
  background: linear-gradient(145deg, #fff, #e8ecff);
  border-color: rgba(255,255,255,.9);
}
.menu-action > span:last-child { min-width: 0; display: grid; gap: 3px; }
.menu-action strong { font-size: 17px; line-height: 1.1; }
.menu-action small { color: #aeb6cf; font-size: 11px; font-weight: 650; line-height: 1.3; }
.menu-action.primary small { color: #626a82; }
.menu-action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.09);
  font-size: 20px;
  line-height: 1;
}
.menu-action.primary .menu-action-icon { background: #111522; color: #fff; }
.menu-action.searching { border-color: rgba(67,137,244,.5); box-shadow: 0 0 0 2px rgba(67,137,244,.1) inset; }
.matchmaking-card {
  margin-top: 12px;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-radius: 15px;
  border: 1px solid rgba(67,137,244,.28);
  background: rgba(39,82,154,.16);
}
.matchmaking-card > div { min-width: 0; display: grid; gap: 3px; }
.matchmaking-card strong { font-size: 13px; }
.matchmaking-card small { color: #aeb9d7; font-size: 11px; line-height: 1.3; }
.matchmaking-card button { padding: 9px 12px; font-size: 12px; }
.rules-link {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: transparent;
  color: #98a3c2;
  font-size: 12px;
}
.rules-link:hover { color: #eef1ff; background: rgba(255,255,255,.04); }

.config-card {
  position: relative;
  width: min(430px, 100%);
  max-height: min(690px, calc(100vh - 40px));
  overflow-y: auto;
  text-align: left;
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  color: #cbd2e5;
  font-size: 24px;
  line-height: 1;
}
.config-heading { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding-right: 36px; }
.config-heading h2 { margin: 0; font-size: 24px; }
.config-heading p { margin: 4px 0 0; font-size: 12px; line-height: 1.35; }
.config-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(255,255,255,.09);
  font-size: 21px;
}
.config-field { margin-top: 16px; font-size: 12px; font-weight: 800; color: #bfc7de; }
.config-field select, .config-field input { margin-top: 0; }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.config-toggle { margin-top: 14px; }
.config-toggle > span { display: grid; gap: 3px; }
.config-toggle small { color: #909bb8; font-size: 10px; font-weight: 600; line-height: 1.3; }
.config-note { margin: 14px 0 0; padding: 10px 11px; border-radius: 12px; background: rgba(67,137,244,.08); color: #aeb9d7; font-size: 11px; line-height: 1.45; }
.modal-submit { width: 100%; margin-top: 16px; min-height: 48px; }
.friends-section { display: grid; gap: 10px; margin-top: 18px; }
.friends-section > strong { font-size: 13px; }
.compact-toggle { margin-top: 0; }
.config-divider { display: flex; align-items: center; gap: 10px; margin: 17px 0 0; color: #7f8aa7; font-size: 11px; }
.config-divider::before, .config-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.09); }
.rules-card h2 { margin: 0 40px 14px 0; }
.rules-list { display: grid; gap: 8px; }
.rules-list p { margin: 0; padding: 10px 11px; border-radius: 12px; background: rgba(255,255,255,.045); color: #c7cee0; font-size: 12px; line-height: 1.45; }
.rules-list strong, .rules-list b { color: #fff; }

@media (max-width: 520px) {
  .home-menu { padding: 22px 18px; }
  .hero-card { height: 74px; margin-bottom: 12px; transform: scale(.88); transform-origin: center bottom; }
  .home-heading h1 { font-size: 38px; }
  .profile-card-compact { padding: 11px 12px; }
  .menu-action { min-height: 66px; grid-template-columns: 42px 1fr; padding: 10px 12px; }
  .menu-action-icon { width: 38px; height: 38px; border-radius: 12px; }
  .config-card { padding: 20px 16px; max-height: calc(100vh - 24px); }
  .config-grid { grid-template-columns: 1fr; gap: 0; }
  .matchmaking-card { grid-template-columns: 1fr; }
  .matchmaking-card button { width: 100%; }
}

/* v0.22 FAQ / illustrated in-game guide */
.faq-card {
  position: relative;
  width: min(920px, 100%);
  max-height: min(820px, calc(100vh - 28px));
  overflow-y: auto;
  text-align: left;
  padding: 26px;
  scroll-behavior: smooth;
}
.faq-heading { padding-right: 48px; display: grid; gap: 6px; }
.faq-heading h2 { margin: 0; font-size: clamp(26px, 4vw, 38px); }
.faq-heading p { margin: 0; color: #aeb6cf; font-size: 13px; }
.faq-kicker { font-size: 10px; font-weight: 900; letter-spacing: .16em; color: #7fb6ff; }
.faq-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px; scrollbar-width: thin; }
.faq-tabs a { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); color: #cdd4e7; text-decoration: none; font-size: 11px; font-weight: 800; }
.faq-tabs a:hover, .faq-tabs a:focus-visible { background: rgba(77,142,255,.16); border-color: rgba(77,142,255,.35); color: #fff; }
.faq-section { scroll-margin-top: 14px; padding: 22px 0; border-top: 1px solid rgba(255,255,255,.08); }
.faq-section:first-of-type { border-top: 0; }
.faq-section h3 { margin: 0 0 10px; font-size: 20px; }
.faq-section h4 { margin: 18px 0 9px; color: #e8ecfa; font-size: 14px; }
.faq-copy { margin: 0 0 14px; color: #bac3da; font-size: 12px; line-height: 1.55; }
.faq-steps { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.faq-steps > div { display: grid; grid-template-columns: 32px 1fr; gap: 9px; align-items: start; padding: 11px; border-radius: 14px; background: rgba(255,255,255,.045); color: #c7cee0; font-size: 12px; line-height: 1.45; }
.faq-steps b:first-child { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(80,145,255,.18); color: #b9d7ff; }
.faq-section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.faq-section-title > div { display: flex; align-items: center; gap: 8px; }
.faq-section-title h3 { margin: 0; }
.faq-section-title small { color: #8994b1; font-size: 10px; }
.side-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; box-shadow: 0 0 18px currentColor; }
.side-dot.light { background: #ffd65a; color: #ffd65a; }
.side-dot.split { background: linear-gradient(135deg,#ffd65a 0 48%,#8966ff 52% 100%); color: #9b7cff; }
.faq-card-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.faq-card-grid.compact { grid-template-columns: repeat(5, minmax(0,1fr)); }
.faq-card-grid figure { min-width: 0; margin: 0; padding: 8px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.065); }
.faq-card-grid img { display: block; width: min(100%, 98px); aspect-ratio: 7 / 10; object-fit: contain; margin: 0 auto 8px; filter: drop-shadow(0 8px 12px rgba(0,0,0,.22)); }
.faq-card-grid figcaption { display: grid; gap: 3px; }
.faq-card-grid figcaption b { color: #f5f7ff; font-size: 11px; }
.faq-card-grid figcaption span { color: #9fa9c4; font-size: 9.5px; line-height: 1.35; }
.dark-examples figure { background: linear-gradient(160deg, rgba(116,82,186,.08), rgba(255,255,255,.025)); }
.faq-note { margin-top: 12px; padding: 11px 12px; border-radius: 12px; background: rgba(255,207,77,.07); border: 1px solid rgba(255,207,77,.13); color: #c9c2a5; font-size: 11px; line-height: 1.45; }
.faq-note strong { color: #ffe18a; }
.faq-score-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.faq-score-grid > div { padding: 11px; border-radius: 13px; background: rgba(255,255,255,.045); display: grid; gap: 5px; }
.faq-score-grid b { font-size: 11px; color: #fff; }
.faq-score-grid span { font-size: 10px; color: #aab3cb; line-height: 1.4; }
.faq-qa { display: grid; gap: 8px; }
.faq-qa details { border-radius: 13px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); padding: 10px 12px; }
.faq-qa summary { cursor: pointer; font-size: 11.5px; font-weight: 800; color: #eef1ff; }
.faq-qa p { margin: 8px 0 1px; color: #aeb7ce; font-size: 10.5px; line-height: 1.5; }

@media (max-width: 760px) {
  .faq-card { padding: 20px 15px; max-height: calc(100vh - 18px); }
  .faq-steps { grid-template-columns: 1fr; }
  .faq-card-grid, .faq-card-grid.compact { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .faq-score-grid { grid-template-columns: 1fr; }
  .faq-section-title { align-items: start; flex-direction: column; gap: 4px; }
}
@media (max-width: 420px) {
  .faq-card-grid, .faq-card-grid.compact { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .faq-card-grid img { width: min(100%, 92px); }
}

/* v0.22 two-sided dark palette: pink / orange / purple / teal */
body[data-game-side="dark"] .active-color-swatch[data-color="red"],
#colorModal[data-side="dark"] .color-btn.red { background: #FF4F89 !important; }
body[data-game-side="dark"] .active-color-swatch[data-color="yellow"],
#colorModal[data-side="dark"] .color-btn.yellow { background: #FFB52E !important; color: #241607 !important; }
body[data-game-side="dark"] .active-color-swatch[data-color="green"],
#colorModal[data-side="dark"] .color-btn.green { background: #A765F5 !important; }
body[data-game-side="dark"] .active-color-swatch[data-color="blue"],
#colorModal[data-side="dark"] .color-btn.blue { background: #31D8FF !important; color: #06212A !important; }

/* Yandex Games input/viewport compliance: the game owns the viewport and
   long-presses must not select or open the browser context menu. Scrollable
   FAQ/hand areas keep their own internal scrolling. */
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { min-height: 100%; }
#app { height: 100%; min-height: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, select { user-select: text; -webkit-user-select: text; }
button, .card, .deck, .menu-action { -webkit-tap-highlight-color: transparent; }

/* v0.24 human-turn timeout + ad reward UI */
.game { position: relative; }
.human-turn-timer {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 118px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(7,12,24,.62);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  font-variant-numeric: tabular-nums;
}
.human-turn-timer span { font-size: 11px; color: #c9d1e8; font-weight: 800; }
.human-turn-timer strong { font-size: 23px; line-height: 1; color: #fff; }
.human-turn-timer small { font-size: 10px; color: #aeb8d4; font-weight: 800; }
.human-turn-timer[data-urgent="true"] { border-color: rgba(255,90,105,.48); background: rgba(89,25,35,.74); }
.human-turn-timer[data-urgent="true"] strong { color: #ff9aa5; }
.turn-expired-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4,7,14,.91);
  backdrop-filter: blur(12px);
}
.turn-expired-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 24px;
  background: #1b2030;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  text-align: center;
}
.turn-expired-icon { font-size: 40px; margin-bottom: 8px; }
.turn-expired-card h2 { margin: 0 0 10px; font-size: 26px; }
.turn-expired-card p { margin: 0 0 20px; color: #b8c1da; }
.danger-exit { width: 100%; min-height: 50px; }
.reward-ad-btn {
  grid-column: 1 / -1;
  margin-top: 7px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255,211,116,.34);
  background: rgba(255,211,116,.12);
  color: #ffe3a0;
  font-size: 12px;
}
.reward-ad-btn:hover { background: rgba(255,211,116,.18); }
@media (max-width: 520px) {
  .human-turn-timer { padding: 6px 10px; min-width: 104px; }
  .human-turn-timer strong { font-size: 20px; }
  .turn-expired-card { padding: 24px 18px; }
}

/* v0.25 selectable free LASTIQ card backs */
:root { --card-back-image: url('/assets/cards/backs/card_back_burst.webp'); }
.deck {
  background: var(--card-back-image) center / contain no-repeat;
}
.home-secondary-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
}
.home-secondary-actions .rules-link { margin: 0; }
.cardback-card { width: min(690px, 100%); text-align: left; }
.cardback-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.cardback-option {
  position: relative;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(8,12,24,.56);
  display: grid;
  gap: 8px;
  align-content: start;
  text-align: center;
  color: #f7f8ff;
  overflow: hidden;
}
.cardback-option:hover { border-color: rgba(255,255,255,.28); }
.cardback-option.selected {
  border-color: rgba(255,255,255,.88);
  background: rgba(255,255,255,.11);
  box-shadow: 0 0 0 2px rgba(67,137,244,.42) inset;
}
.cardback-option img {
  width: 100%;
  aspect-ratio: .7;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.32));
}
.cardback-option > span { min-width: 0; display: grid; gap: 2px; }
.cardback-option strong { font-size: 13px; line-height: 1.15; }
.cardback-option small { color: #9da7c4; font-size: 10px; line-height: 1.25; }
.cardback-option i {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #071d46;
  font-style: normal;
  font-weight: 950;
  opacity: 0;
  transform: scale(.72);
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,.24);
}
.cardback-option.selected i { opacity: 1; transform: scale(1); }
.cardback-note { margin: 14px 0 0; text-align: center; }

@media (max-width: 720px) {
  .cardback-card { width: min(520px, 100%); }
  .cardback-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .cardback-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cardback-option { padding: 8px; border-radius: 15px; }
  .cardback-option strong { font-size: 12px; }
  .cardback-option small { font-size: 9px; }
}
#cardBackModal {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#cardBackModal .cardback-card {
  flex: 0 0 auto;
  margin: auto 0;
}
