:root {
      --bg-void: #060711;
      --panel-glass: rgba(13, 16, 34, 0.84);
      --kda-pink: #ff2a85;
      --kda-cyan: #00f0ff;
      --kda-gold: #ffd166;
      --kda-purple: #a855f7;
      --atomic-blue: #38bdf8;
    }

    * {
      box-sizing: border-box;
      user-select: none;
      -webkit-user-select: none;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background-color: var(--bg-void);
      background-image:
        radial-gradient(circle at 18% 20%, rgba(255, 42, 133, 0.14), transparent 40%),
        radial-gradient(circle at 82% 24%, rgba(56, 189, 248, 0.16), transparent 42%),
        radial-gradient(circle at 50% 88%, rgba(168, 85, 247, 0.14), transparent 50%),
        linear-gradient(180deg, #060711 0%, #0b0e23 100%);
      color: #f8fafc;
      font-family: 'Inter', sans-serif;
      overflow-x: hidden;
    }

    .font-display {
      font-family: 'Orbitron', sans-serif;
    }

    .app-width {
      width: 100%;
      max-width: 1600px;
      margin-inline: auto;
    }

    #gamePage.hidden {
      display: none;
    }

    #changelogEntries {
      max-height: min(70vh, 28rem);
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-width: thin;
    }

    [id^="portrait-"][data-rank-tier="iron"] { border-color: #777777; box-shadow: 0 0 10px #77777788; }
    [id^="portrait-"][data-rank-tier="bronze"] { border-color: #a97142; box-shadow: 0 0 10px #a9714288; }
    [id^="portrait-"][data-rank-tier="silver"] { border-color: #aeb9c7; box-shadow: 0 0 10px #aeb9c788; }
    [id^="portrait-"][data-rank-tier="gold"] { border-color: #d8a22e; box-shadow: 0 0 10px #d8a22e88; }
    [id^="portrait-"][data-rank-tier="platinum"] { border-color: #54c7c4; box-shadow: 0 0 10px #54c7c488; }
    [id^="portrait-"][data-rank-tier="emerald"] { border-color: #2baf69; box-shadow: 0 0 10px #2baf6988; }
    [id^="portrait-"][data-rank-tier="diamond"] { border-color: #5ebeff; box-shadow: 0 0 10px #5ebeff88; }
    [id^="portrait-"][data-rank-tier="master"] { border-color: #9f50e6; box-shadow: 0 0 10px #9f50e688; }
    [id^="portrait-"][data-rank-tier="grandmaster"] { border-color: #d74a4a; box-shadow: 0 0 10px #d74a4a88; }
    [id^="portrait-"][data-rank-tier="challenger"] { border-color: #f5d76e; box-shadow: 0 0 10px #f5d76e88; }

    .glass-panel {
      background: var(--panel-glass);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(255, 255, 255, 0.11);
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), inset 0 0 18px rgba(0, 240, 255, 0.04);
    }

    .combat-log {
      display: flex;
      flex: 0 0 14rem;
      flex-direction: column;
      gap: 2px;
      height: 14rem;
      max-height: 14rem;
      min-height: 0;
      overflow-y: auto;
    }

    .battle-log-collapsed .combat-log {
      display: none;
    }

    .combat-log > div {
      flex: 0 0 1.625rem;
      height: 1.625rem;
      min-height: 1.625rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .holo-text {
      background: linear-gradient(90deg, #00f0ff, #ff2a85, #ffd166, #00f0ff);
      background-size: 300% 300%;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      animation: holoShift 7s ease infinite;
    }

    @keyframes holoShift {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }

    /* Slay the Spire Hand Card Styling */
    .spire-card {
      position: relative;
      transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
      background: linear-gradient(160deg, #151938 0%, #0b0e22 100%);
      border-radius: 1.1rem;
      cursor: pointer;
    }

    .spire-card.playable:hover {
      transform: translateY(-16px) scale(1.05);
      z-index: 30;
      box-shadow: 0 18px 36px rgba(0, 240, 255, 0.32), 0 0 20px rgba(255, 42, 133, 0.35);
    }

    .spire-card.unplayable {
      opacity: 0.48;
      cursor: not-allowed;
      filter: grayscale(0.45);
    }

    .spire-card.card-upgraded {
      box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.45);
    }

    /* Active conditional bonus (e.g. bonus damage while the target is Charmed). */
    .spire-card.card-bonus-glow {
      box-shadow: 0 0 14px rgba(250, 204, 21, 0.55), inset 0 0 0 1px rgba(250, 204, 21, 0.65);
    }

    /* Character Accent Borders */
    .card-ahri { border: 1.5px solid rgba(255, 42, 133, 0.7); }
    .card-akali { border: 1.5px solid rgba(0, 240, 255, 0.7); }
    .card-evelynn { border: 1.5px solid rgba(192, 132, 252, 0.72); }
    .card-kaisa { border: 1.5px solid rgba(99, 102, 241, 0.78); }
    .card-sona { border: 1.5px solid rgba(45, 212, 191, 0.75); }
    .card-squad { border: 1.5px solid rgba(255, 209, 102, 0.85); }

    /* Combat Animations */
    @keyframes shakeScreen {
      0%, 100% { transform: translate(0, 0); }
      20% { transform: translate(-8px, 4px); }
      40% { transform: translate(8px, -4px); }
      60% { transform: translate(-5px, -3px); }
      80% { transform: translate(5px, 3px); }
    }

    .shake-active {
      animation: shakeScreen 0.36s ease-in-out;
    }

    @keyframes kaijuHitFlash {
      0% { filter: brightness(2.6) drop-shadow(0 0 28px #ff2a85); transform: translateX(8px); }
      50% { filter: brightness(1.5) drop-shadow(0 0 18px #00f0ff); transform: translateX(-6px); }
      100% { filter: brightness(1); transform: translateX(0); }
    }

    .kaiju-hit {
      animation: kaijuHitFlash 0.32s ease-out;
    }

    @keyframes floatUpFade {
      0% { opacity: 1; transform: translateY(0) scale(1); }
      100% { opacity: 0; transform: translateY(-48px) scale(1.18); }
    }

    .floating-popup {
      position: absolute;
      pointer-events: none;
      animation: floatUpFade 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
      z-index: 50;
      text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
    }

    /* Pile inspector spotlight: single-card previews render large and static. */
    .pile-spotlight .spire-card {
      cursor: default;
    }

    .pile-spotlight .spire-card.playable:hover {
      transform: none;
      z-index: auto;
    }

    /* Shiny finish: twinkling star pings on two independent layers. */
    .card-finish-1 {
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 10px rgba(255, 255, 255, 0.25);
    }

    .card-finish-1::before,
    .card-finish-1::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
    }

    .card-finish-1::before {
      background-image:
        radial-gradient(circle, #ffffff 1.4px, transparent 1.9px),
        radial-gradient(circle, #ffffff 1px, transparent 1.5px),
        radial-gradient(circle, #ffffff 1.2px, transparent 1.7px);
      background-size: 64px 64px, 96px 96px, 78px 78px;
      background-position: 12% 22%, 82% 14%, 68% 82%;
      animation: shinyTwinkle 2.2s ease-in-out infinite;
    }

    .card-finish-1::after {
      background-image:
        radial-gradient(circle, #fef9c3 1.2px, transparent 1.7px),
        radial-gradient(circle, #ffffff 1px, transparent 1.5px),
        radial-gradient(circle, #fef9c3 1.5px, transparent 2px);
      background-size: 92px 92px, 70px 70px, 112px 112px;
      background-position: 78% 68%, 22% 78%, 45% 35%;
      animation: shinyTwinkle 3.1s ease-in-out -1.2s infinite;
    }

    @keyframes shinyTwinkle {
      0%, 100% { opacity: 0.1; }
      50% { opacity: 0.95; }
    }

    /* Platinum finish: slow liquid-metal sweep. */
    .card-finish-2 {
      box-shadow: inset 0 0 0 1px rgba(203, 225, 255, 0.7), 0 0 14px rgba(174, 194, 224, 0.4);
    }

    .card-finish-2::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      background: linear-gradient(100deg,
        transparent 28%,
        rgba(226, 232, 240, 0.06) 38%,
        rgba(226, 232, 240, 0.5) 47%,
        rgba(148, 184, 220, 0.55) 52%,
        rgba(226, 232, 240, 0.12) 61%,
        transparent 72%);
      background-size: 300% 100%;
      animation: platinumFlow 5.5s linear infinite;
    }

    @keyframes platinumFlow {
      0% { background-position: 120% 0; }
      100% { background-position: -120% 0; }
    }

    .card-finish-3 {
      box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.65), 0 0 18px rgba(0, 240, 255, 0.35);
    }

    .card-finish-3::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      background: linear-gradient(115deg, transparent 30%, rgba(255, 42, 133, 0.28) 42%, rgba(255, 209, 102, 0.32) 50%, rgba(0, 240, 255, 0.28) 58%, transparent 70%);
      background-size: 250% 250%;
      animation: holoSheen 2.8s ease-in-out infinite;
    }

    @keyframes holoSheen {
      0% { background-position: 120% 0; }
      50% { background-position: -20% 0; }
      100% { background-position: 120% 0; }
    }

    @keyframes dorsalPulse {
      0%, 100% { filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.55)); }
      50% { filter: drop-shadow(0 0 22px rgba(0, 240, 255, 0.95)); }
    }

    .dorsal-charged {
      animation: dorsalPulse 1.3s ease-in-out infinite;
    }

    #mainMenuOverlay {
      overscroll-behavior: contain;
    }

    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
    ::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.35); border-radius: 999px; }
