/* ── DESTINY 2 HUB — in-game menu style ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #07090c;
    --panel: rgba(12, 15, 20, 0.72);
    --line: rgba(255, 255, 255, 0.14);
    --line-strong: rgba(255, 255, 255, 0.4);
    --text: #f2f2f2;
    --muted: rgba(242, 242, 242, 0.62);
    --faint: rgba(242, 242, 242, 0.38);
    --exotic: #ceae33;
    --legendary: #522f65;
    --el: #f2f2f2;
}
.el-solar     { --el: #f0631e; }
.el-arc       { --el: #79bbe8; }
.el-void      { --el: #b185df; }
.el-stasis    { --el: #4d88ff; }
.el-strand    { --el: #35e366; }
.el-prismatic { --el: #f2a6d8; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }

/* full-screen subclass key art */
#bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center 30%;
    transition: background-image 0.4s ease;
}
#bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(7,9,12,0.15) 0%, rgba(7,9,12,0.45) 30%, rgba(7,9,12,0.92) 65%, rgba(7,9,12,0.98) 100%),
        linear-gradient(90deg, rgba(7,9,12,0.8) 0%, rgba(7,9,12,0.1) 55%, rgba(7,9,12,0.5) 100%);
}

/* ── TOP BAR (director-style nav) ── */
#topbar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 40px;
    height: 56px;
    background: rgba(7, 9, 12, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
#d2-back {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
#d2-back:hover { color: var(--text); }
#brand {
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-size: 0.85rem;
}
#brand span { color: var(--faint); font-weight: 400; }
#class-tabs { display: flex; gap: 6px; margin-left: auto; height: 100%; }
.nav-tab {
    position: relative;
    padding: 0 18px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--text); }
.nav-tab.active::after {
    content: '';
    position: absolute;
    left: 18px; right: 18px; bottom: -1px;
    height: 3px;
    background: var(--text);
}

main { padding: 0 40px 48px; max-width: 1500px; margin: 0 auto; }

/* ── HERO ── */
#hero { padding: 40px 0 28px; min-height: 46vh; display: flex; flex-direction: column; justify-content: flex-end; }
#subclass-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.sub-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 84px;
    padding: 10px 0 8px;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}
.sub-tab img {
    width: 56px;
    height: 56px;
    opacity: 0.55;
    transition: opacity 0.15s, transform 0.15s, filter 0.15s;
}
.sub-tab span {
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}
.sub-tab:hover img { opacity: 0.9; }
.sub-tab.active { border-color: var(--line-strong); background: rgba(255,255,255,0.05); }
.sub-tab.active img {
    opacity: 1;
    transform: scale(1.06);
    filter: drop-shadow(0 0 12px var(--el));
}
.sub-tab.active span { color: var(--text); }

#hero-kicker {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--el);
    margin-bottom: 6px;
}
#hero-title {
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 30px;
    text-shadow: 0 2px 30px rgba(0,0,0,0.6);
}

#hero-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}
#build-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.build-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px 10px 12px;
    background: rgba(12, 15, 20, 0.6);
    border: 1px solid var(--line);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background 0.15s, border-color 0.15s;
}
.build-tab:hover { background: rgba(255,255,255,0.1); border-color: var(--line-strong); }
.build-num { color: var(--faint); font-size: 0.7rem; }
.build-tab.active {
    background: rgba(255,255,255,0.92);
    color: #0b0d10;
    border-color: #fff;
    box-shadow: 0 0 0 1px var(--el), 0 0 18px -4px var(--el);
}
.build-tab.active .build-num { color: rgba(11,13,16,0.5); }

#raid-tabs {
    display: flex;
    border: 1px solid var(--line);
    background: rgba(12, 15, 20, 0.6);
}
.seg {
    padding: 10px 16px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.seg.active { background: rgba(255,255,255,0.14); color: var(--text); }

/* ── BUILD DETAIL ── */
.build-head {
    border-top: 1px solid var(--line-strong);
    padding: 22px 0 24px;
}
.build-head h2 {
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.build-head p { color: var(--muted); max-width: 75ch; line-height: 1.55; }

.columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 24px;
    align-items: start;
}
.panel {
    background: var(--panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    border-top: 2px solid var(--el);
    padding: 6px 22px 22px;
}
.panel-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 18px 0 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.panel-count { margin-left: auto; font-weight: 400; letter-spacing: 0.1em; color: var(--faint); font-size: 0.68rem; }

/* abilities — super larger, like the in-game subclass screen */
.abilities {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}
.ability { text-align: center; }
.ability-icon {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    margin-bottom: 8px;
}
.ability-icon img { width: 82%; }
.ability.super .ability-icon {
    border-color: var(--el);
    box-shadow: inset 0 0 24px -6px var(--el);
}
.ability-label {
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}
.ability-name { font-size: 0.78rem; font-weight: 500; margin-top: 2px; line-height: 1.3; overflow-wrap: anywhere; }

.aspects, .fragments { display: flex; flex-direction: column; gap: 12px; }
.aspect, .fragment { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: start; }
.fragment { grid-template-columns: 40px minmax(0, 1fr); }
.aspect-icon, .fragment-icon {
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
}
.aspect-name, .fragment-name { font-weight: 600; margin-bottom: 3px; }
.aspect-text, .fragment-text { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.stat-mod { color: #81c995; font-size: 0.74rem; }
.stat-mod.neg { color: #f28b82; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 8px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
    font-weight: 500;
    letter-spacing: 0.06em;
}
.stat-rank {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--el);
    color: #0b0d10;
    font-size: 0.72rem;
    font-weight: 700;
}
.stat-icon { width: 22px; height: 22px; }

/* ── ITEM CARDS (in-game tooltip style) ── */
.items { display: flex; flex-direction: column; gap: 12px; }
.item { border: 1px solid rgba(255,255,255,0.08); background: rgba(10, 12, 16, 0.86); }
.item-head {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 8px 12px 8px 8px;
}
.item.exotic .item-head { background: linear-gradient(90deg, #ceae33, #b8982a); color: #fff; }
.item.legendary .item-head { background: linear-gradient(90deg, #522f65, #43264f); color: #fff; }
.item-icon { width: 52px; height: 52px; border: 1px solid rgba(255,255,255,0.5); }
.set-icon {
    background:
        linear-gradient(135deg, transparent 46%, rgba(255,255,255,0.5) 46% 54%, transparent 54%),
        rgba(0,0,0,0.25);
}
.item-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.item-type { font-size: 0.74rem; opacity: 0.85; margin-top: 1px; }
.item-slot {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.8;
    text-align: right;
}
.item-body { padding: 12px 14px 12px; }
.perk { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.perk:last-of-type { border-bottom: none; }
.perk-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 2px; }
.item.exotic .perk-name { color: var(--exotic); }
.perk-text { color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.item-why { color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin-bottom: 4px; }
.item-source {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--faint);
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.item-source::before { content: 'SOURCE  '; letter-spacing: 0.16em; font-size: 0.62rem; }

/* champion stamp */
.champ {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.champ-dot { width: 10px; height: 10px; transform: rotate(45deg); }
.champ-barrier     { color: #8ab4f8; } .champ-barrier .champ-dot     { background: #8ab4f8; }
.champ-overload    { color: #c58af9; } .champ-overload .champ-dot    { background: #c58af9; }
.champ-unstoppable { color: #fdd663; } .champ-unstoppable .champ-dot { background: #fdd663; }
.champ-how { font-weight: 400; letter-spacing: 0.02em; text-transform: none; color: var(--faint); margin-left: 4px; }

/* ── FOOTER ── */
#resources { margin-top: 36px; }
#resource-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
#resource-links a {
    padding: 9px 16px;
    border: 1px solid var(--line);
    background: rgba(12, 15, 20, 0.6);
    color: var(--text);
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
#resource-links a:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.08); }
#d2-note { font-size: 0.75rem; color: var(--faint); max-width: 80ch; line-height: 1.5; }

/* ── RESPONSIVE ── */
@media (max-width: 1000px) {
    .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    #topbar { padding: 10px 16px 0; gap: 14px; height: auto; flex-wrap: wrap; }
    #brand span { display: none; }
    #class-tabs { width: 100%; margin-left: 0; height: 44px; }
    .nav-tab { flex: 1; padding: 0 4px; font-size: 0.75rem; letter-spacing: 0.12em; }
    .nav-tab.active::after { left: 8px; right: 8px; }
    main { padding: 0 16px 36px; }
    #hero { padding-top: 24px; min-height: 30vh; }
    #subclass-tabs { gap: 4px; flex-wrap: nowrap; }
    .sub-tab { width: auto; flex: 1 1 0; min-width: 0; }
    .sub-tab img { width: 36px; height: 36px; }
    .sub-tab span { font-size: 0.5rem; letter-spacing: 0.06em; }
    .panel { padding: 4px 14px 16px; }
    .abilities { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
    .ability-label { font-size: 0.5rem; letter-spacing: 0.06em; }
    .ability-name { font-size: 0.66rem; }
    .item-head { grid-template-columns: 44px minmax(0, 1fr); }
    .item-name { font-size: 0.92rem; }
    #hero-title { letter-spacing: 0.06em; }
    .build-head h2 { font-size: 1.15rem; }
    .aspect { grid-template-columns: 44px minmax(0, 1fr); }
    .fragment { grid-template-columns: 34px minmax(0, 1fr); }
    .item-icon { width: 44px; height: 44px; }
    .item-slot { grid-column: 1 / -1; text-align: left; }
}

/* ── BUILD YOUR OWN ── */
#mode-tabs {
    display: inline-flex;
    align-self: flex-start;
    border: 1px solid var(--line);
    background: rgba(12, 15, 20, 0.6);
    margin-bottom: 14px;
}
#mode-tabs:empty { display: none; }
#mode-tabs .seg.active { background: var(--el); color: #0b0d10; font-weight: 600; }

.opt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
}
.opt-grid.small { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.opt {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
    text-align: center;
    transition: border-color 0.12s, background 0.12s, opacity 0.12s;
}
.opt img { width: 48px; height: 48px; opacity: 0.6; transition: opacity 0.12s; }
.opt-grid.small .opt img { width: 38px; height: 38px; }
.opt-name { font-size: 0.68rem; line-height: 1.25; color: var(--muted); overflow-wrap: break-word; hyphens: auto; }
.opt:hover { border-color: var(--line-strong); }
.opt:hover img { opacity: 0.9; }
.opt.selected {
    border-color: var(--el);
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 0 18px -8px var(--el);
}
.opt.selected img { opacity: 1; }
.opt.selected .opt-name { color: var(--text); font-weight: 600; }
.opt.disabled { opacity: 0.3; cursor: not-allowed; }
.opt-cap {
    position: absolute;
    top: 4px; right: 5px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--faint);
}
.opt.selected .opt-cap { color: var(--el); }

.opt-info {
    margin-top: 18px;
    padding: 12px 14px;
    border-left: 2px solid var(--el);
    background: rgba(255,255,255,0.04);
    min-height: 64px;
}
.opt-info-name { font-weight: 600; margin-bottom: 4px; }
.opt-info-text { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.reset {
    margin-top: 14px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.reset:hover { border-color: var(--line-strong); color: var(--text); }

.focus { display: flex; flex-direction: column; gap: 8px; }
.focus-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; }
.focus-label { font-size: 0.8rem; font-weight: 500; }
.focus-bar { height: 6px; background: rgba(255,255,255,0.08); }
.focus-bar span { display: block; height: 100%; background: var(--el); }

.wperks { display: flex; flex-direction: column; gap: 10px; }
.wperk { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; }
.wperk-icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); }
.wperk-name { font-weight: 600; }
.wperk-why { font-weight: 400; font-size: 0.7rem; color: var(--el); letter-spacing: 0.04em; margin-left: 6px; }
.wperk-text { color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.empty { color: var(--muted); font-size: 0.85rem; padding: 4px 0 8px; }

@media (max-width: 700px) {
    .opt-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
    .opt-grid.small { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
    .opt img { width: 38px; height: 38px; }
    .focus-row { grid-template-columns: 110px 1fr; }
}

/* hover tooltip for build-your-own options */
#opt-tip {
    position: fixed;
    z-index: 50;
    width: min(360px, calc(100vw - 16px));
    background: rgba(10, 12, 16, 0.97);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    pointer-events: none;
}
.tip-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 8px 12px 8px 8px;
    background: color-mix(in srgb, var(--el) 55%, #15181d);
}
.tip-icon { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,0.4); }
.tip-name { font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.tip-type { font-size: 0.72rem; opacity: 0.85; margin-top: 1px; }
.tip-body { padding: 12px 14px; font-size: 0.82rem; line-height: 1.55; color: var(--muted); }
@media (hover: none) { #opt-tip { display: none; } }

/* origin traits on legendary weapons */
.origin { margin-top: 4px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.origin-label {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 6px;
}
.origin-perk { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 4px 0; }
.origin-icon { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(206,174,51,0.6); }
.item.legendary .origin .perk-name { color: #e2c97a; }

/* ammo type badge in weapon headers */
.ammo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 8px;
    padding: 1px 7px 1px 4px;
    background: rgba(0,0,0,0.6);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    vertical-align: 1px;
}
.ammo img { width: 20px; height: 14px; object-fit: contain; }
.ammo-special { color: #7af48b; }
.ammo-heavy   { color: #c9a6ff; }

/* Artifact: recommended artifact and its seven perk slots */
.art-head { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 12px; }
.art-icon { width: 44px; height: 44px; border: 1px solid var(--line); }
.art-name { font-weight: 600; }
.art-slots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.art-slot {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 4px 6px; border: 1px solid var(--line); text-align: center;
}
.art-slot.filler { opacity: 0.55; border-style: dashed; }
.art-slot-num { position: absolute; top: 3px; left: 5px; font-size: 0.62rem; color: var(--faint); }
.art-slot-icon { width: 36px; height: 36px; border-radius: 50%; }
.art-slot-name { font-size: 0.64rem; line-height: 1.2; color: var(--text); overflow-wrap: break-word; hyphens: auto; }
.art-slot-col { font-size: 0.58rem; letter-spacing: 0.06em; color: var(--el); }
.art-rule { color: var(--faint); font-size: 0.72rem; margin: 8px 0 12px; }

@media (max-width: 700px) {
    .art-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
