/*
 * Вёрстка карточки. Используется и в превью редактора, и на card/plain,
 * с которой снимается PNG, — поэтому никаких зависимостей от окружения страницы.
 * Базовый размер 744×1038 px; масштабирование делается transform: scale() снаружи.
 */

@font-face {
    font-family: 'SF Pro Display';
    src: url('/assets/fonts/SFProDisplay-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: block;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('/assets/fonts/SFProDisplay-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: block;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('/assets/fonts/SFProDisplay-Semibold.woff2') format('woff2');
    font-weight: 600;
    font-display: block;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('/assets/fonts/SFProDisplay-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: block;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('/assets/fonts/SFProDisplay-Heavy.woff2') format('woff2');
    font-weight: 800;
    font-display: block;
}

.card {
    --card-w: 744px;
    --card-h: 1038px;
    --ink: #000;
    --line: #b9b9b9;
    --frame-line: #6f6f6f;
    --art-line: #4a4a4a;
    --muted: #333;

    /* фоны приходят из Services\CardBackground через inline-стиль */
    --bg-outer: #fff;
    --bg-inner: transparent;

    width: var(--card-w);
    height: var(--card-h);
    box-sizing: border-box;
    padding: 12px;
    background: var(--bg-outer);
    border-radius: 30px;
    font-family: 'SF Pro Display', 'Liberation Sans', 'DejaVu Sans', sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

.card * {
    box-sizing: border-box;
}

/* тёмный фон под контентом — светлая типографика и линии */
.card--dark {
    --ink: #f7f7f7;
    --line: rgba(255, 255, 255, 0.42);
    --frame-line: rgba(255, 255, 255, 0.55);
    --art-line: rgba(255, 255, 255, 0.6);
    --muted: #d8d8d8;
}

.card__frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 20px 22px 12px;
    background: var(--bg-inner);
    border: 2px solid var(--frame-line);
    border-radius: 22px;
}

/* ── шапка ──────────────────────────────────────────────── */

.card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 62px;
    flex: 0 0 auto;
}

.card__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

.card__stage {
    flex: 0 0 auto;
}

.card__name {
    flex: 1 1 auto;
    margin: 0;
    font-size: 50px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card__name[data-len="15"],
.card__name[data-len="16"],
.card__name[data-len="17"] {
    font-size: 42px;
}

.card__name[data-len="18"],
.card__name[data-len="19"],
.card__name[data-len="20"],
.card__name[data-len="21"] {
    font-size: 36px;
}

.card__hp {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.card__hp-label {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.card__hp-value {
    font-size: 54px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
}

.card__hp-type {
    display: flex;
    margin-left: 2px;
}

/* ── иллюстрация ────────────────────────────────────────── */

.card__art {
    position: relative;
    flex: 0 0 auto;
    height: 415px;
    margin: 10px 0 0;
    border: 2px solid var(--art-line);
    overflow: hidden;
    background: #ededed;
}

.card__art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card__art-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #8a8a8a;
}

/* ── способность и атаки ────────────────────────────────── */

.card__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 0;
    padding: 14px 0 4px;
}

.card__block-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card__block-name {
    flex: 1 1 auto;
    margin: 0;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.card__ability-label {
    font-size: 16px;
    padding: 7px 14px;
}

.card__block--ability .card__block-name {
    font-size: 31px;
}

.card__cost {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
}

.card__damage {
    flex: 0 0 auto;
    font-size: 48px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -1px;
}

.card__block-text {
    margin: 8px 0 0;
    font-size: 17.5px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.1px;
    text-transform: uppercase;
}

.card__rule {
    width: 100%;
    height: 0;
    margin: 12px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

/* ── подвал ─────────────────────────────────────────────── */

.card__footer {
    flex: 0 0 auto;
}

.card__rule--footer {
    margin: 6px 0 10px;
}

.card__stats {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.card__stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 400;
}

.card__stat-label {
    color: var(--muted);
}

.card__stat-value {
    font-size: 19px;
    font-weight: 600;
}

.card__stat-sep {
    width: 1px;
    height: 26px;
    background: var(--line);
    transform: rotate(20deg);
}

.card__bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0 0;
}

.card__meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
}

.card__illus {
    font-size: 19px;
    font-weight: 700;
}

.card__ids {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card__rarity,
.card__set {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 2px solid var(--ink);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.card__rarity {
    border-radius: 4px;
}

.card__set {
    border-radius: 999px;
}

.card__number {
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.card__flavor {
    flex: 0 1 380px;
    margin: 0;
    padding: 14px 16px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.35;
    text-align: center;
}

.card__copyright {
    padding-top: 8px;
    font-size: 10px;
    font-weight: 400;
    text-align: center;
    color: var(--muted);
}

/* ── страница card/plain: только карточка, без обвязки ──── */

.plain,
.plain body {
    margin: 0;
    padding: 0;
    background: transparent;
}

.plain .card {
    border-radius: 0;
}