/* =========================================================
   DayZ Survival Codex & Field Terminal — Tactical Dark Theme
   Inspired by Satisfactory and Palworld Codex interfaces
   ========================================================= */

:root {
    /* Tactical Apocalypse Palette */
    --dz-bg-0: #06090b;
    --dz-bg-1: #0c1014;
    --dz-bg-2: #12181f;
    --dz-bg-3: #182129;
    --dz-bg-panel: rgba(16, 23, 30, 0.92);
    --dz-bg-card: linear-gradient(165deg, rgba(24, 34, 44, 0.95) 0%, rgba(12, 17, 22, 0.98) 100%);
    --dz-bg-surface: #141c24;

    --dz-red: #e63946;
    --dz-red-hot: #ff4d5a;
    --dz-red-dark: #9e1f29;
    --dz-red-glow: rgba(230, 57, 70, 0.45);
    --dz-red-soft: rgba(230, 57, 70, 0.12);

    --dz-amber: #f59e0b;
    --dz-amber-glow: rgba(245, 158, 11, 0.35);
    --dz-amber-soft: rgba(245, 158, 11, 0.12);

    --dz-green: #10b981;
    --dz-green-glow: rgba(16, 185, 129, 0.35);

    --dz-blue: #38bdf8;
    --dz-blue-glow: rgba(56, 189, 248, 0.35);

    --dz-text: #f1f5f9;
    --dz-text-muted: #94a3b8;
    --dz-text-dim: #64748b;

    --dz-border: rgba(255, 255, 255, 0.08);
    --dz-border-strong: rgba(230, 57, 70, 0.4);
    --dz-border-amber: rgba(245, 158, 11, 0.35);

    --dz-radius: 8px;
    --dz-radius-lg: 14px;
    --dz-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
    --dz-transition: 0.22s cubic-bezier(0.22, 1, 0.36, 1);

    --dz-font-display: "Share Tech Mono", "Inter", -apple-system, sans-serif;
    --dz-font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --dz-font-mono: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;

    --dz-max: 1280px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
}

body.dz-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    font-family: var(--dz-font-ui);
    color: var(--dz-text);
    background: var(--dz-bg-0);
    line-height: 1.55;
    overflow-x: hidden;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
}

.dz-body > * {
    min-width: 0;
    max-width: 100%;
}

/* Force dark form controls */
select,
input,
textarea,
option {
    color-scheme: dark;
    background-color: var(--dz-bg-surface);
    color: var(--dz-text);
}

/* ----- Atmospheric Layers (Satisfactory / Palworld style) ----- */
.dz-atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.dz-grid-radar {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.75;
}

.dz-glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.28;
    pointer-events: none;
}

.dz-glow-orb--a {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, var(--dz-red) 0%, transparent 70%);
    top: -120px;
    right: -100px;
}

.dz-glow-orb--b {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--dz-amber) 0%, transparent 70%);
    top: 45%;
    left: -150px;
}

.dz-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 35%, rgba(6, 9, 11, 0.88) 100%);
}

.dz-scanlines {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 24, 30, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
    background-size: 100% 4px;
    opacity: 0.35;
}

/* ----- Main Container ----- */
.dz-main {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--dz-max);
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

@media (min-width: 768px) {
    .dz-main {
        padding: 2rem 1.5rem 5rem;
    }
}

/* ----- Hero Section ----- */
.dz-hero {
    position: relative;
    background: var(--dz-bg-panel);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius-lg);
    box-shadow: var(--dz-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.dz-hazard-stripe {
    height: 4px;
    width: 100%;
    background: repeating-linear-gradient(
            -45deg,
            var(--dz-red),
            var(--dz-red) 12px,
            #11161a 12px,
            #11161a 24px
    );
}

.dz-hero-inner {
    padding: 1.75rem 1.25rem 1.5rem;
}

@media (min-width: 768px) {
    .dz-hero-inner {
        padding: 2.25rem 2rem 2rem;
    }
}

.dz-hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .dz-hero-brand {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }
}

.dz-mark {
    width: 76px;
    height: 76px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px var(--dz-red-glow));
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .dz-mark {
        width: 88px;
        height: 88px;
    }
}

.dz-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-family: var(--dz-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dz-amber);
    margin: 0 0 0.4rem;
}

.dz-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dz-red);
    box-shadow: 0 0 10px var(--dz-red);
    animation: dz-pulsing 2s infinite;
}

@keyframes dz-pulsing {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.85);
    }
}

.dz-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0 0 0.5rem;
    line-height: 1.15;
}

@media (min-width: 768px) {
    .dz-title {
        font-size: 2.5rem;
    }
}

.dz-lede {
    font-size: 0.95rem;
    color: var(--dz-text-muted);
    max-width: 720px;
    margin: 0;
    line-height: 1.6;
}

.dz-hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--dz-border);
}

@media (min-width: 640px) {
    .dz-hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .dz-hero-stats {
        grid-template-columns: repeat(5, 1fr);
    }
}

.dz-stat-card {
    background: rgba(12, 17, 22, 0.7);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    transition: var(--dz-transition);
}

.dz-stat-card:hover {
    border-color: var(--dz-border-strong);
    background: rgba(24, 32, 40, 0.8);
}

.dz-stat-val {
    font-family: var(--dz-font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.dz-stat-lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dz-text-dim);
}

/* ----- Global Mode Navigation Tabs (Satisfactory / Palworld Style) ----- */
.dz-mode-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    scrollbar-width: thin;
}

.dz-mode-nav::-webkit-scrollbar {
    height: 4px;
}

.dz-mode-nav::-webkit-scrollbar-thumb {
    background: var(--dz-border);
    border-radius: 2px;
}

.dz-mode-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    background: var(--dz-bg-panel);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius);
    color: var(--dz-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--dz-transition);
}

.dz-mode-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(26, 36, 46, 0.85);
    transform: translateY(-1px);
}

.dz-mode-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.25) 0%, rgba(18, 24, 30, 0.95) 100%);
    border-color: var(--dz-red);
    box-shadow: 0 0 16px var(--dz-red-soft);
}

.dz-mode-icon {
    font-size: 1.1rem;
}

/* ----- Controls & Search Bar ----- */
.dz-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .dz-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.dz-search-wrap {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.dz-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dz-text-dim);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.dz-search {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 2.75rem;
    background: var(--dz-bg-panel);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius);
    color: #fff;
    font-size: 0.9rem;
    transition: var(--dz-transition);
}

.dz-search:focus {
    outline: none;
    border-color: var(--dz-red);
    box-shadow: 0 0 12px var(--dz-red-soft);
}

.dz-search-wrap kbd {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.15rem 0.45rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--dz-border);
    border-radius: 4px;
    font-family: var(--dz-font-mono);
    font-size: 0.7rem;
    color: var(--dz-text-muted);
}

.dz-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dz-filter-pill {
    background: var(--dz-bg-panel);
    border: 1px solid var(--dz-border);
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--dz-text-muted);
    cursor: pointer;
    transition: var(--dz-transition);
}

.dz-filter-pill:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.dz-filter-pill.is-active {
    background: var(--dz-red);
    border-color: var(--dz-red-hot);
    color: #fff;
    box-shadow: 0 0 12px var(--dz-red-soft);
}

/* ----- Cards Grid ----- */
.dz-card-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .dz-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dz-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .dz-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.dz-card {
    background: var(--dz-bg-card);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    transition: var(--dz-transition);
    position: relative;
    overflow: hidden;
}

.dz-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--dz-red), transparent);
    opacity: 0;
    transition: var(--dz-transition);
}

.dz-card:hover {
    transform: translateY(-3px);
    border-color: var(--dz-border-strong);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.dz-card:hover::before {
    opacity: 1;
}

/* Image Thumb Box */
.dz-thumb-box {
    width: 100%;
    height: 120px;
    background: radial-gradient(circle, rgba(30, 42, 54, 0.5) 0%, rgba(10, 14, 18, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--dz-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
}

.dz-thumb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    transition: transform 0.25s ease;
}

.dz-card:hover .dz-thumb-img {
    transform: scale(1.06);
}

.dz-box-badge {
    position: absolute;
    bottom: 0.4rem;
    right: 0.4rem;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(10, 15, 20, 0.85);
    border: 1px solid var(--dz-border);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dz-box-badge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dz-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dz-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

.dz-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    font-family: var(--dz-font-mono);
    text-transform: uppercase;
    font-weight: 600;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--dz-border);
    color: var(--dz-text-muted);
}

.dz-badge--red {
    background: var(--dz-red-soft);
    border-color: var(--dz-red);
    color: var(--dz-red-hot);
}

.dz-badge--amber {
    background: var(--dz-amber-soft);
    border-color: var(--dz-amber);
    color: var(--dz-amber);
}

.dz-badge--green {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--dz-green);
    color: var(--dz-green);
}

/* Stat Meters */
.dz-meter-group {
    margin: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dz-meter-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dz-meter-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--dz-text-muted);
}

.dz-meter-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.dz-meter-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--dz-red);
}

.dz-meter-fill--amber {
    background: var(--dz-amber);
}

.dz-meter-fill--blue {
    background: var(--dz-blue);
}

/* Tag Pills (Weapons) */
.dz-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--dz-border);
}

.dz-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--dz-border);
    border-radius: 3px;
    color: var(--dz-text-muted);
}

/* ----- Detail Modal (Satisfactory Item Drawer Style) ----- */
.dz-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 9, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.dz-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.dz-modal {
    background: var(--dz-bg-panel);
    border: 1px solid var(--dz-border-strong);
    border-radius: var(--dz-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.dz-modal-backdrop.is-open .dz-modal {
    transform: scale(1);
}

.dz-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dz-border);
    color: var(--dz-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--dz-transition);
}

.dz-modal-close:hover {
    background: var(--dz-red);
    color: #fff;
}

/* Quick Tools Grid on Landing Page */
.dz-hub-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin-top: 2rem;
}

@media (min-width: 640px) {
    .dz-hub-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dz-hub-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.dz-hub-card {
    background: var(--dz-bg-card);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius-lg);
    padding: 1.75rem 1.5rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: var(--dz-transition);
}

.dz-hub-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--dz-red), transparent);
    opacity: 0;
    transition: var(--dz-transition);
}

.dz-hub-card:hover {
    transform: translateY(-4px);
    border-color: var(--dz-border-strong);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.dz-hub-card:hover::before {
    opacity: 1;
}

.dz-hub-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(230, 57, 70, 0.12);
    border: 1px solid rgba(230, 57, 70, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
    transition: var(--dz-transition);
}

.dz-hub-card:hover .dz-hub-icon-wrap {
    background: var(--dz-red);
    box-shadow: 0 0 18px var(--dz-red-glow);
    transform: scale(1.08);
}

.dz-hub-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
}

.dz-hub-desc {
    font-size: 0.875rem;
    color: var(--dz-text-muted);
    line-height: 1.55;
    margin: 0 0 1.25rem;
}

.dz-hub-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dz-amber);
    margin-top: auto;
}

.dz-hub-card:hover .dz-hub-action {
    color: #fff;
}
