:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #5b6b61;
  --accent: #2f7a55;
  --accent-dark: #245f42;
  --border: #d5dcd6;
  --bad: #b3412e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 28rem;
  margin: 3rem auto;
  padding: 0 1rem;
}

h1 { color: var(--accent); margin-bottom: 0.25rem; }
.intro, .muted, small { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

form.card { display: grid; gap: 0.9rem; }
form.card p.muted { margin: 0; }

label { display: grid; gap: 0.25rem; font-weight: 600; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.name-row input { width: 100%; }
.count { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.8rem; text-align: center; }
label small { font-weight: 400; }

input {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.6; cursor: wait; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.tabs button { background: transparent; color: var(--muted); padding: 0.4rem 0.75rem; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom: 2px solid var(--accent); border-radius: 0; }

.error { color: var(--bad); margin: 0; min-height: 1.5em; }

a { color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
main.wide { max-width: 60rem; }

/* ---------- Admin page ---------- */
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 1rem 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.admin-nav a { text-decoration: none; font-weight: 600; }
.admin-nav a.current { color: var(--text); text-decoration: underline; }

section.card { margin-bottom: 1.25rem; overflow-x: auto; }
section.card h2 { margin-top: 0; font-size: 1.2rem; }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.inline-form label { font-size: 0.9rem; }
.inline-form input, .inline-form select, td input { min-width: 0; }
td input[type="number"] { width: 7rem; }
td input[type="text"] { width: 100%; }
td input.pct { width: 4.5rem; }
textarea { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; width: 100%; min-width: 14rem; }
label.check { display: flex; gap: 0.3rem; align-items: center; font-weight: 400; font-size: 0.85rem; white-space: nowrap; }
.world-types td { vertical-align: top; }
.world-types td input[type="text"] { min-width: 9rem; }

select {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}

button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.secondary:hover { background: var(--bg); }
button.danger { background: var(--bad); }
button.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

.amount-plus { color: var(--accent); font-weight: 600; }
.amount-minus { color: var(--bad); font-weight: 600; }
.struck { text-decoration: line-through; color: var(--muted); }
.tag { font-size: 0.8rem; color: var(--muted); }
#message.error-message { color: var(--bad); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }

/* ---------- Player home ---------- */
main.home { max-width: 52rem; }
.home-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.home-header p { margin: 0.25rem 0; }
.header-links { display: flex; align-items: center; gap: 1rem; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0 1.25rem; }
.home-grid .card { margin: 0; }
.stat h2 { margin: 0; font-size: 1rem; color: var(--muted); }
.big-number { font-size: 2.2rem; font-weight: 700; color: var(--accent); margin: 0.25rem 0; }
.stat .muted { font-size: 0.9rem; margin-bottom: 0; }

.rank-ladder { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin: 0.25rem 0; font-size: 0.85rem; }
.rank-ladder li { padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.rank-ladder li.current { background: var(--accent); border-color: var(--accent); color: #fff; }

.badge-slots { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0.75rem 0; }
.badge-slots li { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px dashed var(--border); }

.center { text-align: center; }

.season-editor { border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.75rem; }
.season-editor h3 { margin: 0.25rem 0; }
.season-editor > label { margin: 0.5rem 0; }

.quick-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.save-bar { position: sticky; bottom: 0; padding: 0.75rem 0; background: linear-gradient(transparent, var(--bg) 35%); }

.badge-pill { display: inline-block; margin-top: 0.2rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-pill.good { background: #2f7a5522; color: var(--accent-dark); }
.badge-pill.warn { background: #b3412e1a; color: var(--bad); }

.name-edit { display: flex; gap: 0.3rem; margin-bottom: 0.3rem; }
.name-edit input { width: 8rem; }
button.link-like { background: none; border: none; padding: 0; color: var(--accent); font-size: 0.8rem; font-weight: 600; text-decoration: underline; cursor: pointer; }
button.link-like:hover { background: none; color: var(--accent-dark); }

.picker { display: grid; gap: 0.4rem; font-weight: 400; }
.pick-list { max-height: 16rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.6rem; display: grid; gap: 0.2rem; }
.pick-list .pick { display: flex; gap: 0.4rem; align-items: center; font-weight: 400; }
.quick-call { display: grid; gap: 0.3rem; margin-bottom: 0.3rem; min-width: 11rem; }
.quick-call textarea { min-width: 11rem; }

button.link-like.danger-link { color: var(--bad); }

input.email-edit { width: 16rem; max-width: 100%; margin-bottom: 0.3rem; }
