:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --line: #2a2e38;
  --text: #f2f4f8;
  --muted: #8b93a3;
  --accent: #c6ff3d;
  --accent-ink: #11140a;
  --danger: #ff5a5f;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 32px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 76px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.head { padding: 8px 0 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.empty { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.px { image-rendering: pixelated; }
.empty .big { width: 64px; height: 64px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; font-weight: 400; }
.center { text-align: center; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit;
  font-size: 17px; /* ≥16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
[hidden] { display: none !important; }

.toast {
  background: var(--text);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  animation: toast 3.5s forwards;
}
@keyframes toast { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

.auth .page { justify-content: center; min-height: 100dvh; padding-bottom: 32px; }
.brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.brand img { border-radius: 18px; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 5px 0 max(env(safe-area-inset-bottom), 6px);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }

/* install + push prompt */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; align-items: center; gap: 14px; }
.step p { margin: 0; flex: 1; font-size: 18px; line-height: 1.35; }
.step .px { flex: none; border-radius: 10px; } /* rounds the app icon in step 3 like a Home Screen tile */
.step-n {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 18px;
}
details.card summary { font-weight: 600; cursor: pointer; }
details.card p { margin-top: 10px; }
.push-card { display: flex; align-items: flex-start; gap: 14px; }
.push-card .px { flex: none; margin-top: 2px; }
.push-card .stack { flex: 1; gap: 8px; }
/* fights */
a.btn { display: block; text-align: center; text-decoration: none; }
.btn.shrink { width: auto; flex: none; padding: 12px 16px; }
select {
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  width: 100%;
}
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; padding: 0; accent-color: var(--accent); flex: none; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 16px; min-height: 44px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.hint { color: var(--muted); }
.back { font-size: 15px; font-weight: 600; text-decoration: none; display: inline-block; padding: 6px 0; }
.section { padding: 8px 0 0; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline > input { min-width: 0; flex: 1; }
.suffix { color: var(--muted); font-size: 15px; white-space: nowrap; }
.alert { background: rgba(255, 90, 95, 0.12); border: 1px solid var(--danger); color: var(--text); border-radius: 12px; padding: 12px 14px; }
.card-link { color: inherit; text-decoration: none; display: block; }
.card-link p { margin: 2px 0 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; }
.seg span { display: block; text-align: center; padding: 11px 8px; border-radius: 9px; font-weight: 700; font-size: 16px; color: var(--muted); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px 8px 10px; min-height: 44px; }
.chip:disabled { opacity: 0.4; }
.chip:active:not(:disabled) { border-color: var(--accent); }
.custom { background: var(--bg); border-radius: 12px; padding: 14px; border: 1px dashed var(--line); }

.goal.card { background: var(--bg); }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-head > div, .goal-head > strong { flex: 1; min-width: 0; }
.goal-head .btn { margin-left: auto; }
.goal-rule { padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.goal-rule .small, .goal-head p { margin: 0; }
.target { margin: 0; }

details.more summary { font-size: 19px; font-weight: 700; cursor: pointer; min-height: 28px; }
details.more[open] summary { margin-bottom: 12px; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }

.tag { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.accepted { color: var(--accent); border-color: var(--accent); }
.tag.no { color: var(--danger); border-color: var(--danger); }
.diff { margin: 0; padding-left: 12px; border-left: 3px solid var(--accent); }

.hp-list { display: flex; flex-direction: column; gap: 8px; }
.hp-row { display: flex; align-items: center; gap: 10px; }
.hp-name { width: 76px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.hp-row.me .hp-name { color: var(--text); font-weight: 700; }
.hp-num { width: 30px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* pull to refresh */
.ptr {
  position: fixed;
  top: calc(env(safe-area-inset-top) - 48px);
  left: 50%;
  margin-left: -22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  z-index: 50;
  pointer-events: none;
  transition: transform 0.2s;
}
.ptr.dragging { transition: none; }
.ptr.ready { border-color: var(--accent); }
.ptr.loading { transform: translateY(84px) !important; }
.ptr.loading img { animation: ptr-spin 0.6s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* add to home screen banner */
.a2hs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}
.a2hs img { flex: none; }

/* copy rules from another fight */
.copy-from { display: flex; align-items: flex-end; gap: 10px; }
.copy-from label { flex: 1; }

/* log tab */
.seg a { display: block; text-align: center; padding: 11px 8px; border-radius: 9px; font-weight: 700; font-size: 16px; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--accent); color: var(--accent-ink); }
.log-line { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.log-line .px { flex: none; }
.bad { color: var(--danger); font-weight: 700; }
