:root {
  --bg: #140f1f;
  --bg-2: #1c1530;
  --card: #241b3a;
  --card-2: #2d2348;
  --line: #3a2e5a;
  --text: #f3eefc;
  --muted: #a99bc9;
  --gold: #f5b942;
  --gold-2: #ffd77a;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --common: #9aa5b1; --uncommon: #4ade80; --rare: #60a5fa; --epic: #c084fc; --legendary: #fbbf24; --mythic: #f472b6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #3b2363 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 110%, #2a1d4d 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 'Nunito', system-ui, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, .brand { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; letter-spacing: .2px; }
h1 { font-size: 2rem; margin: 0 0 .25em; }
h2 { font-size: 1.3rem; margin: 0 0 .75em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; }
.brand { font-size: 1.35rem; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--card-2); object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; border: 3px solid var(--gold); }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text); font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none !important; transition: transform .08s, background .15s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2b1a00; border-color: transparent; }
.btn.gold:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: .85rem; }
form.inline { display: inline; }
label { display: block; font-weight: 700; margin: 0 0 4px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 3px; }
input[type=text], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: inherit;
}
select[multiple] { min-height: 110px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
input[type=file] { color: var(--muted); max-width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.flash { background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .4); color: #bbf7d0; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; }

/* guild header + tabs */
.ghead { display: flex; align-items: center; gap: 14px; margin: 10px 0 16px; }
.gicon { width: 56px; height: 56px; border-radius: 16px; background: var(--card-2); display: grid; place-items: center; font-size: 1.6rem; object-fit: cover; flex: none; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.tabs a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tabs a.on, .tabs a:hover { background: var(--card-2); color: var(--text); text-decoration: none; }

.stat { background: var(--card-2); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-family: 'Fredoka', sans-serif; font-size: 1.6rem; color: var(--gold-2); }
.stat span { color: var(--muted); font-size: .85rem; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.table tr.off td { opacity: .45; }
.scroll { overflow-x: auto; }

/* rarity */
.r { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; }
.r-common { color: var(--common); } .r-uncommon { color: var(--uncommon); } .r-rare { color: var(--rare); }
.r-epic { color: var(--epic); } .r-legendary { color: var(--legendary); } .r-mythic { color: var(--mythic); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--card-2); font-size: .78rem; font-weight: 700; color: var(--muted); }
.pill.gold { background: rgba(245, 185, 66, .15); color: var(--gold-2); }
.thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--bg-2); display: inline-grid; place-items: center; font-size: 1.3rem; vertical-align: middle; }

/* collection page */
.hero { display: flex; align-items: center; gap: 18px; margin: 20px 0 24px; flex-wrap: wrap; }
.loot { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.tile {
  position: relative; background: var(--card-2); border-radius: 14px; padding: 14px 10px 12px; text-align: center;
  border: 2px solid transparent; min-height: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tile .art { width: 64px; height: 64px; display: grid; place-items: center; font-size: 2.6rem; }
.tile .art img { width: 64px; height: 64px; object-fit: contain; }
.tile .nm { font-weight: 800; font-size: .9rem; line-height: 1.2; }
.tile .ct { position: absolute; top: 6px; right: 8px; font-size: .75rem; font-weight: 800; color: var(--muted); }
.tile .sh { position: absolute; top: 6px; left: 8px; font-size: .9rem; }
.tile.missing { background: transparent; border: 2px dashed var(--line); }
.tile.missing .art { filter: grayscale(1) brightness(.3); }
.tile.common { border-color: rgba(154,165,177,.35); }
.tile.uncommon { border-color: rgba(74,222,128,.45); }
.tile.rare { border-color: rgba(96,165,250,.55); box-shadow: 0 0 18px -8px var(--rare); }
.tile.epic { border-color: rgba(192,132,252,.65); box-shadow: 0 0 22px -8px var(--epic); }
.tile.legendary { border-color: var(--legendary); box-shadow: 0 0 26px -6px var(--legendary); }
.tile.mythic { border-color: var(--mythic); box-shadow: 0 0 30px -4px var(--mythic); background: linear-gradient(160deg, #3b2350, #2d2348 50%, #23324d); }
.tile.shiny::after {
  content: ''; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 60%);
  background-size: 250% 100%; animation: sheen 3.5s linear infinite;
}
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .tile.shiny::after { animation: none; } }
.bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 6px 0 14px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

/* landing */
.landing { text-align: center; padding: 70px 0 40px; }
.landing h1 { font-size: 3rem; }
.landing .lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 auto 26px; }
.chest { font-size: 4.5rem; display: inline-block; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .chest { animation: none; } }
.features { margin-top: 40px; text-align: left; }
.foot { color: var(--muted); font-size: .8rem; text-align: center; padding: 40px 0 30px; }
.guilds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.guilds .card { display: flex; align-items: center; gap: 12px; padding: 14px; }
.guilds .card.nobot { opacity: .6; }
details summary { cursor: pointer; font-weight: 700; color: var(--gold-2); }
@media (max-width: 760px) {
  .g3.keep3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .keep3 .stat { padding: 10px 12px; }
  .keep3 .stat b { font-size: 1.25rem; }
}
html { background: var(--bg); }

/* bot status pill */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; background: var(--card-2); font-size: .8rem; font-weight: 800; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 2s infinite; }
.status.off { color: var(--danger); }
.status.off i { background: var(--danger); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
@media (prefers-reduced-motion: reduce) { .status.on i { animation: none; } }
@media (max-width: 520px) { .status .muted { display: none; } }
