:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --panel2:#0c1628;
  --text:#e7eefc;
  --muted:#9bb0d1;
  --line:rgba(255,255,255,.08);
  --accent:#7aa2ff;
  --good:#35d07f;
  --warn:#ffcc66;
  --radius:18px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(122,162,255,.25), transparent 60%),
              radial-gradient(900px 500px at 90% 0%, rgba(53,208,127,.16), transparent 55%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  padding: 14px 14px calc(14px + env(safe-area-inset-top));
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: rgba(11,18,32,.72);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}

.brand__title{font-weight:800; letter-spacing:.2px; font-size:16px}
.brand__subtitle{color:var(--muted); font-size:12px; margin-top:2px}

.iconbtn{
  width:40px; height:40px;
  border:1px solid var(--line);
  border-radius:12px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size:18px;
}

.app{
  padding: 14px 14px 84px; /* bottom nav space */
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section{
  margin-bottom:14px;
}

.controls{
  padding:14px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
}
.row + .row{ margin-top:10px; }

.input, .select{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
}
.input::placeholder{color:rgba(231,238,252,.5)}
.select{appearance:none}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.player{
  display:flex;
  gap:12px;
  padding:12px;
  align-items:center;
}

.avatar{
  width:56px; height:56px;
  border-radius:16px;
  flex:0 0 auto;
  object-fit:cover;
  background: var(--panel2);
  border:1px solid var(--line);
}

.player__meta{
  min-width:0;
  width:100%;
}

.player__name{
  font-weight:800;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.player__motto{
  color: var(--muted);
  font-size:12px;
  margin-top:4px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}

.badges{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:8px;
  flex-wrap:wrap;
}

.badge{
  font-size:11px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
}

/* Tier styles: legend | mythical | goat */
.badge--tier-legend{
  border-color: rgba(53,208,127,.35);
  color: #bff4d8;
  background: rgba(53,208,127,.10);
}
.badge--tier-mythical{
  border-color: rgba(255,204,102,.40);
  color: #ffe3ad;
  background: rgba(255,204,102,.12);
}
.badge--tier-goat{
  border-color: rgba(122,162,255,.45);
  color: #d9e6ff;
  background: rgba(122,162,255,.14);
}

/* XP stays distinct */
.badge--xp{
  border-color: rgba(122,162,255,.35);
  color: #d9e6ff;
  background: rgba(122,162,255,.10);
}

.tap{
  width:100%;
  text-align:left;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
}

.details{
  padding:14px;
}

.details__top{
  display:flex;
  gap:12px;
}

.avatar--big{
  width:84px; height:84px;
  border-radius:22px;
}

.h1{
  margin:0;
  font-size:18px;
  font-weight:900;
}

.p{
  margin:8px 0 0;
  color: var(--muted);
  font-size:13px;
  line-height:1.4;
}

.media{
  margin-top:12px;
  border-radius: var(--radius);
  overflow:hidden;
  border:1px solid var(--line);
  background: rgba(0,0,0,.2);
}
.media img{
  width:100%;
  display:block;
  max-height: 360px;
  object-fit:cover;
}

.btn{
  margin-top:12px;
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight:700;
}

.bottomnav{
  position:fixed;
  left:0; right:0; bottom:0;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display:flex;
  gap:10px;
  background: rgba(11,18,32,.78);
  backdrop-filter: blur(10px);
  border-top:1px solid var(--line);
}

.tab{
  flex:1;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 16px;
  padding:10px 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.tab[aria-current="page"]{
  border-color: rgba(122,162,255,.45);
  background: rgba(122,162,255,.12);
}

.toast{
  position:fixed;
  left:14px; right:14px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  padding:10px 12px;
  border-radius:14px;
  background: rgba(0,0,0,.55);
  border:1px solid var(--line);
  color: var(--text);
  opacity:0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events:none;
  font-size:13px;
}
.toast.show{ opacity:1; transform: translateY(0); }
