/* Forever Characters — one stylesheet, no framework, no build step. */

:root {
  --bg: #0e1116;
  --bg-soft: #151a22;
  --panel: #1a212b;
  --panel-2: #212a36;
  --line: #2c3645;
  --text: #e6e9ef;
  --muted: #9aa5b5;
  --dim: #6b7687;
  --gold: #e3c36a;
  --good: #58c27d;
  --warn: #e0a84a;
  --bad: #d9657a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 50% -220px, #1d2735 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

a { color: inherit; }

/* ---------- header ---------- */

header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #141a23, #0f141b);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0 10px;
}

h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: .4px;
}
h1 a { text-decoration: none; color: var(--gold); }
.realm {
  color: var(--dim);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .6px;
  margin-left: 8px;
  text-transform: uppercase;
}

.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; }
.tabs a {
  padding: 8px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-bottom: none;
}
.tabs a:hover { color: var(--text); background: #1b222c; }
.tabs a.on {
  color: var(--gold);
  background: var(--bg);
  border-color: var(--line);
  margin-bottom: -1px;
}

.status { min-height: 20px; padding: 6px 0 10px; color: var(--muted); font-size: 13px; }

.badge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- buttons & inputs ---------- */

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
}
button:hover { background: #2a3442; }
button.primary { background: #3a5a8c; border-color: #4a6da6; }
button.primary:hover { background: #456aa3; }
button.danger { background: #6d2a37; border-color: #8c3747; }
button.danger:hover { background: #80323f; }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #3a5a8c; outline-offset: -1px; }
textarea { resize: vertical; }

main { padding: 18px 0 40px; }

footer { color: var(--dim); font-size: 12px; padding-bottom: 28px; }

.empty { color: var(--dim); padding: 28px 0; text-align: center; }

/* ---------- toolbar / filters ---------- */

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
/* Every page opens on its toolbar or a heading, so give it room under the tabs. */
#view > .toolbar:first-child { margin-top: 14px; }
.toolbar input[type="search"] { width: 220px; }
.toolbar select, .toolbar input { width: auto; }
.toolbar .spacer { flex: 1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.chip.on { color: #0e1116; background: var(--gold); border-color: var(--gold); font-weight: 600; }

/* ---------- stat strip ---------- */

/* ---------- roster ---------- */

.playerhead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.playerhead h2 { margin: 0; font-size: 17px; color: var(--text); }
.playerhead .count { color: var(--dim); font-size: 13px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.card {
  background: linear-gradient(180deg, var(--panel), #161d26);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cc, var(--line));
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: #3d4a5c; background: linear-gradient(180deg, #1e2630, #181f29); }

.card .cname {
  font-weight: 700;
  font-size: 16px;
  color: var(--cc, var(--text));
  display: flex;
  align-items: center;
  gap: 8px;
}
.card .lvl {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.card .sub { font-size: 13px; color: var(--muted); }
.card .sub .sep { color: var(--dim); margin: 0 5px; }

.specs { display: flex; gap: 6px; flex-wrap: wrap; }
.spec {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #1b2430;
  border: 1px solid var(--line);
  color: var(--muted);
}
.spec.main { color: var(--text); }
.spec.tbd { color: var(--dim); font-style: italic; }

.bar { height: 5px; border-radius: 3px; background: #11161d; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cc, #3a5a8c); }

.note {
  font-size: 12.5px;
  color: var(--muted);
  background: #141b24;
  border-left: 2px solid var(--line);
  padding: 5px 9px;
  border-radius: 0 6px 6px 0;
  white-space: pre-wrap;
}

/* ---------- professions on a card ---------- */

.profs { display: flex; flex-direction: column; gap: 7px; }

.prof {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  grid-template-rows: auto auto;
  gap: 1px 8px;
  align-items: center;
}
.prof .icon { grid-row: span 2; font-size: 15px; text-align: center; }
.prof .pname { font-size: 13.5px; }
.prof .pname small { color: var(--dim); }
.prof .pskill { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prof .pbar { grid-column: 2 / span 2; height: 4px; border-radius: 2px; background: #11161d; overflow: hidden; }
.prof .pbar > i { display: block; height: 100%; }
.prof.gathering .pbar > i { background: var(--good); }
.prof.crafting .pbar > i { background: #7aa7e0; }
.prof.secondary .pbar > i { background: var(--muted); }
.prof.unknown .pbar > i { background: var(--dim); }

.tier {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: 1px;
}

.noprof { font-size: 12.5px; color: var(--dim); font-style: italic; }

.plan {
  font-size: 12px;
  color: var(--warn);
}
.plan::before { content: "\2192  "; }

/* ---------- professions page ---------- */

.profcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.profcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.profcard.gap { border-style: dashed; opacity: .75; }

.profcard h3 {
  margin: 0 0 2px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profcard .kind {
  margin-left: auto;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}
.profcard .makes { font-size: 12.5px; color: var(--dim); margin: 0 0 10px; }

.holders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.holders li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  font-size: 13.5px;
  padding: 5px 7px;
  border-radius: 7px;
  background: #161d26;
  cursor: pointer;
}
.holders li:hover { background: #1d2631; }
.holders li .who { color: var(--cc, var(--text)); font-weight: 600; }
.holders li .who small { color: var(--dim); font-weight: 400; margin-left: 5px; }
.holders li .skill { color: var(--muted); font-variant-numeric: tabular-nums; }
.holders li .hbar { grid-column: 1 / span 2; height: 3px; border-radius: 2px; background: #11161d; overflow: hidden; }
.holders li .hbar > i { display: block; height: 100%; background: #7aa7e0; }
.holders li.best { box-shadow: inset 0 0 0 1px #3f4f66; }
.holders li.best .who::after { content: " \2605"; color: var(--gold); }


.section-title {
  margin: 26px 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
}

.unlocked {
  font-size: 12.5px;
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.unlocked b { color: var(--gold); }
.unlocked a { color: var(--muted); }

/* ---------- service board ---------- */

.posts { display: flex; flex-direction: column; gap: 6px; }

.post {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(140px, 1fr) minmax(150px, 1.2fr);
  gap: 3px 14px;
  align-items: baseline;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13.5px;
}
.post[data-post] { cursor: pointer; }
.post[data-post]:hover { border-color: #3d4a5c; }

.post .pitem { font-weight: 600; font-size: 14px; }
.post .pwho { color: var(--muted); font-size: 12.5px; }
.post .pwho b { color: var(--cc, var(--text)); font-weight: 600; }
.post .pwho em { color: var(--dim); font-style: normal; }
.post .pwho small { display: block; color: var(--dim); font-size: 11.5px; }
.post .pmats { color: var(--muted); font-size: 12.5px; }
.post .pnote {
  grid-column: 1 / -1;
  color: var(--dim);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  padding-top: 5px;
  margin-top: 2px;
}

.postgrid { grid-template-columns: 1fr 1fr; }

@media (max-width: 760px) {
  .post { grid-template-columns: 1fr; }
}

/* ---------- dialogs ---------- */

dialog {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  width: min(440px, 94vw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
dialog.wide { width: min(620px, 94vw); }
dialog::backdrop { background: rgba(5, 8, 12, .65); }
dialog h2 { margin: 0 0 12px; font-size: 18px; color: var(--gold); }
dialog p { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
dialog code { background: #121820; padding: 1px 5px; border-radius: 4px; }

dialog label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
dialog label input, dialog label textarea { margin-top: 3px; }

dialog fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px 2px;
  margin: 0 0 12px;
}
dialog legend { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .8px; padding: 0 6px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.grid .span2 { grid-column: span 2; }
.profgrid { grid-template-columns: 1fr 1fr 90px; }
.hint { grid-column: 1 / -1; margin: -6px 0 10px; font-size: 12px; color: var(--dim); min-height: 16px; }
.hint.warn { color: var(--warn); }

dialog menu {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  align-items: center;
}
dialog menu .spacer { flex: 1; }

@media (max-width: 620px) {
  .grid, .profgrid { grid-template-columns: 1fr 1fr; }
  .grid .span2 { grid-column: span 2; }
  .toolbar input[type="search"] { width: 100%; }
}
