/* Page sheet for player.php. Linked after style.css by includes/css.php,
   so these rules win ties against the shared sheet. */

.char-wrap { animation: charIn 0.45s ease-out; }
@keyframes charIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero ────────────────────────────────────────── */
.char-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 28px;
    background: rgba(18, 18, 20, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px 34px;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(0,0,0,0.45);
}
.char-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.char-hero.is-evil::before {
    background: radial-gradient(ellipse at 0% 0%, rgba(154,35,35,0.18) 0%, transparent 55%);
}
.char-hero.is-good::before {
    background: radial-gradient(ellipse at 0% 0%, rgba(111,143,95,0.12) 0%, transparent 55%);
}
.char-hero > * { position: relative; z-index: 1; }

.char-emblem {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 35%, rgba(255,255,255,0.05), rgba(255,255,255,0.015) 70%);
    border: 1px solid var(--border-light);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 6px 18px rgba(0,0,0,0.35);
    overflow: hidden;
}
.char-emblem img { width: 58px; height: auto; }
.char-emblem .lvl-num {
    font-family: 'Beaulieux', sans-serif;
    font-size: 1.9rem;
    color: var(--text-main);
    line-height: 1;
}
.char-hero.is-evil .char-emblem {
    border-color: rgba(154,35,35,0.55);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 18px rgba(154,35,35,0.25);
}
.char-hero.is-good .char-emblem {
    border-color: rgba(111,143,95,0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 18px rgba(111,143,95,0.18);
}

.char-identity { min-width: 0; flex: 1; }
.char-hero-actions { margin-top: 14px; }
.pm-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold);
    border: 1px solid rgba(201,168,76,0.45);
    background: rgba(201,168,76,0.05);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.pm-hero-btn:hover {
    border-color: var(--gold);
    background: rgba(201,168,76,0.12);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(201,168,76,0.18);
}
.char-identity h2 {
    margin: 0 0 8px;
    font-size: clamp(1.55rem, 4vw, 2.3rem);
    line-height: 1.08;
    letter-spacing: 1px;
    word-break: break-word;
}
.char-sub {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0 0 14px;
    letter-spacing: 0.02em;
}

.char-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    color: var(--text-mid);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-online  { color: var(--sage); border-color: rgba(111,143,95,0.4);  background: rgba(111,143,95,0.08); }
.pill-offline { color: var(--text-dim); }
.pill-good    { color: var(--sage); border-color: rgba(111,143,95,0.35); background: rgba(111,143,95,0.06); }
.pill-evil    { color: var(--rust); border-color: rgba(154,35,35,0.45);  background: rgba(154,35,35,0.08); }
.pill-neutral { color: var(--text-mid); }

/* ── Guild box: guild name + in-guild rank, grouped so the
      rank clearly belongs to the guild. Sits right of the name. ── */
.guild-box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 200px;
    max-width: 250px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: linear-gradient(160deg, rgba(201,168,76,0.07), rgba(255,255,255,0.012));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    text-decoration: none;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.guild-box:hover {
    border-color: rgba(201,168,76,0.5);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0,0,0,0.4);
}
.guild-box-emblem {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Beaulieux', serif;
    font-size: 1.4rem;
    color: var(--gold);
    text-transform: uppercase;
    background: radial-gradient(circle at 50% 35%, rgba(201,168,76,0.20), rgba(201,168,76,0.04) 70%);
    border: 1px solid rgba(201,168,76,0.4);
}
.guild-box-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guild-box-label {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
}
.guild-box-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.guild-box-rank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-mid);
    margin-top: 1px;
}
.guild-box-rank .gr-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.guild-box.gr-1 .guild-box-rank { color: var(--gold); }
.guild-box.gr-2 .guild-box-rank { color: #b89346; }
.guild-box.gr-3 .guild-box-rank { color: #8aaa78; }
.guild-box.gr-4 .guild-box-rank { color: var(--text-mid); }
.guild-box.gr-5 .guild-box-rank { color: var(--text-dim); font-style: italic; }

/* ── Section heading ─────────────────────────────── */
.sec-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 38px 0 16px;
    color: var(--text-mid);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.sec-head::before {
    content: '';
    width: 3px;
    height: 13px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}
.sec-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-light), transparent);
}

/* ── Stat grid ───────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.stat-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-height: 1.6rem;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.stat-value small { font-size: 0.7rem; color: var(--text-dim); font-weight: 600; }
.stat-value.green { color: var(--sage); }
.stat-value.red   { color: var(--rust); }
.stat-value img   { height: 22px; align-self: center; }
.stat-value .boss-stat-icon { width: 20px; height: 20px; color: var(--accent); opacity: 0.85; align-self: center; }

/* ── Battles feed ────────────────────────────────── */
.battles-feed { display: flex; flex-direction: column; gap: 10px; }
.battle-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: rgba(18, 18, 20, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 20px;
    transition: border-color 0.2s, transform 0.15s;
}
.battle-card:hover { border-color: var(--border-light); transform: translateX(2px); }
.battle-card.pvp {
    border-color: rgba(154,35,35,0.28);
    background: rgba(154,35,35,0.06);
}
.battle-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }

/* Killer (assassin) dimmer, Victim (victime) brighter — mirrors deaths.php. */
.battle-killer {
    font-weight: 600; font-size: 0.9rem; color: var(--text-mid);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.battle-victim {
    font-weight: 700; font-size: 0.95rem; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.battle-killer a, .battle-victim a { color: inherit; text-decoration: none; transition: color 0.15s; }
.battle-killer a:hover, .battle-victim a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.battle-killer.self, .battle-victim.self { color: var(--accent); }

/* Name + level pill + trailing icon, mirrors deaths.php .death-side.
   The pill is a sibling of the name, not a child: .battle-killer and
   .battle-victim ellipsis-clip at 220px and would swallow it. The group
   is nowrap so a pill can never wrap away from its own name (it would
   read as the other player's level), and the blade/skull are inside it
   so the row breaks into two clean halves — "killer lvl ⚔" then
   "victim lvl 💀" — instead of stranding a lone icon on its own line,
   which the extra pill width makes easy to trigger on a phone. */
.battle-side { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.battle-lvl {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--sage);
    background: rgba(111, 143, 95, 0.08);
    border: 1px solid rgba(111, 143, 95, 0.18);
}
.battle-card.pvp .battle-lvl {
    color: #83a471;
    background: rgba(111, 143, 95, 0.1);
    border-color: rgba(111, 143, 95, 0.24);
}

/* Sword & skull — masked SVG icons with the ember-flicker glow (from deaths.php).
   Glow lives on the parent, mask on ::before, so the drop-shadow isn't clipped. */
.battle-blade, .battle-skull {
    flex-shrink: 0; display: inline-block; line-height: 0;
    animation: ember-flicker-icon 2.6s ease-in-out infinite;
}
.battle-blade::before, .battle-skull::before {
    content: ""; display: block; width: 100%; height: 100%;
    background-color: currentColor;
    -webkit-mask: var(--icon) no-repeat center / contain;
            mask: var(--icon) no-repeat center / contain;
}
.battle-blade { --icon: url('img/icons/blade-drag.svg');           width: 17px; height: 17px; color: var(--text-mid); opacity: 0.55; }
.battle-skull { --icon: url('img/icons/skull-crossed-bones.svg');  width: 15px; height: 15px; color: var(--accent);   opacity: 0.85; }
.battle-card.pvp .battle-skull { opacity: 0.95; }
@keyframes ember-flicker-icon {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(196, 97, 42, 0.36)) drop-shadow(0 0 8px rgba(154, 35, 35, 0.22)); }
    45%      { filter: drop-shadow(0 0 4px rgba(210, 110, 50, 0.46)) drop-shadow(0 0 10px rgba(170, 45, 35, 0.3)); }
    70%      { filter: drop-shadow(0 0 2px rgba(180, 85, 35, 0.3)) drop-shadow(0 0 6px rgba(140, 30, 30, 0.2)); }
}
.battle-right { display: flex; align-items: center; gap: 14px; }
.battle-time { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.03em; white-space: nowrap; }
.battle-badge {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 3px;
    line-height: 1.4;
}
.badge-pvp { color: #fff; background: var(--accent); }
.badge-pve { color: var(--sage); background: rgba(111,143,95,0.08); border: 1px solid rgba(111,143,95,0.18); }

/* ── Rivals (nemeses / favorite victims) ─────────── */
.rivals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.rival-card {
    background: rgba(18, 18, 20, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px 22px;
    transition: border-color 0.2s;
}
.rival-card:hover { border-color: var(--border-light); }
.rival-card h3 {
    font-family: inherit !important;
    margin: 0 0 14px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: left;
}
.rival-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.rival-row:last-child { border-bottom: none; }
.rival-row a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rival-row a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.rival-rank {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 700;
    width: 22px;
    flex-shrink: 0;
}
.rival-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rival-count {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.rival-empty { color: var(--text-dim); font-size: 0.85rem; padding: 6px 0; }

/* ── Items lost ──────────────────────────────────── */
.loss-list { display: flex; flex-wrap: wrap; gap: 8px; }
.loss-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    background: rgba(154, 35, 35, 0.05);
    border: 1px solid rgba(154, 35, 35, 0.2);
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--text-mid);
    transition: border-color 0.2s, color 0.2s;
}
.loss-chip:hover { border-color: rgba(154,35,35,0.45); color: var(--text-main); }
.loss-chip b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ── Items destroyed (ember / burning glow, from deaths.php) ── */
.destroyed-chip {
    background: rgba(40, 20, 15, 0.35);
    border-color: rgba(196, 97, 42, 0.22);
}
.destroyed-chip:hover { border-color: rgba(196, 97, 42, 0.5); color: var(--text-main); }
.destroyed-chip svg { color: #c4612a; opacity: 0.6; }
.destroyed-chip .item-link {
    color: #d8a87a;
    text-shadow:
        0 0 4px rgba(196, 97, 42, 0.55),
        0 0 10px rgba(154, 35, 35, 0.35);
    animation: ember-flicker 2.6s ease-in-out infinite;
}
.destroyed-chip .item-link:hover {
    color: #f0c89a;
    text-shadow:
        0 0 6px rgba(220, 130, 60, 0.8),
        0 0 14px rgba(180, 50, 40, 0.5);
}
.destroyed-chip b { color: #c4612a; font-variant-numeric: tabular-nums; }
@keyframes ember-flicker {
    0%, 100% {
        text-shadow:
            0 0 4px rgba(196, 97, 42, 0.55),
            0 0 10px rgba(154, 35, 35, 0.35);
    }
    45% {
        text-shadow:
            0 0 5px rgba(210, 110, 50, 0.7),
            0 0 12px rgba(170, 45, 35, 0.45);
    }
    70% {
        text-shadow:
            0 0 3px rgba(180, 85, 35, 0.45),
            0 0 8px rgba(140, 30, 30, 0.3);
    }
}

/* ── XP progress ─────────────────────────────────── */
.xp-panel {
    background: rgba(18, 18, 20, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    margin-top: 16px;
    transition: border-color 0.2s;
}
.xp-panel:hover { border-color: var(--border-light); }
.xp-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.xp-lvl {
    font-family: 'Beaulieux', sans-serif;
    font-size: 1rem;
    color: var(--text-main);
    letter-spacing: 0.04em;
}
.xp-lvl small {
    font-family: 'Segoe UI', sans-serif;
    color: var(--text-dim);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-left: 4px;
}
.xp-pct { color: var(--accent); font-weight: 800; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.xp-track {
    height: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 999px;
    box-shadow: 0 0 12px var(--accent-glow);
    transition: width 0.6s ease;
}
.xp-fill.max { background: linear-gradient(90deg, var(--gold), #e0c878); box-shadow: 0 0 12px rgba(201,168,76,0.4); }
.xp-sub {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}
.xp-sub b { color: var(--text-mid); font-variant-numeric: tabular-nums; }

/* ── Equipment ───────────────────────────────────── */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}
.equip-slot {
    background: rgba(18, 18, 20, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 13px 16px;
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    transition: border-color 0.2s, transform 0.18s;
}
.equip-slot:hover { border-color: var(--border-light); transform: translateY(-2px); }
.equip-slot.empty { opacity: 0.38; }
.equip-slot.weapon {
    border-color: rgba(154, 35, 35, 0.4);
    background: rgba(154, 35, 35, 0.06);
}
.equip-pos {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.equip-slot.weapon .equip-pos { color: var(--accent); }
.equip-tag {
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 2px 7px;
    border-radius: 999px;
    color: var(--accent);
    background: rgba(154,35,35,0.12);
    border: 1px solid rgba(154,35,35,0.3);
}
.equip-item {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    word-break: break-word;
}
.equip-item .q { color: var(--text-dim); font-weight: 400; font-size: 0.8rem; }
.equip-item.none { color: var(--text-dim); font-weight: 400; font-style: italic; }

@media (max-width: 600px) {
    .rivals-grid { grid-template-columns: 1fr; }
    .char-hero { flex-direction: column; text-align: center; padding: 26px 20px; gap: 20px; }
    .char-badges { justify-content: center; }
    .guild-box { width: 100%; max-width: 320px; align-self: center; text-align: left; }
    .char-sub { margin-bottom: 16px; }
    .sec-head { margin: 30px 0 14px; }
    .sec-head::after { display: none; }
    .battle-card { gap: 10px; }
    .battle-right { width: 100%; justify-content: space-between; }
    .xp-panel { padding: 18px 18px; }
    /* Only this page turns the back link into a full-width button on
       mobile; the shared .back-link in style.css stays inline. */
    .back-link { display: block; text-align: center; margin-top: 26px; padding: 12px; border: 1px solid var(--border); border-radius: 4px; }
    .back-link:hover { border-color: var(--border-light); }
}
