html, body {
    margin: 0;
    padding: 0;
    background-color: #0B0B0D;
    color: #E6E1D3;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    /* Faint procedural noise overlay — kept low contrast for the dark forge feel. */
    background-image:
        radial-gradient(1200px 600px at 10% -10%, rgba(201, 162, 75, 0.08), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(109, 143, 176, 0.05), transparent 70%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.85 0 0 0 0 0.7 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-attachment: fixed;
}

a { color: #C9A24B; text-decoration: none; }
a:hover { color: #E6C878; text-decoration: underline; text-decoration-thickness: 1px; }

.l2-tabular { font-variant-numeric: tabular-nums; }

/* Soft top-border accent for hero/section panels. */
.l2-gold-top {
    box-shadow: inset 0 1px 0 0 rgba(201, 162, 75, 0.45);
}

/* Item slot framing — 40x40 tile housing the 32x32 PNG icon. */
.l2-item-slot {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0F0F12;
    border: 1px solid #2A2A30;
    box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.18);
    border-radius: 4px;
    flex-shrink: 0;
}
.l2-item-slot img { width: 32px; height: 32px; image-rendering: pixelated; image-rendering: crisp-edges; }

/* Sized variants — upscaled pixel-art stays crisp via the rule above. */
.l2-item-slot--md { width: 56px; height: 56px; border-radius: 6px; }
.l2-item-slot--md img { width: 48px; height: 48px; }

.l2-item-slot--lg {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.28), 0 4px 16px rgba(0, 0, 0, 0.55);
    position: relative;
}
.l2-item-slot--lg img { width: 64px; height: 64px; }

/* Decorative inventory-tile corners on the large slot — pure CSS, no assets. */
.l2-item-slot--lg::before,
.l2-item-slot--lg::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(201, 162, 75, 0.55);
    pointer-events: none;
}
.l2-item-slot--lg::before { top: 3px; left: 3px; border-right: 0; border-bottom: 0; }
.l2-item-slot--lg::after { bottom: 3px; right: 3px; border-left: 0; border-top: 0; }

/* Grade-tinted frames (palette per design.md). */
.l2-item-slot--grade-d { border-color: #6E6A60; box-shadow: inset 0 0 0 1px rgba(110, 106, 96, 0.35), 0 0 12px rgba(110, 106, 96, 0.18); }
.l2-item-slot--grade-c { border-color: #4A86C9; box-shadow: inset 0 0 0 1px rgba(74, 134, 201, 0.35), 0 0 14px rgba(74, 134, 201, 0.22); }
.l2-item-slot--grade-b { border-color: #4FAE6A; box-shadow: inset 0 0 0 1px rgba(79, 174, 106, 0.35), 0 0 14px rgba(79, 174, 106, 0.22); }
.l2-item-slot--grade-a { border-color: #C24A4A; box-shadow: inset 0 0 0 1px rgba(194, 74, 74, 0.4), 0 0 16px rgba(194, 74, 74, 0.28); }
.l2-item-slot--grade-s { border-color: #C9A24B; box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.55), 0 0 18px rgba(201, 162, 75, 0.35); }

/* Strengthen the large slot's grade glow further. */
.l2-item-slot--lg.l2-item-slot--grade-a { box-shadow: inset 0 0 0 1px rgba(194, 74, 74, 0.5), 0 0 22px rgba(194, 74, 74, 0.4), 0 4px 16px rgba(0, 0, 0, 0.55); }
.l2-item-slot--lg.l2-item-slot--grade-s { box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.65), 0 0 26px rgba(201, 162, 75, 0.5), 0 4px 16px rgba(0, 0, 0, 0.55); }

/* Card hover affordance per design.md */
.l2-card-hover {
    transition: background-color 160ms ease-out, box-shadow 160ms ease-out, transform 160ms ease-out;
}
.l2-card-hover:hover {
    background-color: #1A1A20;
    box-shadow: inset 3px 0 0 0 #C9A24B, 0 0 0 1px #2A2A30;
}

/* Hero gradient surface */
.l2-hero {
    background:
        radial-gradient(800px 400px at 8% 0%, rgba(201, 162, 75, 0.20), transparent 65%),
        radial-gradient(900px 500px at 100% 100%, rgba(109, 143, 176, 0.10), transparent 70%),
        linear-gradient(180deg, #14110B 0%, #0F0F12 100%);
    border: 1px solid #2A2A30;
    box-shadow: inset 0 1px 0 0 rgba(201, 162, 75, 0.55);
    border-radius: 8px;
}

/* Hero with AI-generated background art layered behind the gradient. */
.l2-hero-image {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(11, 11, 13, 0.92) 0%, rgba(11, 11, 13, 0.65) 45%, rgba(11, 11, 13, 0.35) 100%),
        linear-gradient(180deg, rgba(20, 17, 11, 0.55) 0%, rgba(15, 15, 18, 0.85) 100%),
        url("images/hero/forge-bg.jpg") center right / cover no-repeat,
        #0F0F12;
    box-shadow: inset 0 1px 0 0 rgba(201, 162, 75, 0.55);
}
.l2-hero-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px 320px at 8% 0%, rgba(201, 162, 75, 0.18), transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* Trust band — heraldic emblem tiles above the footer. */
.l2-trust-emblem {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(201, 162, 75, 0.35);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.18), 0 6px 20px rgba(0, 0, 0, 0.45);
    background: #0F0F12;
}

/* Empty-state illustration framing. */
.l2-empty-illustration {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 6px;
    border: 1px solid #2A2A30;
    box-shadow: inset 0 1px 0 0 rgba(201, 162, 75, 0.25);
    opacity: 0.85;
}

#blazor-error-ui {
    background: #B4413A;
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.6);
    display: none;
    left: 0;
    padding: 0.6rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Reconnect modal (dark fantasy theme) ─────────────────────────────── */
dialog#components-reconnect-modal {
    margin: auto;
    padding: 0;
    border: 1px solid rgba(201, 162, 75, 0.45);
    border-radius: 8px;
    background: linear-gradient(180deg, #14110B 0%, #0F0F12 100%);
    color: #E6E1D3;
    box-shadow:
        inset 0 1px 0 0 rgba(201, 162, 75, 0.55),
        0 20px 60px rgba(0, 0, 0, 0.75);
    max-width: 420px;
    width: calc(100% - 32px);
    font-family: 'Inter', system-ui, sans-serif;
}
dialog#components-reconnect-modal::backdrop {
    background: rgba(5, 5, 8, 0.78);
    backdrop-filter: blur(2px);
}
dialog#components-reconnect-modal .components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 28px;
    text-align: center;
}
dialog#components-reconnect-modal p {
    margin: 0;
    font-size: 0.95rem;
    color: #E6E1D3;
    letter-spacing: 0.01em;
}
dialog#components-reconnect-modal p.components-reconnect-repeated-attempt-visible,
dialog#components-reconnect-modal p.components-reconnect-failed-visible,
dialog#components-reconnect-modal p.components-resume-failed-visible {
    color: #9A9386;
    font-size: 0.85rem;
}
dialog#components-reconnect-modal #components-seconds-to-next-attempt {
    color: #C9A24B;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
dialog#components-reconnect-modal button {
    margin-top: 8px;
    padding: 8px 20px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #0B0B0D;
    background: linear-gradient(180deg, #D6B25A 0%, #C9A24B 100%);
    border: 1px solid rgba(201, 162, 75, 0.7);
    border-radius: 4px;
    cursor: pointer;
    transition: filter 160ms ease-out, transform 160ms ease-out;
}
dialog#components-reconnect-modal button:hover { filter: brightness(1.1); }
dialog#components-reconnect-modal button:active { transform: translateY(1px); }

/* Spinner — gold ring on charcoal */
dialog#components-reconnect-modal .components-rejoining-animation {
    position: relative;
    width: 56px;
    height: 56px;
}
dialog#components-reconnect-modal .components-rejoining-animation div {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #C9A24B;
    border-right-color: rgba(201, 162, 75, 0.35);
    animation: l2-reconnect-spin 1.1s linear infinite;
}
dialog#components-reconnect-modal .components-rejoining-animation div:nth-child(2) {
    inset: 8px;
    border-top-color: rgba(230, 200, 120, 0.55);
    border-right-color: transparent;
    animation-duration: 1.6s;
    animation-direction: reverse;
}
@keyframes l2-reconnect-spin {
    to { transform: rotate(360deg); }
}
