:root {
  --ink: #4a3566;
  --ink-soft: #7d68a0;
  --outline: #6b4d8a;
  --pink: #ff8fb8;
  --purple: #b28bff;
  --mint: #8ee59b;
  --sky: #9fd3ff;
  --gold: #ffd84d;
  --card: rgba(255, 255, 255, 0.9);
  --radius: 22px;
  --shadow: 0 8px 24px rgba(107, 77, 138, 0.14);
  --font: "Trebuchet MS", "Verdana", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%; min-height: 100%;
  background: linear-gradient(180deg, #bfe3ff 0, #ffe0f2 520px, #fff3de 1100px, #fff3de 100%);
  background-color: #fff3de;
}
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); color: var(--ink); line-height: 1.45; background: transparent;
}
a { color: #b0489a; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
.muted { color: var(--ink-soft); }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px; flex: 1; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(178, 139, 255, 0.25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* language switcher (EN FR ES DE) */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: #fff; border: 2px solid #eadcff; }
.lang-switch a { font-weight: 800; font-size: .78rem; letter-spacing: .3px; text-decoration: none; color: var(--ink-soft); padding: 5px 7px; border-radius: 999px; line-height: 1; }
.lang-switch a:hover { color: var(--ink); background: #f6efff; }
.lang-switch a[aria-current="true"] { color: #fff; background: linear-gradient(135deg, var(--pink), var(--purple)); }
@media (max-width: 520px) {
  .brand-name { display: none; }
  .topbar-right { gap: 6px; }
  .lang-switch a { padding: 5px 5px; font-size: .72rem; }
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
  padding: 4px 12px 4px 4px; border-radius: 999px; background: #fff; border: 2px solid #eadcff; max-width: 45vw;
}
.user-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 800; font-size: .9rem; background: linear-gradient(135deg, var(--pink), var(--purple));
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 800; color: var(--ink); text-decoration: none; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; border: 2px solid var(--outline); background: #fff;
  box-shadow: 0 3px 0 rgba(107, 77, 138, .35); transition: transform .08s, box-shadow .08s, filter .15s;
  -webkit-tap-highlight-color: transparent; min-height: 44px;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(107, 77, 138, .35); }
.btn:focus-visible, .tab:focus-visible, input:focus-visible { outline: 3px solid #7cc7ff; outline-offset: 2px; }
.btn.primary { color: #fff; background: linear-gradient(90deg, var(--pink), var(--purple)); text-shadow: 0 1px 0 rgba(107,77,138,.5); }
.btn.mint { color: #fff; background: linear-gradient(90deg, #6fd3a0, #5ab8f0); text-shadow: 0 1px 0 rgba(60,90,110,.5); }
.btn.ghost { background: rgba(255,255,255,.7); }
.btn.small { padding: 6px 14px; min-height: 36px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 2px solid rgba(212, 184, 245, .6); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 28px 22px; margin: 6px 0 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,240,250,.75));
  border: 2px solid rgba(212, 184, 245, .6); box-shadow: var(--shadow);
}
.hero-text { position: relative; z-index: 2; max-width: 620px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
.hero-title { margin: 0 0 12px; line-height: 1.1; }
.hero-welcome { display: block; font-size: clamp(1.05rem, 3.6vw, 1.35rem); color: var(--ink-soft); font-weight: 800; margin-bottom: 6px; }
.hero-logo { display: block; width: min(100%, 480px); height: auto; }
.lead { font-size: 1.08rem; color: var(--ink-soft); margin: 0 0 16px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.rainbow-text {
  background: linear-gradient(90deg, #ff6f9f, #ff9f4a, #f5b800, #45c46a, #3aa6f0, #9b6cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-deco { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cloud { position: absolute; width: 90px; height: 30px; background: #fff; border-radius: 30px; opacity: .9; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 40px; height: 40px; left: 14px; top: -20px; }
.cloud::after { width: 32px; height: 32px; left: 44px; top: -14px; }
.cloud.c1 { right: 8%; top: 22%; animation: drift 9s ease-in-out infinite alternate; }
.cloud.c2 { right: 26%; top: 64%; transform: scale(.7); animation: drift 12s ease-in-out infinite alternate-reverse; }
.spark { position: absolute; width: 14px; height: 14px; background: #ffd84d; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 2.4s ease-in-out infinite; }
.spark.s1 { right: 14%; top: 12%; } .spark.s2 { right: 40%; top: 20%; animation-delay: .8s; } .spark.s3 { right: 6%; top: 70%; animation-delay: 1.5s; }
.rainbow-arc {
  position: absolute; right: -60px; bottom: -150px; width: 300px; height: 300px; border-radius: 50%; opacity: .35;
  background: radial-gradient(circle, transparent 0 52%, #b69cff 52% 56%, #7cc7ff 56% 60%, #8ee59b 60% 64%, #ffe66d 64% 68%, #ffb86b 68% 72%, #ff8fab 72% 76%, transparent 76%);
}
@keyframes drift { from { translate: 0 0; } to { translate: -24px 4px; } }
@keyframes twinkle { 0%, 100% { opacity: .3; scale: .7; } 50% { opacity: 1; scale: 1.1; } }
@media (max-width: 640px) { .hero-deco { opacity: .55; } }

/* ---------- game grid ---------- */
.section-title { font-size: 1.4rem; margin: 0 0 12px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.game-card { overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s; }
a.game-card:hover { transform: translateY(-3px) rotate(-.3deg); }
.game-thumb { aspect-ratio: 16 / 9; width: 100%; height: auto; object-fit: cover; display: block; background: #f3e9ff; }
.thumb-soon { aspect-ratio: 16 / 9; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; color: #fff; text-shadow: 0 2px 0 rgba(107,77,138,.35); }
.game-info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-info h3 { font-size: 1.25rem; margin: 0; }
.game-info p { margin: 0; color: var(--ink-soft); font-size: .95rem; flex: 1; }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.top-today { font-size: .85rem; color: var(--ink-soft); }
.top-today b { color: var(--ink); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: #f1e8ff; color: var(--ink-soft); }
.game-card.soon { opacity: .8; }
.skeleton { min-height: 280px; background: linear-gradient(90deg, #fff 0%, #f6efff 50%, #fff 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- auth ---------- */
.auth-wrap { display: grid; place-items: start center; padding: 8px 0 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 18px 20px 22px; }
.tabs { display: flex; gap: 6px; background: #f4ecff; padding: 5px; border-radius: 999px; }
.tab {
  flex: 1; font: inherit; font-weight: 800; color: var(--ink-soft); background: transparent; border: 0;
  padding: 9px 10px; border-radius: 999px; cursor: pointer; min-height: 40px;
}
.tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(107,77,138,.18); }
.form { display: none; flex-direction: column; gap: 12px; margin-top: 16px; }
.form.active { display: flex; }
.form-title { font-size: 1.6rem; margin: 4px 0 0; }
.form p { margin: 0; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; }
.optional { font-weight: 400; color: var(--ink-soft); }
.form input {
  font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 14px; border: 2px solid #decdf6; background: #fff; color: var(--ink);
}
.form input:focus { border-color: var(--purple); outline: none; }
.form input[aria-invalid="true"] { border-color: #e0567f; background: #fff7f9; }
.label-text { display: block; }
.hint { font-weight: 400; color: var(--ink-soft); font-size: .8rem; }
.field-error { color: #c73a6f; font-size: .85rem; font-weight: 700; }
.field-error:empty { display: none; }
.form-error { background: #ffe3ec; color: #b02a5c; padding: 10px 12px; border-radius: 12px; font-weight: 700; }
.switch { text-align: center; }
/* Safe.Zone login (CaPoBi-style PIN keypad, pastel) */
.sz-head { display: flex; align-items: center; gap: 12px; }
.sz-head img { flex: none; }
.sz-head .form-title { margin: 0; }
.sz-step { display: flex; flex-direction: column; gap: 12px; }
.sz-pin-title { text-align: center; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); font-weight: 800; }
.sz-prompt {
  text-align: center; font-weight: 800; letter-spacing: .06em; line-height: 1.5; font-size: 1.05rem;
  background: linear-gradient(90deg, #ff6f9f, #b06cff, #3aa6f0); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.form input.sz-pin {
  display: block; width: 100%; font-size: 1.8rem; text-align: center; letter-spacing: .6em; padding: 8px 14px 8px calc(14px + .6em);
  min-height: 58px; background: #fbf7ff; border-color: #decdf6; color: var(--ink); caret-color: transparent;
}
.sz-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sz-keypad button {
  min-height: 54px; border-radius: 16px; border: 2px solid #e6d8fa; background: linear-gradient(180deg, #fff, #f6efff);
  font: inherit; font-size: 1.35rem; font-weight: 800; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 rgba(107, 77, 138, .18);
  touch-action: manipulation;
}
.sz-keypad button:hover { border-color: var(--purple); }
.sz-keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(107, 77, 138, .18); }
.sz-keypad button[disabled] { visibility: hidden; }
.sz-keypad .sz-back { color: #d0487e; }
.sz-hint { text-align: center; margin: 0; }
.small-print { font-size: .85rem; }

/* ---------- game page ---------- */
.game-head { margin: 4px 0 12px; }
.game-head h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-top: 6px; }
.game-head p { margin: 0; }
.back { font-weight: 700; text-decoration: none; }
.game-layout { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .game-layout { grid-template-columns: minmax(0, 1fr) 330px; } }
.frame-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #bfe3ff; box-shadow: var(--shadow); border: 3px solid #fff;
}
@media (max-width: 640px) and (orientation: portrait) {
  .frame-wrap { aspect-ratio: auto; height: min(68vh, 560px); margin: 0 -8px; width: calc(100% + 16px); border-radius: 18px; }
}
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.frame-wrap.pseudo-fs { aspect-ratio: auto !important; max-height: none !important; position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; border: 0; aspect-ratio: auto; }
.frame-wrap:fullscreen { border-radius: 0; border: 0; }
.exit-fs { position: absolute; right: 10px; bottom: 10px; z-index: 2; }
.coming-soon { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; font-size: 1.3rem; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(107,77,138,.4); }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.howto { color: var(--ink-soft); font-size: .92rem; flex: 1; min-width: 200px; }
.note { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: #fff6d6; border: 2px dashed #f0cf6a; font-weight: 600; }

/* ---------- leaderboard ---------- */
.board { padding: 16px; }
.board h2 { font-size: 1.3rem; }
.board-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.board-list li {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 14px; background: #faf6ff;
}
.board-list li.me { background: linear-gradient(90deg, #fff1c9, #ffe3f1); border: 2px solid #ffd84d; }
.rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: #ece2fb; color: var(--ink); }
.rank.r1 { background: linear-gradient(135deg, #ffe066, #f5b800); color: #6b4a00; }
.rank.r2 { background: linear-gradient(135deg, #eef0f5, #c6ccd8); color: #4b5160; }
.rank.r3 { background: linear-gradient(135deg, #ffd0a8, #e59a5c); color: #6b3a10; }
.player { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { font-weight: 800; color: #b0489a; font-variant-numeric: tabular-nums; }
.board-empty { text-align: center; color: var(--ink-soft); padding: 24px 8px; background: none !important; display: block !important; }
.board-me { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: #f1fff4; border: 2px solid #bdeccb; font-weight: 700; }
.board-me:empty { display: none; }
.board-prizes { margin: 8px 0 4px; padding: 8px 10px; border-radius: 12px; background: linear-gradient(90deg, #fff6d6, #ffe8f5); border: 1.5px solid #ffd84d; font-size: .86rem; line-height: 1.35; color: var(--ink); }
.board-prizes:empty { display: none; }
.board-prizes .prize-brand { font-weight: 800; color: #9a5fd6; letter-spacing: .01em; }
.board-prizes .prize-usd { color: var(--ink-soft); font-weight: 600; }
.tz { font-size: .78rem; margin: 10px 0 0; }

.center-card { max-width: 460px; margin: 40px auto; padding: 28px; text-align: center; }
.footer a { color: inherit; }
.footer { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.footer p { margin: 0; }
@media (max-width: 420px) {
  .brand-name { font-size: 1.05rem; }
  .user-chip { padding: 3px; }
  .user-chip .name { display: none; }
  .btn.small { padding: 6px 11px; }
  .container { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.board-tabs .tab { font-size: .88rem; white-space: nowrap; padding: 8px 6px; }
.frame-wrap:not(.pseudo-fs) { max-height: 78vh; }
.frame-wrap:fullscreen { max-height: none; aspect-ratio: auto !important; }

/* ---------- 1-vs-1 games (chess, backgammon) ---------- */
.duel-root .card { padding: 16px; }
.duel-root h2 { font-size: 1.2rem; }
.duel-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.duel-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 860px) { .duel-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.duel-guest { text-align: center; padding: 24px !important; }
.duel-guest p { max-width: 460px; margin: 0 auto 14px; }
.duel-field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.duel-field .lbl { font-weight: 700; font-size: .9rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; background: #f3ecff; padding: 4px; border-radius: 16px; }
.seg-btn { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; padding: 6px 10px; white-space: nowrap; }
.seg-btn[aria-checked="true"] { background: #fff; box-shadow: 0 2px 6px rgba(107,77,138,.18); color: #b0489a; }
.seg-btn:focus-visible { outline: 3px solid #7cc7ff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn-row .btn { flex: 1; }
.code-join { display: flex; gap: 8px; }
.code-in { flex: 1; min-width: 0; font: inherit; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; padding: 8px 12px; border-radius: 12px; border: 2px solid #d9c6f5; background: #fff; color: var(--ink); }
.glist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.glist-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: #faf6ff; }
.glist-item.your-turn { background: linear-gradient(90deg, #fff1c9, #ffe3f1); }
.glist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.glist-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: .85rem; }
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.stat { background: #faf6ff; border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; }
.stat b { font-size: 1.15rem; color: #b0489a; }
.stat span { font-size: .72rem; color: var(--ink-soft); }
.duel-lb .seg { margin-top: 6px; }
.duel-howto { margin-top: 14px; }

.duel-layout { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .duel-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.duel-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: stretch; max-width: 600px; width: 100%; margin: 0 auto; }
.pbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 16px; background: rgba(255,255,255,.85); border: 2px solid transparent; }
.pbar.on-turn { border-color: #ffd84d; background: #fffaf0; }
.pdot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--outline); flex: none; }
.pdot.chess-w, .pdot.backgammon-w { background: #fffaf3; }
.pdot.chess-b { background: #a88be6; }
.pdot.backgammon-b { background: #c7a6ff; }
.pname { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prating { font-size: .8rem; font-weight: 700; background: #f3ecff; border-radius: 10px; padding: 2px 8px; }
.pclock { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 58px; text-align: right; color: var(--ink-soft); }
.pclock:empty { display: none; }
.pclock.running { color: #b0489a; }
.pclock.low { color: #e0245e; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.duel-status { margin: 2px 4px; font-weight: 700; min-height: 1.4em; }
.duel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { color: #b02a5c; }
.duel-banner { text-align: center; padding: 18px !important; }
.duel-banner.won { background: linear-gradient(135deg, #fff6d6, #ffe3f1); border-color: #ffd84d; }
.duel-banner p { margin: 4px 0; font-weight: 700; }
.duel-side { padding: 14px !important; display: flex; flex-direction: column; gap: 10px; }
.san-list { margin: 0; padding-left: 2.2em; max-height: 320px; overflow: auto; font-variant-numeric: tabular-nums; }
.san-list li { padding: 2px 0; }
.san-list li span { display: inline-block; min-width: 64px; font-weight: 700; }
.bg-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; max-height: 320px; overflow: auto; }
.bg-log li { background: #faf6ff; border-radius: 10px; padding: 4px 8px; }
.duel-wait { text-align: center; }
.invite-code { font-size: 2rem; font-weight: 900; letter-spacing: 6px; color: #b0489a; margin: 6px 0; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; font: inherit; font-size: .85rem; padding: 6px 10px; border-radius: 10px; border: 2px solid #d9c6f5; }
.duel-loading { text-align: center; }

/* chess board */
.duel-board-wrap { position: relative; width: 100%; }
.chess-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; width: 100%; border-radius: 16px; overflow: hidden; border: 4px solid #d4b8f5; box-shadow: var(--shadow); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.sq { position: relative; display: grid; place-items: center; cursor: default; aspect-ratio: 1; min-width: 0; min-height: 0; overflow: hidden; }
.sq.light { background: #fff4fa; }
.sq.dark { background: #dccbf7; }
.sq.last.light { background: #ffe6a8; }
.sq.last.dark { background: #f4cf8f; }
.sq.sel { background: #b8f0c8 !important; }
.sq.check { background: radial-gradient(circle, #ff8fb8 0, #ffb3cf 45%, transparent 75%) !important; }
.chess-board.my-turn .sq { cursor: pointer; }
.sq .piece { width: 88%; height: 88%; pointer-events: none; filter: drop-shadow(0 1.5px 0 rgba(107,77,138,.25)); }
.sq.dragging .piece { opacity: .3; }
.sq .hint { position: absolute; pointer-events: none; }
.sq.dot .hint { width: 30%; height: 30%; border-radius: 50%; background: rgba(107,77,138,.28); }
.sq.cap .hint { inset: 4%; border-radius: 50%; border: 4px solid rgba(176,72,154,.45); }
.crd { position: absolute; font-size: .62rem; font-weight: 800; color: #8a72ad; pointer-events: none; }
.crd.crd-r { top: 2px; left: 3px; }
.crd.crd-f { bottom: 1px; right: 4px; }
.drag-ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 100; }
.drag-ghost .piece { width: 100%; height: 100%; }
.promo-picker { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(255,244,250,.9); border-radius: 16px; z-index: 5; font-weight: 800; }
.promo-row { display: flex; gap: 8px; }
.promo-btn { width: 64px; height: 64px; border-radius: 16px; border: 3px solid #d4b8f5; background: #fff; cursor: pointer; padding: 4px; }
.promo-btn:hover, .promo-btn:focus-visible { border-color: #ff8fb8; }
.promo-btn .piece { width: 100%; height: 100%; }
@media (max-width: 420px) { .stat-row { grid-template-columns: repeat(3, 1fr); } .duel-root .card { padding: 14px; } }

/* backgammon board */
.bg-board { width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.bg-svg { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: var(--shadow); }
.bg-svg .pnum { font: 700 11px var(--font); fill: #8a72ad; text-anchor: middle; }
.bg-svg .ckn { font: 800 15px var(--font); fill: #4a3566; text-anchor: middle; pointer-events: none; }
.bg-svg .hit { fill: transparent; }
.bg-board.my-turn .hit { cursor: pointer; }
.bg-svg .tri.dest { fill: #8ee59b; }
.bg-svg .tri.last { stroke: #f5b800; stroke-width: 3; }
.bg-svg .ck.can circle:first-child { stroke: #f5b800; stroke-width: 4; }
.bg-svg .ck.sel circle:first-child { stroke: #2fb36b; stroke-width: 5; }
.bg-svg .ck.moved circle:last-child { stroke: #8ee59b; }
.bg-svg .land { fill: rgba(142, 229, 155, .45); stroke: #2fb36b; stroke-width: 2.5; stroke-dasharray: 5 4; pointer-events: none; }
.bg-svg .dest-tray { fill: rgba(142, 229, 155, .5); stroke: #2fb36b; stroke-width: 3; pointer-events: none; }
.bg-svg .die.used { opacity: .3; }
.bg-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bg-hint { flex: 1; min-width: 150px; font-weight: 700; color: var(--ink-soft); font-size: .9rem; }

/* ---------- Terms / Privacy (English-only legal pages) ---------- */
.legal { max-width: 860px; margin: 0 auto; padding: clamp(18px, 4vw, 40px); line-height: 1.6; overflow-wrap: anywhere; }
.legal h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 0 0 12px; line-height: 1.15; }
.legal h2 { font-size: clamp(1.15rem, 3.6vw, 1.4rem); margin: 28px 0 10px; scroll-margin-top: 16px; }
.legal h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.legal p, .legal li { color: var(--ink); }
.legal ul, .legal ol { padding-left: 1.4em; }
.legal li { margin: 4px 0; }
.legal hr { border: 0; border-top: 2px dashed rgba(212, 184, 245, .7); margin: 24px 0; }
.legal a { color: #7a4fc4; }
.legal code { background: #f6efff; border-radius: 6px; padding: 1px 5px; font-size: .92em; }
.legal .table-wrap { overflow-x: auto; margin: 12px 0; }
.legal table { border-collapse: collapse; width: 100%; font-size: .94rem; }
.legal th, .legal td { border: 1px solid #e6d8f7; padding: 8px 10px; text-align: left; vertical-align: top; }
.legal th { background: #f8f2ff; }
.legal mark.todo { background: #fff1b8; color: #6b4d00; border-radius: 4px; padding: 0 3px; font-weight: 700; }
.legal-note { background: #f6efff; border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; color: var(--ink-soft); font-weight: 700; }
