@import url("../../common/src/fonts/macondo/macondo.css");
@import url("../../common/src/fonts/skranji/skranji.css");

:root {
    color-scheme: dark;
    font-family: Arial, Helvetica, sans-serif;
    background: #15171d;
    color: #f1f4f8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #15171d;
}

button,
select {
    font: inherit;
}

button {
    background: #2f6fed;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    min-height: 36px;
    padding: 0 14px;
}

select {
    background: #151922;
    border: 1px solid #3a4252;
    border-radius: 6px;
    color: #f1f4f8;
    min-height: 36px;
    padding: 7px 9px;
}

.top-nav {
    align-items: center;
    background: #20242d;
    border-bottom: 1px solid #343b49;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 0 18px;
}

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

.nav-links a {
    border-radius: 6px;
    color: #f1f4f8;
    padding: 8px 10px;
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    background: #303746;
}

.status-text {
    color: #b9c2d3;
    font-size: 13px;
}

main {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.print-controls {
    align-items: end;
    background: #20242d;
    border: 1px solid #343b49;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    padding: 14px;
}

label {
    display: grid;
    gap: 5px;
}

label span {
    color: #b9c2d3;
    font-size: 12px;
}

.deck-count-chip {
    background: #151922;
    border: 1px solid #343b49;
    border-radius: 999px;
    color: #dce5f4;
    font-size: 13px;
    font-weight: 700;
    min-height: 36px;
    padding: 9px 12px;
}

.print-pages {
    display: grid;
    gap: 18px;
}

.print-page {
    background: #f8fafc;
    border: 1px solid #343b49;
    display: grid;
    gap: 0.12in;
    grid-template-columns: repeat(3, 2.5in);
    grid-template-rows: repeat(3, 3.5in);
    justify-content: center;
    margin: 0 auto;
    padding: 0.25in;
    width: 8.5in;
}

.print-card-slot {
    break-inside: avoid;
    height: 3.5in;
    page-break-inside: avoid;
    width: 2.5in;
}

.card-preview {
    --card-text-color: #101820;
    --card-primary-color: #e8edf6;
    --card-secondary-color: #d9e2ee;
    --card-tertiary-color: #aeb8c8;
    --card-shell-fill: var(--card-primary-color);
    --card-primary-fill: var(--card-primary-color);
    --card-frame-fill: var(--card-secondary-color);
    --card-rail-fill: var(--card-frame-fill);
    --card-icon-color: #68758a;
    --card-rail-width: 0.31in;
    --card-header-height: 0.28in;
    --card-footer-height: 0.22in;
    aspect-ratio: 2.5 / 3.5;
    background: var(--card-shell-fill);
    border: 1px solid #7f8da3;
    border-radius: 0.07in;
    color: var(--card-text-color);
    display: grid;
    font-family: "Macondo", Georgia, serif;
    grid-template-columns: var(--card-rail-width) minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
    position: relative;
    width: 100%;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.download-card-preview {
    height: 3.5in;
    left: -10000px;
    position: fixed;
    top: 0;
    width: 2.5in;
}

.technique-plates {
    display: none;
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 2;
}

.card-preview.supertype-technique .technique-plates {
    display: block;
}

.technique-plate {
    fill: currentColor;
    height: 0.86in;
    position: absolute;
    width: 0.86in;
}

.technique-plate.top-left {
    color: var(--card-technique-corner-top-left, var(--card-tertiary-color));
    left: -0.08in;
    top: -0.08in;
}

.technique-plate.top-right {
    color: var(--card-technique-corner-top-right, var(--card-tertiary-color));
    right: -0.08in;
    top: -0.08in;
    transform: scaleX(-1);
}

.technique-plate.bottom-left {
    bottom: -0.08in;
    color: var(--card-technique-corner-bottom-left, var(--card-tertiary-color));
    left: -0.08in;
    transform: scaleY(-1);
}

.technique-plate.bottom-right {
    bottom: -0.08in;
    color: var(--card-technique-corner-bottom-right, var(--card-tertiary-color));
    right: -0.08in;
    transform: scale(-1);
}

.card-preview > :not(.technique-plates) {
    position: relative;
}

.card-preview.supertype-technique .preview-costs,
.card-preview.supertype-technique .preview-rail-stats,
.card-preview.supertype-technique .preview-title,
.card-preview.supertype-technique .preview-speed,
.card-preview.supertype-technique .preview-ability,
.card-preview.supertype-technique .preview-elements .symbol-dot {
    position: relative;
    z-index: 3;
}

.preview-left-rail {
    background: var(--card-rail-fill);
    border-right: 1px solid #aeb8c8;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-width: 0;
    padding: 0.05in 0.04in 0.06in;
}

.preview-card-face {
    display: grid;
    grid-template-rows: auto auto 1.27in minmax(0, 1fr) var(--card-footer-height);
    min-height: 0;
    min-width: 0;
}

.preview-header {
    align-items: center;
    background: var(--card-frame-fill);
    border-bottom: 1px solid #aeb8c8;
    display: grid;
    gap: 0.05in;
    grid-template-columns: minmax(0, 1fr) 0.25in;
    min-height: var(--card-header-height);
    padding: 0.04in 0.06in;
}

.preview-title {
    font-size: 0.14in;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-speed {
    align-items: center;
    color: var(--card-text-color);
    display: grid;
    font-family: "Skranji", Georgia, serif;
    font-weight: 800;
    height: 0.23in;
    justify-content: center;
    justify-items: center;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    width: 0.23in;
}

.preview-speed.visible {
    opacity: 1;
    visibility: visible;
}

.preview-type-line {
    background: var(--card-primary-fill);
    border-bottom: 1px solid #c1cad8;
    font-size: var(--preview-type-font-size, 0.105in);
    font-weight: 700;
    line-height: 1.1;
    overflow: hidden;
    padding: 0.03in 0.32in 0.03in 0.06in;
    text-align: center;
    white-space: nowrap;
}

.preview-art {
    align-items: center;
    background: #fbfcfe;
    border-bottom: 1px solid #c1cad8;
    display: flex;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

.preview-art canvas {
    display: block;
    height: 100%;
    image-rendering: pixelated;
    object-fit: fill;
    width: 100%;
}

.preview-costs,
.preview-elements {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.04in;
    min-height: 0.22in;
}

.preview-costs {
    align-content: start;
    flex-direction: column;
    flex-wrap: nowrap;
}

.preview-elements {
    background: var(--card-frame-fill);
    border-top: 1px solid #aeb8c8;
    justify-content: center;
    overflow: hidden;
    padding: 0.03in 0.05in;
}

.preview-cost-entry {
    align-items: center;
    display: grid;
    gap: 0.02in;
    justify-items: center;
}

.preview-cost-value {
    font-family: "Skranji", Georgia, serif;
    font-size: 0.095in;
    font-weight: 800;
    line-height: 1;
}

.symbol-dot {
    align-items: center;
    background: #151922;
    border-radius: 50%;
    color: #f1f4f8;
    display: inline-flex;
    font-size: 0.1in;
    font-weight: 700;
    height: 0.2in;
    justify-content: center;
    width: 0.2in;
}

.symbol-dot img {
    display: block;
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.preview-elements .symbol-dot {
    height: 0.16in;
    width: 0.16in;
}

.preview-rail-stats {
    display: grid;
    gap: 0.035in;
    justify-items: center;
}

.rail-stat {
    align-items: center;
    display: grid;
    height: 0.22in;
    justify-content: center;
    justify-items: center;
    width: 0.22in;
}

.rail-stat-value {
    align-items: center;
    display: flex;
    font-family: "Skranji", Georgia, serif;
    font-size: 0.18in;
    font-weight: 800;
    grid-area: 1 / 1;
    height: 0.22in;
    justify-content: center;
    line-height: 1;
    text-align: center;
    width: 0.22in;
    z-index: 1;
}

.preview-stat-icon,
.rail-stat-icon {
    background: var(--card-icon-color);
    display: block;
    grid-area: 1 / 1;
    height: 0.22in;
    mask: var(--stat-icon-url) center / contain no-repeat;
    opacity: 0.55;
    -webkit-mask: var(--stat-icon-url) center / contain no-repeat;
    width: 0.22in;
}

.speed-icon {
    height: 0.23in;
    transform: rotate(30deg);
    width: 0.23in;
}

.preview-speed-value {
    align-items: center;
    display: flex;
    font-size: 0.18in;
    grid-area: 1 / 1;
    height: 0.22in;
    justify-content: center;
    line-height: 1;
    text-align: center;
    width: 0.22in;
    z-index: 1;
}

.preview-body {
    background: var(--card-primary-fill);
    display: flex;
    flex-direction: column;
    gap: var(--preview-rules-gap, 0.045in);
    min-height: 0;
    overflow: hidden;
    padding: var(--preview-rules-padding, 0.055in) 0.065in;
}

.preview-ability {
    border-bottom: 1px solid #c6cfdd;
    padding-bottom: var(--preview-rules-padding, 0.045in);
}

.preview-ability.charge-ability {
    transform: rotate(180deg);
}

.preview-ability.first-charge-ability {
    margin-top: auto;
}

.preview-ability-text {
    font-family: "Skranji", Georgia, serif;
    font-size: var(--preview-rules-font-size, 0.096in);
    line-height: var(--preview-rules-line-height, 1.15);
    white-space: pre-line;
}

.preview-ability-inline-title,
.preview-ability-section-title {
    font-weight: 700;
}

.preview-ability-inline-title::after {
    content: ": ";
}

.inline-token-icon {
    display: inline-block;
    height: 1.15em;
    margin: 0 0.08em;
    object-fit: contain;
    vertical-align: -0.2em;
    width: 1.15em;
}

.drain-token-icon {
    background: currentColor;
    mask: var(--inline-icon-url) center / contain no-repeat;
    -webkit-mask: var(--inline-icon-url) center / contain no-repeat;
}

@page {
    size: letter portrait;
    margin: 0.25in;
}

@media print {
    *,
    *::before,
    *::after {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    :root {
        color-scheme: light;
        background: #fff;
    }

    html,
    body {
        background: #fff;
        margin: 0;
        min-height: 0;
    }

    body > :not(main),
    .print-controls {
        display: none !important;
    }

    main {
        display: block;
        padding: 0;
    }

    .print-pages {
        display: block;
    }

    .print-page {
        background: #fff;
        border: 0;
        break-after: page;
        display: grid;
        gap: 0;
        grid-template-columns: repeat(3, 2.5in);
        grid-template-rows: repeat(3, 3.5in);
        height: 10.5in;
        justify-content: center;
        margin: 0;
        page-break-after: always;
        padding: 0;
        width: 8in;
    }

    .print-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .print-card-slot,
    .card-preview {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

@media (max-width: 720px) {
    .print-controls {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 460px) {
    .print-controls {
        grid-template-columns: 1fr;
    }
}
