:root {
    --editor-topbar-h: 58px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body[data-page="editor"] {
    min-height: 100dvh;
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--color-ink-primary);
    background:
        radial-gradient(100% 120% at 12% 0%, rgba(124, 133, 255, 0.18), transparent 50%),
        radial-gradient(100% 120% at 100% 100%, rgba(167, 139, 250, 0.14), transparent 52%),
        #0d1322;
}

body[data-page="editor"] .editor-page-root {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

body[data-page="editor"] .editor-page-topbar {
    height: var(--editor-topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    background: rgba(10, 13, 22, 0.82);
}

body[data-page="editor"] .editor-page-topbar h1 {
    margin: 0;
    font-size: 0.96rem;
    font-family: var(--font-display);
    color: #f7efe2;
}

body[data-page="editor"] .editor-page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

body[data-page="editor"] .editor-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f7efe2;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.78rem;
}

body[data-page="editor"] .editor-page-link:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
}

body[data-page="editor"] .editor-page-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 9px;
    gap: 8px;
}

body[data-page="editor"] .editor-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(8, 12, 20, 0.72);
}

body[data-page="editor"] .editor-tabs .tab-btn {
    min-height: 32px;
    border-radius: 8px;
    font-size: 0.78rem;
    padding-inline: 0.85rem;
}

body[data-page="editor"] .editor-tab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(8, 12, 20, 0.54);
}

body[data-page="editor"] .tab-pane {
    min-height: 0;
    flex: 1;
}

body[data-page="editor"] .tab-pane.hidden {
    display: none !important;
}

body[data-page="editor"] #tab-cards.cards-editor-view {
    display: flex;
}

body[data-page="editor"] #tab-collections,
body[data-page="editor"] #tab-stats {
    padding: 16px;
    overflow-y: auto;
}

body[data-page="editor"] #tab-cards.cards-editor-view .browser-top {
    display: grid;
    gap: 10px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .browser-heading {
    display: grid;
    gap: 4px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .browser-set,
body[data-page="editor"] #tab-cards.cards-editor-view .browser-search,
body[data-page="editor"] #tab-cards.cards-editor-view .filter-group,
body[data-page="editor"] #tab-cards.cards-editor-view .preview-control {
    display: grid;
    gap: 6px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .browser-filters {
    display: grid;
    gap: 8px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .input-premium,
body[data-page="editor"] #tab-cards.cards-editor-view textarea,
body[data-page="editor"] #tab-cards.cards-editor-view select,
body[data-page="editor"] #tab-cards.cards-editor-view input[type="text"],
body[data-page="editor"] #tab-cards.cards-editor-view input[type="number"] {
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    padding: 8px 10px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .input-premium.is-readonly {
    opacity: 0.8;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    text-align: left;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-thumb {
    width: 44px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-name {
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--color-paper-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-meta,
body[data-page="editor"] #tab-cards.cards-editor-view .card-list-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.8);
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-list-meta span,
body[data-page="editor"] #tab-cards.cards-editor-view .card-list-stats span {
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.24);
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-preview-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-preview-thumb {
    width: 62px;
    height: 84px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    cursor: pointer;
    padding: 4px;
    background: rgba(255, 255, 255, 0.08);
    flex: 0 0 auto;
}

body[data-page="editor"] #tab-cards.cards-editor-view .card-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body[data-page="editor"] #tab-cards.cards-editor-view .placeholder-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 12px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .form-group {
    display: grid;
    gap: 6px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .form-group label {
    margin: 0;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-editor-grid {
    display: grid;
    gap: 8px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: contain;
    padding: 3px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-meta-text {
    display: grid;
    gap: 1px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-code {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.64);
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-inputs {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 10px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-number {
    text-align: center;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stat-value {
    justify-self: start;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: var(--font-numeric);
}

body[data-page="editor"] #tab-cards.cards-editor-view .ability-preview {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.24);
}

body[data-page="editor"] #tab-cards.cards-editor-view .ability-preview-title {
    font-weight: 700;
    color: #fff;
}

body[data-page="editor"] #tab-cards.cards-editor-view .ability-preview-meta,
body[data-page="editor"] #tab-cards.cards-editor-view .ability-preview-desc {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.82rem;
}

body[data-page="editor"] #tab-cards.cards-editor-view .image-editor {
    display: grid;
    gap: 10px;
}

body[data-page="editor"] #tab-cards.cards-editor-view .image-option.is-hidden {
    display: none;
}

body[data-page="editor"] #tab-cards.cards-editor-view .field-hint {
    margin: 0;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.64);
}

body[data-page="editor"] #tab-cards.cards-editor-view .editor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

body[data-page="editor"] #tab-cards.cards-editor-view .editor-actions.secondary {
    justify-content: space-between;
}

body[data-page="editor"] #tab-cards.cards-editor-view .editor-actions .spacer {
    flex: 1;
}

body[data-page="editor"] #tab-cards.cards-editor-view .btn-primary,
body[data-page="editor"] #tab-cards.cards-editor-view .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
}

body[data-page="editor"] #tab-cards.cards-editor-view .btn-primary {
    border-color: rgba(196, 163, 90, 0.7);
    background: linear-gradient(120deg, #7b2d26, #c08642);
    color: #fff;
}

body[data-page="editor"] #tab-cards.cards-editor-view .btn-secondary.btn-danger {
    border-color: rgba(220, 38, 38, 0.6);
    color: #fecaca;
}

body[data-page="editor"] #tab-cards.cards-editor-view .stats-preview-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

body[data-page="editor"] #tab-cards.cards-editor-view .stats-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 12px;
}

@media (max-width: 767px) {
    :root {
        --editor-topbar-h: 54px;
    }

    body[data-page="editor"] .editor-page-main {
        padding: 7px;
        gap: 7px;
    }

    body[data-page="editor"] .editor-tabs {
        padding: 5px;
        gap: 5px;
        overflow-x: auto;
    }

    body[data-page="editor"] .editor-tabs .tab-btn {
        min-height: 36px;
        min-width: 92px;
    }
}
