/* Teacakes Galore — dashboard mini-game shell */

.tcg-root {
  --tcg-pink: #f472b6;
  --tcg-cream: #fff7ed;
  --tcg-brown: #78350f;
  --tcg-panel: rgba(255, 255, 255, 92%);
  --tcg-cell-size: 50px;
  max-width: 520px;
  margin: 0 auto;
  min-height: 640px;
  padding: 16px;
  border-radius: 16px;
  background-color: #fde68a;
  /* Tile image set inline from /teacakes-match-assets (manifest) or fallback URL in JS */
  background-image: none;
  background-repeat: repeat-y;
  background-position: center top;
  background-size: 100% auto;
  box-shadow: 0 16px 40px rgba(120, 53, 15, 0.2);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--tcg-brown);
  position: relative;
  overflow: hidden;
}

.tcg-root::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.88) 0%, rgba(255, 247, 237, 0.55) 40%, rgba(255, 247, 237, 0.75) 100%);
  pointer-events: none;
  z-index: 0;
}

.tcg-root > * {
  position: relative;
  z-index: 1;
}

.tcg-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin: 8px 0 4px;
  text-shadow: 0 1px 0 #fff;
  letter-spacing: 0.02em;
}

.tcg-by {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 16px;
  opacity: 0.9;
}

.tcg-panel {
  background: var(--tcg-panel);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border: 2px solid rgba(120, 53, 15, 0.15);
}

.tcg-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.tcg-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #f9a8d4, var(--tcg-pink));
  color: #5b0b2e;
  box-shadow: 0 4px 0 #be185d;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.tcg-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #be185d;
}

.tcg-btn.secondary {
  background: linear-gradient(180deg, #fef3c7, #fcd34d);
  color: #78350f;
  box-shadow: 0 4px 0 #b45309;
}

.tcg-btn.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.tcg-hud {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.tcg-hud--play {
  flex-wrap: wrap;
  align-items: center;
}

.tcg-hud-bricks {
  white-space: nowrap;
}

.tcg-hud-gems {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  margin: -2px 0 8px;
}

.tcg-obj-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(120, 53, 15, 0.12);
}

.tcg-obj-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.tcg-obj-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}

.tcg-obj-dot--0 { background: #fb7185; }
.tcg-obj-dot--1 { background: #4ade80; }
.tcg-obj-dot--2 { background: #38bdf8; }
.tcg-obj-dot--3 { background: #fbbf24; }
.tcg-obj-dot--4 { background: #c084fc; }

.tcg-obj-count {
  color: var(--tcg-brown);
  font-variant-numeric: tabular-nums;
}

.tcg-board-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.tcg-board {
  display: grid;
  gap: 4px;
  padding: 8px;
  background: rgba(120, 53, 15, 0.12);
  border-radius: 12px;
  touch-action: none;
}

.tcg-cell {
  width: var(--tcg-cell-size);
  height: var(--tcg-cell-size);
  border-radius: 10px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.14s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.1s ease;
  position: relative;
}

.tcg-cell:active {
  cursor: grabbing;
}

.tcg-cell.tcg-dragging {
  transition: none;
  z-index: 3;
  filter: brightness(1.06);
}

.tcg-cell.tcg-swap-target {
  outline: 3px solid #d97706;
  outline-offset: 1px;
}

@keyframes tcg-tile-disintegrate {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1) blur(0);
    box-shadow:
      inset 0 -3px 0 rgba(0, 0, 0, 0.12),
      0 0 0 0 rgba(251, 191, 36, 0);
  }
  28% {
    filter: brightness(1.45) blur(0.5px);
    box-shadow:
      inset 0 -3px 0 rgba(0, 0, 0, 0.08),
      0 0 18px 6px rgba(251, 191, 36, 0.75);
  }
  100% {
    transform: scale(0.12) rotate(14deg);
    opacity: 0;
    filter: brightness(2) blur(7px);
    box-shadow: none;
  }
}

.tcg-cell.tcg-disintegrate {
  animation: tcg-tile-disintegrate 0.42s cubic-bezier(0.34, 0.72, 0.22, 1) forwards;
  animation-delay: var(--tcg-disi-delay, 0ms);
  pointer-events: none;
  z-index: 4;
  transition: none;
}

.tcg-cell.tcg-swap-anim {
  transition: none;
  will-change: transform;
}

@keyframes tcg-nomatch-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.tcg-cell.tcg-nomatch-shake {
  animation: tcg-nomatch-shake 0.32s ease;
}

.tcg-cell-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tcg-tile-img--powerup {
  object-fit: contain;
  padding: 2px;
  box-sizing: border-box;
}

.tcg-tile-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.tcg-cell.selected {
  outline: 3px solid #c026d3;
  outline-offset: 2px;
  filter: brightness(1.08);
}

.tcg-kind-0 { background: linear-gradient(180deg, #fecdd3, #fb7185); color: #881337; }
.tcg-kind-1 { background: linear-gradient(180deg, #bbf7d0, #4ade80); color: #14532d; }
.tcg-kind-2 { background: linear-gradient(180deg, #bfdbfe, #38bdf8); color: #0c4a6e; }
.tcg-kind-3 { background: linear-gradient(180deg, #fde68a, #fbbf24); color: #713f12; }
.tcg-kind-4 { background: linear-gradient(180deg, #e9d5ff, #c084fc); color: #4c1d95; }

/* Play board: gems read as icons only; bricks & powerups keep a light panel */
.tcg-root--play .tcg-cell:not(.tcg-brick):not([class*="tcg-pu-"]) {
  background: transparent;
  border-color: rgba(120, 53, 15, 0.14);
  box-shadow: none;
}

.tcg-root--play .tcg-cell[class*="tcg-pu-"] {
  background: rgba(255, 255, 255, 0.35);
}

.tcg-brick {
  background: linear-gradient(145deg, #9a3412, #7c2d12 40%, #451a03);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35);
}

.tcg-brick--cracked {
  background: linear-gradient(145deg, #b45309, #92400e 45%, #78350f);
  opacity: 0.92;
}

.tcg-brick-glyph {
  font-size: calc(var(--tcg-cell-size, 50px) * 0.52);
  line-height: 1;
  color: rgba(254, 243, 199, 0.95);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  font-weight: 800;
}

.tcg-kind-strip {
  box-shadow: 0 0 0 2px #fff, 0 0 8px 2px rgba(250, 204, 21, 0.9);
}

.tcg-kind-bomb {
  box-shadow: 0 0 0 2px #fff, 0 0 10px 3px rgba(236, 72, 153, 0.95);
}

.tcg-level-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tcg-level-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(120, 53, 15, 0.2);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-weight: 700;
}

.tcg-level-btn:hover {
  border-color: var(--tcg-pink);
}

.tcg-level-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Map level select: full-height art inside a large scrollable viewport */
/* Stretch play mode in dashboard + Discord shell */
#teacakesGaloreRoot,
#teacakesActivityRoot {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#teacakesGalorePage #teacakesGaloreRoot {
  min-height: calc(100vh - 52px);
  min-height: calc(100dvh - 52px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#teacakesActivityRoot {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#teacakesGaloreRoot > .tcg-root--play,
#teacakesActivityRoot > .tcg-root--play {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

/* Play mode: battle layout — larger, closer to MH Puzzle scale */
.tcg-root.tcg-root--play {
  --tcg-play-radius: 22px;
  max-width: min(1320px, 100%);
  width: 100%;
  margin: 0 auto;
  min-height: min(100vh - 48px, 980px);
  min-height: min(100dvh - 48px, 980px);
  padding: clamp(12px, 1.8vw, 22px) clamp(14px, 2vw, 28px) clamp(14px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  font-size: clamp(15px, 1.05vw + 11px, 19px);
  font-family: ui-rounded, "Segoe UI", "Nunito", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(168deg, rgba(56, 120, 180, 0.35) 0%, transparent 38%),
    linear-gradient(180deg, #7ec8f0 0%, #4a8fc4 14%, #3d7a5c 48%, #1e3d28 72%, #152a1f 100%);
  border-radius: var(--tcg-play-radius);
  box-shadow:
    0 0 0 3px rgba(139, 90, 43, 0.55),
    0 0 0 6px rgba(45, 74, 50, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 24px 56px rgba(10, 30, 18, 0.55);
  color: #2c1810;
}

.tcg-root.tcg-root--play::before {
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.15) 0%, transparent 35%, rgba(20, 40, 30, 0.12) 100%);
}

.tcg-root.tcg-root--play > * {
  color: inherit;
}

.tcg-battle {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: clamp(12px, 1.8vw, 22px);
  flex: 1;
  min-height: 0;
}

.tcg-battle-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tcg-battle-left {
  flex: 0 0 clamp(158px, 16vw, 200px);
  max-width: 220px;
}

.tcg-battle-center {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

.tcg-battle-right {
  flex: 0 0 clamp(148px, 15vw, 190px);
  max-width: 210px;
  align-items: center;
  padding: clamp(10px, 1.2vw, 16px) clamp(8px, 1vw, 12px);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(60, 38, 22, 0.92) 0%, rgba(35, 22, 14, 0.96) 100%);
  border: 3px solid rgba(120, 72, 40, 0.85);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.12),
    inset 0 -6px 16px rgba(0, 0, 0, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.35);
}

.tcg-parchment {
  background:
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 3px,
      rgba(101, 67, 33, 0.04) 3px,
      rgba(101, 67, 33, 0.04) 4px
    ),
    linear-gradient(145deg, rgba(255, 252, 242, 0.99) 0%, rgba(248, 235, 210, 0.98) 55%, rgba(238, 220, 188, 0.97) 100%);
  border-radius: 16px;
  padding: clamp(12px, 1.4vw, 18px) clamp(12px, 1.3vw, 16px) clamp(14px, 1.5vw, 20px);
  border: 3px solid rgba(101, 67, 33, 0.42);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 8px rgba(101, 67, 33, 0.08),
    0 8px 20px rgba(40, 25, 10, 0.22);
}

.tcg-moves-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf7, #f0dfc0);
  border: 3px solid rgba(185, 50, 40, 0.45);
  margin-bottom: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 0 rgba(120, 40, 30, 0.2);
}

.tcg-moves-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #7c2d12;
}

.tcg-moves-arrows {
  color: #dc2626;
  font-size: 1.05em;
  font-weight: 900;
  text-shadow: 0 0 6px rgba(248, 113, 113, 0.6);
}

.tcg-moves-pill-num {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 900;
  line-height: 1;
  color: #b91c1c;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.65),
    0 0 20px rgba(248, 113, 113, 0.35);
}

.tcg-battle-chapter {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #5c4033;
  text-align: center;
}

.tcg-parchment-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #3d2a1f;
  border-bottom: 2px solid rgba(101, 67, 33, 0.22);
  padding-bottom: 6px;
}

.tcg-parchment-goals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.tcg-parchment-goals .tcg-obj-chip {
  font-size: 0.82rem;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.62);
  border-width: 2px;
}

.tcg-parchment-goals .tcg-obj-img {
  width: 22px;
  height: 22px;
}

.tcg-parchment-sub {
  margin: 0 0 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #5c4033;
}

.tcg-vigor-wrap {
  margin-top: auto;
}

.tcg-vigor-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b4423;
  margin-bottom: 6px;
}

.tcg-vigor-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(60, 40, 25, 0.18);
  overflow: hidden;
  border: 2px solid rgba(101, 67, 33, 0.28);
}

.tcg-vigor-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f87171, #fbbf24);
  transition: width 0.35s cubic-bezier(0.25, 0.85, 0.35, 1);
}

.tcg-board-frame {
  position: relative;
  height: 100%;
  min-height: clamp(280px, 52vh, 720px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.2vw, 16px);
  background:
    radial-gradient(ellipse 90% 55% at 50% 100%, rgba(0, 0, 0, 0.28), transparent 58%),
    linear-gradient(168deg, #8b7355 0%, #5c4a3d 35%, #3d3128 100%);
  border-radius: 22px;
  border: 4px solid #1a1410;
  box-shadow:
    inset 0 3px 16px rgba(0, 0, 0, 0.4),
    inset 0 -2px 0 rgba(255, 255, 255, 0.06),
    0 0 0 2px rgba(139, 90, 43, 0.55),
    0 12px 32px rgba(0, 0, 0, 0.35);
}

.tcg-board-frame::before,
.tcg-board-frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(180, 140, 80, 0.55);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
}

.tcg-board-frame::before {
  top: 8px;
  left: 8px;
  border-right: none;
  border-bottom: none;
}

.tcg-board-frame::after {
  bottom: 8px;
  right: 8px;
  border-left: none;
  border-top: none;
}

.tcg-board-frame-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  border-radius: 14px;
  padding: 6px;
  background: rgba(12, 9, 7, 0.55);
  box-shadow:
    inset 0 3px 12px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tcg-root.tcg-root--play .tcg-board-wrap {
  flex: 1 1 auto;
  min-height: clamp(320px, 58vh, 820px);
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

.tcg-root.tcg-root--play .tcg-board {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  gap: clamp(4px, 0.55vw, 7px);
  padding: clamp(7px, 0.9vw, 12px);
  background:
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(60, 48, 38, 0.5), transparent 55%),
    rgba(28, 22, 17, 0.88);
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.tcg-root.tcg-root--play .tcg-cell {
  border-radius: clamp(10px, 1.1vw, 14px);
  border-width: 2px;
}

.tcg-enemy-name {
  font-size: clamp(0.72rem, 1.05vw, 0.95rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  color: #fffbeb;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.8),
    0 0 12px rgba(251, 191, 36, 0.25);
  margin-bottom: 10px;
}

.tcg-enemy-portrait {
  width: clamp(88px, 11vw, 118px);
  height: clamp(108px, 13vw, 148px);
  margin: 0 auto 12px;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(255, 255, 255, 0.2), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.35));
  border: 3px solid rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.45);
}

.tcg-enemy-silhouette {
  width: 78%;
  height: 82%;
  margin-bottom: 6px;
  border-radius: 42% 42% 48% 48%;
  background: linear-gradient(180deg, #7c5cbf 0%, #3d2560 45%, #1a1028 100%);
  opacity: 0.95;
  box-shadow:
    0 -6px 12px rgba(0, 0, 0, 0.35) inset,
    0 4px 12px rgba(124, 92, 191, 0.35);
}

.tcg-enemy-hp-wrap {
  width: 100%;
  margin-bottom: 12px;
}

.tcg-enemy-hp-bar {
  height: clamp(14px, 1.6vw, 18px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.28);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.tcg-enemy-hp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  transition: width 0.4s cubic-bezier(0.25, 0.85, 0.35, 1);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.45);
}

.tcg-enemy-turn {
  width: clamp(42px, 5vw, 52px);
  height: clamp(42px, 5vw, 52px);
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: #fef2f2;
  background: linear-gradient(180deg, #ef4444, #b91c1c 55%, #7f1d1d);
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 0 14px rgba(239, 68, 68, 0.35);
}

.tcg-skill-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.tcg-skill-orb {
  width: clamp(54px, 6.5vw, 64px);
  height: clamp(54px, 6.5vw, 64px);
  border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.55);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.22), rgba(20, 15, 12, 0.5));
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.15),
    0 6px 14px rgba(0, 0, 0, 0.4);
  position: relative;
  padding: 0;
}

.tcg-skill-plus {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.62rem;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  line-height: 1;
}

.tcg-skill-lv {
  font-size: 0.58rem;
  font-weight: 800;
  color: rgba(255, 250, 235, 0.95);
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tcg-battle-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.18));
  border: 2px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tcg-battle-hero-avatar {
  width: clamp(52px, 6vw, 64px);
  height: clamp(52px, 6vw, 64px);
  border-radius: 14px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.tcg-battle-hero-avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.75rem, 3vw, 2.1rem);
  background: rgba(255, 255, 255, 0.22);
}

.tcg-battle-hero-tag {
  flex: 1;
  font-size: clamp(0.88rem, 1.2vw, 1.05rem);
  font-weight: 800;
  color: #fffef8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.tcg-battle-quit {
  padding: 10px 20px;
  font-size: 0.95rem;
  box-shadow: 0 4px 0 #92400e;
}

@media (max-width: 720px) {
  .tcg-battle {
    flex-wrap: wrap;
  }

  .tcg-battle-left {
    flex: 1 1 100%;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .tcg-battle-left .tcg-moves-pill {
    margin-bottom: 0;
  }

  .tcg-battle-left .tcg-vigor-wrap {
    flex: 1 1 140px;
    margin-top: 0;
    min-width: 120px;
  }

  .tcg-battle-center {
    flex: 1 1 100%;
    order: 3;
  }

  .tcg-board-frame {
    min-height: min(52vh, 560px);
  }

  .tcg-root.tcg-root--play .tcg-board-wrap {
    min-height: min(48vh, 520px);
  }

  .tcg-battle-right {
    flex: 1 1 auto;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 12px;
  }

  .tcg-skill-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .tcg-root.tcg-root--play {
    min-height: auto;
    padding: 12px;
  }
}

.tcg-activity-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 0 0 10px;
}

.tcg-activity-nav-btn {
  flex: 1;
  max-width: 200px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid rgba(120, 53, 15, 0.25);
  background: rgba(255, 255, 255, 0.55);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--tcg-brown);
}

.tcg-activity-nav-btn.is-active {
  background: linear-gradient(180deg, #f9a8d4, var(--tcg-pink));
  border-color: #be185d;
  color: #5b0b2e;
}

.tcg-root--activity-lb .tcg-lb-panel {
  padding: 10px 12px;
}

.tcg-lb-scroll {
  max-height: min(52vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tcg-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.tcg-lb-table th,
.tcg-lb-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(120, 53, 15, 0.12);
}

.tcg-lb-table th {
  font-weight: 800;
  position: sticky;
  top: 0;
  background: rgba(255, 247, 237, 0.95);
}

.tcg-lb-rank {
  width: 2rem;
  font-variant-numeric: tabular-nums;
}

.tcg-lb-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tcg-lb-row--me {
  background: rgba(244, 114, 182, 0.15);
  font-weight: 700;
}

.tcg-root.tcg-root--map {
  max-width: min(720px, calc(100vw - 16px));
  width: 100%;
  padding: 8px 10px 12px;
  min-height: unset;
}

.tcg-root.tcg-root--map .tcg-title {
  margin-bottom: 4px;
}

.tcg-root.tcg-root--map .tcg-by {
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.tcg-map-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 6px;
}

.tcg-map-tab {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 220px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid rgba(120, 53, 15, 0.28);
  background: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--tcg-brown);
  box-shadow: 0 2px 0 rgba(120, 53, 15, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.tcg-map-tab:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.72);
}

.tcg-map-tab.is-active {
  background: linear-gradient(180deg, #f9a8d4, var(--tcg-pink));
  border-color: #be185d;
  color: #5b0b2e;
  box-shadow: 0 3px 0 #be185d;
}

.tcg-map-tab.is-active:hover:not(:disabled) {
  filter: brightness(1.02);
}

.tcg-map-tab.is-locked:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.tcg-map-chapter2-hint {
  text-align: center;
  margin: 0 0 6px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.tcg-map-wrap {
  margin-bottom: 8px;
  flex: 1;
  min-height: 0;
}

.tcg-map-viewport {
  width: 100%;
  border-radius: 16px;
  border: 2px solid rgba(120, 53, 15, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 8px 28px rgba(120, 53, 15, 0.18);
  background: #87ceeb;
  box-sizing: border-box;
}

.tcg-map-viewport--scroll {
  max-height: min(92vh, calc(100vh - 120px));
  max-height: min(92dvh, calc(100dvh - 120px));
  min-height: min(320px, 45vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.tcg-map-scroller {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  line-height: 0;
}

.tcg-map-bg {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.tcg-map-bg--fallback {
  min-height: 420px;
  background: linear-gradient(180deg, #bae6fd, #fde68a 55%, #86efac);
}

.tcg-map-overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.tcg-map-connector {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  width: clamp(36px, 10vw, 56px);
  height: auto;
  pointer-events: none;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.tcg-map-decor {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

.tcg-map-clouds {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0.42;
  mix-blend-mode: soft-light;
}

.tcg-map-node-wrap {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 6px;
}

/* Selected avatar + pack frame, floated above the next playable level */
.tcg-map-player-pin {
  position: absolute;
  z-index: 7;
  transform: translate(-50%, calc(-50% - clamp(46px, 12vw, 64px)));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tcg-map-player-stack {
  position: relative;
}

/* Picture-style box: your avatar fills the inner window (no pawn PNG). */
.tcg-map-player-stack--boxed {
  width: clamp(52px, 15vw, 74px);
  height: clamp(52px, 15vw, 74px);
  padding: 4px;
  box-sizing: border-box;
  background: linear-gradient(165deg, #fffbeb 0%, #fef3c7 40%, #fde68a 100%);
  border: 3px solid rgba(120, 53, 15, 0.55);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 8px rgba(180, 83, 9, 0.1),
    0 5px 14px rgba(0, 0, 0, 0.28);
  filter: drop-shadow(0 4px 10px rgba(120, 53, 15, 0.2));
}

.tcg-map-player-avatar--boxed {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  z-index: 0;
}

.tcg-map-player-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 36px;
  font-size: 1.25rem;
  font-weight: 800;
  color: rgba(120, 53, 15, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

/* Optional manifest PNG: true frame with transparent center over a smaller avatar */
.tcg-map-player-stack--png-overlay {
  width: clamp(58px, 17vw, 86px);
  height: clamp(58px, 17vw, 86px);
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.28));
}

.tcg-map-player-stack--png-overlay .tcg-map-player-avatar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 54%;
  height: 54%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 0;
}

.tcg-map-player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  pointer-events: none;
}

.tcg-map-stars {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1.2vw, 8px);
  margin-top: 2px;
  pointer-events: none;
  position: relative;
  z-index: 6;
}

.tcg-map-star--glyph {
  font-size: clamp(22px, 6.2vw, 34px);
  line-height: 1;
  display: inline-block;
  font-weight: 800;
}

.tcg-map-star--on {
  color: #fde047;
  text-shadow:
    0 0 1px #b45309,
    0 1px 0 #92400e,
    0 -1px 1px rgba(255, 255, 255, 0.45);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.tcg-map-star--off {
  color: rgba(88, 45, 12, 0.22);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tcg-map-avatar {
  width: clamp(48px, 14vw, 72px);
  height: auto;
  margin-bottom: -6px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
  position: relative;
}

.tcg-map-node {
  position: relative;
  pointer-events: auto;
  width: clamp(56px, 16vw, 80px);
  height: clamp(56px, 16vw, 80px);
  min-width: 52px;
  min-height: 52px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 10px 18px rgba(255, 255, 255, 0.38),
    inset 0 -14px 22px rgba(0, 0, 0, 0.12),
    0 5px 0 rgba(255, 255, 255, 0.95),
    0 8px 14px rgba(41, 37, 36, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  /* Default = cleared (blue candy dome); .current / .locked override */
  background:
    radial-gradient(ellipse 95% 80% at 50% 28%, rgba(255, 255, 255, 0.75) 0%, transparent 52%),
    radial-gradient(ellipse 88% 78% at 50% 42%, #60a5fa 0%, #2563eb 52%, #1e40af 100%);
}

.tcg-map-node.current {
  background:
    radial-gradient(ellipse 95% 80% at 50% 28%, rgba(255, 255, 255, 0.78) 0%, transparent 52%),
    radial-gradient(ellipse 88% 78% at 50% 42%, #4ade80 0%, #22c55e 52%, #15803d 100%);
}

.tcg-map-node.locked {
  background:
    radial-gradient(ellipse 95% 80% at 50% 28%, rgba(255, 255, 255, 0.35) 0%, transparent 52%),
    radial-gradient(ellipse 88% 78% at 50% 42%, #d1d5db 0%, #9ca3af 55%, #6b7280 100%);
  box-shadow:
    inset 0 6px 12px rgba(255, 255, 255, 0.22),
    inset 0 -10px 18px rgba(0, 0, 0, 0.1),
    0 5px 0 rgba(255, 255, 255, 0.75),
    0 6px 12px rgba(41, 37, 36, 0.22);
}

.tcg-map-node-num {
  position: relative;
  z-index: 1;
  font-size: clamp(0.82rem, 3.2vw, 1.05rem);
  font-weight: 800;
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 1px 3px rgba(0, 0, 0, 0.75);
}

.tcg-map-node:hover:not(:disabled) {
  transform: scale(1.08);
  filter: brightness(1.05);
}

.tcg-map-node:active:not(:disabled) {
  transform: scale(0.96);
}

.tcg-map-node.current:not(.locked) {
  filter:
    drop-shadow(0 0 5px rgba(34, 197, 94, 0.65))
    drop-shadow(0 0 12px rgba(250, 204, 21, 0.5));
}

.tcg-map-node.cleared:not(.current):not(.locked) {
  filter: drop-shadow(0 2px 5px rgba(37, 99, 235, 0.4));
}

.tcg-map-node.locked {
  cursor: not-allowed;
  opacity: 0.9;
  filter: saturate(0.92) brightness(0.98);
}

.tcg-map-node.locked .tcg-map-node-num {
  opacity: 0.95;
}

.tcg-row--menu-main {
  align-items: center;
}

.tcg-menu-avatar-btn {
  position: relative;
  width: clamp(80px, 24vw, 108px);
  height: clamp(80px, 24vw, 108px);
  min-width: 80px;
  min-height: 80px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  background-color: transparent;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  box-shadow:
    0 5px 0 #be185d,
    0 10px 20px rgba(120, 53, 15, 0.22);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.tcg-menu-avatar-btn:not([style*="background-image"]) {
  background: linear-gradient(180deg, #f9a8d4, var(--tcg-pink));
}

.tcg-menu-avatar-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 #be185d,
    0 4px 12px rgba(120, 53, 15, 0.2);
}

.tcg-menu-avatar-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 12% 10%;
  box-sizing: border-box;
  pointer-events: none;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 40%);
}

.tcg-menu-avatar-preview {
  position: relative;
  width: 52%;
  max-height: 44%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* No inner ring or circular crop—just the art on the pink button */
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.tcg-menu-avatar-preview img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.tcg-menu-avatar-btn-text {
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  font-weight: 800;
  color: #5b0b2e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  text-align: center;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.tcg-root--avatars .tcg-title {
  margin-bottom: 4px;
}

.tcg-avatar-panel {
  padding: 12px 10px;
  margin-bottom: 10px;
}

.tcg-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 12px 10px;
  justify-items: center;
  max-height: min(58vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 2px 8px;
  -webkit-overflow-scrolling: touch;
}

.tcg-avatar-pick {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 100%;
  max-width: 72px;
  border-radius: 50%;
  transition: transform 0.1s ease;
}

.tcg-avatar-pick:hover {
  transform: scale(1.06);
}

.tcg-avatar-pick:focus-visible {
  outline: 2px solid #be185d;
  outline-offset: 3px;
}

.tcg-avatar-pick-ring {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-sizing: border-box;
  border: 3px solid rgba(120, 53, 15, 0.28);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.65),
    0 4px 10px rgba(120, 53, 15, 0.18);
  background: linear-gradient(145deg, #fff7ed, #fde68a);
}

.tcg-avatar-pick--selected .tcg-avatar-pick-ring {
  border-color: #16a34a;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.85),
    0 0 0 3px rgba(34, 197, 94, 0.45),
    0 4px 12px rgba(22, 163, 74, 0.35);
}

.tcg-avatar-pick-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: top;
}

.tcg-avatar-pick-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: clamp(0.75rem, 3.5vw, 1rem);
  font-weight: 800;
  color: rgba(120, 53, 15, 0.55);
  background: rgba(255, 255, 255, 0.5);
}

.tcg-muted {
  font-size: 0.82rem;
  opacity: 0.85;
  font-weight: 500;
}

.tcg-settings label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: 600;
}

/* Activity iframe loads only this stylesheet (not styles.css): keep text visible on #0f172a. */
#teacakesActivityRoot .muted {
  color: #94a3b8;
}
#teacakesActivityRoot .hint-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #e2e8f0;
  line-height: 1.5;
}
#teacakesActivityRoot .hint-box h3 {
  color: #f8fafc;
}

@media (max-width: 540px) {
  .tcg-root {
    --tcg-cell-size: 42px;
  }

  .tcg-cell {
    font-size: 1.1rem;
  }
}
