/* v1.1 polish: dark wood shell to match Drake's game-screen mockup.
   Board geometry stays in app.css. Textures can be swapped via --art-bg / --art-board. */

@font-face {
  font-family: Cinzel;
  src: url("../assets/fonts/Cinzel-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: Lora;
  src: url("../assets/fonts/Lora-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: Lora;
  src: url("../assets/fonts/Lora-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("../assets/fonts/Inter-VariableFont.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brass: #d6ad5e;
  --brass-deep: #a87b34;
  --cream: #f5e7c8;
  --ink: #3b2414;
  --bg-deep: #1a0e08;
  --card: linear-gradient(180deg, rgba(120,74,42,.62), rgba(60,34,18,.62));
  --shadow: 0 8px 20px rgba(0,0,0,.45);
}

html[data-theme="ivory"],
html[data-theme="harbor"],
html[data-theme="wooden"] {
  /* Chrome stays dark wood; only the board palette changes in app.css. */
}

body {
  font-family: Inter, "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--cream);
  background-color: #2a160c;
  background-image:
    var(--art-bg, none),
    radial-gradient(ellipse at 50% -10%, rgba(110,70,36,.55), transparent 58%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(18deg, rgba(255,214,160,.035) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(180deg, rgba(40,18,8,.35) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #4a2c18 0%, #2c1810 42%, #1a0e08 100%);
  background-size: auto, auto, auto, auto, auto, auto;
  background-blend-mode: normal, normal, multiply, soft-light, normal, normal;
}

#app { max-width: 560px; }

/* Wordmark */
.brand { margin: 18px 0 22px; }
.brand h1,
.wordmark,
.topbar h2 {
  font-family: Cinzel, serif;
  font-weight: 700;
  letter-spacing: 1.2px;
  background: linear-gradient(#f8dc97, #c9953e 70%, #9d6f2a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1.5px 1px rgba(0,0,0,.6));
  text-shadow: none;
}
.brand h1 { font-size: clamp(2rem, 8vw, 2.6rem); }
.brand p { color: #e0c79a; }
.wordmark {
  font-size: 1.35rem;
  text-align: center;
  margin: 0;
  flex: 1;
}

/* Home chips + medal */
.chip {
  background: var(--card);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(214,173,94,.38), inset 0 1px 0 rgba(255,230,180,.15), 0 4px 10px rgba(0,0,0,.35);
  color: var(--cream);
  border-radius: 16px;
}
.chip .label { color: #e0c79a; }
.chip .value { color: #fbefd6; font-family: Lora, serif; }
.chip#home-streak .icon { display: none; }
.home-medal.streak-medal { margin: 0; }

.menu { max-width: 420px; }
.privacy, .footnote { color: #d9bc88; }

/* Buttons — raised wood with brass rim, like the mockup action bar */
.btn {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: .3px;
  color: #f8e8c8;
  background: linear-gradient(180deg, #8a5530, #5b341b);
  border: 0;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,215,160,.35), inset 0 0 0 1.2px rgba(214,173,94,.6), 0 3px 0 #2e180a, 0 6px 10px rgba(0,0,0,.45);
  text-shadow: 0 1px 0 rgba(0,0,0,.45);
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,215,160,.25), inset 0 0 0 1.2px rgba(214,173,94,.55), 0 1px 0 #2e180a; }
.btn.primary {
  background: linear-gradient(180deg, #c9a24a, #8a6a22);
  color: #3b2010;
  text-shadow: 0 1px 0 rgba(255,230,180,.35);
  box-shadow: inset 0 1px 0 rgba(255,240,200,.5), inset 0 0 0 1.2px rgba(214,173,94,.7), 0 3px 0 #5a3a10, 0 6px 10px rgba(0,0,0,.45);
}
.btn.ghost {
  background: linear-gradient(180deg, rgba(138,85,48,.45), rgba(91,52,27,.45));
  color: #f0c977;
}
.btn.danger {
  background: linear-gradient(180deg, #8a3030, #5b1b1b);
  color: #f8e8c8;
}
.btn.picked, .color-pick .btn.picked, .theme-pick.picked, .palette button.picked, .sandbox-tools .picked {
  box-shadow: inset 0 1px 0 rgba(255,215,160,.4), inset 0 0 0 2px #e6bd63, 0 0 10px rgba(255,200,90,.35), 0 3px 0 #2e180a;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: var(--brass);
  background: radial-gradient(circle at 35% 30%, #6e4428, #3c2414);
  box-shadow: inset 0 0 0 1.3px rgba(214,173,94,.75), 0 2px 5px rgba(0,0,0,.5);
  display: grid;
  place-items: center;
  padding: 0;
  flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.muted { color: #b8955e; opacity: .72; }

/* Top bars */
.topbar { margin-bottom: 14px; }
.topbar h2 { font-size: 1.2rem; }

/* Cards / panels */
.panel, .side-panel, .learn-card, .coach-card, .opp, .modal, .promo {
  background: var(--card);
  border: 0;
  color: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(214,173,94,.38), inset 0 1px 0 rgba(255,230,180,.15), 0 4px 10px rgba(0,0,0,.35);
}
.panel h3, .learn-card h3, .coach-card h3, .opp .name, .modal h3 {
  font-family: Lora, serif;
  color: #fbefd6;
}
.panel p, .learn-card p, .footnote, .opp .blurb { color: #e0c79a; }
.opp .rating { color: #f2c66d; }
.opp.picked { box-shadow: inset 0 0 0 2px #e6bd63, 0 0 10px rgba(255,200,90,.35); }

/* Setup avatars */
.opp { grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px 12px; }
.opp .avatar { width: 48px; height: 48px; }
.opp .blurb { grid-column: 2 / -1; }

/* Lesson */
.speech, .bubble {
  background: linear-gradient(180deg, #fbf0d8, #f0dcb3);
  color: #3b2414;
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 0 0 1px rgba(168,123,52,.5);
  border: 0;
}
.speech { border-radius: 14px; padding: 10px 14px; }

/* Game screen */
.game-screen {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 420px);
  margin: 0 auto;
}
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 8px;
}
.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 0 12px 0 8px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(214,173,94,.38), inset 0 1px 0 rgba(255,230,180,.15), 0 4px 10px rgba(0,0,0,.35);
}
.player-meta { min-width: 0; }
.player-meta h2, .player-card #game-title {
  font: 700 17px Lora, serif;
  color: #fbefd6;
  margin: 0;
  line-height: 1.1;
  background: none;
  filter: none;
  letter-spacing: 0;
}
.player-sub { font: 500 12.5px Inter, sans-serif; color: #e0c79a; margin: 3px 0 0; letter-spacing: .2px; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #6e4428, #3c2414);
  box-shadow: 0 0 0 2px var(--brass), 0 0 0 3.5px #5a3518, 0 3px 6px rgba(0,0,0,.5);
}
.avatar .avatar-img, .avatar .avatar-piece, .avatar .piece-svg, .avatar .piece-img {
  width: 120%;
  height: 120%;
  object-fit: contain;
}
.avatar .avatar-piece { display: grid; place-items: center; width: 86%; height: 86%; margin-top: 6%; }
.avatar .avatar-piece .piece-svg { width: 100%; height: 100%; }
.avatar.coach-av { width: 56px; height: 56px; }
.monogram {
  font: 700 24px Cinzel, serif;
  color: #5a3414;
  background: radial-gradient(circle at 35% 28%, #fbe8bf, #e2be7d 55%, #b98a45);
}
.monogram-letter { line-height: 1; }

.player-card .caps {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  min-height: 0;
  justify-content: flex-end;
  height: 30px;
  padding: 0 2px;
}
.player-card .mini-piece { width: 18px; height: 24px; margin-left: -3px; filter: drop-shadow(0 1.5px 1px rgba(0,0,0,.55)); }

.streak-medal {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 3px 9px 3px 3px;
  border-radius: 20px;
  background: rgba(30,16,7,.45);
  box-shadow: inset 0 0 0 1px rgba(214,173,94,.45);
  flex: none;
}
.streak-medal .medal-svg { width: 30px; height: 30px; display: block; }
.streak-medal .n { font: 800 16px Inter, sans-serif; color: #ffe3a3; line-height: 1; }
.streak-medal .l { font: 600 8.5px Inter, sans-serif; letter-spacing: .6px; text-transform: uppercase; color: #d9bc88; line-height: 1.05; }

#view-game .board-wrap { width: 100%; margin: 2px 0; }
#view-game .board-frame {
  padding: 3.8%;
  border-radius: 12px;
  background:
    var(--art-board, none),
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #6b4022, #4a2a14 40%, #3d2210);
  background-size: cover;
  box-shadow: 0 14px 26px rgba(0,0,0,.55), 0 3px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,215,160,.35), inset 0 0 0 1px rgba(40,20,8,.6);
  border: 0;
}

/* Last-move and selection closer to the mockup gold glow */
#view-game .sq.last-from, #view-game .sq.last-to {
  box-shadow: inset 0 0 0 999px rgba(255,196,90,.34), inset 0 0 0 1.5px rgba(255,205,110,.6);
}
#view-game .sq.selected {
  box-shadow: inset 0 0 0 2.5px #e6bd63, inset 0 0 9px 2px rgba(255,220,140,.75);
  background-image: radial-gradient(circle, rgba(255,214,120,.42), rgba(214,160,60,.18) 70%);
}
#view-game .sq.check {
  animation: check-pulse 900ms ease-in-out infinite;
}
@keyframes check-pulse {
  0%, 100% { box-shadow: inset 0 0 0 999px rgba(192,69,50,.4); }
  50% { box-shadow: inset 0 0 0 999px rgba(220,80,50,.66), 0 0 16px rgba(220,80,50,.45); }
}
#view-game .sq.legal::after {
  width: 28%;
  height: 28%;
  background: radial-gradient(circle at 40% 35%, rgba(255,240,200,.85), rgba(232,190,110,.7));
  box-shadow: 0 0 0 1.2px rgba(90,52,20,.45), 0 0 6px rgba(255,214,130,.45);
}
#view-game .sq.legal.capture::after {
  width: 78%;
  height: 78%;
  background: transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(58,32,14,.4);
}

.piece { transition: transform 240ms cubic-bezier(.2,.7,.2,1), opacity 200ms ease, filter 200ms ease; }
.piece.hopping { transition: none; pointer-events: none; }
.piece.arriving { opacity: 0; transform: scale(.86); }
.piece.leaving { opacity: 0; filter: brightness(1.8); pointer-events: none; z-index: 4; transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease; }
.piece-body {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transform-origin: 50% 92%;
  will-change: transform;
  pointer-events: none;
}
.avatar .contact-shadow { display: none; }
.avatar .piece-body { width: 100%; height: 100%; }

.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.fx-burst {
  position: absolute;
  left: 0; top: 0;
  width: 12.5%; height: 12.5%;
  background:
    radial-gradient(circle, rgba(255,230,160,.95) 0 12%, transparent 13%),
    radial-gradient(circle at 30% 30%, #f2c66d 0 8%, transparent 9%),
    radial-gradient(circle at 70% 40%, #fff6d0 0 7%, transparent 8%),
    radial-gradient(circle at 40% 75%, #d6ad5e 0 8%, transparent 9%);
  animation: burst 420ms ease-out forwards;
}
@keyframes burst {
  0% { transform: translate(var(--tx,0), var(--ty,0)) scale(.4); opacity: 1; }
  100% { transform: translate(var(--tx,0), var(--ty,0)) scale(1.8); opacity: 0; }
}
/* transform already includes square offset from JS; scale on the element is combined */
.board.mate-flash { animation: mate-flash 700ms ease-out; }
@keyframes mate-flash {
  0% { box-shadow: inset 0 0 0 1px rgba(42,27,16,.35), 0 0 0 0 rgba(242,198,109,0); }
  35% { box-shadow: inset 0 0 0 3px rgba(242,198,109,.85), 0 0 28px 6px rgba(242,198,109,.45); }
  100% { box-shadow: inset 0 0 0 1px rgba(42,27,16,.35), 0 0 0 0 rgba(242,198,109,0); }
}

.move-strip {
  position: relative;
  height: 36px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(25,13,6,.5);
  box-shadow: inset 0 0 0 1px rgba(214,173,94,.3);
}
.move-strip::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 36px;
  z-index: 2;
  background: linear-gradient(90deg, rgba(40,22,11,1), rgba(40,22,11,0));
  pointer-events: none;
}
#view-game .move-list {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0;
  padding: 0 10px 0 16px;
  white-space: nowrap;
  scrollbar-width: none;
  font: 500 13px Inter, sans-serif;
  color: #ecd8b2;
}
#view-game .move-list::-webkit-scrollbar { display: none; }
#view-game .move-list li,
#view-game .move-list .mp {
  display: flex;
  gap: 5px;
  align-items: center;
  flex: none;
  list-style: none;
}
#view-game .move-list .n { color: #b8955e; font-weight: 600; }
#view-game .move-list .mv { padding: 2px 5px; border-radius: 6px; }
#view-game .move-list .mv.cur {
  background: linear-gradient(#f2c66d, #c9913b);
  color: #3b2010;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.45);
}

.coach-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}
.coach-tip .bubble {
  position: relative;
  flex: 1;
  padding: 9px 13px 10px;
  border-radius: 14px;
}
.coach-tip .bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 26px;
  width: 14px;
  height: 14px;
  background: #f6e6c5;
  transform: rotate(45deg);
  box-shadow: -1px 1px 0 rgba(168,123,52,.45);
}
.coach-tip .who { font: 700 13px Lora, serif; color: #7a4a1c; }
.coach-tip .t { font: 500 13px/1.32 Inter, sans-serif; color: #3b2414; margin: 0; }

.game-status {
  text-align: center;
  font: 600 13px Inter, sans-serif;
  color: #f8e8c8;
  min-height: 0;
  margin: 0;
}
.game-status.check { color: #ffb4a8; }
.game-status.visually-quiet:not(.check):not(.over) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.game-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.game-actions .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #f0c977;
  min-height: 62px;
  padding: 8px 4px;
  font-size: 12px;
}
.game-actions .btn svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.5));
}
.game-actions .btn span { font: 600 12px Inter, sans-serif; color: #f8e8c8; letter-spacing: .3px; }
.resign-link {
  display: block;
  margin: 2px auto 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #d9bc88;
  font: 500 12px Inter, sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  padding: 10px 4px;
}
.resign-link:active { transform: none; box-shadow: none; }

/* Results modal */
.modal-backdrop { background: rgba(18,8,4,.62); }
.modal {
  border-radius: 18px;
  padding: 22px 18px 16px;
  max-width: 340px;
  text-align: center;
}
.modal h3 {
  font: 700 1.6rem Cinzel, serif;
  letter-spacing: .8px;
  background: linear-gradient(#f8dc97, #c9953e 70%, #9d6f2a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1.5px 1px rgba(0,0,0,.6));
}
.modal p { color: #f5e7c8; }
.elo-change { font-weight: 700; }
.elo-change.up { color: #f2c66d; }
.elo-change.down { color: #ffb4a8; }

.promo-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.promo {
  background: linear-gradient(180deg, #5b341b, #3c2414);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,215,160,.35), inset 0 0 0 1.2px rgba(214,173,94,.6), 0 8px 20px rgba(0,0,0,.5);
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 24px);
}
.promo-cancel { color: #f5e7c8; }
.promo button {
  background: linear-gradient(180deg, #8a5530, #5b341b);
  border: 0;
  box-shadow: inset 0 1px 0 rgba(255,215,160,.3), inset 0 0 0 1px rgba(214,173,94,.55);
  border-radius: 12px;
}
.promo button:hover, .promo button:focus {
  box-shadow: inset 0 1px 0 rgba(255,215,160,.4), inset 0 0 0 2px #e6bd63;
}

.theme-pick {
  background: rgba(30,16,7,.4);
  color: #f5e7c8;
  border-color: rgba(214,173,94,.35);
}
.toggle { color: #f5e7c8; }
.toggle input { accent-color: #d6ad5e; }

/* Desktop: keep the phone-column composition, just larger type and board */
@media (min-width: 860px) {
  #app { max-width: 560px; }
  .game-layout { grid-template-columns: 1fr; }
  .game-screen { width: 100%; }
  .wordmark { font-size: 1.7rem; }
  #view-game .board-wrap { width: 100%; }
}


/* Drake piece placement: canvas fills the square (king ~90% of the cell).
   Light rim + soft shadow so walnut pieces stay readable on walnut squares. */
.piece picture { width: 100%; height: 100%; display: block; }
.piece-img, .piece-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  filter:
    drop-shadow(0 0 1px rgba(255, 235, 200, 0.55))
    drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}
.piece.dragging .piece-img,
.piece.dragging .piece-svg {
  filter:
    drop-shadow(0 0 1px rgba(255, 235, 200, 0.55))
    drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45));
}
.contact-shadow {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 62%;
  height: 16%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(20, 8, 2, 0.42), rgba(20, 8, 2, 0) 70%);
  pointer-events: none;
  z-index: 0;
}
.piece picture, .piece-svg { position: relative; z-index: 1; }

/* Tiled wood + slightly lifted dark squares for contrast */
html[data-theme="wooden"] body,
body {
  background-size: 256px 256px, auto, auto, auto, auto, auto;
  background-repeat: repeat, no-repeat, repeat, repeat, repeat, no-repeat;
}
#view-game .board-frame {
  background-image:
    var(--art-frame, none),
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #6b4022, #4a2a14 40%, #3d2210);
  background-size: 256px 256px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  border-image: var(--art-brass-border, none) 24 / 10px / 0 stretch;
}
html[data-theme="wooden"] .sq.light,
html:not([data-theme]) .sq.light {
  background-image: var(--art-sq-light, none),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--wood-light), var(--wood-light-2));
  background-size: 100% 100%;
}
html[data-theme="wooden"] .sq.light:nth-child(3n),
html:not([data-theme]) .sq.light:nth-child(3n) { background-image: var(--art-sq-light-2, var(--art-sq-light, none)), linear-gradient(180deg, var(--wood-light), var(--wood-light-2)); }
html[data-theme="wooden"] .sq.light:nth-child(3n+1),
html:not([data-theme]) .sq.light:nth-child(3n+1) { background-image: var(--art-sq-light-3, var(--art-sq-light, none)), linear-gradient(180deg, var(--wood-light), var(--wood-light-2)); }
html[data-theme="wooden"] .sq.dark,
html:not([data-theme]) .sq.dark {
  /* slight lift so walnut pieces stay readable at 48–64px */
  background-image:
    linear-gradient(180deg, rgba(255, 224, 180, 0.16), rgba(255, 214, 160, 0.08)),
    var(--art-sq-dark, none),
    linear-gradient(180deg, #9a6236, #7a4a24);
  background-size: 100% 100%;
}
html[data-theme="wooden"] .sq.dark:nth-child(3n),
html:not([data-theme]) .sq.dark:nth-child(3n) {
  background-image:
    linear-gradient(180deg, rgba(255, 224, 180, 0.16), rgba(255, 214, 160, 0.08)),
    var(--art-sq-dark-2, var(--art-sq-dark, none)),
    linear-gradient(180deg, #9a6236, #7a4a24);
}
html[data-theme="wooden"] .sq.dark:nth-child(3n+1),
html:not([data-theme]) .sq.dark:nth-child(3n+1) {
  background-image:
    linear-gradient(180deg, rgba(255, 224, 180, 0.16), rgba(255, 214, 160, 0.08)),
    var(--art-sq-dark-3, var(--art-sq-dark, none)),
    linear-gradient(180deg, #9a6236, #7a4a24);
}
.move-strip {
  background-image: var(--art-brass-trim, none), linear-gradient(180deg, rgba(25,13,6,.5), rgba(25,13,6,.5));
  background-repeat: repeat-x, no-repeat;
  background-size: auto 5px, auto;
  background-position: top, 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .piece { transition: transform 160ms ease, opacity 160ms ease; }
  .piece.hopping { transition: none; }
  .piece.arriving { opacity: 1; transform: none; }
  .piece.leaving { transition: opacity 120ms ease; }
  .fx-burst, .board.mate-flash { animation: none; }
}


/* v1.1A-hotfix2 — constrain Drake PNG coach portraits (256px intrinsic)
   that were painted unscaled inside .coach-art, and capture FX. */
.learn-card,
.coach-card {
  overflow: hidden;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
}
.coach-art {
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #6e4428, #3c2414);
  box-shadow: 0 0 0 2px var(--brass, #d6ad5e), 0 0 0 3px #5a3518;
}
.coach-art .avatar-img,
.coach-art img,
.coach-art .avatar-piece,
.coach-art .piece-svg,
.coach-art .piece-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
}

.player-card .caps {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
  min-width: 40px;
  flex: 1 1 auto;
  height: auto;
  min-height: 28px;
  max-height: 40px;
  overflow: visible;
}
.mini-piece {
  width: 18px;
  height: 24px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.mini-piece .piece-svg,
.mini-piece svg,
.mini-piece img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.piece.capture-victim {
  pointer-events: none;
  z-index: 5;
}
.piece.squash-out {
  pointer-events: none;
  z-index: 5;
  animation: capture-fade 120ms ease-in forwards;
}
.piece.squash-out .piece-body {
  transform-origin: 50% 92%;
  animation: capture-squash 120ms ease-in forwards;
}
@keyframes capture-squash {
  0% { transform: scale(1, 1); }
  40% { transform: scale(1.28, 0.42); }
  100% { transform: scale(1.38, 0.12); }
}
@keyframes capture-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.fx-poof {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 6;
}
.fx-poof i {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #f7e7c2 0 35%, #c9a56a 60%, rgba(90, 53, 28, 0) 72%);
  animation: poof-dust 320ms ease-out forwards;
}
.fx-poof i:nth-child(1) { --dx: -16px; --dy: -9px; --s: 1.05; }
.fx-poof i:nth-child(2) { --dx: 14px; --dy: -11px; --s: .9; animation-delay: 15ms; }
.fx-poof i:nth-child(3) { --dx: -6px; --dy: -16px; --s: .75; animation-delay: 30ms; }
.fx-poof i:nth-child(4) { --dx: 8px; --dy: -4px; --s: .8; animation-delay: 10ms; }
.fx-poof i:nth-child(5) { --dx: -18px; --dy: -2px; --s: .7; animation-delay: 25ms; }
.fx-poof i:nth-child(6) { --dx: 18px; --dy: 1px; --s: .65; animation-delay: 35ms; }
@keyframes poof-dust {
  0% { transform: translate(0, 0) scale(0.35); opacity: 0.95; }
  70% { opacity: 0.65; }
  100% { transform: translate(var(--dx), var(--dy)) scale(var(--s, 1)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .piece.squash-out { animation: none; opacity: 0; transition: opacity 80ms ease; }
  .fx-poof, .fx-burst { display: none !important; animation: none; }
}

/* Keep the phone-column width on large desktops (already 560px at min-width 860px). */
@media (min-width: 860px) {
  #app { max-width: 560px; margin-left: auto; margin-right: auto; }
}
