/* =========================================================
   BattleNest UI – Design System
   Dark Gaming Interface · Pure CSS3 · Flexbox + Grid
   ========================================================= */

/* ---------- 1. Variablen & Reset ---------- */
:root {
    --bg: #121214;
    --bg-alt: #1a1b1e;
    --surface: #1e1f23;
    --surface-2: #26272c;
    --surface-3: #303138;
    --border: #2d2e34;
    --border-strong: #3a3b43;

    --text: #ececef;
    --text-muted: #9b9da6;
    --text-dim: #6c6e76;

    --gold: #f0b93b;
    --gold-bright: #ffd45e;
    --gold-dark: #8a6620;

    --hp: #e5484d;
    --hp-bright: #ff6166;
    --mana: #4da3ff;
    --mana-bright: #74bdff;
    --success: #46a758;
    --danger: #e5484d;

    --rarity-common: #9aa0a8;
    --rarity-rare: #4da3ff;
    --rarity-epic: #b45cff;
    --rarity-legendary: #ff9d1f;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow: 0 6px 18px rgba(0, 0, 0, .5);
    --shadow-glow-gold: 0 0 18px rgba(240, 185, 59, .28);

    --transition: .18s ease;
    --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Consolas, Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-ui);
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(77, 163, 255, .06), transparent 60%),
        radial-gradient(900px 500px at 10% -10%, rgba(240, 185, 59, .05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--mana); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(240, 185, 59, .3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid var(--bg-alt); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- 2. Basis-Elemente & Typografie ---------- */
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); font-weight: 700; }
h1 { font-size: 1.5rem; letter-spacing: .2px; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { color: var(--text); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); font-size: .85rem; }
.mono { font-family: var(--font-mono); }

/* ---------- 3. Layout: Header, Nav, Container ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26, 27, 30, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--sp-4);
    height: 60px;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .4px;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), #c98a1a);
    color: #1a1304;
    font-size: 1.05rem;
    box-shadow: var(--shadow-glow-gold);
}

.nav-links { display: flex; gap: var(--sp-1); margin-left: var(--sp-2); }
.nav-links a {
    color: var(--text-muted);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-weight: 600;
    transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--gold); background: rgba(240, 185, 59, .1); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.currency {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-3);
    border: 1px solid rgba(240, 185, 59, .35);
    background: rgba(240, 185, 59, .08);
    color: var(--gold);
    border-radius: 20px;
    font-weight: 700;
    font-size: .92rem;
    white-space: nowrap;
}

.container { max-width: 1200px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-6); }
.section { margin-bottom: var(--sp-6); }
.section-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
}
.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-5);
}

.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
}

.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 4. Buttons & Formulare ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: .6rem 1.4rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), filter var(--transition);
    user-select: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--gold), #d39e26);
    color: #1a1304;
    box-shadow: 0 2px 10px rgba(240, 185, 59, .25);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--shadow-glow-gold); }

.btn-ghost {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger { background: linear-gradient(135deg, var(--hp), #b93a3e); color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--success), #3a8a4c); color: #fff; }

.btn-sm { padding: .35rem .9rem; font-size: .85rem; }
.btn-lg { padding: .8rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

label { display: block; color: var(--text-muted); font-size: .85rem; font-weight: 600; margin: var(--sp-3) 0 var(--sp-1); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: .6rem .8rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240, 185, 59, .15); }
textarea { resize: vertical; min-height: 120px; }

/* ---------- 5. Character Dashboard & Profil ---------- */
.avatar {
    position: relative;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    background: radial-gradient(circle at 30% 25%, #3a3c44, #202127);
    border: 3px solid var(--gold);
    overflow: hidden;
}
.profile-card {
    display: flex;
    gap: var(--sp-5);
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow);
}
.profile-card .avatar {
    position: relative;
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 3rem;
    background: radial-gradient(circle at 30% 25%, #3a3c44, #202127);
    border: 3px solid var(--gold);
    box-shadow: var(--shadow-glow-gold);
    overflow: hidden;
}
.profile-card .avatar::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px dashed rgba(240, 185, 59, .45);
}
.profile-info { flex: 1; min-width: 0; }
.profile-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-2);
}
.profile-head h1 { font-size: 1.45rem; margin-right: auto; }

.class-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: .18rem .7rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.class-krieger { color: var(--hp-bright); background: rgba(229, 72, 77, .14); border: 1px solid rgba(229, 72, 77, .4); }
.class-magier  { color: var(--mana-bright); background: rgba(77, 163, 255, .14); border: 1px solid rgba(77, 163, 255, .4); }
.class-schurke { color: #c79bff; background: rgba(180, 92, 255, .14); border: 1px solid rgba(180, 92, 255, .4); }

.class-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}
.class-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.class-option small { color: var(--text-dim); font-size: .78rem; line-height: 1.35; }
.class-option input { position: absolute; opacity: 0; pointer-events: none; }
.class-option:hover { border-color: var(--border-strong); }
.class-option:has(input:checked) {
    border-color: var(--gold);
    background: rgba(240, 185, 59, .06);
    box-shadow: 0 0 0 3px rgba(240, 185, 59, .12);
}

.level-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 var(--sp-2);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), #c98a1a);
    color: #1a1304;
    font-weight: 800;
    box-shadow: var(--shadow-glow-gold);
}

.xp-bar {
    height: 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}
.xp-fill {
    height: 100%;
    width: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, #c98a1a, var(--gold), var(--gold-bright));
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(240, 185, 59, .6);
    transition: width 1.1s cubic-bezier(.22, 1, .36, 1);
    animation: xpShine 2.5s linear infinite;
}
.xp-label {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--text-muted);
    margin-bottom: var(--sp-1);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}
.stat-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--sp-2) var(--sp-3);
    text-align: center;
}
.stat-chip .icon { font-size: 1.1rem; }
.stat-chip .value { font-size: 1.15rem; font-weight: 800; display: block; }
.stat-chip .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; color: var(--text-dim); }
.stat-chip.hp .value { color: var(--hp-bright); }
.stat-chip.mana .value { color: var(--mana-bright); }
.stat-chip.gold .value { color: var(--gold); }
.stat-chip.atk .value { color: var(--text); }
.stat-chip.def .value { color: var(--text); }
.stat-chip.crit .value { color: #ff9d9d; }

/* ---------- 6. Ausrüstungs-Slots & Tooltips ---------- */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--sp-3);
}
.slot {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
}
.slot:hover { transform: translateY(-3px); border-color: var(--gold); }
.slot .slot-icon { font-size: 2.1rem; filter: saturate(.7); opacity: .9; }
.slot .slot-label {
    position: absolute;
    bottom: -22px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: .72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .5px;
    pointer-events: none;
}
.slot.equipped { border-style: solid; }
.slot.rarity-rare     { border-color: var(--rarity-rare);     box-shadow: 0 0 14px rgba(77, 163, 255, .35); }
.slot.rarity-epic     { border-color: var(--rarity-epic);     box-shadow: 0 0 16px rgba(180, 92, 255, .4); }
.slot.rarity-legendary { border-color: var(--rarity-legendary); box-shadow: 0 0 20px rgba(255, 157, 31, .5); }

.tooltip {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 200px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: var(--sp-3);
    font-size: .82rem;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    z-index: 50;
}
.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--border-strong);
}
.slot:hover .tooltip,
.slot:focus .tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.tooltip h4 { font-size: .92rem; margin-bottom: var(--sp-1); }
.tooltip .tt-rarity { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; margin-bottom: var(--sp-2); }
.tooltip .tt-stat { display: flex; justify-content: space-between; gap: var(--sp-3); color: var(--text-muted); padding: .1rem 0; }
.tooltip .tt-stat b { color: var(--success); }
.tooltip.rarity-rare h4, .tooltip.rarity-rare .tt-rarity { color: var(--rarity-rare); }
.tooltip.rarity-epic h4, .tooltip.rarity-epic .tt-rarity { color: var(--rarity-epic); }
.tooltip.rarity-legendary h4, .tooltip.rarity-legendary .tt-rarity { color: var(--rarity-legendary); }

/* ---------- 7. Arena & Kampfoberfläche ---------- */
.duel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--sp-4);
    align-items: center;
}
.versus {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(180deg, var(--gold), #a3781a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(240, 185, 59, .35);
}

.fighter { text-align: center; }
.fighter .avatar {
    width: 88px;
    height: 88px;
    margin: 0 auto var(--sp-2);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2.6rem;
    background: radial-gradient(circle at 30% 25%, #3a3c44, #202127);
    border: 2px solid var(--border-strong);
}
.fighter .name { font-weight: 800; font-size: 1.05rem; }
.fighter .class-badge { margin-top: var(--sp-1); }

.bar {
    position: relative;
    height: 26px;
    margin-top: var(--sp-2);
    border-radius: 20px;
    background: #0d0d0f;
    border: 1px solid var(--border-strong);
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width .5s cubic-bezier(.22, 1, .36, 1);
    position: relative;
    overflow: hidden;
}
.bar-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 45%);
}
.hp-fill   { background: linear-gradient(90deg, #b93a3e, var(--hp), var(--hp-bright)); box-shadow: 0 0 14px rgba(229, 72, 77, .5); }
.mana-fill { background: linear-gradient(90deg, #2f7bd6, var(--mana), var(--mana-bright)); box-shadow: 0 0 14px rgba(77, 163, 255, .45); }
.bar-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: .82rem;
    font-weight: 800;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
    letter-spacing: .4px;
}

.arena-status {
    text-align: center;
    margin: var(--sp-4) 0;
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
    background: rgba(240, 185, 59, .08);
    border: 1px solid rgba(240, 185, 59, .3);
    color: var(--gold);
    font-weight: 700;
    letter-spacing: .5px;
}

.combat-log {
    margin-top: var(--sp-4);
    background: #0c0d0f;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-3);
    height: 260px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: .84rem;
    line-height: 1.7;
}
.combat-log::before {
    content: "// kampf-log";
    display: block;
    color: var(--text-dim);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: var(--sp-2);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border);
}
.log-line { color: var(--text-muted); }
.log-line .t { color: var(--text-dim); margin-right: var(--sp-1); }
.log-hit { color: var(--hp-bright); }
.log-crit { color: var(--gold-bright); font-weight: 700; }
.log-defend { color: var(--mana-bright); }
.log-heal { color: var(--success); }

.action-bar {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
    flex-wrap: wrap;
    justify-content: center;
}
.action-btn {
    flex: 1;
    min-width: 170px;
    padding: .9rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 800;
    font-size: .98rem;
    cursor: pointer;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.action-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
    transform: skewX(-20deg);
    transition: left .45s ease;
}
.action-btn:hover::before { left: 120%; }
.action-btn:hover { transform: translateY(-3px); }
.action-btn:active { transform: translateY(0) scale(.97); }
.action-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.action-btn.atk {
    background: linear-gradient(135deg, #c23a3e, var(--hp));
    box-shadow: 0 4px 16px rgba(229, 72, 77, .4);
}
.action-btn.atk:hover { box-shadow: 0 6px 22px rgba(229, 72, 77, .6); }
.action-btn.skill {
    background: linear-gradient(135deg, #2f7bd6, var(--mana));
    box-shadow: 0 4px 16px rgba(77, 163, 255, .4);
}
.action-btn.skill:hover { box-shadow: 0 6px 22px rgba(77, 163, 255, .6); }
.action-btn.defend {
    background: linear-gradient(135deg, #3a3c44, #555861);
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.action-btn.defend:hover { border-color: var(--mana); box-shadow: 0 6px 22px rgba(77, 163, 255, .35); }

/* Animierte Kampfarena (Live-Duell) */
.battle-arena {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--sp-4);
    align-items: center;
    margin-top: var(--sp-4);
    padding: var(--sp-5) var(--sp-4);
    min-height: 300px;
    background:
        radial-gradient(circle at 50% 130%, rgba(77, 163, 255, .10), transparent 62%),
        linear-gradient(180deg, var(--surface-2), var(--bg-alt));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    overflow: visible;
}
.battle-arena .fighter {
    position: relative;
    z-index: 2;
}
.battle-arena .sprite {
    width: 110px;
    height: 110px;
    margin: 0 auto var(--sp-2);
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 2.9rem;
    background: radial-gradient(circle at 30% 25%, #3a3c44, #202127);
    border: 2px solid var(--border-strong);
    box-shadow: var(--shadow);
    transition: filter .2s ease;
}
.battle-arena .fighter.p1 .sprite { border-color: rgba(255, 97, 102, .6); box-shadow: 0 0 20px rgba(229, 72, 77, .22); }
.battle-arena .fighter.p2 .sprite { border-color: rgba(116, 189, 255, .6); box-shadow: 0 0 20px rgba(77, 163, 255, .22); }

.battle-arena .fighter.attacking-p1 { animation: lungeRight .45s ease-in-out; }
.battle-arena .fighter.attacking-p2 { animation: lungeLeft .45s ease-in-out; }
@keyframes lungeRight {
    0%   { transform: translateX(0); }
    40%  { transform: translateX(64px); }
    100% { transform: translateX(0); }
}
@keyframes lungeLeft {
    0%   { transform: translateX(0); }
    40%  { transform: translateX(-64px); }
    100% { transform: translateX(0); }
}

.battle-arena .fighter.hit { animation: hitShake .35s ease; }
@keyframes hitShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-12px); }
    50% { transform: translateX(12px); }
    75% { transform: translateX(-7px); }
}

.battle-arena .fighter.critical .sprite {
    filter: brightness(1.6) drop-shadow(0 0 16px var(--gold-bright));
}

.damage-number {
    position: absolute;
    font-weight: 900;
    font-size: 1.6rem;
    color: var(--hp-bright);
    text-shadow: 0 2px 10px rgba(0, 0, 0, .65);
    pointer-events: none;
    z-index: 50;
    animation: floatUp .9s ease-out forwards;
}
.damage-number.crit {
    color: var(--gold-bright);
    font-size: 2.2rem;
    text-shadow: 0 0 16px rgba(255, 159, 29, .75);
}
@keyframes floatUp {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-64px) scale(1.4); }
}

#arena-damage-numbers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 40;
}
#arena-log {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 30;
}

/* ---------- 8. Item-Shop & Inventar ---------- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: var(--sp-4);
    align-items: start; /* Verhindert, dass Karten auf gleiche Höhe gezwungen werden */
}
.item-card {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    overflow: visible !important;
    height: auto !important;
    min-height: max-content;
}
.item-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--card-rarity, var(--rarity-common));
    box-shadow: 0 0 12px var(--card-rarity, var(--rarity-common));
}
.item-card:hover { transform: translateY(-4px); }

.item-card.rarity-common { border-color: #3a3c44; }
.item-card.rarity-rare {
    --card-rarity: var(--rarity-rare);
    border-color: var(--rarity-rare);
    box-shadow: 0 0 16px rgba(77, 163, 255, .25), var(--shadow);
}
.item-card.rarity-epic {
    --card-rarity: var(--rarity-epic);
    border-color: var(--rarity-epic);
    box-shadow: 0 0 20px rgba(180, 92, 255, .3), var(--shadow);
}
.item-card.rarity-legendary {
    --card-rarity: var(--rarity-legendary);
    border-color: var(--rarity-legendary);
    box-shadow: 0 0 26px rgba(255, 157, 31, .4), var(--shadow);
}

.shop-tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.shop-tab {
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.shop-tab:hover { color: var(--text); border-color: var(--border-strong); }
.shop-tab.active {
    background: linear-gradient(135deg, rgba(176, 92, 255, .25), rgba(77, 163, 255, .2));
    border-color: rgba(176, 92, 255, .5);
    color: #d9a7ff;
}

.item-rarity {
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--card-rarity, var(--rarity-common));
    margin-bottom: var(--sp-1);
}
.item-card h3 { font-size: 1.02rem; margin-bottom: var(--sp-1); }
.item-card h3 .rar {
    font-size: 1.25rem;
    background: linear-gradient(180deg, var(--card-rarity, var(--text)), var(--card-rarity, var(--text)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--card-rarity, var(--text));
}
.item-desc { color: var(--text-muted); font-size: .86rem; flex: 1; margin-bottom: var(--sp-3); }
.item-stats { margin-bottom: var(--sp-3); font-size: .88rem; }
.item-stats div { padding: .15rem 0; color: var(--text-muted); }
.item-stats b { color: var(--text); }
.item-stats b.plus-atk { color: var(--hp-bright); }
.item-stats b.plus-def { color: var(--mana-bright); }
.item-stats b.plus-hp { color: var(--success); }

/* Stellt sicher, dass kein übergeordneter Container die Karten anschneidet */
.panel,
.item-grid {
    overflow: visible !important;
}

.item-footer {
    display: flex;
    flex-direction: column; /* Stapelt Preis und Action-Bereich sauber untereinander */
    align-items: stretch;
    gap: var(--sp-2);
    margin-top: auto;
}

.footer-actions {
    display: flex;
    flex-direction: column !important; /* Formulare/Buttons untereinander */
    gap: 8px;
    width: 100%;
}

.footer-actions form,
.footer-actions .btn {
    width: 100% !important; /* Nutzt die volle Kartenbreite */
    box-sizing: border-box;
}

.footer-actions .btn {
    white-space: normal; /* Verhindert das Abschneiden von Button-Texten */
    word-break: break-word;
}
.price { color: var(--gold); font-weight: 800; font-size: .98rem; white-space: nowrap; min-width: 0; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: .25rem .7rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
}
.badge-owned { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-strong); }
.badge-equipped { background: rgba(70, 167, 88, .15); color: var(--success); border: 1px solid rgba(70, 167, 88, .45); }
.badge-empty { background: rgba(240, 185, 59, .12); color: var(--gold); border: 1px solid rgba(240, 185, 59, .45); }

/* ---------- 8b. Feedback, Formulare & Utilities ---------- */
.flash {
    padding: .8rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-4);
    border: 1px solid var(--border-strong);
    font-weight: 600;
    font-size: .92rem;
}
.flash.success { background: rgba(70, 167, 88, .12); border-color: rgba(70, 167, 88, .5); color: var(--success); }
.flash.error { background: rgba(229, 72, 77, .12); border-color: rgba(229, 72, 77, .5); color: var(--hp-bright); }
.flash.warning { background: rgba(240, 185, 59, .12); border-color: rgba(240, 185, 59, .5); color: var(--gold); }

.meta { color: var(--text-muted); font-size: .85rem; }
.stats { margin: var(--sp-2) 0; font-size: .88rem; }
.stats span, .stats div { display: block; padding: .1rem 0; color: var(--text-muted); }
.row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.center { text-align: center; padding: 3rem 1rem; }
.ok { color: var(--success); font-weight: 700; }
.err { color: var(--hp-bright); font-weight: 700; }
.stat-number { display: block; font-size: 1.7rem; font-weight: 800; color: var(--gold); }

.hero { text-align: center; padding: 3rem 1.5rem; }
.hero h1 { font-size: 1.9rem; margin-bottom: .6rem; }
.hero p { max-width: 640px; margin: 0 auto; color: var(--text-muted); }
.hero .btn { margin: var(--sp-2); }
.auth-panel { max-width: 480px; margin: 0 auto; }

.defend-badge { display: none; color: var(--mana-bright); font-size: .82rem; font-weight: 700; margin-top: var(--sp-1); }
.hp-fill.p2 { background: linear-gradient(90deg, #2f7bd6, var(--mana), var(--mana-bright)); box-shadow: 0 0 14px rgba(77, 163, 255, .5); }

.bonus-strip { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.bonus-strip .stat-chip { text-align: left; }

.quick-result { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.quick-result pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: .84rem; margin-top: var(--sp-3); color: var(--text-muted); max-height: 260px; overflow-y: auto; }

.share { text-align: center; margin-top: var(--sp-4); color: var(--text-muted); word-break: break-all; }
.share code { background: var(--surface-2); border: 1px solid var(--border); padding: .2rem .6rem; border-radius: var(--radius-sm); color: var(--gold); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: .78rem; letter-spacing: .6px; }
tr:hover td { background: rgba(255, 255, 255, .02); }

/* ---------- 8c. Footer ---------- */
.site-footer {
    margin-top: var(--sp-5);
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: var(--sp-4) var(--sp-4) var(--sp-5);
}
.footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
}
.footer-links { display: flex; gap: var(--sp-3); }
.footer-links a { color: var(--text-muted); font-size: .9rem; }
.footer-links a:hover { color: var(--gold); text-decoration: none; }
.footer-meta { color: var(--text-dim); font-size: .8rem; }

/* ---------- 8d. Rechtsseiten ---------- */
.legal-top { margin-bottom: var(--sp-4); }
.legal-top .section-title { margin-top: var(--sp-3); }
.legal-top p { margin-top: var(--sp-2); }
.panel h2 { color: var(--gold); font-size: 1.15rem; margin-top: var(--sp-5); border-bottom: 1px solid var(--border); padding-bottom: var(--sp-2); }
.panel h3 { color: var(--text); font-size: 1rem; margin-top: var(--sp-4); }
.panel ul { padding-left: 1.2rem; }
.panel li { margin-bottom: var(--sp-1); color: var(--text); }
.highlight-box {
    background: rgba(112, 0, 255, .12);
    border-left: 4px solid #8b5cf6;
    padding: var(--sp-3) var(--sp-4);
    margin: var(--sp-3) 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

/* ---------- 8e. Nest-Wall (Activity-Feed) ---------- */
.feed-list { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-4); }
.feed-post {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
}
.feed-head { display: flex; align-items: center; gap: var(--sp-3); }
.feed-head .avatar { flex-shrink: 0; }
.feed-author { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.feed-author strong { font-size: 1.05rem; }
.feed-date { margin-left: auto; white-space: nowrap; }
.feed-equip { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-3); }
.equip-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .15rem .5rem;
    font-size: .78rem;
    color: var(--text-muted);
}
.equip-unequip { display: inline; margin-left: var(--sp-1); }
.equip-unequip-btn {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 1;
    font-size: .7rem;
    padding: 0;
    cursor: pointer;
    vertical-align: middle;
    transition: color var(--transition), border-color var(--transition);
}
.equip-unequip-btn:hover { color: #ff6b6b; border-color: #ff6b6b; }
.feed-body { margin: var(--sp-3) 0 0; color: var(--text); }
.feed-actions { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.kind-badge {
    background: rgba(77, 163, 255, .14);
    color: var(--mana-bright);
    border: 1px solid rgba(77, 163, 255, .4);
    border-radius: var(--radius-sm);
    padding: .2rem .6rem;
    font-size: .78rem;
    font-weight: 700;
}
.vote-form { margin: 0; }
.vote-btn {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: .3rem .7rem;
    font-size: .85rem;
    cursor: pointer;
    font-weight: 700;
    transition: all .15s ease;
}
.vote-btn:hover { border-color: var(--gold); color: var(--gold); }
.vote-btn.active { background: rgba(240, 185, 59, .15); border-color: var(--gold); color: var(--gold); }
.feed-comments { border-top: 1px solid var(--border); margin-top: var(--sp-3); padding-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.comment { display: flex; align-items: flex-start; gap: var(--sp-2); background: var(--surface); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); }
.comment p { margin: .2rem 0 0; color: var(--text-muted); }
.comment-form { display: flex; gap: var(--sp-2); }
.comment-form input { margin: 0; flex: 1; }
.duel-pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: .84rem; margin-top: var(--sp-3); color: var(--text-muted); max-height: 260px; overflow-y: auto; }

/* Avatare: Bild füllt den runden Rahmen, kleine Varianten */
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { flex: 0 0 44px; width: 44px; height: 44px; font-size: 1.2rem; }
.avatar-xs { flex: 0 0 28px; width: 28px; height: 28px; font-size: .8rem; border-width: 2px; }
.user-link { color: var(--text); text-decoration: none; }
.user-link:hover { color: var(--gold); text-decoration: underline; }
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.role-admin { background: rgba(255, 90, 90, .18); color: #ff6b6b; border-color: rgba(255, 90, 90, .5); }
.role-mod { background: rgba(77, 163, 255, .14); color: var(--mana-bright); border-color: rgba(77, 163, 255, .4); }

/* ---------- 9. Dorf & Questgeber ---------- */
.hero-bar { display: flex; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.hero-portrait { width: 96px; height: 96px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface-2); object-fit: cover; flex: 0 0 auto; }
.hero-info { flex: 1 1 260px; min-width: 220px; }
.hero-info h3 { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.hero-mission { flex: 1 1 280px; min-width: 240px; }
.hero-mission .card { height: 100%; }

.badge-class { background: linear-gradient(135deg, rgba(176, 92, 255, .22), rgba(77, 163, 255, .2)); color: #d9a7ff; border: 1px solid rgba(176, 92, 255, .45); }

.village { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-4); }
.npc-card { margin: 0; }
.npc-head { display: flex; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-3); }
.npc-portrait { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface-2); object-fit: cover; flex: 0 0 auto; }
.npc-id h3 { margin-bottom: var(--sp-1); }
.npc-desc { margin-top: var(--sp-1); }

.npc-quests { display: flex; flex-direction: column; }
.quest-row { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: var(--sp-3); border-top: 1px solid var(--border); }
.npc-quests .quest-row:first-child { border-top: 0; }
.quest-row:hover { background: var(--surface-2); }
.quest-row-main { display: flex; flex-direction: column; gap: var(--sp-1); }
.quest-row-action { flex: 0 0 auto; }

.quest-fight { display: flex; gap: var(--sp-4); align-items: center; justify-content: space-between; margin-top: var(--sp-3); flex-wrap: wrap; }
.fight-side { flex: 1 1 200px; min-width: 0; }
.fight-side h3 { margin-bottom: var(--sp-2); }
.fight-vs { font-size: 1.4rem; font-weight: 800; color: var(--text-muted); flex: 0 0 auto; }

/* ---------- Quest-Arena (animierter Kampf) ---------- */
.arena { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-top: var(--sp-3); flex-wrap: wrap; }
.fighter { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); position: relative; }
.fighter .sprite { font-size: 4.5rem; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); transform-origin: center bottom; }
.fighter .sprite img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 2px solid var(--border-strong); background: var(--surface-2); }
.monster-sprite { animation: idle-bob 2.2s ease-in-out infinite; }
.fighter-name { font-weight: 700; color: var(--text); }
.arena-bar { width: 100%; }
.arena-vs { font-size: 1.6rem; font-weight: 900; color: var(--gold); align-self: center; }

.dmg-float {
    position: absolute; top: 10%; left: 50%; transform: translateX(-50%);
    font-weight: 900; font-size: 1.5rem; color: var(--hp-bright);
    text-shadow: 0 2px 6px rgba(0,0,0,.6); opacity: 0; pointer-events: none;
}
.dmg-float.show { animation: float-up .9s ease-out forwards; }

.battle-log {
    margin-top: var(--sp-3); max-height: 180px; overflow-y: auto;
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--sp-3); font-size: .9rem; display: flex; flex-direction: column; gap: .35rem;
}
.log-line { color: var(--text-muted); animation: log-in .25s ease-out; }
.log-line:last-child { color: var(--text); }

/* Animationen */
@keyframes idle-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -42px); } }
@keyframes log-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes attack-lunge-right { 0% { transform: translateX(0); } 40% { transform: translateX(46px) rotate(4deg); } 100% { transform: translateX(0); } }
@keyframes attack-lunge-left { 0% { transform: translateX(0); } 40% { transform: translateX(-46px) rotate(-4deg); } 100% { transform: translateX(0); } }
@keyframes hit-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

.fighter.attack-anim.hero { animation: attack-lunge-right .26s ease-in-out; }
.fighter.attack-anim.monster { animation: attack-lunge-left .26s ease-in-out; }
.fighter.defend-anim { animation: hit-shake .26s ease-in-out; }
.fighter.hit-anim .sprite, .fighter.hit-anim .sprite img { animation: hit-shake .35s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
    .monster-sprite, .dmg-float.show, .fighter.attack-anim, .fighter.hit-anim .sprite { animation: none !important; }
}

@media (max-width: 640px) {
    .hero-bar { flex-direction: column; align-items: center; text-align: center; }
    .hero-info h3 { justify-content: center; }
    .npc-head { flex-direction: column; text-align: center; }
    .quest-row { flex-direction: column; align-items: flex-start; }
}

/* ---------- 10. Animationen ---------- */
@keyframes xpShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .5s ease both; }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 980px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .equip-grid { grid-template-columns: repeat(3, 1fr); }
    .duel { grid-template-columns: 1fr; }
    .versus { text-align: center; font-size: 1.8rem; }
    .profile-card { flex-direction: column; text-align: center; }
    .profile-head { justify-content: center; }
    .profile-head h1 { margin-right: 0; }
    .stat-grid { margin-top: var(--sp-3); }
}

@media (max-width: 640px) {
    .nav { height: auto; min-height: 60px; flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
    .nav-links { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
    .nav-links a { flex: 1; text-align: center; font-size: .85rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .equip-grid { grid-template-columns: repeat(2, 1fr); }
    .panel { padding: var(--sp-4); }
    .action-btn { min-width: 100%; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .profile-card .avatar { flex-basis: 84px; width: 84px; height: 84px; font-size: 2.2rem; }
    .footer-inner { flex-direction: column; text-align: center; }
    .footer-brand .brand { justify-content: center; }
}

/* ---------- 11. Extras (Logout-Button, Honeypot) ---------- */
.logout-form { display: inline-flex; }
.hp-field { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; }