:root {
  --paper: #f3efe6;
  --paper-2: #eae4d6;
  --card: #fffcf5;
  --ink: #17150f;
  --ink-soft: #2c2920;
  --muted: #6f6a5b;
  --line: #dcd5c4;
  --line-strong: #c9bfa8;
  --accent: #b23a2e;
  --accent-dark: #8f2c23;
  --accent-soft: #f1d9d3;
  --brass: #9a7b3f;
  --green: #2f6b4f;
  --green-soft: #dde9e1;
  --amber: #a56a12;
  --amber-soft: #f6e6c8;
  --red: #a33a32;
  --red-soft: #f3d8d4;
  --blue: #3f5f8a;
  --blue-soft: #dde5ef;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;
  --shadow: 3px 3px 0 rgba(23, 21, 15, 0.08);
  --shadow-lg: 6px 6px 0 rgba(23, 21, 15, 0.1);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(178, 58, 46, 0.06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(154, 123, 63, 0.08), transparent 55%),
    repeating-linear-gradient(0deg, rgba(23, 21, 15, 0.018) 0, rgba(23, 21, 15, 0.018) 1px, transparent 1px, transparent 28px),
    var(--paper);
  min-height: 100vh;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background: rgba(243, 239, 230, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--accent); border-radius: 8px;
  color: var(--accent); font-family: var(--serif); font-size: 22px; font-weight: 700;
  transform: rotate(-3deg);
  background: var(--card);
}
.brand-text { font-family: var(--serif); font-size: 22px; letter-spacing: 0.4px; font-weight: 700; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: rgba(23, 21, 15, 0.05); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--card); border: 1px solid var(--line); box-shadow: 2px 2px 0 rgba(23,21,15,.06); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.wallet-chip {
  font-family: var(--mono); font-size: 13px; padding: 5px 10px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--card); color: var(--ink-soft); white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.5; border: 1px solid transparent; white-space: nowrap;
}
.badge-muted { background: var(--paper-2); color: var(--muted); border-color: var(--line); }
.badge-green { background: var(--green-soft); color: var(--green); border-color: #bcd3c3; }
.badge-amber { background: var(--amber-soft); color: var(--amber); border-color: #e5cb95; }
.badge-red { background: var(--red-soft); color: var(--red); border-color: #e0b4ad; }
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: #b9c9de; }
.badge-accent { background: var(--accent-soft); color: var(--accent-dark); border-color: #dcb0a8; }

.app { max-width: 1120px; margin: 0 auto; padding: 32px 28px 80px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: var(--serif); font-size: 34px; line-height: 1.25; letter-spacing: 0.5px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 680px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); margin-bottom: 8px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; color: var(--ink); }
h2 { font-size: 24px; margin: 0 0 10px; }
h3 { font-size: 19px; margin: 0 0 8px; }
h4 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.hidden { display: none !important; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-flat { box-shadow: none; }
.card-inset { background: var(--paper); box-shadow: none; }
.card-accent { border-color: #dcb0a8; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.hr-dashed { border-top: 1px dashed var(--line-strong); margin: 16px 0; }

.hero { padding: 34px 30px; border-radius: 20px; background: linear-gradient(135deg, rgba(255,252,245,.95), rgba(234,228,214,.75)); border: 1px solid var(--line); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.hero::after { content: "B"; position: absolute; right: 26px; bottom: -34px; font-family: var(--serif); font-size: 190px; color: rgba(178,58,46,.06); line-height: 1; pointer-events: none; }
.hero h1 { font-size: 40px; margin: 4px 0 12px; max-width: 620px; }
.hero p { max-width: 620px; color: var(--ink-soft); }
.hero .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-ledger { background: var(--ink); color: #f6f1e4; border-radius: 14px; padding: 18px; font-family: var(--mono); font-size: 13px; line-height: 1.9; box-shadow: var(--shadow); }
.hero-ledger .ledger-line { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed rgba(246,241,228,.18); padding: 5px 0; }
.hero-ledger .ledger-line:last-child { border-bottom: 0; }
.hero-ledger .ledger-total { color: #f0b45d; font-size: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); cursor: pointer; line-height: 1.4;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:hover { background: #fff; box-shadow: 2px 2px 0 rgba(23,21,15,.08); text-decoration: none; }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff8f1; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #f6f1e4; }
.btn-dark:hover { background: #2c2920; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(23,21,15,.05); color: var(--ink); box-shadow: none; }
.btn-danger { background: var(--red-soft); border-color: #d9ada6; color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fffdf8; color: var(--ink); outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(178,58,46,.12); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.help { font-size: 12px; color: var(--muted); line-height: 1.5; }
.error-text { color: var(--red); font-size: 13px; margin-top: 8px; white-space: pre-wrap; }

.progress-track { height: 9px; border-radius: 999px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #d9784f); transition: width .3s ease; }
.progress-fill.green { background: linear-gradient(90deg, var(--green), #5f9b7d); }

.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.goal-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.goal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.goal-card h3 { margin: 0; font-size: 19px; line-height: 1.4; }
.goal-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.goal-meta strong { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  transition: border-color .12s ease, background .12s ease;
}
.task-row:hover { border-color: var(--line-strong); background: #fffdf8; }
.task-type {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .03em;
  background: var(--paper-2); border: 1px solid var(--line);
}
.task-type.ship { background: var(--accent-soft); color: var(--accent-dark); border-color: #dcb0a8; }
.task-type.validate { background: var(--blue-soft); color: var(--blue); border-color: #b9c9de; }
.task-type.build { background: var(--green-soft); color: var(--green); border-color: #bcd3c3; }
.task-type.research { background: var(--amber-soft); color: var(--amber); border-color: #e5cb95; }
.task-main { min-width: 0; }
.task-main h4 { margin: 0 0 3px; font-size: 16px; }
.task-sub { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.reward { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--accent-dark); }

.path-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.path-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.path-card.recommended { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(178,58,46,.08); }
.path-card h4 { display: flex; align-items: center; gap: 8px; margin: 0; }
.path-line { font-size: 13px; color: var(--ink-soft); }
.path-line b { color: var(--muted); font-weight: 500; }

.criteria { display: flex; flex-direction: column; gap: 10px; }
.criterion { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); }
.criterion-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.criterion-text { font-weight: 600; line-height: 1.5; }
.req-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.req-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px dashed var(--line); }
.req-row:first-child { border-top: 0; }
.req-index { font-family: var(--mono); color: var(--muted); font-size: 12px; padding-top: 2px; }
.req-text { font-size: 14px; }
.req-must { color: var(--accent-dark); font-size: 11px; border: 1px solid #dcb0a8; border-radius: 999px; padding: 1px 6px; margin-left: 6px; }
.req-note { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: pre-line; }

.evidence { margin-top: 8px; border-left: 3px solid var(--accent); background: #fbf4ec; padding: 9px 12px; border-radius: 0 8px 8px 0; }
.evidence-id { font-family: var(--mono); font-size: 11px; color: var(--brass); }
.evidence-text { font-size: 14px; white-space: pre-line; }
.evidence-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; color: var(--ink-soft); }
.chip-accent { border-color: #dcb0a8; background: var(--accent-soft); color: var(--accent-dark); }
.chip-green { border-color: #bcd3c3; background: var(--green-soft); color: var(--green); }
.chip-amber { border-color: #e5cb95; background: var(--amber-soft); color: var(--amber); }
.chip-red { border-color: #e0b4ad; background: var(--red-soft); color: var(--red); }
.chip-blue { border-color: #b9c9de; background: var(--blue-soft); color: var(--blue); }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }

.score-hero { display: flex; align-items: center; gap: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.score-number { font-family: var(--mono); font-size: 52px; line-height: 1; font-weight: 700; letter-spacing: -2px; }
.score-number small { font-size: 14px; color: var(--muted); letter-spacing: 0; font-weight: 400; }
.score-label { font-size: 13px; color: var(--muted); }
.stamp {
  display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px;
  border: 3px double currentColor; border-radius: 10px; transform: rotate(-4deg);
  font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: .12em;
  color: var(--accent); background: rgba(255,252,245,.65); white-space: nowrap;
}
.stamp.green { color: var(--green); }
.stamp.amber { color: var(--amber); }
.stamp.red { color: var(--red); }

.dim-bar { display: grid; grid-template-columns: 78px minmax(0,1fr) 46px; gap: 10px; align-items: center; margin: 8px 0; }
.dim-bar .bar { height: 10px; border-radius: 999px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line); }
.dim-bar .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #d9784f); }
.dim-bar .num { text-align: right; font-family: var(--mono); font-size: 13px; }

.payout-box { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 14px; background: var(--paper); }
.payout-amount { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--accent-dark); }
.payout-formula { font-size: 12px; color: var(--muted); }

.quote-block { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--ink-soft); }

.job-panel { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--card); box-shadow: var(--shadow); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.job-step { color: var(--muted); font-size: 13px; }
.job-panel .progress-track { height: 12px; }
.job-panel .progress-fill { background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%); background-size: 18px 18px; animation: stripe 1s linear infinite; }
@keyframes stripe { from { background-position: 0 0; } to { background-position: 18px 0; } }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(23,21,15,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.upload-zone {
  border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 24px; text-align: center;
  background: var(--paper); cursor: pointer; transition: border-color .12s ease, background .12s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: #fbf4ec; }
.upload-zone strong { display: block; font-size: 15px; margin-bottom: 4px; }
.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 13px; }
.file-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-section { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); }
.profile-section h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-section .kv { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.profile-section .kv .k { color: var(--muted); font-size: 12px; }
.profile-section .kv .v { white-space: pre-line; }
.profile-context { background: var(--ink); color: #f2ecdd; border-radius: 12px; padding: 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.85; white-space: pre-wrap; overflow-x: auto; max-height: 46vh; overflow-y: auto; }
.profile-context-details summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0 10px; list-style: none; }
.profile-context-details summary::-webkit-details-marker { display: none; }
.profile-context-details summary::before { content: "▸ "; color: var(--brass); }
.profile-context-details[open] summary::before { content: "▾ "; }
.observation { border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 0 10px 10px 0; padding: 10px 12px; background: var(--card); }
.observation.confirmed { border-left-color: var(--green); }
.observation.denied { border-left-color: var(--red); opacity: .7; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.table .amount { font-family: var(--mono); text-align: right; white-space: nowrap; }
.table .amount.pos { color: var(--green); }
.table .amount.neg { color: var(--red); }
.encouragement-card { border-color: #dcb0a8; background: linear-gradient(135deg, #fffcf5, #fbf1e9); }
.encouragement-card h3 { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: 16px; background: rgba(255,252,245,.5); }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 14px; }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { padding: 11px 14px; border-radius: 10px; background: var(--ink); color: #f6f1e4; box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .18s ease; }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.modal-root { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(23,21,15,.42); backdrop-filter: blur(3px); }
.modal {
  width: min(820px, 100%); max-height: 90vh; overflow: auto; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.callout { border: 1px solid var(--line); border-left: 4px solid var(--brass); border-radius: 0 10px 10px 0; padding: 12px 14px; background: var(--paper); }
.callout.accent { border-left-color: var(--accent); }
.callout.green { border-left-color: var(--green); }
.callout.amber { border-left-color: var(--amber); }
.callout.red { border-left-color: var(--red); }
.callout p:last-child { margin-bottom: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

.code { font-family: var(--mono); font-size: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .grid-hero, .grid-2, .grid-3, .goal-grid, .path-grid, .profile-sections { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .task-row { grid-template-columns: 40px minmax(0, 1fr); }
  .task-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
  .brand-text { font-size: 19px; }
  .nav { order: 3; flex-basis: 100%; }
  .app { padding: 20px 14px 60px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 29px; }
  .card { padding: 15px; }
  .page-head h1 { font-size: 28px; }
  .score-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
  .modal { padding: 16px; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


.auth-wrap { min-height: 60vh; display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: min(520px, 100%); }
.auth-card h1 { font-size: 30px; line-height: 1.3; }
.auth-mode .nav, .auth-mode #wallet-chip, .auth-mode #mode-badge, .auth-mode #user-chip, .auth-mode #logout-btn { display: none !important; }
.user-chip { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
