/* Gambit Plus — portraits, navigation, profile, achievements, Online hub and the
   post-game card. Every colour is a theme token (src/styles/tokens.css). */

/* ---------- painted portraits ---------- */

.avatar.gp-ph { background: hsl(var(--h, 140) var(--av-s2) var(--av-l2)); }
.avatar.gp-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s cubic-bezier(.2, .9, .3, 1), filter .35s ease; user-select: none; -webkit-user-drag: none; }
.avatar.xs, .avatar.sm, .avatar.md, .avatar.lg, .avatar.xl { padding: 0; box-sizing: border-box; }
.avatar.xs { width: 26px; height: 26px; }
.avatar.xl { width: 104px; height: 104px; }
.avatar.gp-ph.live img { animation: gp-breathe 6s ease-in-out infinite; animation-delay: calc(var(--h, 0) * -.021s); }
@keyframes gp-breathe { 0%, 100% { transform: scale(1.02) translateY(0); } 50% { transform: scale(1.055) translateY(-1.5%); } }
.avatar.gp-ph.happy { box-shadow: 0 0 0 2px var(--gp-green), 0 0 16px color-mix(in srgb, var(--gp-green) 60%, transparent); }
.avatar.gp-ph.happy img { animation: gp-happy .7s cubic-bezier(.2, 1.5, .4, 1); filter: saturate(1.15) brightness(1.05); }
.avatar.gp-ph.sad img { filter: saturate(.35) brightness(.92); transform: rotate(-5deg) translateY(5%) scale(1.04); }
.avatar.gp-ph.sad { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-great) 60%, transparent); }
.avatar.gp-ph.wow img { animation: gp-wow .5s cubic-bezier(.2, 1.6, .4, 1); transform: scale(1.12); }
.avatar.gp-ph.wow { box-shadow: 0 0 0 2px var(--c-inaccuracy), 0 0 16px color-mix(in srgb, var(--c-inaccuracy) 60%, transparent); }
.avatar.gp-ph.thinking::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2.5px solid transparent; border-top-color: var(--ink); border-right-color: color-mix(in srgb, var(--ink) 40%, transparent); animation: spin .9s linear infinite; }
.avatar.gp-ph.thinking img { filter: brightness(.93); }
@keyframes gp-happy { 0% { transform: scale(1); } 35% { transform: scale(1.14) translateY(-6%); } 65% { transform: scale(1.04) translateY(2%); } 100% { transform: scale(1.06); } }
@keyframes gp-wow { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1.12); } }
.avatar.gp-initial { background: linear-gradient(135deg, var(--accent-2), var(--accent-3)); color: var(--on-accent); }
.avatar.gp-initial b { font: 800 calc(1em + 2px) / 1 var(--font-display); font-size: 46%; letter-spacing: .02em; }
.avatar.you.gp-ph { background: var(--surface-2); }

/* ---------- piece pick-up, hover and premoves (plus/grab.js) ---------- */

/* A finger on the board scrolls the page, except on a piece the player can pick up (grab.js sets grab-w / grab-b).
   The core had touch-action: none on the whole board: on a phone almost half the screen did not scroll. */
.board { touch-action: pan-y; }
/* (the piece layer takes no pointer events; these pieces do, so that their touch-action is the one that counts) */
.board.grab-w .pc.w, .board.grab-b .pc.b { pointer-events: auto; touch-action: none; }

/* Hover: only where a real pointer can hover. The class is set for mouse and pen pointers, never for a finger.
   The lift is a `translate` and a shadow only: a `scale` here would also scale the piece's offset on the board
   (the position lives in `transform`), so a hovered piece would jump away from its square. */
.board .pc.hov, .board.arcade .pc.hov { translate: none; scale: none; filter: none; }
@media (hover: hover) and (pointer: fine) {
  .board.interactive .pc { transition: translate .14s cubic-bezier(.2, .7, .3, 1), filter .14s ease; }
  .board.can-grab { cursor: grab; }
  .board .pc.hov, .board.arcade .pc.hov { filter: drop-shadow(0 calc(var(--sqs) * .06) calc(var(--sqs) * .05) rgb(var(--shade-rgb)/.34)); }
  .board:not(.still) .pc.hov:not(.dragging) { translate: 0 -4%; }
}
@media (prefers-reduced-motion: reduce) {
  .board.interactive .pc { transition: none; }
  .board:not(.still) .pc.hov:not(.dragging) { translate: none; }
}
.board.grabbing { cursor: grabbing; }
.board.arcade .pc.sel { animation: none; filter: none; }
.board .pc.g-land, .board.arcade .pc.g-land { transform-origin: 50% 50%; }
.board .pc.dragging, .board.arcade .pc.dragging { transform-origin: 50% 50%; translate: none; scale: none; transition: filter .16s ease; filter: drop-shadow(0 calc(var(--sqs) * .07) calc(var(--sqs) * .06) rgb(var(--shade-rgb)/.3)); }
/* the square a dragged piece will land on; under a finger it gets a halo the finger cannot cover */
.mark.hover { background: rgb(var(--glint-rgb)/.16); box-shadow: inset 0 0 0 calc(var(--sqs) * .07) rgb(var(--glint-rgb)/.85); }
.board.touch-drag .mark.hover:before { content: ""; position: absolute; inset: -45%; border-radius: 50%; background: rgb(var(--glint-rgb)/.2); box-shadow: inset 0 0 0 calc(var(--sqs) * .06) rgb(var(--glint-rgb)/.6); }
/* premove: the move that will be played once the bot has moved, and the squares a piece may be sent to */
.mark.pre { background: rgb(var(--arrow-pre-rgb)/.42); }
.mark.pre.to { box-shadow: inset 0 0 0 calc(var(--sqs) * .06) rgb(var(--arrow-pre-rgb)/.95); }
.mark.dot.pm:after { background: rgb(var(--arrow-pre-rgb)/.62); }
.mark.cap.pm:after { border-color: rgb(var(--arrow-pre-rgb)/.68); }

/* ---------- settings: piece picker ---------- */

/* On a 320 px phone the three sample pieces get narrower boxes: the art shrinks to fit instead of repeating (UX16-12). */
.pset-prev i { background-size: contain; background-repeat: no-repeat; background-position: center; }

/* ---------- new game: time control (plus.js adds the pool clocks, nine options in all) ---------- */

/* Nine labels do not fit one row of equal segments ("10 + 510 + 0…"): they wrap, each one a full tap target (UX16-2). */
.seg[data-name="tc"] { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); }
.seg[data-name="tc"] button { min-height: 44px; padding-inline: 2px; }
@media (max-width: 359px) { .seg[data-name="tc"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- navigation ---------- */

.mode-btn[data-gp-nav] { position: relative; }
.mode-btn .gp-live-dot { width: 6px; height: 6px; margin-left: -2px; align-self: flex-start; margin-top: 3px; }
.gp-live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gp-green); animation: gp-ping 2.2s ease-out infinite; flex: none; }
@keyframes gp-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gp-green) 70%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.gp-me { border: 0; background: transparent; padding: 0; border-radius: 50%; flex: none; display: grid; place-items: center; transition: transform .15s; }
.gp-me:hover { transform: scale(1.06); }
.gp-me .avatar { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--line); }
.gp-me.signed .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--gp-green); }
.gp-me.is-active .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink); }
@media (max-width: 599px) { .gp-me .avatar { width: 32px; height: 32px; } }
.tab .gp-tab-av { width: 26px; height: 26px; margin-block: 1px; box-shadow: 0 0 0 1.5px var(--line); }
.tab.is-active .gp-tab-av { box-shadow: 0 0 0 2px var(--ink); }
.tab .ico { transition: transform .2s cubic-bezier(.2, 1.4, .4, 1); }
.tab.is-active .ico { transform: translateY(-1px); }
.tab span { white-space: nowrap; }
@media (max-width: 380px) { .tab span { font-size: 10px; } }

.gp-me-pop { width: 300px; padding: 8px; }
.gp-me-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.gp-me-head div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gp-me-head b { font-size: 16px; }
.gp-me-head span { font-size: 12.5px; color: var(--ink-2); }
.gp-me-cta { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 8px; padding: 12px; border: 0; border-radius: var(--rad-3); text-align: left; background: linear-gradient(120deg, var(--surface-2), var(--bg)); color: var(--ink); }
.gp-me-cta .ico { width: 22px; height: 22px; color: var(--gp-green); }
.gp-me-cta span { display: flex; flex-direction: column; gap: 2px; }
.gp-me-cta em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.gp-me-count { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.gp-flag { font-size: .9em; }

/* ---------- home ---------- */

.home-hero {
  background:
    linear-gradient(90deg, var(--bg-deep) 0%, rgb(var(--bg-deep-rgb)/.9) 30%, rgb(var(--bg-deep-rgb)/.45) 58%, rgb(var(--bg-deep-rgb)/.08) 100%),
    url("../art/hero.webp") 78% 62% / cover no-repeat, var(--bg-deep);
}
.home-hero .hh-knight { display: none; }
.home-hero:before { opacity: .25; }
.home-hero .hh-goal { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgb(var(--bg-deep-rgb)/.35); border-radius: 50%; }
@media (max-width: 599px) {
  .home-hero { background: linear-gradient(180deg, rgb(var(--bg-deep-rgb)/.55), rgb(var(--bg-deep-rgb)/.92) 70%), url("../art/hero.webp") 70% 40% / cover no-repeat, var(--bg-deep); }
}

.start-tile { transition: transform .18s cubic-bezier(.2, .9, .3, 1), box-shadow .18s, background .15s; }
.start-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.start-tile .st-art { box-shadow: inset 0 1px 0 rgb(var(--glint-rgb)/.18), 0 6px 14px -8px rgb(var(--shade-rgb)/.5); }
.start-tile[data-h=play] .st-art { background: transparent; box-shadow: 0 6px 14px -8px rgb(var(--shade-rgb)/.5); }
.start-tile[data-h=play] .st-art .avatar { width: 100%; height: 100%; border-radius: var(--rad-3); }
.start-tile[data-h=learn] .st-art { background: linear-gradient(140deg, var(--tile-2a), var(--tile-2b)); }
.start-tile[data-h=rush] .st-art { background: linear-gradient(140deg, var(--tile-1a), var(--tile-1b)); }
.start-tile[data-h=rush] .st-rush { color: var(--on-tile-1); }
.start-tile[data-h=openings] .st-art { background: linear-gradient(140deg, var(--tile-3a), var(--tile-3b)); }
.start-tile[data-h=analysis] .st-art { background: linear-gradient(140deg, var(--tile-4a), var(--tile-4b)); }
.start-tile[data-h=editor] .st-art { background: linear-gradient(140deg, var(--tile-5a), var(--tile-5b)); }
.cont-row .avatar, .st-art .avatar { border-radius: var(--rad-3); }

.gp-join {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-radius: var(--rad-4); text-align: left;
  background: var(--raised); color: var(--ink); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line-2); transition: transform .15s, box-shadow .15s;
}
.gp-join:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.gp-join > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.gp-join b { font-size: 15.5px; }
.gp-join em { font-style: normal; font-size: 13px; color: var(--ink-2); }
.gp-join-avs { display: flex; flex: none; }
.gp-join-avs img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2.5px var(--raised); }
.gp-join-avs img + img { margin-left: -12px; }

/* ---------- bot picker ---------- */

.bot-tile .avatar.sm { width: 54px; height: 54px; }
@media (max-width: 599px) { .bot-tile .avatar.sm { width: 46px; height: 46px; } }
.bot-tile .gp-ph img { transition: transform .3s cubic-bezier(.2, .9, .3, 1); }
.bot-tile:hover .gp-ph img { transform: scale(1.1); }
.bot-tile.is-selected .avatar { box-shadow: 0 0 0 2.5px var(--raised), 0 0 0 4.5px hsl(var(--h, 140) var(--av-s3) var(--av-l3)); }
.bot-detail.gp-detail { background: linear-gradient(115deg, hsl(var(--h) var(--av-s4) var(--av-l4)) 0%, var(--surface) 62%); }
.bot-detail .avatar.gp-ph.lg { width: 96px; height: 96px; border-radius: var(--rad-5); box-shadow: 0 10px 22px -12px rgb(var(--shade-rgb)/.55); }
.gp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gp-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--rad-pill); background: var(--raised); font-size: 12px; font-weight: 700; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.gp-tag .ico { width: 13px; height: 13px; }
.gp-tag.won { color: var(--ok); }
.gp-diff { gap: 3px; }
.gp-diff i { width: 6px; height: 11px; border-radius: var(--rad-0); background: var(--line); }
.gp-diff i.on { background: hsl(var(--h, 140) var(--av-s3) var(--av-l3)); }

/* ---------- post-game card ---------- */

.sheet.center { max-height: calc(100dvh - 24px); overflow-y: auto; }
.gp-stats { width: 100%; display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.gp-acc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gp-acc-col { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 8px 12px; border-radius: var(--rad-4); background: var(--surface); min-width: 0; }
.gp-acc-col:first-child { background: var(--surface-2); }
.gp-acc-who { font-size: 12.5px; font-weight: 700; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-acc-ring { position: relative; width: 78px; height: 78px; display: grid; place-items: center; }
.gp-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.gp-ring-track { fill: none; stroke: var(--line); stroke-width: 6; }
.gp-ring-fill { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .9, .3, 1); }
.gp-acc-ring b { position: relative; font: 800 24px/1 var(--font-display); letter-spacing: .01em; }
.gp-acc-ring small { font-size: 13px; margin-left: 1px; color: var(--ink-3); }
.gp-acc-lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.gp-est { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-top: 4px; }
.gp-est b { font: 800 21px/1 var(--font-display); letter-spacing: .02em; }
.gp-est span { font-size: 11.5px; color: var(--ink-3); text-align: center; }
.gp-verdict { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.gp-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.gp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border-radius: var(--rad-pill); background: var(--surface); font-size: 12px; }
.gp-chip b { font: 800 14px/1 var(--font-display); }
.gp-chip em { font-style: normal; color: var(--ink-3); font-weight: 600; }
.gp-chip.zero { opacity: .45; }

/* ---------- sign-in ---------- */

.sheet.gp-si-sheet { width: min(460px, calc(100vw - 24px)); }
.gp-signin { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 24px 22px; }
.gp-signin .close-x { position: absolute; top: 10px; right: 10px; }
.gp-si-hero { display: flex; align-items: center; gap: 16px; padding-right: 30px; }
.gp-si-hero img { width: 88px; height: 88px; border-radius: var(--rad-5); object-fit: cover; flex: none; box-shadow: 0 14px 28px -14px rgb(var(--shade-rgb)/.6); }
.gp-si-hero h2 { margin: 0 0 4px; font: 800 30px/1 var(--font-display); }
.gp-si-hero p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.gp-si-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.gp-si-grid button { position: relative; padding: 0; border: 0; border-radius: 50%; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); transition: transform .15s; }
.gp-si-grid button:hover { transform: scale(1.08); }
.gp-si-grid button.is-on { box-shadow: 0 0 0 2.5px var(--raised), 0 0 0 4.5px var(--ink); }
.gp-si-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-signin input[type=text], .gp-signin select {
  width: 100%; box-sizing: border-box; height: 46px; padding: 0 14px; border: 0; border-radius: var(--rad-3); background: var(--surface); color: var(--ink);
  font: 600 15px/1 var(--font-body); box-shadow: inset 0 0 0 1px var(--line);
}
.gp-signin input:focus, .gp-signin select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.gp-si-or { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
.gp-si-or::before, .gp-si-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gp-si-oauth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gp-si-oauth button { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; font-weight: 700; }
.gp-si-oauth svg { width: 18px; height: 18px; }
.gp-fine { margin: 0; font-size: 11.5px; color: var(--ink-3); text-align: center; }
@media (max-width: 440px) { .gp-si-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- profile ---------- */

.gp-profile { position: relative; border-radius: var(--rad-5); overflow: hidden; background: var(--raised); box-shadow: var(--shadow-2); }
.gp-pf-banner { height: 120px; background: linear-gradient(180deg, rgb(var(--bg-deep-rgb)/.1), rgb(var(--bg-deep-rgb)/.55)), url("../art/hero.webp") 60% 55% / cover no-repeat, var(--bg-deep); }
.gp-pf-main { display: flex; align-items: flex-start; gap: 6px 16px; padding: 0 20px; position: relative; flex-wrap: wrap; }
.gp-pf-main > .avatar { margin-top: -52px; }
.gp-pf-av { box-shadow: 0 0 0 4px var(--raised), 0 14px 30px -14px rgb(var(--shade-rgb)/.6); }
.gp-pf-av.avatar.you:not(.gp-ph):not(.gp-initial) { background: var(--ink); }
.gp-pf-id { flex: 1; min-width: 160px; padding-top: 12px; }
.gp-pf-id h2 { margin: 0; font: 800 34px/1 var(--font-display); letter-spacing: .005em; }
.gp-pf-id p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.gp-pf-title { font-weight: 750; color: var(--r-legendary, var(--gold-lo)); }
.gp-pf-actions { padding-top: 12px; }
.gp-pf-actions button { display: inline-flex; align-items: center; gap: 6px; }
.gp-pf-actions .ico { width: 16px; height: 16px; }
.gp-pf-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 16px 0 0; background: var(--line-2); border-top: 1px solid var(--line-2); }
.gp-pf-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; background: var(--raised); }
.gp-pf-stats b { font: 800 24px/1 var(--font-display); letter-spacing: .02em; }
.gp-pf-stats span { font-size: 11.5px; color: var(--ink-3); font-weight: 650; text-align: center; }
@media (max-width: 599px) {
  .gp-pf-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .gp-pf-stats div { grid-column: span 2; }
  .gp-pf-stats div:nth-child(n+4) { grid-column: span 3; }
  .gp-pf-id h2 { font-size: 28px; }
  .gp-pf-main .avatar.xl { width: 88px; height: 88px; }
}

/* ---------- medals ---------- */

.gp-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.gp-sec-head h3 { margin: 0; font-size: 17px; font-weight: 750; }
.gp-ach { display: flex; flex-direction: column; }
.gp-ach-bar { height: 6px; border-radius: var(--rad-pill); background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.gp-ach-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--streak)); }
.gp-ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.gp-ach-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: var(--rad-4); background: var(--surface); min-width: 0; }
.gp-ach-card.done { background: var(--raised); box-shadow: var(--shadow-1); }
.gp-ach-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gp-ach-txt b { font-size: 14px; }
.gp-ach-txt > span { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.gp-ach-card:not(.done) .gp-ach-txt b { color: var(--ink-2); }
.gp-ach-prog { display: block; height: 4px; border-radius: var(--rad-pill); background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.gp-ach-prog i { display: block; height: 100%; background: var(--ink-2); border-radius: inherit; }
.gp-ach-num, .gp-ach-tier { font-style: normal; font-size: 11px; font-weight: 750; color: var(--ink-3); letter-spacing: .04em; }
.gp-ach-tier { text-transform: uppercase; letter-spacing: .1em; }
.gp-ach-tier.t-bronze { color: var(--tier-bronze); }
.gp-ach-tier.t-silver { color: var(--tier-silver); }
.gp-ach-tier.t-gold { color: var(--gold); }
.gp-ach-tier.t-platinum { color: var(--tier-platinum); }

.gp-medal { position: relative; width: 52px; height: 56px; flex: none; display: grid; place-items: center; filter: drop-shadow(0 4px 6px rgb(var(--shade-rgb)/.22)); }
.gp-medal.lg { width: 64px; height: 70px; }
.gp-medal > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gp-medal .inner { fill: none; stroke: rgb(var(--glint-rgb)/.55); stroke-width: 1.4; }
.gp-medal i { position: relative; display: grid; place-items: center; color: var(--medal-ink); }
.gp-medal i .ico { width: 22px; height: 22px; stroke-width: 2.1; }
.gp-medal.lg i .ico { width: 27px; height: 27px; }
.gp-medal.t-bronze .s1 { stop-color: var(--medal-bronze-1); } .gp-medal.t-bronze .s2 { stop-color: var(--medal-bronze-2); } .gp-medal.t-bronze .s3 { stop-color: var(--medal-bronze-3); }
.gp-medal.t-silver .s1 { stop-color: var(--medal-silver-1); } .gp-medal.t-silver .s2 { stop-color: var(--medal-silver-2); } .gp-medal.t-silver .s3 { stop-color: var(--medal-silver-3); }
.gp-medal.t-gold .s1 { stop-color: var(--medal-gold-1); } .gp-medal.t-gold .s2 { stop-color: var(--medal-gold-2); } .gp-medal.t-gold .s3 { stop-color: var(--medal-gold-3); }
.gp-medal.t-platinum .s1 { stop-color: var(--medal-platinum-1); } .gp-medal.t-platinum .s2 { stop-color: var(--medal-platinum-2); } .gp-medal.t-platinum .s3 { stop-color: var(--medal-platinum-3); }
.gp-medal.t-platinum i { color: var(--medal-ink-platinum); }
.gp-medal.locked { filter: grayscale(1) opacity(.42); }

.gp-medal-toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h, 0px) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 90; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px 14px; border-radius: var(--rad-5); background: var(--bg-deep); color: var(--ink);
  box-shadow: var(--shadow-3), inset 0 0 0 1px rgb(var(--glint-rgb)/.08); animation: gp-drop .5s cubic-bezier(.2, 1.3, .4, 1); transition: opacity .4s, transform .4s; max-width: calc(100vw - 32px);
}
.gp-medal-toast.out { opacity: 0; transform: translate(-50%, 16px); }
@media (min-width: 900px) { .gp-medal-toast { left: auto; right: 24px; bottom: 24px; transform: none; } .gp-medal-toast.out { transform: translateY(16px); } }
.gp-medal-toast div { display: flex; flex-direction: column; gap: 1px; }
.gp-medal-toast em { font-style: normal; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.gp-medal-toast b { font: 800 22px/1.05 var(--font-display); }
.gp-medal-toast span { font-size: 12.5px; color: var(--ink-2); }
@keyframes gp-drop { from { opacity: 0; translate: 0 30px; scale: .9; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* ---------- Online hub ---------- */

.panel-online { gap: 18px; }
.gp-on-hero {
  position: relative; overflow: hidden; border-radius: var(--rad-5); min-height: 250px; display: flex; align-items: center; padding: 30px 32px; color: var(--ink);
  background: linear-gradient(90deg, var(--bg-deep) 0%, rgb(var(--bg-deep-rgb)/.9) 32%, rgb(var(--bg-deep-rgb)/.25) 64%, transparent 100%), url("../art/online.webp") 80% 50% / cover no-repeat, var(--bg-deep);
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--info-rgb)/.12);
}
.gp-on-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 470px; }
.gp-on-copy h2 { margin: 0; font: 800 56px/.95 var(--font-display); letter-spacing: .005em; color: var(--ink); }
.gp-on-copy p { margin: 0; font-size: 15px; color: var(--ink-2); max-width: 40ch; }
.gp-on-me { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 14px 6px 6px; border-radius: var(--rad-pill); background: rgb(var(--glint-rgb)/.08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.gp-on-me span { display: flex; flex-direction: column; }
.gp-on-me b { font-size: 14px; }
.gp-on-me em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.gp-on-me .link { color: var(--info); margin-left: 6px; }
.gp-on-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.gp-on-main, .gp-on-aside { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.gp-on-sec { padding: 18px; border-radius: var(--rad-5); background: var(--raised); box-shadow: var(--shadow-1); }

.gp-pools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gp-pool {
  --k: var(--gp-blitz); position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 14px 14px; border: 0; border-radius: var(--rad-4); text-align: left;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); transition: transform .15s, box-shadow .15s, background .15s;
}
.gp-pool::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--k); }
.gp-pool:hover { transform: translateY(-2px); background: var(--raised); box-shadow: inset 0 0 0 1.5px var(--k), 0 12px 24px -16px var(--k); }
.gp-pool b { font: 800 30px/1 var(--font-display); letter-spacing: .01em; }
.gp-pool span { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--k); }
.gp-pool .ico { width: 14px; height: 14px; }
.gp-pool.k-bullet { --k: var(--gp-bullet); }
.gp-pool.k-blitz { --k: var(--gp-blitz); }
.gp-pool.k-rapid { --k: var(--gp-rapid); }
.gp-pool.k-classical { --k: var(--gp-classical); }

.gp-friend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gp-friend { display: flex; align-items: center; gap: 12px; padding: 14px; border: 0; border-radius: var(--rad-4); text-align: left; background: var(--surface); color: var(--ink); transition: background .15s, transform .15s; }
.gp-friend:hover { background: var(--surface-2); transform: translateY(-1px); }
.gp-friend > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gp-friend b { font-size: 15px; }
.gp-friend em { font-style: normal; font-size: 12.5px; color: var(--ink-2); }
.gp-friend > .ico { color: var(--ink-3); }
.gp-fr-ico { width: 44px; height: 44px; border-radius: var(--rad-3); display: grid; place-items: center; flex: none; background: var(--emblem); color: var(--ink); box-shadow: var(--emblem-edge); }
.gp-fr-ico .ico { width: 22px; height: 22px; }


.gp-lad { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.gp-lad li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--rad-3); }
.gp-lad li.me { background: color-mix(in srgb, var(--gp-green) 12%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gp-green) 50%, transparent); }
.gp-lad .avatar { width: 34px; height: 34px; }
.gp-lad b { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-lad b em { font-style: normal; font-size: 11px; font-weight: 750; color: var(--gp-green); text-transform: uppercase; letter-spacing: .08em; margin-left: 4px; }
.gp-rank { width: 20px; text-align: center; font: 800 15px/1 var(--font-display); color: var(--ink-3); }
.gp-elo { font: 800 16px/1 var(--font-display); letter-spacing: .02em; color: var(--ink-2); }
.gp-beaten { display: grid; color: var(--c-inaccuracy); }
.gp-beaten .ico { width: 15px; height: 15px; fill: currentColor; }

@media (max-width: 899px) {
  .gp-on-cols { grid-template-columns: minmax(0, 1fr); }
  .gp-on-hero { min-height: 280px; align-items: flex-end; padding: 22px 20px; background: linear-gradient(180deg, rgb(var(--bg-deep-rgb)/.1) 0%, rgb(var(--bg-deep-rgb)/.6) 45%, var(--bg-deep) 92%), url("../art/online.webp") 72% 30% / cover no-repeat, var(--bg-deep); }
  .gp-on-copy h2 { font-size: 44px; }
  .gp-pools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gp-friend-grid { grid-template-columns: minmax(0, 1fr); }
  .gp-on-sec { padding: 14px; }
}

/* matchmaking */

/* pass and play */
.gp-local { display: flex; flex-direction: column; gap: 14px; }
.gp-local-vs { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 6px 0; }
.gp-local-vs .avatar { width: 72px; height: 72px; box-shadow: var(--shadow-2); }
.gp-local-vs > span:nth-child(2) { font: 800 22px/1 var(--font-display); color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }

@media (prefers-reduced-motion: reduce) {
  .avatar.gp-ph img, .gp-live-dot, .avatar.gp-ph.thinking::after { animation: none !important; }
}

/* ---------- desktop install ---------- */

.gp-install-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; border: 0; border-radius: var(--rad-pill); flex: none;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow-1); transition: transform .15s, box-shadow .15s;
}
.gp-install-btn .ico { width: 18px; height: 18px; }
.gp-install-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
@media (max-width: 899px) { .gp-install-btn span { display: none; } .gp-install-btn { padding: 0 9px; } }
.gp-dock { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gp-dock-icon { width: 96px; height: 96px; filter: drop-shadow(0 10px 18px rgb(var(--shade-rgb)/.35)); }
.gp-dock .install-steps { align-self: stretch; }
html.gp-standalone .install-slot { display: none; }

/* ---------- crafted boards (atelier/atelier.js, art/boards/) ---------- */

/* one picture for the 64 squares; the two plain colours show until it has loaded */
.board.bd-skin { background: var(--tex) center / 100% 100% no-repeat, repeating-conic-gradient(var(--sq-dark) 0 25%, var(--sq-light) 0 50%) 0 0 / 25% 25%; }
@media (min-width: 600px) {
  .board.bd-skin { box-shadow: 0 0 0 2px var(--bd-frame), 0 0 0 7px var(--bd-frame-2), 0 0 0 9px var(--bd-frame-3), 0 26px 50px -22px rgb(var(--shade-rgb)/.6), 0 6px 14px -6px rgb(var(--shade-rgb)/.3); }
}
/* coordinates and move marks must read on a texture: a halo for the letters, two-tone dots and rings */
.board.bd-skin .coord.on-light { text-shadow: 0 0 3px rgb(var(--glint-rgb)/.7), 0 0 1px rgb(var(--glint-rgb)/.9); }
.board.bd-skin .coord.on-dark { text-shadow: 0 0 3px rgb(var(--shade-rgb)/.75), 0 1px 1px rgb(var(--shade-rgb)/.8); }
.board.bd-skin .mark.dot:not(.pm):after { background: rgb(var(--shade-rgb)/.5); box-shadow: 0 0 0 calc(var(--sqs) * .022) rgb(var(--glint-rgb)/.55); }
.board.bd-skin .mark.cap:not(.pm):after { border-color: rgb(var(--shade-rgb)/.5); box-shadow: 0 0 0 calc(var(--sqs) * .018) rgb(var(--glint-rgb)/.5), inset 0 0 0 calc(var(--sqs) * .018) rgb(var(--glint-rgb)/.5); }

/* snow on the Christmas board: twelve flakes, moved by the compositor, under the pieces */
.bd-snow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; border-radius: inherit; contain: strict; }
.bd-snow i { position: absolute; top: -3%; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: radial-gradient(circle, rgb(var(--glint-rgb)/.95) 0 38%, rgb(var(--glint-rgb)/0) 72%); animation: bd-snow var(--t) linear infinite; animation-delay: var(--d); }
@keyframes bd-snow { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--dx), calc(var(--bs) * 1.08), 0); } }
.bd-snow.asleep i { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .bd-snow { display: none; } }

/* Settings → Board: the crafted group */
.bd-picker { margin: 0 0 18px; }
.bd-rest { margin-bottom: 8px; }
.bd-title { margin: 0 0 2px; font: 700 var(--fs-3, 15px) / 1.2 var(--font-body); color: var(--ink); }
.bd-note { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); }
.bd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.swatch.bd-swatch { min-height: 44px; }
.swatch.bd-swatch i { background: var(--th) center / cover no-repeat, repeating-conic-gradient(var(--d) 0 25%, var(--l) 0 50%) 0 0 / 50% 50%; box-shadow: inset 0 0 0 1px rgb(var(--shade-rgb)/.35); }
.swatch.bd-swatch span { text-align: center; line-height: 1.15; }
.bd-live { display: flex; gap: 12px; align-items: center; margin: 0 0 12px; padding: 10px; border-radius: var(--rad-3); background: var(--surface); }
.bd-live[hidden] { display: none; }
.bd-live-board { position: relative; flex: none; width: min(46%, 168px); aspect-ratio: 1; border-radius: var(--rad-1); background: center / 100% 100% no-repeat var(--surface-2); box-shadow: var(--shadow-1); }
.bd-live-board i { position: absolute; width: 12.5%; height: 12.5%; background: center / 100% 100% no-repeat; }
.bd-live-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.bd-live-text b { font-size: 15px; color: var(--ink); }
.bd-snow-opt { margin-top: 6px; }

/* the December offer (Home only: hidden elsewhere, QA63-1) */
.bd-offer[hidden] { display: none; }
.bd-offer { position: fixed; left: 50%; bottom: calc(var(--tab-h, 64px) + env(safe-area-inset-bottom, 0px) + 12px); transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px; width: min(calc(100vw - 24px), 430px); box-sizing: border-box; padding: 10px 12px; border-radius: var(--rad-4); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-3, var(--shadow-2)), inset 0 0 0 1px var(--line); font-size: 13.5px; }
.bd-offer > i { flex: none; width: 44px; height: 44px; border-radius: var(--rad-2); background: center / cover no-repeat; }
.bd-offer > span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.bd-offer > span span { color: var(--ink-2); }
.bd-offer button { flex: none; min-height: 44px; }

/* QA17-7: the Settings piece preview lays its pieces out in flow (position: static); the Letters disc is
   positioned from its piece, so the piece must be its containing block or the disc spans the sheet. */
.pset-live .pc[data-glyph] { position: relative; }
