:root {
  color-scheme: light;
  --paper: #f6f1e7;
  --card: #fffdf9;
  --ink: #25231f;
  --muted: #7c7569;
  --line: #e7dece;
  --gold: #b78a3c;
  --gold-dark: #876324;
  --gold-soft: #f0e3c5;
  --green: #357a5b;
  --red: #b44b48;
  --purple: #745b94;
  --shadow: 0 14px 40px rgba(68, 50, 22, .08);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 10% 0, #fffdf8 0, transparent 35%), var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(183, 138, 60, .25); outline-offset: 2px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, .serif { font-family: "Songti SC", "SimSun", serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.gold { color: var(--gold-dark); }
.good { color: var(--green); }
.bad { color: var(--red); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.app-shell { width: min(1120px, 100%); margin: 0 auto; padding: 22px 24px 108px; }
.landing { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.landing-inner { width: min(740px, 100%); text-align: center; }
.brand-mark { width: 76px; height: 76px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 24px; background: var(--ink); color: var(--gold-soft); font-size: 36px; box-shadow: var(--shadow); }
.landing h1 { margin-bottom: 8px; font-size: clamp(38px, 8vw, 70px); font-weight: 500; letter-spacing: .12em; }
.landing-sub { color: var(--gold-dark); letter-spacing: .28em; font-size: 12px; text-transform: uppercase; }
.landing-desc { margin: 26px auto 30px; max-width: 540px; color: var(--muted); line-height: 1.9; }
.landing-actions { width: min(360px, 100%); margin: 0 auto; display: grid; gap: 10px; }
.mode-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 24px 0; }
.mode-chip { border: 1px solid var(--line); background: rgba(255, 253, 249, .8); border-radius: 14px; padding: 12px 16px; color: var(--ink); }
.mode-chip.active { border-color: var(--gold); background: var(--gold-soft); }
.mode-chip small { display: block; margin-top: 3px; color: var(--muted); }
.landing-footer { margin-top: 28px; color: var(--muted); font-size: 12px; }

.btn { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; background: var(--card); color: var(--ink); transition: transform .16s, border-color .16s, box-shadow .16s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--gold); box-shadow: 0 5px 16px rgba(91, 65, 24, .08); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fffaf0; }
.btn-gold { background: linear-gradient(135deg, #c7a055, #a87b30); border-color: transparent; color: white; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: rgba(180, 75, 72, .3); }
.btn-sm { min-height: 34px; padding: 6px 11px; border-radius: 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

.card { background: rgba(255, 253, 249, .96); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 5px 20px rgba(75, 55, 24, .035); }
.card + .card { margin-top: 12px; }
.card h3 { margin-bottom: 10px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head span { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.create-shell { width: min(940px, 100%); margin: 0 auto; padding: 26px 20px 60px; }
.create-head { margin-bottom: 24px; text-align: center; }
.create-head h1 { margin-bottom: 8px; }
.steps { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.steps span { padding: 6px 10px; border-radius: 99px; background: rgba(255, 255, 255, .55); }
.create-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.avatar { flex: 0 0 auto; width: 74px; height: 74px; display: grid; place-items: center; border: 1px solid #dac69e; border-radius: 24px; background: linear-gradient(145deg, #f7e9cc, #d8bc84); color: #4f3d22; font-family: "Songti SC", "SimSun", serif; font-size: 30px; box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .4); }
.avatar.large { width: 96px; height: 96px; font-size: 38px; }
.create-hero h2 { margin: 0 0 6px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 12px; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: white; color: var(--ink); }
.textarea { min-height: 110px; resize: vertical; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--card); color: var(--ink); text-align: left; }
.choice.selected { border-color: var(--gold); background: #fbf2df; box-shadow: inset 3px 0 var(--gold); }
.choice strong { display: block; margin-bottom: 5px; }
.choice small { color: var(--muted); line-height: 1.6; }
.attr-row { display: grid; grid-template-columns: 58px 1fr 38px 76px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.attr-row:last-child { border-bottom: 0; }
.attr-value { text-align: right; font-weight: 700; }
.attr-controls { display: flex; gap: 5px; }
.attr-controls button { width: 34px; min-height: 32px; padding: 0; }
.meter { height: 7px; overflow: hidden; border-radius: 99px; background: #ede5d8; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d5b873, #a8792e); }

.topbar { position: sticky; top: 0; z-index: 10; margin: -22px -24px 22px; padding: 14px 24px; background: rgba(246, 241, 231, .93); border-bottom: 1px solid rgba(215, 200, 175, .7); backdrop-filter: blur(16px); }
.topbar-main { display: flex; align-items: center; gap: 12px; }
.topbar-name { flex: 1; min-width: 0; }
.topbar-name strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-name small { color: var(--muted); }
.resource { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 12px; white-space: nowrap; }
.stat-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { min-width: 0; text-align: center; }
.stat span { display: block; color: var(--muted); font-size: 11px; }
.stat b { display: block; margin-top: 3px; font-size: 15px; }
.stamina-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.stamina-line .meter { flex: 1; }

.profile-card { display: flex; align-items: center; gap: 18px; }
.profile-info { flex: 1; }
.profile-info h2 { margin-bottom: 6px; }
.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--muted); font-size: 11px; }
.tag-gold { border-color: #dcc28c; background: #faf0da; color: var(--gold-dark); }
.tag-green { border-color: #add4c0; background: #edf7f1; color: var(--green); }
.tag-red { border-color: #e3b9b7; background: #fff1f0; color: var(--red); }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick { min-height: 100px; border: 1px solid var(--line); border-radius: 15px; padding: 15px; background: var(--card); color: var(--ink); text-align: left; }
.quick:hover { border-color: var(--gold); }
.quick b { display: block; margin-bottom: 8px; font-size: 16px; }
.quick small { color: var(--muted); line-height: 1.5; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(680px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(6, 1fr); padding: 7px; border: 1px solid rgba(222, 207, 181, .8); border-radius: 20px; background: rgba(35, 34, 31, .96); box-shadow: 0 14px 35px rgba(30, 24, 15, .22); backdrop-filter: blur(16px); }
.nav-btn { border: 0; border-radius: 13px; padding: 9px 4px; background: transparent; color: #bdb6aa; font-size: 12px; }
.nav-btn.active { background: #f4e7cb; color: #4d3819; }

.job-card { position: relative; overflow: hidden; }
.job-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--gold); }
.job-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.job-desc { color: var(--muted); font-size: 13px; line-height: 1.7; }
.progress-track { height: 10px; margin: 10px 0; overflow: hidden; border-radius: 99px; background: #eae1d3; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, #d7bb7b, #9d702b); }
.list { display: grid; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; margin-bottom: 4px; }
.list-main small { color: var(--muted); line-height: 1.5; }
.list-value { text-align: right; white-space: nowrap; }
.empty { padding: 30px 16px; border: 1px dashed #d9ccb8; border-radius: 15px; color: var(--muted); text-align: center; line-height: 1.8; }
.log-list { max-height: 420px; overflow: auto; }
.log-item { padding: 9px 0; border-bottom: 1px dashed var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
.honor { padding: 14px; border-radius: 14px; background: linear-gradient(135deg, #f8edda, #fffdf8); border: 1px solid #e5d1a9; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-btn { border: 0; border-radius: 99px; padding: 8px 13px; background: #ebe3d7; color: var(--muted); }
.tab-btn.active { background: var(--ink); color: #fff; }
.locked { filter: grayscale(1); opacity: .58; }
.modal-head h2 { overflow-wrap: anywhere; }
.modal-body { overflow-wrap: anywhere; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(26, 23, 19, .56); backdrop-filter: blur(5px); }
.modal { width: min(560px, 100%); max-height: min(86vh, 780px); overflow: auto; border: 1px solid #e2d2b5; border-radius: 22px; padding: 22px; background: var(--card); box-shadow: 0 28px 90px rgba(0, 0, 0, .25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eee6da; color: var(--ink); }
.modal-body { color: var(--muted); line-height: 1.8; }
.modal-actions { display: grid; gap: 8px; margin-top: 18px; }
#toast-root { position: fixed; z-index: 200; top: 18px; left: 50%; transform: translateX(-50%); width: min(430px, calc(100% - 30px)); pointer-events: none; }
.toast { margin-bottom: 8px; padding: 12px 16px; border: 1px solid #d9c08d; border-radius: 12px; background: rgba(35, 34, 31, .96); color: #fff7e8; box-shadow: var(--shadow); text-align: center; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.fade-in { animation: fade-in .25s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 760px) {
  .app-shell { padding: 14px 14px 102px; }
  .topbar { margin: -14px -14px 16px; padding: 12px 14px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip { grid-template-columns: repeat(3, 1fr); row-gap: 12px; }
  .resource { padding: 6px 8px; }
  .topbar .avatar { width: 48px; height: 48px; border-radius: 16px; font-size: 22px; }
  .bottom-nav { bottom: 8px; }
  .nav-btn { font-size: 11px; }
  .card { padding: 15px; border-radius: 16px; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .choice-grid { grid-template-columns: 1fr; }
  .profile-card { align-items: flex-start; }
  .profile-card .avatar { width: 62px; height: 62px; border-radius: 19px; font-size: 26px; }
  .create-hero { align-items: flex-start; }
  .attr-row { grid-template-columns: 50px 1fr 32px 72px; gap: 7px; }
  .list-row { align-items: flex-start; flex-wrap: wrap; }
  .list-row > .btn, .list-row > .btn-row { margin-left: auto; }
  .landing h1 { letter-spacing: .06em; }
  .topbar-name small { font-size: 10px; }
  .resource { font-size: 11px; }
}
