/* ==========================================================================
   CARDS.CSS — Стили рамок 4 стихий, угловых кружков и большого блока описания
   ========================================================================== */

/* ==========================================================================
     ИНДИВИДУАЛЬНЫЙ ДИЗАЙН ЛИЦЕВОЙ СТОРОНЫ КАРТ ПОД КАЖДУЮ СТИХИЮ
     + УГЛОВЫЕ КРУЖКИ ХАРАКТЕРИСТИК КАК В ХРОНИКАХ ЭТЕРИУМА
     ========================================================================== */
  .am-card {
    padding: 4px;
    border-radius: 7px;
    position: relative;
    overflow: visible;
  }

  /* 1. СТИХИЯ ЗЕМЛИ (Лесной малахит, резной дуб и серебристая окантовка) */
  .am-card.elem-earth {
    background: linear-gradient(165deg, #2a4723 0%, #182b14 55%, #0e1a0b 100%);
    border: 2px solid #8eb584;
    box-shadow:
      0 4px 10px rgba(0,0,0,0.82),
      inset 0 0 0 1.5px #2e5225,
      inset 0 0 12px rgba(16, 36, 12, 0.9);
  }
  .am-card.elem-earth .am-card-header {
    background: linear-gradient(180deg, #2b4223 0%, #172612 100%);
    border: 1px solid #7ea372;
    border-radius: 4px;
  }
  .am-card.elem-earth .am-card-art-box {
    border: 1.5px solid #6c9160;
    background: linear-gradient(180deg, #162e14 0%, #24471e 60%, #142911 100%);
  }

  /* 2. СТИХИЯ ОГНЯ (Кованый обсидиан, багровая медь и языки пламени) */
  .am-card.elem-fire {
    background: linear-gradient(165deg, #591a12 0%, #330d08 55%, #1c0604 100%);
    border: 2px solid #d47a4a;
    box-shadow:
      0 4px 10px rgba(0,0,0,0.82),
      inset 0 0 0 1.5px #7a2416,
      inset 0 0 12px rgba(48, 8, 4, 0.9);
  }
  .am-card.elem-fire .am-card-header {
    background: linear-gradient(180deg, #4f1a12 0%, #2b0c08 100%);
    border: 1px solid #c96b3b;
    border-radius: 3px;
  }
  .am-card.elem-fire .am-card-art-box {
    border: 1.5px solid #b55a32;
    background: linear-gradient(180deg, #38100a 0%, #6e2214 60%, #260905 100%);
  }

  /* 3. СТИХИЯ ВОДЫ (Глубинный аквамарин, морской сланец и серебряный перламутр) */
  .am-card.elem-water {
    background: linear-gradient(165deg, #163e52 0%, #0d2533 55%, #07151f 100%);
    border: 2px solid #82bfd1;
    box-shadow:
      0 4px 10px rgba(0,0,0,0.82),
      inset 0 0 0 1.5px #1f5770,
      inset 0 0 12px rgba(6, 24, 36, 0.9);
  }
  .am-card.elem-water .am-card-header {
    background: linear-gradient(180deg, #173c4f 0%, #0c222e 100%);
    border: 1px solid #6daec2;
    border-radius: 6px;
  }
  .am-card.elem-water .am-card-art-box {
    border: 1.5px solid #5899ad;
    background: linear-gradient(180deg, #0c2636 0%, #184963 60%, #091d29 100%);
  }

  /* 4. СТИХИЯ ВОЗДУХА (Небесный мрамор, грозовой индиго и платиновый кант) */
  .am-card.elem-air {
    background: linear-gradient(165deg, #342c57 0%, #1f1a38 55%, #120f24 100%);
    border: 2px solid #b8c0e0;
    box-shadow:
      0 4px 10px rgba(0,0,0,0.82),
      inset 0 0 0 1.5px #4a407a,
      inset 0 0 12px rgba(18, 14, 38, 0.9);
  }
  .am-card.elem-air .am-card-header {
    background: linear-gradient(180deg, #322a52 0%, #1b1630 100%);
    border: 1px solid #9fa8cf;
    border-radius: 5px;
  }
  .am-card.elem-air .am-card-art-box {
    border: 1.5px solid #8892bd;
    background: linear-gradient(180deg, #1e1938 0%, #3b3269 60%, #16122b 100%);
  }


  /* Декоративный SVG-орнамент лицевой стороны карты (уникальный для каждой из 4 стихий) */
  .am-card-face-ornament {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
    overflow: hidden;
  }

  .am-card-face-ornament svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  /* Уникальная фактура и форма лицевой стороны под каждую стихию */
  .am-card.elem-earth {
    background:
      repeating-linear-gradient(135deg, rgba(120, 175, 95, 0.06) 0px, rgba(120, 175, 95, 0.06) 3px, transparent 3px, transparent 8px),
      linear-gradient(165deg, #2b4a22 0%, #192e14 55%, #0e1a0b 100%);
    border: 2px solid #8eb87e;
    border-radius: 9px 4px 9px 4px;
  }

  .am-card.elem-fire {
    background:
      repeating-linear-gradient(45deg, rgba(255, 110, 50, 0.07) 0px, rgba(255, 110, 50, 0.07) 2px, transparent 2px, transparent 7px),
      linear-gradient(165deg, #611b12 0%, #360d07 55%, #1c0503 100%);
    border: 2px solid #df7b42;
    border-radius: 3px;
  }

  .am-card.elem-water {
    background:
      radial-gradient(circle at 50% 0%, rgba(110, 210, 235, 0.16) 0%, transparent 70%),
      linear-gradient(165deg, #164459 0%, #0c2838 55%, #06151f 100%);
    border: 2px solid #79c4d9;
    border-radius: 10px;
  }

  .am-card.elem-air {
    background:
      radial-gradient(circle at 80% 20%, rgba(205, 215, 255, 0.15) 0%, transparent 65%),
      linear-gradient(165deg, #3a3161 0%, #221c3d 55%, #120e24 100%);
    border: 2px solid #c2cae8;
    border-radius: 6px 11px 6px 11px;
  }

  .am-elem-header-glyph {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .am-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: #f0d778;
    box-shadow: 0 8px 20px rgba(0,0,0,0.88), 0 0 12px rgba(232, 204, 110, 0.5);
    z-index: 15;
  }

  .am-card.selected {
    border: 2px solid #fff0b3;
    box-shadow: 0 0 18px rgba(242, 202, 116, 0.95);
    transform: translateY(-6px) scale(1.03);
    z-index: 16;
  }

  .am-card.unplayable {
    filter: brightness(0.66) saturate(0.72);
  }

  .am-card.unplayable:hover {
    filter: brightness(0.92) saturate(1);
  }

  .am-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    padding: 2px 22px 2px 5px;
    min-height: 20px;
    z-index: 2;
    position: relative;
  }

  .am-card-title {
    font-size: 10.5px;
    font-weight: 800;
    color: #f5ebd6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-shadow: 0 1px 2px #000;
    font-family: Tahoma, 'Segoe UI', sans-serif;
  }

  /* КЛАССИЧЕСКИЙ УГЛОВОЙ СИНИЙ КРУЖОК СТОИМОСТИ (ПРАВЫЙ ВЕРХНИЙ УГОЛ КАК В CHRONICLES OF AETHERIUM) */
  .am-orb-mana {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #2b3f9e 0%, #121f66 65%, #09103b 100%);
    border: 1.5px solid #b8c4d4;
    color: #f2dc6b;
    font-size: 11.5px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.85), inset 0 1px 1px rgba(255,255,255,0.25);
    text-shadow: 0 1px 2px #000;
    z-index: 6;
    font-family: Tahoma, sans-serif;
  }

  .am-card-art-box {
    flex: 1;
    margin: 3px 0 2px 0;
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.85);
    min-height: 54px;
  }

  .am-card-illustration {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }

  .am-card-illustration svg.am-svg-art {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.22s ease;
  }

  .am-card:hover .am-card-illustration svg.am-svg-art {
    transform: scale(1.05);
  }

  .am-card-illustration img.am-custom-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .am-art-badges {
    position: absolute;
    top: 3px;
    left: 3px;
    display: flex;
    gap: 3px;
    z-index: 3;
  }

  .am-mini-badge {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(14, 12, 9, 0.84);
    border: 1px solid rgba(196, 168, 104, 0.45);
    color: #e6d6a8;
    font-family: Tahoma, sans-serif;
  }

  .am-ability-btn {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 8px);
    padding: 2px 4px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 3px;
    border: 1px solid #d9b86c;
    background: linear-gradient(180deg, #523b16 0%, #2b1d08 100%);
    color: #f5e2a8;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.9);
    z-index: 5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .am-ability-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #73531f 0%, #3d2a0b 100%);
    border-color: #f5dc8c;
  }

  .am-ability-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    border-color: #555;
  }

  /* НИЖНЯЯ ПАНЕЛЬ КАРТЫ С УГЛОВЫМИ КРУЖКАМИ АТАКИ (СЛЕВА) И ЗДОРОВЬЯ (СПРАВА) КАК НА СКРИНЕ 2 */
  .am-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 20px;
    z-index: 5;
    position: relative;
    margin-top: 1px;
  }

  .am-stat-pill {
    min-width: 24px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 900;
    text-shadow: 0 1px 2px #000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.85), inset 0 1px 1px rgba(255,255,255,0.2);
    font-family: Tahoma, sans-serif;
  }

  /* Тёмно-бордовый угловой кружок атаки (слева внизу, как в оригинале) */
  .am-stat-atk {
    background: radial-gradient(circle at 35% 35%, #7a261b 0%, #4a120b 70%, #290804 100%);
    border: 1.5px solid #b8b8b8;
    color: #f2dc6b;
    margin-left: -3px;
    margin-bottom: -3px;
  }

  /* Тёмно-зелёный угловой кружок здоровья (справа внизу, как в оригинале) */
  .am-stat-hp {
    background: radial-gradient(circle at 35% 35%, #2e7320 0%, #194710 70%, #0d2908 100%);
    border: 1.5px solid #b8b8b8;
    color: #f2dc6b;
    margin-right: -3px;
    margin-bottom: -3px;
  }

  .am-stat-hp.damaged {
    background: radial-gradient(circle at 35% 35%, #8f4b14 0%, #522806 70%, #2e1502 100%);
    border-color: #d4a868;
    color: #ffe49e;
  }

  .am-elem-crest-label {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #ccb992;
    opacity: 0.9;
  }

  .am-spell-banner {
    width: 100%;
    height: 19px;
    border-radius: 3px;
    background: rgba(15, 11, 8, 0.72);
    border: 1px solid rgba(196, 168, 108, 0.45);
    color: #e6d296;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  /* ==========================================================================
     КЛАССИЧЕСКОЕ ОПИСАНИЕ КАРТЫ ХРОНИКИ ЭТЕРИУМА
     Никакого неона, никаких смайликов/квадратиков:
     Слева — мини-карта с 3 угловыми кружками (стоимость, атака, здоровье),
     Справа — жёлтый подчёркнутый заголовок, жирная строка параметров и чистый текст
     ========================================================================== */
  .card-rollout-tooltip {
    position: fixed;
    width: 450px;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
  }

  .card-rollout-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .rollout-inner {
    background:
      radial-gradient(circle at 20% 30%, rgba(34, 58, 30, 0.45) 0%, transparent 60%),
      linear-gradient(180deg, #162617 0%, #0e1a0f 100%);
    border: 2px solid #6b7d5e;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.94), inset 0 0 0 1px rgba(190, 210, 175, 0.14);
    color: #dce3d5;
  }

  .classic-am-tooltip-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
  }

  /* Миниатюра карты слева с 3 угловыми кружками как на скриншоте 2 */
  .classic-am-thumb-wrap {
    position: relative;
    width: 78px;
    height: 92px;
    flex-shrink: 0;
    margin: 4px 6px 4px 4px;
  }

  .classic-am-thumb-box {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    border: 2px solid #aeb8c2;
    overflow: hidden;
    background: #142214;
    box-shadow: 0 3px 8px rgba(0,0,0,0.85), inset 0 0 8px rgba(0,0,0,0.75);
  }

  .classic-am-thumb-box svg,
  .classic-am-thumb-box img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
  }

  .classic-orb {
    position: absolute;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border-radius: 11px;
    border: 1.5px solid #b8c2cc;
    color: #f0da67;
    font-size: 11.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Tahoma, Arial, sans-serif;
    text-shadow: 0 1px 2px #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.85);
    z-index: 4;
  }

  .classic-orb-cost {
    top: -6px;
    right: -7px;
    background: radial-gradient(circle at 35% 35%, #263894 0%, #0e1854 75%, #070d33 100%);
  }

  .classic-orb-atk {
    bottom: -6px;
    left: -7px;
    background: radial-gradient(circle at 35% 35%, #6e2218 0%, #42100a 75%, #260703 100%);
  }

  .classic-orb-hp {
    bottom: -6px;
    right: -7px;
    background: radial-gradient(circle at 35% 35%, #2b6e1e 0%, #17420f 75%, #0c2607 100%);
  }

  .classic-am-text-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .classic-am-title {
    display: inline-block;
    align-self: flex-start;
    font-size: 16px;
    font-weight: 700;
    color: #e3cf65;
    padding-bottom: 2px;
    margin-bottom: 7px;
    border-bottom: 1px solid #8c8247;
    line-height: 1.2;
  }

  .classic-am-type-line {
    font-size: 13px;
    font-weight: 700;
    color: #edf2e8;
    margin-bottom: 6px;
    line-height: 1.25;
  }

  /* Ряд анимированных графических иконок характеристик (Стоимость, Атака, Здоровье) */
  .classic-am-anim-stats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .anim-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 5px;
    border-radius: 6px;
    background: rgba(10, 18, 11, 0.78);
    border: 1px solid rgba(168, 186, 154, 0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 5px rgba(0,0,0,0.5);
  }

  .anim-stat-svg-wrap {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .anim-stat-svg-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
  }

  .anim-stat-label {
    font-size: 11px;
    color: #b8c7b0;
    font-weight: 600;
  }

  .anim-stat-val {
    font-size: 13px;
    font-weight: 800;
    color: #f5df76;
    text-shadow: 0 1px 2px #000;
  }

  /* Ключевые кадры для анимированных картинок стоимости, атаки и здоровья */
  @keyframes manaOrbitSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  @keyframes manaCorePulse {
    0%, 100% { transform: scale(0.92); opacity: 0.85; }
    50% { transform: scale(1.12); opacity: 1; }
  }

  @keyframes swordSlashPulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    35% { transform: rotate(-8deg) scale(1.1); }
    70% { transform: rotate(5deg) scale(1.04); }
  }

  @keyframes swordGlintMove {
    0%, 100% { opacity: 0.25; transform: translateX(-3px); }
    50% { opacity: 1; transform: translateX(3px); }
  }

  @keyframes heartBeatAnim {
    0%, 100% { transform: scale(1); }
    20% { transform: scale(1.16); }
    40% { transform: scale(0.96); }
    60% { transform: scale(1.1); }
  }

  .svg-mana-ring {
    transform-origin: 12px 12px;
    animation: manaOrbitSpin 5.5s linear infinite;
  }

  .svg-mana-core {
    transform-origin: 12px 12px;
    animation: manaCorePulse 2s ease-in-out infinite;
  }

  .svg-atk-blades {
    transform-origin: 12px 12px;
    animation: swordSlashPulse 2.2s ease-in-out infinite;
  }

  .svg-atk-spark {
    transform-origin: 12px 12px;
    animation: swordGlintMove 1.8s ease-in-out infinite;
  }

  .svg-hp-heart {
    transform-origin: 12px 12px;
    animation: heartBeatAnim 1.7s ease-in-out infinite;
  }

  /* Большой блок под описание и способности — в том же стиле, что и блоки Стоимость / Атака / Здоровье */
  .classic-am-desc-block {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(10, 18, 11, 0.78);
    border: 1px solid rgba(168, 186, 154, 0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 5px rgba(0,0,0,0.5);
    font-size: 12.5px;
    line-height: 1.42;
    color: #d8e2d2;
  }

  .classic-am-desc-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .classic-am-desc-row + .classic-am-desc-row {
    padding-top: 6px;
    border-top: 1px solid rgba(168, 186, 154, 0.18);
  }

  .classic-am-desc-row p {
    margin: 0;
    flex: 1;
  }

  /* Универсальные контейнеры для встроенных SVG-картинок вместо текстовых символов */
  .ui-svg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
  }

  .ui-svg-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
  }

  .ui-svg-icon.lg { width: 28px; height: 28px; }
  .ui-svg-icon.xl { width: 38px; height: 38px; }
  .ui-svg-icon.sm { width: 13px; height: 13px; }
