/* Faction portal. Tokens and the header match the main site (styles.css). */
:root {
  --bg: #06080b;
  --panel: #0c1016;
  --panel2: #11161e;
  --line: rgba(255, 255, 255, .085);
  --line2: rgba(255, 255, 255, .15);
  --text: #f3f5f8;
  --muted: #98a0ab;
  --dim: #6f7883;
  --red: #dc2936;
  --red2: #ff4652;
  --green: #57d694;
  --amber: #e9ad55;
  --violet: #b793ff;
  --blue: #74b6f0;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); scrollbar-color: #2a313a transparent; scrollbar-width: thin; }
body { margin: 0; min-height: 100vh; color: var(--text); font: 14px/1.6 Inter, system-ui, sans-serif; background: linear-gradient(180deg, #06080b 0, #090c11 54%, #06080b 100%); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: Rajdhani, sans-serif; font-weight: 700; text-transform: uppercase; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--red2); outline-offset: 2px; }
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 70% -12%, rgba(220, 41, 54, .15), transparent 29%), linear-gradient(90deg, transparent 0 49.93%, rgba(255, 255, 255, .015) 50%, transparent 50.07%); background-size: auto, 64px 64px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: 8px; background: var(--red); font-weight: 700; }
.skip-link:focus { top: 12px; }

/* Site header: same layout as the home page */
.topbar { position: sticky; top: 0; z-index: 30; min-height: 76px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 10px max(24px, calc((100vw - var(--max)) / 2)); border-bottom: 1px solid var(--line); background: rgba(6, 8, 11, .93); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.brand img { width: 43px; height: 43px; object-fit: contain; }
.brand div { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font: 700 14px Rajdhani, sans-serif; letter-spacing: .12em; }
.brand span { color: #707984; font: 700 8px Rajdhani, sans-serif; letter-spacing: .18em; }
.player-nav { min-width: 0; display: flex; justify-content: center; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.player-nav::-webkit-scrollbar { display: none; }
.nav-button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: #0d1218; color: #a0a8b3; font: 700 11px Rajdhani, sans-serif; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; transition: .16s; }
.nav-button:hover { color: #fff; border-color: rgba(220, 41, 54, .45); background: #121820; }
.nav-button.primary { border-color: rgba(220, 41, 54, .52); background: rgba(220, 41, 54, .12); color: #ff858d; }
.account-slot { justify-self: end; }
/* QA-19's line in the "What it takes" box. */
.fact-card .fact-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.account { display: flex; align-items: center; gap: 10px; line-height: 1.3; }
.account img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #151a22; }
.account strong { display: block; max-width: 160px; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.account span { display: block; color: var(--muted); font-size: 11px; }
.account .on-server { color: var(--green); }
.link-button { padding: 0; border: 0; background: none; color: var(--muted); font-size: 11px; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: #fff; }

/* Faction tabs */
.tabs { position: sticky; top: 76px; z-index: 25; border-bottom: 1px solid var(--line); background: rgba(9, 12, 17, .94); backdrop-filter: blur(14px); }
.tabs-inner { display: flex; gap: 4px; width: min(calc(100% - 40px), var(--max)); margin: auto; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 14px 14px; color: var(--muted); font: 700 13px Rajdhani, sans-serif; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; transition: color .14s; }
.tab:hover { color: #fff; }
.tab.active { color: #fff; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--red2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border: 1px solid var(--line2); border-radius: 8px; background: #10151c; font-size: 13px; font-weight: 700; cursor: pointer; transition: .16s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #636d78; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { border-color: var(--red); background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { border-color: var(--red2); background: var(--red2); }
.btn-danger { border-color: rgba(220, 41, 54, .42); background: rgba(220, 41, 54, .1); color: #ff8e96; }
.btn-danger:hover:not(:disabled) { border-color: var(--red2); background: var(--red); color: #fff; }
.btn-quiet { background: transparent; }
.btn-small { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn-wide { width: 100%; }
.busy button, .busy .btn { pointer-events: none; opacity: .6; }

/* Shared text */
main { width: min(calc(100% - 40px), var(--max)); margin: auto; }
.label { display: block; color: var(--muted); font: 700 12px Rajdhani, sans-serif; letter-spacing: .17em; text-transform: uppercase; }
.label-red { color: var(--red2); }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.empty { padding: 30px 20px; border: 1px dashed var(--line2); border-radius: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; margin-bottom: 4px; color: var(--text); }
.card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 16, 22, .82); }
.card h3 { margin: 4px 0 12px; font-size: 22px; line-height: 1.1; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin-bottom: 0; }
.count-chip { flex: none; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: #0a0e14; color: var(--muted); font: 700 12px Rajdhani, sans-serif; letter-spacing: .06em; white-space: nowrap; }
.tag { display: inline-block; padding: 3px 8px; border: 1px solid rgba(220, 41, 54, .34); border-radius: 6px; background: rgba(220, 41, 54, .09); color: #ff858d; font: 700 13px Rajdhani, sans-serif; letter-spacing: .1em; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border: 1px solid var(--line2); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { border-color: rgba(87, 214, 148, .3); background: rgba(87, 214, 148, .06); color: var(--green); }
.pill.warn { border-color: rgba(233, 173, 85, .34); background: rgba(233, 173, 85, .07); color: var(--amber); }
.pill.bad { border-color: rgba(220, 41, 54, .38); background: rgba(220, 41, 54, .08); color: #ff858d; }
.pill.plain::before { display: none; }
.emblem { width: 70px; height: 70px; border: 1px solid var(--line2); border-radius: 12px; object-fit: cover; background: #090c10; }

/* Alerts */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 14px 16px; border: 1px solid var(--line2); border-left-width: 3px; border-radius: 10px; background: rgba(255, 255, 255, .03); }
.alert p { margin: 2px 0 0; color: #c2c8d0; font-size: 13px; }
.alert strong { display: block; font-size: 14px; }
.alert .btn { flex: none; }
.alert.warn { border-color: rgba(233, 173, 85, .34); border-left-color: var(--amber); background: rgba(233, 173, 85, .06); }
.alert.danger { border-color: rgba(220, 41, 54, .4); border-left-color: var(--red2); background: rgba(220, 41, 54, .07); }
.alert.info { border-color: rgba(116, 182, 240, .28); border-left-color: var(--blue); background: rgba(116, 182, 240, .05); }
.alert.good { border-color: rgba(87, 214, 148, .3); border-left-color: var(--green); background: rgba(87, 214, 148, .05); }

/* Directory */
.view { display: none; padding: 40px 0 90px; }
.view.active { display: block; }
#directory-view { padding-top: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 80px; align-items: center; padding: 64px 0 52px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #a0a8b3; font: 700 12px Rajdhani, sans-serif; letter-spacing: .2em; }
.eyebrow i { width: 32px; height: 1px; background: var(--red); }
.hero h1 { margin: 16px 0 18px; font-size: clamp(50px, 6vw, 82px); line-height: .88; letter-spacing: -.04em; }
.hero h1 em { font-style: normal; color: #76808c; }
.hero p { max-width: 660px; margin: 0; color: #a7aeb8; font-size: 16px; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
.hero-note { color: var(--muted); font-size: 13px; }
.fact-card { padding: 24px; border: 1px solid var(--line2); border-radius: 14px; background: linear-gradient(150deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .01)); box-shadow: 0 28px 80px rgba(0, 0, 0, .25); }
.fact-card > strong { display: block; margin-top: 12px; font: 700 44px/1.05 Rajdhani, sans-serif; }
.fact-card > p { margin: 2px 0 16px; color: var(--muted); font-size: 13px; }
.fact-card div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.fact-card div span { color: var(--muted); }
.how-it-works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 56px; }
.how-step { display: flex; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 16, 22, .7); }
.how-step > span { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(220, 41, 54, .4); border-radius: 8px; background: rgba(220, 41, 54, .09); color: #ff858d; font: 700 16px Rajdhani, sans-serif; }
.how-step h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.2; }
.how-step p { margin: 0; color: var(--muted); font-size: 13px; }
.view-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px; align-items: end; margin-bottom: 24px; }
.view-head h2 { margin: 4px 0 0; font-size: 40px; line-height: 1; }
.view-head h2 small { margin-left: 8px; color: var(--muted); font-size: .5em; font-weight: 600; }
.view-head p { margin: 0; color: var(--muted); font-size: 14px; }
.directory-tools { margin-bottom: 14px; }
.search, input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px; background: #090c11; color: var(--text); outline: none; }
input:focus, textarea:focus, select:focus { border-color: rgba(220, 41, 54, .7); box-shadow: 0 0 0 3px rgba(220, 41, 54, .1); }
input[type="file"] { padding: 8px; font-size: 12px; }
.directory-tools .search { max-width: 340px; }
.faction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.faction-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 16, 22, .82); overflow: hidden; }
.faction-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 90% 0, rgba(220, 41, 54, .075), transparent 40%); pointer-events: none; }
.faction-card.mine { border-color: rgba(220, 41, 54, .42); }
.faction-top { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.faction-card h3 { position: relative; margin: 16px 0 6px; font-size: 24px; line-height: 1.1; overflow-wrap: anywhere; }
.faction-card > p { position: relative; display: -webkit-box; flex: 1; margin: 0 0 16px; overflow: hidden; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.faction-foot { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.faction-foot b { color: var(--text); }
.meter { position: relative; height: 5px; margin-bottom: 14px; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, .08); }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.meter.good i { background: var(--green); }
.skeleton { height: 240px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(100deg, rgba(255, 255, 255, .018) 30%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .018) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position-x: -220%; } }

/* Invitations */
.invite-list { display: grid; gap: 8px; margin-bottom: 20px; }
.invite-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 16px; border: 1px solid rgba(87, 214, 148, .3); border-radius: 10px; background: rgba(87, 214, 148, .05); }
.invite-row small { display: block; color: var(--muted); font-size: 12px; }
.invite-actions { display: flex; gap: 8px; }

/* Banner shown above each faction page */
.faction-banner { display: grid; gap: 0; margin-top: 18px; }
.banner-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 16, 22, .82); }
.banner-row img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: #090c10; }
.banner-row strong { font: 700 18px Rajdhani, sans-serif; text-transform: uppercase; }
.banner-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-left: auto; color: var(--muted); font-size: 13px; }
.banner-facts b { color: var(--text); }
.faction-banner + .view { padding-top: 26px; }

/* Overview */
.identity { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-bottom: 14px; }
.identity .emblem { width: 92px; height: 92px; }
.identity h2 { margin: 0; font-size: 34px; line-height: 1.05; overflow-wrap: anywhere; }
.identity p { margin: 6px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.identity-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { position: relative; display: block; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 16, 22, .82); transition: .15s; }
a.stat:hover { border-color: rgba(220, 41, 54, .42); transform: translateY(-1px); }
a.stat::after { content: "→"; position: absolute; top: 12px; right: 14px; color: var(--dim); }
.stat b { display: block; margin-top: 4px; overflow: hidden; font: 700 27px/1.15 Rajdhani, sans-serif; white-space: nowrap; text-overflow: ellipsis; }
.stat small { display: block; color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.two-col + .two-col, .two-col + .card, .card + .two-col, #technology-content > .card + .card { margin-top: 14px; }
.checklist { display: grid; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 2px; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line2); border-radius: 50%; color: #0a0e14; font-size: 12px; font-weight: 800; }
.checklist li.done::before { content: "✓"; border-color: var(--green); background: var(--green); }
.checklist small { display: block; color: var(--muted); font-size: 12px; }
.checklist a { color: #ff858d; text-decoration: underline; }
.checklist .meter { margin: 6px 0 0; max-width: 340px; }
.activity { display: grid; }
.activity > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity > div:first-child { border-top: 0; }
.activity span { min-width: 0; overflow-wrap: anywhere; }
.activity small { display: block; color: var(--muted); font-size: 12px; }
.activity b { flex: none; font-weight: 600; white-space: nowrap; color: var(--muted); }
.activity b.plus { color: var(--green); }
.activity b.minus { color: #ff8e96; }
.scroll-list { max-height: 420px; overflow-y: auto; }
details.settings { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 16, 22, .82); }
details.settings > summary { padding: 16px 22px; font: 700 18px Rajdhani, sans-serif; text-transform: uppercase; cursor: pointer; }
.settings-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; padding: 0 22px 22px; }
.danger-zone { padding: 18px; border: 1px solid rgba(220, 41, 54, .3); border-radius: 10px; background: rgba(220, 41, 54, .04); }
.danger-zone p { margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.danger-zone label { display: grid; gap: 6px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.stack-form { display: grid; gap: 14px; align-content: start; }
.stack-form > label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.stack-form small { color: var(--muted); font-size: 12px; font-weight: 400; }
.stack-form small.bad { color: #ff8e96; }
.stack-form textarea { min-height: 100px; resize: vertical; }
.input-row { display: flex; gap: 8px; }
.input-row .btn { flex: none; }

/* Members */
.members-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.member-list { display: grid; gap: 8px; }
.member-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 16, 22, .82); }
.member-row img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: #151a22; }
.member-row h4 { margin: 0; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; text-transform: none; }
.member-row h4 a:hover { text-decoration: underline; }
.member-row p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.role { color: #ff858d; font-weight: 700; text-transform: capitalize; }
.role.member { color: var(--muted); }
.member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.side-stack { display: grid; gap: 14px; }
.role-list { display: grid; gap: 8px; margin: 0; font-size: 13px; }
.role-list div { display: grid; gap: 1px; }
.role-list dt { font-weight: 700; }
.role-list dd { margin: 0; color: var(--muted); font-size: 12px; }
.pending-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.pending-row:first-child { border-top: 0; }
.pending-row img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; background: #151a22; }
.pending-row div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pending-row small { display: block; color: var(--muted); font-size: 12px; }

/* Vault */
.vault-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
.vault-panel .search { margin-bottom: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter-chip { padding: 4px 10px; border: 1px solid var(--line2); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.filter-chip:hover { color: #fff; }
.filter-chip[aria-pressed="true"] { border-color: rgba(220, 41, 54, .55); background: rgba(220, 41, 54, .12); color: #ff9aa1; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; max-height: 620px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #070a0e; transition: border-color .15s; scrollbar-width: thin; }
.slot-grid.drop-target { border-color: rgba(87, 214, 148, .6); }
.slot { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 124px; padding: 10px; border: 1px solid #2b3139; border-radius: 8px; background: #12161d; transition: border-color .14s; }
.slot[draggable="true"] { cursor: grab; }
.slot[draggable="true"]:active { cursor: grabbing; }
.slot:not(.empty):hover { border-color: #525b68; }
.slot.drop-target { border-color: var(--green); background: rgba(87, 214, 148, .08); }
.slot.empty { min-height: 72px; justify-content: center; align-items: center; border-style: dashed; border-color: #242a31; background: transparent; color: #4f5863; font: 700 13px Rajdhani, sans-serif; }
.slot.temporary { background: linear-gradient(150deg, rgba(255, 255, 255, .04), #12161d 55%); }
.slot.cards { border-color: rgba(116, 182, 240, .3); background: linear-gradient(150deg, rgba(116, 182, 240, .11), #12161d 55%); }
.slot.currency { border-color: rgba(233, 173, 85, .3); background: linear-gradient(150deg, rgba(233, 173, 85, .1), #12161d 55%); }
.slot.locked { border-color: rgba(183, 147, 255, .3); background: linear-gradient(150deg, rgba(183, 147, 255, .12), #12161d 55%); }
.slot-type { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font: 700 11px Rajdhani, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.slot-type b { color: #fff; letter-spacing: 0; }
.slot strong { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.slot small { overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.slot .btn { margin-top: auto; }
.slot-spacer { margin-top: auto; }
.slots-toggle { margin-top: 10px; }
.slot-grid .empty-note { grid-column: 1 / -1; padding: 30px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Technology */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tech-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.tech-card.owned { border-color: rgba(183, 147, 255, .32); background: linear-gradient(150deg, rgba(183, 147, 255, .12), rgba(18, 22, 29, .6) 60%); }
.tech-card h4 { margin: 0; font-size: 18px; line-height: 1.15; overflow-wrap: anywhere; text-transform: none; }
.tech-card p { margin: 0; color: var(--muted); font-size: 12px; }
.tech-cost { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.tech-cost b { color: var(--text); }

/* Treasury */
.amount-form { display: grid; gap: 8px; }
.amount-form .input-row input { min-width: 0; }
.quick-row { display: flex; flex-wrap: wrap; gap: 6px; }
.treasury-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.form-block + .form-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-block > .label { margin-bottom: 8px; }

/* Stats page */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-list span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; background: #0a0e14; font-size: 12px; overflow-wrap: anywhere; }
.chip-list span b { margin-left: 4px; }
.muted-copy { margin: 0; color: var(--muted); font-size: 13px; }

/* Admin */
.admin-list { display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 16, 22, .82); }
.admin-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-identity img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: #151a22; }
.admin-identity strong { font: 700 19px Rajdhani, sans-serif; overflow-wrap: anywhere; }
.admin-identity p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* Dialogs */
.dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line2); border-radius: 14px; background: #0d1117; color: var(--text); box-shadow: 0 30px 100px rgba(0, 0, 0, .7); }
.dialog-wide { width: min(860px, calc(100vw - 32px)); }
.dialog-small { width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(6px); }
.dialog-body { position: relative; padding: 26px; }
.dialog h2 { margin: 4px 0 14px; font-size: 30px; line-height: 1.05; overflow-wrap: anywhere; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.dialog-copy { margin: -4px 0 16px; color: #c2c8d0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.create-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
.create-preview .label { margin-bottom: 8px; }
.create-preview .faction-card > p { -webkit-line-clamp: 6; }
.cost-note { margin: 0; padding: 10px 12px; border: 1px solid rgba(233, 173, 85, .3); border-radius: 8px; background: rgba(233, 173, 85, .06); color: #e6cfa7; font-size: 13px; }
.warn-note { margin: 0; padding: 10px 12px; border: 1px solid rgba(183, 147, 255, .34); border-radius: 8px; background: rgba(183, 147, 255, .08); color: #d5c2ff; font-size: 13px; }
#admin-dialog .danger-zone { margin-top: 20px; }

/* Toast */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 70; max-width: 420px; padding: 13px 16px; border: 1px solid var(--line2); border-radius: 9px; background: #151a22; box-shadow: 0 14px 48px #000; font-size: 13px; }
.toast.error { border-color: rgba(220, 41, 54, .55); color: #ffb0b6; }
.toast.working::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 9px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; vertical-align: -1px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer: same as the home page */
.site-footer { width: min(calc(100% - 40px), var(--max)); margin: auto; padding: 30px 0 40px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; border-top: 1px solid var(--line); }
.footer-brand { display: flex; align-items: center; gap: 9px; }
.footer-brand img { width: 38px; height: 38px; object-fit: contain; }
.footer-brand div { display: flex; flex-direction: column; line-height: 1.3; }
.footer-brand strong { font: 700 12px Rajdhani, sans-serif; letter-spacing: .1em; }
.footer-brand span, .site-footer > span { color: var(--dim); font-size: 11px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 12px; font-weight: 600; }
.footer-links a:hover { color: #fff; }
.site-footer > span { justify-self: end; }

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 48px 0 40px; }
  .fact-card { max-width: 440px; }
  .how-it-works { grid-template-columns: 1fr; }
  .vault-layout, .members-layout, .settings-body { grid-template-columns: 1fr; }
  .view-head { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 760px) {
  .topbar { position: static; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 13px; }
  .brand div span { display: none; }
  .player-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .tabs { top: 0; }
  .tabs-inner, main, .site-footer { width: calc(100% - 26px); }
  .tab { padding: 12px 10px; }
  .view { padding: 28px 0 70px; }
  .view-head h2 { font-size: 32px; }
  .hero h1 { font-size: 50px; }
  .faction-grid { grid-template-columns: 1fr; }
  .two-col, .create-layout { grid-template-columns: 1fr; }
  .create-preview { display: none; }
  .identity { grid-template-columns: auto minmax(0, 1fr); }
  .identity .emblem { width: 64px; height: 64px; }
  .identity h2 { font-size: 26px; }
  .identity-side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .member-row { grid-template-columns: auto minmax(0, 1fr); }
  .member-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .admin-row { grid-template-columns: 1fr; }
  .admin-actions { justify-content: flex-start; }
  .alert { flex-direction: column; align-items: flex-start; }
  .banner-facts { margin-left: 0; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
  .dialog-body { padding: 20px; }
  .account strong { max-width: 110px; }
  .site-footer { grid-template-columns: 1fr; justify-items: start; }
  .site-footer > span { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
