/* =========================================================
   FunCards Theme (global)
   - Colors, radii, shadows, typography tokens
   - Base font setup for the whole app
   ========================================================= */

:root {
    /* =========================
       Palette (fantasy)
       ========================= */
    --fc-bg-0: #07060b;
    --fc-bg-1: #141226;
    --fc-bg-2: #2b2540;

    --fc-panel: rgba(0, 0, 0, 0.38);
    --fc-panel-strong: rgba(0, 0, 0, 0.55);
    --fc-border: rgba(255, 255, 255, 0.14);

    --fc-text: #f5f5f5;
    --fc-text-dim: rgba(255, 255, 255, 0.72);

    --fc-gold-1: #ffe7a0;
    --fc-gold-2: #ffb94d;
    --fc-gold-3: #b3620c;

    --fc-danger: #ff6464;

    /* =========================
       Shape / shadow
       ========================= */
    --fc-radius-lg: 0.75rem;
    --fc-radius-md: 0.6rem;

    --fc-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.85);
    --fc-shadow-soft: 0 0.35rem 0.9rem rgba(0, 0, 0, 0.6);

    /* =========================
       Typography (single source of truth)
       ========================= */
    --fc-font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --fc-font-title: 'Cinzel', ui-serif, Georgia, serif;
    --fc-font-mono: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

    --fc-line-height: 1.35;
    --fc-letter-spacing: 0.01em;

    /* =========================
       Shared sizing tokens
       NOTE:
       - Used by DeckEditor/collection grids/etc
       - Game page overrides this variable locally
       ========================= */
    --card-width: clamp(5.5rem, 8vw, 8.5rem);

    /* Make Bootstrap inherit our font via CSS vars (works fine with var()) */
    --bs-body-font-family: var(--fc-font-ui);
}

/* =========================================================
   Base
   ========================================================= */

html, body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--fc-text);
    font-family: var(--fc-font-ui);
    line-height: var(--fc-line-height);
    letter-spacing: var(--fc-letter-spacing);

    background: radial-gradient(circle at top, var(--fc-bg-2) 0, var(--fc-bg-1) 55%, var(--fc-bg-0) 100%);

    /* Make small UI text a bit smoother */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure form controls inherit the app font */
button, input, select, textarea {
    font: inherit;
}

/* Numbers: stable width for HP/ATK/mana/counters */
.fc-num,
.stat,
.pile-count,
.card-tile-mana,
.deck-card-count-badge,
.fc-card-mana,
.fc-stat-corner {
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   Font utilities (use in markup anytime)
   Examples:
   <span class="fc-font-title">...</span>
   <span class="fc-font-ui">...</span>
   ========================================================= */
.fc-font-ui {
    font-family: var(--fc-font-ui);
}

.fc-font-title {
    font-family: var(--fc-font-title);
}

.fc-font-mono {
    font-family: var(--fc-font-mono);
}

/* =========================================================
   Headings / titles
   ========================================================= */
.fc-title {
    font-family: var(--fc-font-title);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 0 0 1rem 0;
    color: #fdf5d0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Muted text */
.fc-muted {
    color: var(--fc-text-dim);
}

/* =========================================================
   Panels
   ========================================================= */
.fc-panel {
    background: var(--fc-panel);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-lg);
    box-shadow: var(--fc-shadow-soft);
}

/* =========================================================
   Utilities
   ========================================================= */
.fc-clickable {
    cursor: pointer;
}

.fc-scroll {
    overflow: auto;
    scrollbar-gutter: stable;
}

/* =========================================================
   Badges
   ========================================================= */
.fc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;

    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;

    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.22);
    color: rgba(255, 255, 255, 0.92);
}

/* =========================================================
   Inputs
   ========================================================= */
.fc-input {
    background-color: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--fc-text);
}

.fc-input:focus {
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--fc-text);
}

/* =========================================================
   Buttons (single style system)
   ========================================================= */
.btn.fc-btn {
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0.25rem 0.8rem rgba(0, 0, 0, 0.35);
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn.fc-btn:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.45);
}

.btn.fc-btn:active:not(:disabled) {
    transform: translateY(1px);
    filter: brightness(1.02);
}

.btn.fc-btn:focus-visible {
    outline: none;
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(255, 231, 160, 0.55);
}

.btn.fc-btn:disabled {
    opacity: 0.55;
    filter: grayscale(0.15);
    cursor: default;
    box-shadow: none;
}

/* Primary */
.btn.fc-btn-primary {
    background: radial-gradient(circle at 30% 20%, var(--fc-gold-1) 0, var(--fc-gold-2) 45%, var(--fc-gold-3) 100%);
    color: #3b2200;
    font-weight: 800;
    border-color: rgba(255, 210, 120, 0.35);
}

/* Secondary */
.btn.fc-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 800;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0.25rem 0.8rem rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn.fc-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}

/* Danger */
.btn.fc-btn-danger {
    background: rgba(120, 0, 0, 0.70);
    border-color: rgba(255, 120, 120, 0.55);
    color: #fff;
    font-weight: 900;
}

/* End Turn */
.btn.fc-btn-endturn {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.92);
    font-weight: 900;
    border-color: rgba(255, 255, 255, 0.24);
}

.btn.fc-btn-endturn:not(:disabled) {
    background: radial-gradient(circle at 30% 20%, var(--fc-gold-1) 0, var(--fc-gold-2) 45%, var(--fc-gold-3) 100%);
    color: #2a1600;
    border-color: rgba(255, 215, 140, 0.60);
    box-shadow: 0 0.25rem 0.8rem rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(255, 231, 160, 0.22),
    0 0 18px rgba(255, 185, 77, 0.32);
}

.btn.fc-btn-endturn:not(:disabled):hover {
    filter: brightness(1.06);
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(255, 231, 160, 0.28),
    0 0 22px rgba(255, 185, 77, 0.40);
}

/* =========================================================
   Icon button
   ========================================================= */
.fc-icon-btn {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.18);

    background: rgba(0, 0, 0, 0.20);
    color: rgba(255, 255, 255, 0.92);

    transition: filter 120ms ease, transform 120ms ease, background 120ms ease;
}

.fc-icon-btn:hover {
    filter: brightness(1.06);
    background: rgba(255, 255, 255, 0.06);
}

.fc-icon-btn:active {
    transform: translateY(1px);
}

/* =========================================================
   Modal (generic)
   ========================================================= */
.fc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.1rem;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
}

.fc-modal-window {
    width: min(720px, 100%);
    max-height: min(84vh, 720px);
    overflow: auto;
    padding: 1rem;

    background: var(--fc-panel-strong);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-lg);
    box-shadow: var(--fc-shadow);
}
