/* ===== Design tokens (light and dark) ===== */
:root {
  --bg: #e9ecff;
  --panel: #fff;
  --ink: #1a1a3a;
  --mute: #5b5f86;
  --line: #1a1a3a;
  --soft: #f0f2ff;
  --hero: #3b2fd9;
  --gold: #f7b500;
  --silver: #c9d1e0;
  --bronze: #cf7a3b;
  --mint: #36e0a1;
  --ok: #0b7a53;
  --bad: #c0392b;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14142b;
    --panel: #1f1f3d;
    --ink: #eceeff;
    --mute: #9a9fc9;
    --line: #0a0a1a;
    --soft: #2a2a52;
    --ok: #5af0b8;
    --bad: #ff8a8a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14142b;
  --panel: #1f1f3d;
  --ink: #eceeff;
  --mute: #9a9fc9;
  --line: #0a0a1a;
  --soft: #2a2a52;
  --ok: #5af0b8;
  --bad: #ff8a8a;
  color-scheme: dark;
}

/* ===== Base ===== */
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    500 15px/1.55 Nunito,
    system-ui,
    sans-serif;
}
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
.px {
  font-family: "Press Start 2P", ui-monospace, monospace;
}
h2 {
  font-size: 19px;
  font-weight: 800;
  margin: 30px 0 12px;
}
h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
a:focus-visible,
summary:focus-visible,
.logbox:focus-visible,
.rewardbox:focus-visible {
  outline: 3px solid var(--hero);
  outline-offset: 2px;
}
.status,
.empty {
  padding: 24px 0;
  margin: 0;
}
.demo {
  font-size: 13px;
  color: var(--mute);
  margin-bottom: 14px;
}
.demo a {
  color: var(--ink);
  font-weight: 700;
  margin-left: 10px;
}
.note {
  margin-top: 30px;
  font-size: 13px;
  color: var(--mute);
}
.muted {
  color: var(--mute);
}
.ok {
  color: var(--ok);
}

/* ===== Coin dots and price chips ===== */
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
}
.dg {
  background: var(--gold);
}
.ds {
  background: var(--silver);
}
.db {
  background: var(--bronze);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 10px;
}

/* ===== Coder card ===== */
.hero {
  background: var(--hero);
  color: #fff;
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--line);
  border-radius: 6px;
  padding: 18px;
  display: grid;
  gap: 18px;
}
.top {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ava {
  flex: none;
  width: 72px;
  height: 72px;
  border: 3px solid #fff;
  border-radius: 6px;
  background: #ffffff26;
  display: grid;
  place-items: center;
  font-size: 26px;
}
.who h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}
.who p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.85;
}
.who .trk {
  font-size: 14px;
  font-weight: 800;
  opacity: 1;
}
.grade {
  margin-left: auto;
  text-align: center;
  font-size: 12px;
}
.grade b {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border: 3px solid #fff;
  border-radius: 6px;
  background: var(--gc);
  font-size: 30px;
  font-weight: 400;
  text-shadow: 2px 2px 0 #0004;
}
.between {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.bar {
  height: 18px;
  border: 3px solid #fff;
  border-radius: 3px;
  background: #0000004d;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--mint);
}
.bar.max i {
  background: var(--gold);
}
.coins {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.coin {
  border: 3px solid #fff;
  border-radius: 6px;
  padding: 10px 6px;
  text-align: center;
  background: #0000002e;
}
.coin b {
  display: block;
  font-size: 17px;
  font-weight: 400;
  margin-bottom: 6px;
}
.coin span {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== Project stacks ===== */
.track {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 6px;
  margin-bottom: 12px;
}
.track > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.track summary small {
  color: var(--mute);
  font-weight: 700;
  white-space: nowrap;
}
.term {
  margin: 0 14px;
  border-top: 2px solid var(--soft);
}
.term:last-child {
  margin-bottom: 10px;
}
.term > summary {
  cursor: pointer;
  padding: 9px 0;
  font-weight: 800;
  font-size: 14px;
  color: var(--mute);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.term > ul {
  padding-bottom: 6px;
}

/* ===== Shared list rows (projects and activity log) ===== */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  margin-bottom: 6px;
  border-radius: 4px;
  background: var(--soft);
  color: inherit;
  text-decoration: none;
}
.row .t {
  flex: 1;
  min-width: 0;
}
.row .d {
  color: var(--mute);
  font-size: 13px;
  white-space: nowrap;
}
a.row:hover {
  outline: 3px solid var(--hero);
  outline-offset: 1px;
}
.amt {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-weight: 800;
}
.amt .chip {
  margin: 0 0 0 8px;
}
.pos {
  color: var(--ok);
}
.neg {
  color: var(--bad);
}
.logbox {
  position: relative;
  max-height: 18rem;
  overflow-y: auto;
  padding: 8px 8px 2px;
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 6px;
}
.hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--mute);
}
.end {
  padding: 6px 0 8px;
  text-align: center;
  font-size: 13px;
  color: var(--mute);
}

/* ===== Rewards ===== */
.cat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.item {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price {
  margin: 0;
  font-size: 13px;
  color: var(--mute);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}
.stock {
  margin: auto 0 0;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ===== Long text safety and reward scroll box ===== */
.row .t,
.who h1,
.item h3,
.track summary span,
.term summary span {
  overflow-wrap: anywhere;
  min-width: 0;
}
.rewardbox {
  position: relative;
  max-height: 34rem;
  overflow-y: auto;
  padding: 12px;
  background: var(--soft);
  border: 3px solid var(--line);
  border-radius: 6px;
}
