:root {
  --ink: #1f2927;
  --muted: #6e7974;
  --line: #dfe5df;
  --paper: #f7f8f3;
  --surface: #ffffff;
  --mint: #dcefe4;
  --green: #237a58;
  --green-dark: #15543d;
  --gold: #efb84e;
  --gold-soft: #fff1ce;
  --coral: #df765e;
  --coral-soft: #ffebe5;
  --shadow: 0 14px 38px rgba(38, 56, 48, .08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(35, 122, 88, .24); outline-offset: 2px; }

.app-shell { min-height: 100dvh; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.topbar { width: min(100% - 32px, 960px); margin: 0 auto; padding: calc(22px + env(safe-area-inset-top)) 0 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 7vw, 34px); line-height: 1.05; letter-spacing: 0; }
h2 { margin-bottom: 4px; font-size: 20px; letter-spacing: 0; }
h3 { margin-bottom: 4px; font-size: 16px; }
.page-wrap { width: min(100% - 32px, 960px); margin: 0 auto; }
.page { display: grid; gap: 16px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-heading p, .subtle { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 0; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.button, .icon-button, .nav-item, .action-card, .text-button { border: 0; }
.button { min-height: 44px; padding: 0 16px; border-radius: 6px; background: var(--green); color: #fff; font-weight: 750; transition: transform .15s ease, background .15s ease; }
.button:hover { background: var(--green-dark); }
.button:active { transform: translateY(1px); }
.button.secondary { background: var(--mint); color: var(--green-dark); }
.button.ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
.button.danger { background: var(--coral-soft); color: #a54732; }
.button.small { min-height: 38px; padding: 0 12px; font-size: 13px; }
.icon-button { min-width: 60px; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--green-dark); background: var(--mint); font-weight: 700; }
.text-button { padding: 4px 0; background: transparent; color: var(--green); font-weight: 700; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.hero-panel { padding: 20px; background: linear-gradient(135deg, #193c31 0%, #276d52 100%); color: #fff; overflow: hidden; position: relative; }
.hero-panel::after { content: ""; position: absolute; width: 180px; height: 180px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; right: -55px; top: -70px; }
.hero-top, .hero-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; }
.hero-label { margin-bottom: 5px; color: #bde2ce; font-size: 13px; }
.hero-name { margin: 0; font-size: 25px; }
.level-badge { min-width: 76px; height: 76px; display: grid; place-items: center; align-content: center; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; background: rgba(255,255,255,.1); }
.level-badge strong { font-size: 24px; line-height: 1; }
.level-badge span { color: #cbeadb; font-size: 11px; }
.xp-block { flex: 1; align-self: flex-end; }
.xp-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: #d5eee0; }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.2); }
.progress-value { height: 100%; border-radius: inherit; background: var(--gold); transition: width .35s ease; }
.hero-stat { min-width: 96px; padding-top: 16px; }
.hero-stat strong { display: block; font-size: 26px; }
.hero-stat span { color: #cbeadb; font-size: 12px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.action-card { min-height: 116px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 5px 18px rgba(38,56,48,.04); }
.action-card:hover { border-color: #9acaae; transform: translateY(-1px); }
.action-card .action-kicker { color: var(--green); font-size: 11px; font-weight: 800; }
.action-card strong { max-width: 100%; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.action-card .action-reward { color: var(--muted); font-size: 12px; }
.action-card.quick-add { align-items: center; justify-content: center; border-style: dashed; color: var(--green); background: #fbfdfa; }
.quick-add strong { color: var(--green); }
.action-card.quick-add .plus { font-size: 28px; line-height: 1; font-weight: 300; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-card { padding: 15px; }
.stat-card strong { display: block; margin-bottom: 4px; font-size: 22px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.goal-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.goal-row:last-child { border-bottom: 0; padding-bottom: 0; }
.goal-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.goal-line span:last-child { color: var(--green); font-weight: 700; }
.goal-row .progress-track { margin-top: 9px; height: 7px; background: #eaf0eb; }
.goal-row .progress-value { background: var(--green); }

.list { display: grid; gap: 10px; }
.list-item { padding: 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.list-item-main { min-width: 0; }
.list-item-main strong { display: block; margin-bottom: 4px; overflow-wrap: anywhere; }
.list-item-main p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.list-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 99px; background: var(--mint); color: var(--green-dark); font-size: 11px; font-weight: 700; }
.chip.gold { background: var(--gold-soft); color: #946716; }
.chip.coral { background: var(--coral-soft); color: #a54732; }

.skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.skill-card { padding: 15px; }
.skill-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.skill-head strong { font-size: 15px; }
.skill-head span { color: var(--green); font-size: 12px; font-weight: 800; }
.skill-card .progress-track { background: #eaf0eb; height: 7px; }
.skill-card .progress-value { background: var(--green); }
.skill-foot { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 11px; }
.achievement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.achievement { min-height: 100px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa; }
.achievement.unlocked { background: var(--gold-soft); border-color: #f0d99d; }
.achievement strong { display: block; margin-bottom: 5px; font-size: 14px; }
.achievement p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.filter-button { min-height: 38px; padding: 0 12px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); }
.filter-button.active { background: var(--green); border-color: var(--green); color: #fff; }
.date-heading { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.history-item { padding: 14px 0; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item strong { display: block; margin-bottom: 4px; font-size: 14px; }
.history-item p { margin: 0; color: var(--muted); font-size: 12px; }
.history-xp { flex-shrink: 0; color: var(--green); font-size: 15px; font-weight: 800; }
.history-item.revoked { opacity: .5; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; line-height: 1.6; }

.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fcfdfb; }
.field textarea { min-height: 84px; resize: vertical; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.45; }
.choice-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { min-height: 54px; display: grid; place-items: center; padding: 5px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); text-align: center; font-size: 12px; cursor: pointer; }
.choice input:checked + label { border-color: var(--green); background: var(--mint); color: var(--green-dark); font-weight: 750; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--green); }

.bottom-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(16px); }
.nav-item { min-height: 54px; display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 6px; background: transparent; color: var(--muted); }
.nav-item span { font-weight: 800; font-size: 13px; }
.nav-item small { font-size: 10px; }
.nav-item.active { color: var(--green); background: #eef7f0; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; align-items: end; background: rgba(25, 42, 35, .38); }
.modal { width: min(100%, 560px); max-height: min(88dvh, 760px); overflow: auto; margin: 0 auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; background: var(--surface); box-shadow: 0 -16px 44px rgba(25,42,35,.2); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin-bottom: 4px; }
.modal-close { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-actions .button { flex: 1 1 130px; }
.feedback-screen { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(16, 45, 35, .84); color: #fff; }
.feedback-box { width: min(100%, 390px); padding: 28px 22px; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; background: rgba(33,91,67,.96); text-align: center; box-shadow: 0 18px 60px rgba(0,0,0,.2); animation: feedback-in .28s ease-out; }
.feedback-box .feedback-mark { color: var(--gold); font-size: 38px; line-height: 1; }
.feedback-box h2 { margin: 14px 0 10px; font-size: 24px; }
.feedback-box p { margin: 6px 0; color: #d9f0e2; line-height: 1.6; }
.feedback-box .feedback-reward { margin: 16px 0; color: #fff; font-size: 22px; font-weight: 800; }
.toast-root { position: fixed; z-index: 40; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); left: 16px; display: grid; justify-items: center; pointer-events: none; }
.toast { max-width: 460px; padding: 11px 15px; border-radius: 6px; background: #1f2927; color: #fff; font-size: 13px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.offline-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-radius: 99px; background: var(--gold-soft); color: #946716; font-size: 11px; font-weight: 700; }

@keyframes feedback-in { from { opacity: 0; transform: scale(.96) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 700px) {
  .page { gap: 20px; }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .skill-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .achievement-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 12px; padding-bottom: 20px; }
}
@media (max-width: 420px) {
  .topbar, .page-wrap { width: min(100% - 24px, 960px); }
  .topbar { padding-top: calc(16px + env(safe-area-inset-top)); }
  .stat-card { padding: 12px 10px; }
  .stat-card strong { font-size: 19px; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .list-item-actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
