:root{
  --bg0:#070b14;
  --bg1:#0b1020;
  --panel: rgba(255,255,255,0.05);
  --panel2: rgba(255,255,255,0.035);
  --stroke: rgba(255,255,255,0.10);
  --text: rgba(233,240,255,0.92);
  --muted: rgba(233,240,255,0.65);
  --r: 18px;
}

html, body { height: 100%; }

body{
  margin:0;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;

  /* IMPORTANT: remove the scrolling background from body */
  background: none;
}

/* Fixed background layer (prevents scroll seam / cutoff) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(32,74,130,0.35), transparent 60%),
    radial-gradient(1000px 800px at 80% 30%, rgba(16,130,110,0.22), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));

  /* helps some mobile browsers render smoothly */
  transform: translateZ(0);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(32,74,130,0.35), transparent 60%),
    radial-gradient(1000px 800px at 80% 30%, rgba(16,130,110,0.22), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

a{ color:inherit; text-decoration:none; }

.container{
  max-width: 1220px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.topbar{
  position: sticky;
  top:0;
  z-index: 5;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.topbarLeft{ display:flex; flex-direction:column; gap:4px; }
.brand{ font-weight:900; letter-spacing:0.2px; }
.sub{ font-size:12px; color:var(--muted); }

.topbarRight{ display:flex; gap:10px; align-items:center; }
select{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  outline:none;
}

.linkBtn{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.mainLayout{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  align-items:start;
}
@media (max-width: 980px){
  .mainLayout{ grid-template-columns: 1fr; }
}

.panel{
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}

.panelTitleRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}

.panelTitle{
  font-weight: 900;
  font-size: 16px;
}

.row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top: 10px;
}
.row.wrap{ flex-wrap:wrap; }
.row.split{ display:flex; align-items:flex-end; gap:18px; flex-wrap:wrap; }

/* New generation row layout */
.generateRow{
  display:flex;
  align-items:flex-end;
  gap:12px;
  padding: 8px 0;
  margin-bottom: 20px;
}

.genInputGroup{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.genInputGroup label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
  font-weight:700;
}
.genInputGroup input{
  width: 80px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 10px;
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
  font-size: 14px;
}

#btnGenerate{
  flex: 1;
  padding: 10px 24px;
  height: 42px;
  font-size: 14px;
  letter-spacing: 0.5px;
  font-weight: 800;
  color: #fff;
  background: #4285f4;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  outline: none;
}
#btnGenerate:hover{
  background: #5191f5;
}
#btnGenerate:active{
  transform: scale(0.98);
}

#meta{
  font-size:11px;
  color:var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  opacity: 0.7;
}

@media (max-width: 480px) {
  .generateRow {
    flex-wrap: wrap;
    align-items: flex-end;
  }
  #btnGenerate {
    width: 100%;
    flex: none;
  }
  .genInputGroup {
    flex: 1;
  }
}

.col{ display:flex; flex-direction:column; gap:6px; }
.col.center{ align-items:center; }

.label{ color: var(--muted); font-size: 12px; }
.label.small{ font-size: 11px; color: rgba(233,240,255,0.60); }
.label.xsmall{ font-size: 10px; color: rgba(233,240,255,0.50); text-transform:uppercase; letter-spacing:0.3px; }

.search, input[type="number"]{
  width:100%;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  outline:none;
}

.pill{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  font-size: 12px;
  color: rgba(233,240,255,0.80);
}

.btn{
  cursor:pointer;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(46, 230, 182, 0.12);
  color: var(--text);
  font-weight: 800;
}
.btn:hover{ filter: brightness(1.08); }
.btn.ghost{
  background: rgba(255,255,255,0.045);
  font-weight: 700;
}

.tabs{ display:flex; gap:8px; margin-top: 10px; flex-wrap:wrap; }
.tab{
  cursor:pointer;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(233,240,255,0.88);
  font-weight: 800;
}
.tab.active{
  background: rgba(46, 230, 182, 0.12);
  border-color: rgba(46, 230, 182, 0.22);
}

.toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
}
.toggle input{ width:16px; height:16px; }
.toggleLabel{ font-size: 12px; color: rgba(233,240,255,0.86); font-weight: 700; }

.charGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
@media (max-width: 980px){
  .charGrid{ grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 560px){
  .charGrid{ grid-template-columns: repeat(4, 1fr); }
}

.charTile{
  cursor:pointer;
  user-select:none;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(0,0,0,0.14);
  padding: 10px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  position:relative;
}
.charTile:hover{ filter: brightness(1.06); }

.charTile .check{
  position:absolute;
  top:8px; right:8px;
  width:18px; height:18px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 12px;
}

.portrait{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.2);
}

.charTile .name{
  font-size: 11px;
  font-weight: 800;
  color: rgba(233,240,255,0.90);
  text-align:center;
  line-height: 1.1;
}

.charTile.selected{
  border-color: rgba(46, 230, 182, 0.32);
  box-shadow: 0 0 0 3px rgba(46, 230, 182, 0.12);
}

.variationCard{
  margin-top: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 12px;
}

.variationTitle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}

.variationRows{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.slotRow{
  display:flex;
  flex-direction: column;
  gap:10px;
  align-items:stretch;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.14);
}

.slotLabel{
  width: 100%;
  font-weight: 900;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.3;
}

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

.slotMembers{
  display:flex;
  gap:10px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}
.slotMembers::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.member{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  min-width: 0;
  flex: 1;
}

.member .portrait{
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.member .name{
  font-size: 11px;
  font-weight: 800;
  text-align:center;
}

.error{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,80,80,0.25);
  background: rgba(255,80,80,0.08);
  color: rgba(255,220,220,0.95);
  font-weight: 800;
}

/* Drawer */
.drawer{
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 92vw);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 50;
  display:flex;
  flex-direction:column;
}

.drawer.hidden{ display:none; }

.drawerHeader{
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.drawerTitle{
  font-weight: 900;
  font-size: 14px;
}

.drawerControls{
  padding: 12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.drawerBody{
  padding: 12px 14px 18px;
  overflow:auto;
}

/* Missing character styling inside drawer teams */
.member.missing{
  opacity: 0.35;
  filter: grayscale(0.35);
}
.missingTag{
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(233,240,255,0.80);
}
select {
  color: rgba(233,240,255,0.95);
  background: rgba(10, 18, 35, 0.65);
  border: 1px solid rgba(255,255,255,0.12);
}

select:focus {
  outline: none;
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(120, 180, 255, 0.12);
}

/* The opened dropdown items (works in most browsers) */
select option,
select optgroup {
  background-color: #0b1326;   /* dark */
  color: rgba(233,240,255,0.95);
}

/* If an option is disabled, keep it readable */
select option:disabled {
  color: rgba(233,240,255,0.45);
}

.hidden { display: none !important; }
.clickableMember { cursor: pointer; }
.clickableMember:focus { outline: 2px solid rgba(140,170,255,0.65); outline-offset: 2px; }
.member.clickableMember{
  cursor: pointer;
}

.member.clickableMember:focus{
  outline: 2px solid rgba(140,170,255,0.65);
  outline-offset: 2px;
  border-radius: 12px;
}

.charTile.missing {
  opacity: 0.6;
  filter: grayscale(0.5);
}

#teamsSearchSuggestions .charTile.missing {
  opacity: 0.7;
  filter: grayscale(0.3);
}

.charGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
}

#teamsSearchSuggestions {
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
}

#teamsSearchSuggestions .charTile {
  cursor: pointer;
  transition: transform 0.2s;
}

#teamsSearchSuggestions .charTile:hover {
  transform: scale(1.05);
}

/* -----------------------------
   Rank badges (CSS only)
------------------------------ */

.variationTitleRight{
  display:flex;
  align-items:center;
  gap:10px;
}

.teamMeta{
  display:flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  align-self: center;
  min-width: 44px;
  margin-left: auto; /* Push to the far right */
}

/* -----------------------------
   Rank badges (colored letter, no background)
------------------------------ */

.rankBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  font-weight: 900;
  font-size: 24px;         /* bigger default */
  line-height: 1;
  letter-spacing: -0.03em;

  background: transparent;
  border: none;
  padding: 0;

  /* keeps it readable on dark UI */
  text-shadow: 0 1px 2px rgba(0,0,0,0.75);
}

.rankBadge.smallBadge{
  font-size: 18px;
}

/* premium S (pink) */
.rankBadge.rank-s{
  color: #ff4fb8;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.75),
    0 0 10px rgba(255, 79, 184, 0.35);
}

/* good -> green */
.rankBadge.rank-a{
  color: #36e37a;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.75),
    0 0 10px rgba(54, 227, 122, 0.28);
}

/* mid -> yellow/orange */
.rankBadge.rank-b{ color:#b8f34a; text-shadow: 0 1px 2px rgba(0,0,0,0.75), 0 0 10px rgba(184,243,74,0.18); }
.rankBadge.rank-c{ color:#ffd24a; text-shadow: 0 1px 2px rgba(0,0,0,0.75), 0 0 10px rgba(255,210,74,0.16); }
.rankBadge.rank-d{ color:#ff9b3d; text-shadow: 0 1px 2px rgba(0,0,0,0.75), 0 0 10px rgba(255,155,61,0.14); }

/* bad -> red */
.rankBadge.rank-e{ color:#ff5a5a; text-shadow: 0 1px 2px rgba(0,0,0,0.75), 0 0 10px rgba(255,90,90,0.13); }
.rankBadge.rank-f{ color:#d63b3b; text-shadow: 0 1px 2px rgba(0,0,0,0.75), 0 0 10px rgba(214,59,59,0.10); }

.rankBadge.rank-x{ color: rgba(233,240,255,0.55); }

/* About page */
.aboutPanel{
  max-width: 860px;
}

.aboutText{
  margin: 10px 0;
  color: rgba(233,240,255,0.88);
  line-height: 1.65;
}

.aboutEmail{
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: rgba(233,240,255,0.95);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.aboutLegal{
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

/* -----------------------------
   Views + Navigation
------------------------------ */

.view { display: none; }
body[data-view="suggestions"] #viewSuggestions { display: block; }
body[data-view="characters"]  #viewCharacters  { display: block; }
body[data-view="abyss"]       #viewAbyss       { display: block; }
body[data-view="onslaught"]   #viewOnslaught   { display: block; }
body[data-view="explore"]     #viewExplore     { display: block; }
body[data-view="more"]        #viewMore        { display: block; }

/* Desktop top nav */
.topnav{
  display:flex;
  gap:8px;
  align-items:center;
  margin: 0 12px;
}

.navBtn{
  cursor:pointer;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(233,240,255,0.88);
  font-weight: 900;
  font-size: 12px;
}
.navBtn.active{
  background: rgba(46, 230, 182, 0.14);
  border-color: rgba(46, 230, 182, 0.25);
}

/* Mobile bottom nav */
.bottomNav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display:none; /* enabled via media query */
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.bottomNavBtn{
  flex:1;
  cursor:pointer;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(233,240,255,0.88);
  font-weight: 900;
  font-size: 12px;
}
.bottomNavBtn.active{
  background: rgba(46, 230, 182, 0.16);
  border-color: rgba(46, 230, 182, 0.28);
}

/* Responsive rules */
@media (max-width: 980px){
  .topnav { display:none; }
  .bottomNav { display:flex; }
  body { padding-bottom: 74px; } /* make room for bottom nav */
  body[data-view="suggestions"] #viewSuggestions { display: block; }
  #viewSuggestions .mainLayout { grid-template-columns: 1fr; }
  #pickerPanel { border-radius: 0; border: none; box-shadow: none; border-top: 1px solid rgba(255,255,255,0.08); }
  main.container{ padding-bottom: 88px; }
}