/* 温暖手账风：米色纸张、棕色描边、胶带、圆角贴纸 */
:root {
  --paper: #fbf5e8; --paper2: #f5ebd7; --ink: #4a3a2a; --muted: #9a8670; --line: #d9c4a3; --brown: #8a6a4a;
  --accent: #e8935a; --green: #81b29a; --red: #e07a5f; --yellow: #f2c14e;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --hand: "Hannotate SC", "HanziPen SC", "Kaiti SC", "STKaiti", var(--font);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #efe2c9; color: var(--ink); font: 14px/1.5 var(--font); }
#view { position: fixed; inset: 0; }
#view canvas { display: block; width: 100%; height: 100%; }
button { font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px; padding: 5px 12px; cursor: pointer; }
button:hover { background: #fff8ea; border-color: var(--brown); }
button.primary { background: var(--accent); border-color: #c46f3a; color: #fff; font-weight: 600; }
button.primary:hover { background: #f0a06a; }
button.danger { color: var(--red); }
button.on { background: #ffe6c2; border-color: var(--brown); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: #4f9a76; } .down { color: var(--red); }
[hidden] { display: none !important; }

.card, #top, #tasks, #tutorial, #panel, #build, .dlg, .settle, .title-card, .lcard {
  background: var(--paper); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 6px 20px rgba(90, 60, 30, .18);
}

/* 顶部状态栏 */
#top { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; align-items: center; padding: 5px 8px; white-space: nowrap; z-index: 5; }
#top:empty { display: none; }
#top .blk { padding: 2px 10px; border-right: 1.5px dashed var(--line); }
#top .blk:last-child { border-right: 0; }
#top .name { font-family: var(--hand); font-size: 16px; font-weight: 700; }
#top .money b { font-size: 16px; }
#top .money span { font-size: 12px; margin-left: 4px; }
#top .star { color: #d9822b; font-size: 16px; }
#top .stars { color: #e8a33b; font-size: 11px; margin-left: 3px; }
#top .speed button { padding: 1px 8px; border-radius: 7px; margin-left: 2px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; border: 1px solid rgba(0,0,0,.15); }
#phase-btn { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); font-size: 17px; padding: 8px 26px; background: var(--accent); color: #fff; border-color: #c46f3a; font-weight: 700; z-index: 5; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(232,147,90,.25); } }

/* 右侧任务 */
#tasks { position: fixed; right: 12px; top: 64px; width: 270px; padding: 8px 10px; z-index: 4; max-height: calc(100vh - 160px); overflow: auto; }
#tasks:empty { display: none; }
.tasks-head { display: flex; gap: 8px; align-items: center; }
.tasks-head button { margin-left: auto; padding: 1px 8px; font-size: 12px; }
.hot { background: var(--red); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0; }
.filters button { padding: 0 7px; font-size: 12px; border-radius: 8px; }
.trow { position: relative; display: flex; gap: 6px; align-items: center; padding: 5px 6px; margin: 3px 0; border-radius: 8px; background: var(--paper2); cursor: pointer; overflow: hidden; }
.trow:hover { background: #ffeccc; }
.trow.urgent { background: #fde0d6; }
.trow .lb { flex: 1; }
.trow .who { font-size: 11px; color: var(--brown); }
.trow .u { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); }
.empty, .more { color: var(--muted); padding: 6px; }
.tip { color: var(--muted); font-size: 11px; margin: 6px 0 0; }

/* 新手目标 */
#tutorial { position: fixed; left: 12px; top: 64px; width: 250px; padding: 8px 12px; z-index: 4; }
#tutorial h4 { margin: 0 0 4px; font-family: var(--hand); font-size: 16px; }
.goal { padding: 1px 0; }
.goal.done { color: var(--muted); text-decoration: line-through; }

/* 底部入口 */
#dock { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5; }
#dock button { display: flex; flex-direction: column; align-items: center; width: 64px; padding: 4px 0 3px; font-size: 12px; border-radius: 12px; box-shadow: 0 3px 10px rgba(90,60,30,.15); }
#dock button span { font-size: 22px; line-height: 1.2; }

/* 面板 */
#panel { position: fixed; left: 12px; top: 64px; bottom: 90px; width: 420px; padding: 14px 16px; overflow: auto; z-index: 6; }
#panel h2 { margin: 0 0 8px; font-family: var(--hand); font-size: 22px; }
#panel h3 { margin: 14px 0 6px; font-size: 14px; border-bottom: 1.5px dashed var(--line); padding-bottom: 2px; }
#panel .close { position: absolute; right: 10px; top: 10px; padding: 0 8px; }
.catrow { display: flex; gap: 10px; padding: 6px; border-radius: 10px; cursor: pointer; border: 1.5px solid transparent; }
.catrow:hover { background: var(--paper2); border-color: var(--line); }
.catrow img { width: 84px; height: 84px; border-radius: 10px; background: #f3e7d2; }
.ci { flex: 1; }
.mini { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 6px; align-items: center; font-size: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.tag { background: #f1e2c8; border-radius: 8px; padding: 0 7px; font-size: 12px; }
.tag.main { background: #ffd9b0; font-weight: 600; }
.tag.biz { background: #d8ecdf; }
.tag.bad { background: #f9d3c8; }
.chip { display: inline-block; background: #efe2c9; border-radius: 8px; padding: 0 7px; font-size: 12px; }
.chip.rare { background: #e9d5ff; color: #6b3fa0; }
.sbar { height: 8px; background: #eadbc2; border-radius: 4px; overflow: hidden; min-width: 50px; }
.sbar i { display: block; height: 100%; border-radius: 4px; }
.cathead { display: flex; gap: 12px; align-items: center; }
.cathead img { width: 130px; height: 130px; border-radius: 12px; background: #f3e7d2; }
.cathead .big { font-size: 20px; font-weight: 700; font-family: var(--hand); }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.stats { display: grid; grid-template-columns: 48px 1fr 48px 1fr; gap: 4px 8px; align-items: center; font-size: 12px; }
.reason { background: #fff3dc; border-left: 4px solid var(--yellow); padding: 4px 8px; border-radius: 4px; }
.log { font-size: 12px; max-height: 180px; overflow: auto; background: var(--paper2); padding: 6px 8px; border-radius: 8px; }
.genes { font-size: 12px; color: #6d5a45; padding-left: 18px; }
.adopt { display: grid; grid-template-columns: 1fr; gap: 10px; }
.acard { border: 1.5px dashed var(--line); border-radius: 12px; padding: 8px; display: grid; grid-template-columns: 110px 1fr; gap: 0 10px; align-items: start; }
.acard img { grid-row: span 7; width: 110px; height: 110px; border-radius: 10px; background: #f3e7d2; }
.acard button { margin-top: 4px; justify-self: start; }
.rating { display: flex; gap: 12px; align-items: center; }
.rating .score { font-size: 42px; font-weight: 700; color: #d9822b; font-family: var(--hand); }
.stars { color: #e8a33b; }
.stars.big { font-size: 20px; }
.dist { margin-left: auto; font-size: 11px; width: 120px; }
.dist i { display: inline-block; height: 6px; background: var(--yellow); border-radius: 3px; vertical-align: middle; max-width: 70px; }
.rv { background: var(--paper2); border-radius: 10px; padding: 6px 9px; margin: 6px 0; }
.rv details { font-size: 12px; color: var(--muted); }
.why { display: inline-block; margin-right: 6px; }
.form label { display: flex; justify-content: space-between; margin-top: 8px; }
.form input[type=range] { width: 100%; accent-color: var(--accent); }
.staff { border: 1.5px dashed var(--line); border-radius: 10px; padding: 6px 9px; margin: 6px 0; }
.allow label { margin-right: 6px; font-size: 12px; }
.keys { padding-left: 18px; font-size: 13px; }

/* 装修 */
#build { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); width: min(1000px, 94vw); padding: 8px 12px; z-index: 6; }
.bhead { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.bhead .muted { font-size: 12px; flex: 1; }
.shop { display: flex; flex-wrap: wrap; gap: 5px; }
.shop button { display: flex; flex-direction: column; align-items: center; padding: 4px 9px; position: relative; font-size: 12px; }
.shop button span { color: var(--accent); }
.shop button i { position: absolute; right: 3px; top: 1px; font-style: normal; font-size: 10px; }

/* 提示、气泡、对话 */
#toasts { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 20; pointer-events: none; }
.toast { background: var(--paper); border: 2px solid var(--line); border-radius: 12px; padding: 5px 14px; box-shadow: 0 4px 12px rgba(90,60,30,.18); transition: opacity .4s, transform .4s; max-width: 70vw; }
.toast.good { border-color: var(--green); } .toast.bad { border-color: var(--red); background: #fff1ec; font-weight: 600; } .toast.warn { border-color: var(--yellow); }
.toast.out { opacity: 0; transform: translateY(-8px); }
#tooltip { position: fixed; z-index: 30; pointer-events: none; background: rgba(255,251,242,.97); border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; max-width: 240px; box-shadow: 0 4px 12px rgba(90,60,30,.18); }
.tt-bars { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; align-items: center; margin: 4px 0; }
#dialog { position: fixed; left: 0; right: 0; bottom: 40px; display: flex; justify-content: center; z-index: 40; }
.dlg { width: min(720px, 92vw); padding: 16px 20px 14px; position: relative; display: flex; flex-direction: column; gap: 10px; }
.dlg .who { font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--brown); min-height: 1em; }
.dlg .say { font-size: 17px; }
.dlg input { font: inherit; font-size: 18px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; width: 240px; }
.dlg button { align-self: flex-end; }

/* 结算 */
#modal { position: fixed; inset: 0; background: rgba(60,40,20,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.settle { width: min(640px, 94vw); max-height: 90vh; overflow: auto; padding: 20px 24px; position: relative; }
.settle h2 { margin: 0 0 8px; font-family: var(--hand); font-size: 24px; }
.settle h3 { margin: 12px 0 4px; font-size: 14px; border-bottom: 1.5px dashed var(--line); }
.settle .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settle .cols div div { display: flex; justify-content: space-between; }
.settle .net { font-size: 22px; font-weight: 700; text-align: center; margin: 10px 0; font-family: var(--hand); }
.settle button { display: block; margin: 14px auto 0; font-size: 16px; padding: 8px 24px; }
.tape { position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); width: 110px; height: 24px; background: rgba(240, 200, 140, .75); border-radius: 3px; }

/* 标题与加载 */
#title, #loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 60; }
#loading { background: #efe2c9; }
#title { background: linear-gradient(180deg, rgba(239,226,201,.1), rgba(239,226,201,.55)); }
.title-card, .lcard { padding: 28px 40px; text-align: center; position: relative; min-width: 340px; }
.title-card h1, .lcard h1 { font-family: var(--hand); font-size: 48px; margin: 6px 0 0; letter-spacing: 6px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.title-btns { display: flex; gap: 10px; justify-content: center; }
.title-btns button { font-size: 18px; padding: 8px 28px; }
.credit { font-size: 11px; color: var(--muted); margin-top: 18px; }
.credit a { color: var(--brown); }
.lbar { height: 10px; background: #eadbc2; border-radius: 5px; overflow: hidden; margin-top: 10px; }
.lbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
