:root {
  --bg: #fff7df;
  --bg2: #ffe7ad;
  --card: rgba(255,255,255,.86);
  --card-solid: #fffdf6;
  --ink: #3a291d;
  --muted: #776554;
  --orange: #ff9f43;
  --orange2: #ffbd59;
  --red: #ff6b6b;
  --green: #48c78e;
  --blue: #5ca8ff;
  --purple: #9b7bff;
  --shadow: 0 18px 50px rgba(105, 72, 26, .18);
  --line: rgba(96, 69, 42, .16);
  --radius: 24px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff2c4 0 18%, transparent 36%),
    radial-gradient(circle at 95% 10%, #ffd9bd 0 14%, transparent 32%),
    linear-gradient(145deg, var(--bg), #fff0c9 60%, #fff9ec);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.safe-wrap {
  width: min(100%, 520px);
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -.04em; }
.eyebrow, .tiny-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.app-shell { display: grid; gap: 14px; }
.hero-card, .mission-card, .record-card, .local-card, .modal-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.hero-card { overflow: hidden; }
.cat-stage {
  height: 172px;
  position: relative;
  background: linear-gradient(180deg, #bce6ff 0%, #e9f8ff 58%, #ffe4a4 59%, #ffc370 100%);
  border-radius: 24px 24px 36px 36px;
}
.city-bg { position: absolute; inset: 0; overflow: hidden; }
.cloud { position: absolute; width: 58px; height: 22px; border-radius: 99px; background: rgba(255,255,255,.85); }
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 28px; height: 28px; left: 8px; top: -12px; }
.cloud::after { width: 34px; height: 34px; right: 8px; top: -18px; }
.c1 { top: 28px; left: 24px; animation: drift 12s linear infinite; }
.c2 { top: 46px; right: 18px; transform: scale(.75); animation: drift2 14s linear infinite; }
.building { position: absolute; bottom: 50px; width: 54px; border-radius: 10px 10px 0 0; background: rgba(65, 85, 122, .2); }
.building::before { content:""; position:absolute; inset: 12px 10px; background: repeating-linear-gradient(0deg, rgba(255,255,255,.5) 0 8px, transparent 8px 15px); }
.b1 { height: 68px; left: 24px; }
.b2 { height: 92px; left: 94px; }
.b3 { height: 76px; right: 38px; }
.cat-rider { position: absolute; left: 50%; bottom: 22px; width: 160px; height: 104px; transform: translateX(-50%); animation: bob 1.7s ease-in-out infinite; }
.tail { position: absolute; width: 52px; height: 18px; left: 18px; top: 50px; border: 10px solid #e68132; border-right: 0; border-bottom: 0; border-radius: 50px 0 0 0; transform: rotate(-22deg); }
.cat-body { position: absolute; left: 54px; top: 8px; width: 74px; height: 76px; border-radius: 45% 45% 50% 50%; background: #ffb052; border: 4px solid #7b4a24; }
.ear { position: absolute; width: 22px; height: 24px; top: -16px; background: #ffb052; border: 4px solid #7b4a24; transform: rotate(45deg); border-radius: 7px 3px; }
.ear.left { left: 8px; } .ear.right { right: 8px; }
.face { position: absolute; width: 48px; height: 35px; left: 11px; top: 25px; border-radius: 50%; background: #ffe1ad; }
.eye { position: absolute; width: 7px; height: 9px; background: #2b1c13; top: 32px; border-radius: 50%; }
.e1 { left: 25px; } .e2 { right: 25px; }
.nose { position: absolute; width: 8px; height: 6px; left: 31px; top: 45px; border-radius: 50%; background: #e8635f; }
.bag { position: absolute; width: 38px; height: 34px; right: -28px; bottom: 8px; border-radius: 8px; background: #7fd1ff; border: 4px solid #3d6b82; }
.bag::before { content:""; position:absolute; width:18px; height:8px; border:3px solid #3d6b82; border-bottom:0; top:-11px; left:6px; border-radius: 10px 10px 0 0; }
.scooter { position: absolute; left: 30px; bottom: 0; width: 106px; height: 34px; border-radius: 24px 45px 14px 14px; background: #ff6b6b; border: 4px solid #713a32; }
.scooter::before { content:""; position:absolute; width: 44px; height: 10px; right: -18px; top: -12px; border-top: 5px solid #713a32; transform: rotate(-23deg); }
.wheel { position: absolute; bottom: -13px; width: 26px; height: 26px; border-radius: 50%; background: #45342d; border: 5px solid #ffe0b3; }
.w1 { left: 4px; } .w2 { right: 8px; }
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }
@keyframes drift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }
@keyframes drift2 { 0%,100% { transform: translateX(0) scale(.75); } 50% { transform: translateX(-16px) scale(.75); } }
.hero-info { padding: 16px; display: grid; gap: 9px; }
.date-label { color: var(--muted); font-size: 13px; }
.clue-badges, .current-clues { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; border-radius: 999px; background: #fff4cf; border: 1px solid rgba(120,76,18,.14); color: #6c4616; font-size: 12px; font-weight: 800; }
.badge.bad { background: #ffe7e4; color: #9b302a; }
.badge.good { background: #e7fff3; color: #11623b; }
.badge.info { background: #e9f3ff; color: #185a99; }
.mission-board { display: grid; gap: 12px; }
.mission-card { padding: 14px; display: grid; gap: 13px; transition: transform .18s, opacity .18s; }
.mission-card.done { background: rgba(239,255,246,.9); }
.mission-card.locked { opacity: .72; }
.mission-head { display: flex; gap: 12px; align-items: center; }
.mission-index { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; background: #fff1bd; font-weight: 900; font-size: 20px; color: #945a00; box-shadow: inset 0 -4px rgba(207, 134, 22, .12); }
.mission-index.hard { background: #ffe3e3; color: #bc3c3c; }
.mission-head p, .local-card p, .help-content p { color: var(--muted); font-size: 14px; line-height: 1.55; margin-top: 3px; }
.primary-btn, .ghost-btn, .danger-btn {
  border: 0; border-radius: 16px; padding: 13px 16px; font-weight: 900; cursor: pointer;
}
.primary-btn { background: linear-gradient(180deg, #ffcc68, #ff9f43); color: #4b2705; box-shadow: 0 9px 20px rgba(255,159,67,.26); }
.primary-btn:active, .ghost-btn:active, .danger-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.ghost-btn { background: rgba(255,255,255,.65); border: 1px solid var(--line); }
.danger-btn { background: #fff0f0; color: #9a3030; border: 1px solid rgba(190,30,30,.18); width: 100%; margin-top: 14px; }
.record-card { padding: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.record-card strong { display: block; margin-top: 5px; font-size: 17px; }
.local-card { padding: 15px; }
.local-card h3 { margin-bottom: 6px; }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: end center; padding: 14px; background: rgba(48, 31, 17, .42); }
.modal[hidden] { display: none; }
.modal-card { width: min(100%, 520px); max-height: min(88dvh, 760px); overflow: auto; padding: 16px; background: rgba(255,253,246,.98); }
.game-card { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.modal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f4ead6; font-size: 24px; line-height: 1; cursor: pointer; }
.game-panel { display: grid; gap: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats-grid div { background: #fff7df; border: 1px solid var(--line); border-radius: 15px; padding: 9px 8px; text-align: center; }
.stats-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.stats-grid strong { display: block; margin-top: 3px; font-size: 17px; }
.progress-track { height: 14px; border-radius: 99px; background: #f1dfbd; overflow: hidden; border: 1px solid rgba(110, 75, 22, .13); }
.progress-track span { display:block; height: 100%; width: 0%; background: linear-gradient(90deg, #62d695, #ffca57); border-radius: inherit; transition: width .25s ease; }
.event-log { min-height: 48px; padding: 12px; border-radius: 16px; background: #fff8e8; border: 1px dashed rgba(110,75,22,.2); color: #64492f; line-height: 1.45; }
.route-grid { display: grid; gap: 10px; }
.route-card { text-align: left; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 13px; cursor: pointer; box-shadow: 0 8px 22px rgba(97,64,26,.08); display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.route-card:disabled { opacity: .6; cursor: not-allowed; }
.route-icon { width: 45px; height: 45px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; background: #fff0c7; }
.route-card h4 { margin: 0 0 4px; font-size: 16px; }
.route-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.route-card.stable .route-icon { background: #e8fff3; }
.route-card.risky .route-icon { background: #ffe8e5; }
.route-card.supply .route-icon { background: #e8f2ff; }
.route-card.fast .route-icon { background: #fff1cc; }
.tool-panel { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-btn { border: 1px solid var(--line); background: #f9f3e6; border-radius: 14px; padding: 10px 12px; font-weight: 800; cursor: pointer; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 12px 16px; border-radius: 999px; color: #fff; background: rgba(43, 31, 23, .88); box-shadow: var(--shadow); font-weight: 800; }
@media (min-width: 430px) { .route-grid { grid-template-columns: 1fr; } }
