* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 1000px;
  padding: 20px 16px 60px;
  background: #0f1420;
  color: #e8ecf4;
  font-family: "Segoe UI", system-ui, sans-serif;
}

header { position: relative; }
header h1 { margin: 0 0 4px; font-size: 1.6rem; }
.subtitle { margin: 0 0 16px; color: #93a0b8; font-size: 0.9rem; }
#faq-btn {
  position: absolute;
  top: 2px;
  right: 0;
  width: 34px;
  height: 34px;
  border: 1px solid #2a3550;
  border-radius: 50%;
  background: #1c2333;
  color: #93a0b8;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
#faq-btn:hover { color: #e8ecf4; border-color: #4c8dff; }

/* FAQ page */
.faq { max-width: 72ch; line-height: 1.6; }
.faq h2 { margin: 26px 0 8px; font-size: 1.12rem; }
.faq p { margin: 0 0 10px; color: #c9d1e0; }
.faq ul { margin: 0 0 10px; padding-left: 22px; color: #c9d1e0; }
.faq li { margin-bottom: 4px; }
.faq-data { margin-top: 28px; color: #93a0b8; font-size: 0.8rem; }
main[hidden] { display: none; }

/* Type selector */
.type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.type-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: #1c2333;
  color: #e8ecf4;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: capitalize;
  transition: transform 0.06s;
}
.type-btn:hover { transform: translateY(-1px); filter: brightness(1.15); }
.type-btn.active {
  background: var(--tc);
  border-color: #fff;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.type-btn:not(.active) { border-color: var(--tc); }

.type-bar[hidden] { display: none; }

/* Mode tabs */
.mode-bar { display: flex; gap: 6px; margin-bottom: 12px; }
.mode-btn {
  padding: 6px 18px;
  border: 1px solid #2a3550;
  border-radius: 8px;
  background: #161c2b;
  color: #93a0b8;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.mode-btn:hover { color: #e8ecf4; }
.mode-btn.active { background: #4c8dff; border-color: #4c8dff; color: #fff; }
.boss-bar[hidden], .controls[hidden] { display: none; }

/* Boss picker */
.boss-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: #161c2b;
  border-radius: 10px;
  font-size: 0.9rem;
}
#boss-select {
  padding: 5px 10px;
  border: 1px solid #2a3550;
  border-radius: 8px;
  background: #0f1420;
  color: #e8ecf4;
  font-size: 0.88rem;
  width: 300px;
  max-width: 100%;
}
#boss-select:focus { outline: none; border-color: #4c8dff; }
#boss-select::placeholder { color: #93a0b8; }
.boss-select-wrap { position: relative; display: inline-block; }
.boss-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #1c2333;
  border: 1px solid #2a3550;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 20;
  overflow: hidden;
}
.boss-suggest button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: none;
  color: #e8ecf4;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.boss-suggest button:hover, .boss-suggest button.active { background: #232c42; }
#boss-clear {
  padding: 5px 12px;
  border: 1px solid #2a3550;
  border-radius: 8px;
  background: #1c2333;
  color: #e8ecf4;
  font-size: 0.82rem;
  cursor: pointer;
}
#boss-clear:hover { background: #232c42; }
.boss-info { color: #93a0b8; font-size: 0.82rem; }

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #161c2b;
  border-radius: 10px;
  font-size: 0.9rem;
}
.controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.controls label[hidden] { display: none; }
.controls input[type="checkbox"] { accent-color: #4c8dff; width: 15px; height: 15px; }
.controls.scenario { margin-top: -6px; font-size: 0.85rem; color: #93a0b8; }
.controls select {
  padding: 3px 6px;
  border: 1px solid #2a3550;
  border-radius: 6px;
  background: #0f1420;
  color: #e8ecf4;
  font-size: 0.84rem;
}
.controls select:focus { outline: none; border-color: #4c8dff; }
#search {
  padding: 5px 10px;
  border: 1px solid #2a3550;
  border-radius: 8px;
  background: #0f1420;
  color: #e8ecf4;
  font-size: 0.88rem;
  width: 180px;
}
#search:focus { outline: none; border-color: #4c8dff; }
#search::placeholder { color: #93a0b8; }
.row-count { margin-left: auto; color: #93a0b8; font-size: 0.82rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
td { white-space: nowrap; }
th, td { padding: 7px 10px; text-align: left; }
th { color: #93a0b8; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: #e8ecf4; }
th.sortable.sorted { color: #4c8dff; }
th.sortable.sorted::after { content: " ▾"; }
tbody tr { border-top: 1px solid #1e2637; }
tbody tr:hover { background: #161c2b; }
td.rank { color: #93a0b8; }
td.metric-best { color: #ffd76a; font-weight: 600; }

.mon-name { font-weight: 600; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: 0.03em;
}
.badge.shadow { background: #6d28d9; color: #fff; }
.badge.shadow.hypo { background: transparent; border: 1px dashed #a78bfa; color: #a78bfa; }
.badge.gmax { background: #db2777; color: #fff; }
.badge.mega { background: #b45309; color: #fff; }
.mini-type {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--tc);
  vertical-align: baseline;
}
.move-off-type { color: #93a0b8; }
.elite { color: #ffd76a; }

.show-all-wrap { text-align: center; margin: 14px 0; }
#show-all {
  padding: 8px 22px;
  border: 1px solid #2a3550;
  border-radius: 8px;
  background: #1c2333;
  color: #e8ecf4;
  font-size: 0.88rem;
  cursor: pointer;
}
#show-all:hover { background: #232c42; }

footer { margin-top: 24px; color: #93a0b8; font-size: 0.78rem; line-height: 1.5; }
footer p { margin: 4px 0; }

@media (max-width: 640px) {
  body { padding: 12px 8px 40px; }
  th, td { padding: 6px 6px; }
  .type-btn { padding: 4px 8px; font-size: 0.76rem; }
}
