:root {
  --bg: #111318; --panel: #1a1d24; --panel2: #22262f; --line: #2e333d;
  --text: #e8eaee; --muted: #9aa1ad; --accent: #e3b55a; --accent-ink: #1a1408;
  --ok: #4cb782; --bad: #e0675a; --me: #6aa8ff; --discord: #5865f2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 18px; margin-bottom: 10px; }
h3 { font-size: 15px; }
button, input, select { font: inherit; color: inherit; }
input, select { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.error { color: var(--bad); min-height: 1em; }

.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 17px; color: var(--accent); letter-spacing: .5px; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; }
#who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.navbtn { background: none; border: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.navbtn.active { background: var(--panel2); color: var(--text); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; text-decoration: underline; }
.me-name { font-weight: 600; }

main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; display: flex; flex-direction: column; gap: 10px; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.discord { background: var(--discord); color: #fff; padding: 10px 14px; }
.devlogin { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row label { min-width: 120px; }

.role { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.role-leader { color: var(--accent); border-color: var(--accent); }
.role-officer { color: var(--me); border-color: var(--me); }
.chip { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 2px 9px; margin: 2px 4px 2px 0; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.mine { border-color: var(--me); }
.summary { margin: 8px 0; }

/* my hunters */
.hunters { border-collapse: collapse; width: 100%; max-width: 560px; }
.hunters th, .hunters td { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.hunters thead th { color: var(--muted); font-weight: 500; font-size: 13px; }
.hunters tbody th { font-weight: 500; white-space: nowrap; }
.hunters tr.owned tbody th, .hunters tr.owned th { color: var(--text); }
.hunters .weapon { display: block; }
.power { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.insight { width: 56px; }
.ins { white-space: nowrap; }
.ilabel { color: var(--muted); margin-right: 3px; }
.status { font-size: 12px; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.err { color: var(--bad); }
.weapon { font-size: 11px; color: var(--muted); font-weight: 400; }

/* teams */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.spacer { flex: 1; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.tab { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 1px; color: var(--muted); }
.tab b { color: var(--text); }
.tab.active { border-color: var(--accent); background: var(--panel2); }
.tab .mon { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .time { font-size: 12px; }
.stageinfo { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.el { font-weight: 600; }
.el-fire { color: #ff7a59; } .el-water { color: #4ea1ff; } .el-thunder { color: #f2c94c; } .el-ice { color: #7fd6f5; } .el-dragon { color: #b07cff; }
.stagetools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

.board { display: grid; grid-template-columns: 260px 1fr; gap: 12px; align-items: start; }
.pool { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 10px; position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.pool h3 { margin-bottom: 8px; color: var(--muted); font-weight: 500; }
.poolcards { display: flex; flex-direction: column; gap: 6px; }
.squads { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-items: start; }
.squad { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.squad.full { border-color: #3d4a3f; }
.squad header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.squad header h3 { flex: 1; }
.sqname { flex: 1; background: transparent; border-color: transparent; font-weight: 600; padding: 2px 4px; }
.sqname:hover { border-color: var(--line); }
.total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bonus { font-size: 11px; padding: 1px 6px; border-radius: 10px; white-space: nowrap; }
.bonus.ok { background: rgba(76, 183, 130, .18); color: var(--ok); }
.bonus.no { background: rgba(224, 103, 90, .12); color: var(--bad); }
.icon { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.icon:hover { color: var(--bad); }
.slots { display: flex; flex-direction: column; gap: 6px; }
.slot.empty { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; text-align: center; color: var(--muted); font-size: 12px; }
.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.addsquad { border: 1px dashed var(--line); background: none; border-radius: 10px; color: var(--muted); padding: 20px; cursor: pointer; }
.mcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; }
.mcard[draggable="true"] { cursor: grab; }
.mcard.me { border-color: var(--me); }
.mcard.selected { outline: 2px solid var(--accent); }
.mcard.dragging { opacity: .5; }
.mname { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.mname .role { padding: 0 5px; }
.hline { font-variant-numeric: tabular-nums; }
.hsel { width: 100%; padding: 3px 4px; font-variant-numeric: tabular-nums; }

/* guild */
.members, .hunterlist { border-collapse: collapse; width: 100%; }
.members th, .members td, .hunterlist td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.members thead th { color: var(--muted); font-weight: 500; font-size: 13px; }
.members tr.me td:first-child { color: var(--me); }
.hunterlist input { width: 100%; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--ok); padding: 8px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
#toast.bad { border-color: var(--bad); }

.board > *, .squads > * { min-width: 0; }
.hline { overflow-wrap: anywhere; }
.tablewrap { overflow-x: auto; }

@media (max-width: 760px) {
  main { padding: 12px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .pool { position: static; max-height: 260px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .squads { grid-template-columns: minmax(0, 1fr); }
  .members td:nth-child(3) .chip { white-space: normal; }
  #who { margin-left: 0; }
}
