/* 一缸一塘 · 样式。--u = 画布宽 / 375，所有尺寸跟着它缩放 */
:root {
  --bg: #0E1D19; --panel: #F4EED2; --ink: #1F3A34; --ink-2: #516E7D; --muted: rgba(31, 58, 52, 0.62);
  --teal: #1D4137; --teal-2: #2C4742; --line: #3A5A50; --cream: #EFE6CF; --gold: #BEAE62; --orange: #D9772F; --red: #E8836F;
  --u: 1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { display: flex; align-items: center; justify-content: center; font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; color: var(--cream); }
#app { position: relative; overflow: hidden; border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
@media (max-width: 520px) { #app { border-radius: 0; box-shadow: none; } }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > .hide { pointer-events: none; }
.layer, .toasts { pointer-events: none !important; }
.layer > * { pointer-events: auto; }
button { font-family: inherit; }
svg { flex: none; }

/* ---------- 顶栏 / 底栏 ---------- */
.topbar { position: absolute; left: 0; right: 0; top: 0; height: calc(56px * var(--u)); display: flex; align-items: center; gap: calc(6px * var(--u)); padding: 0 calc(12px * var(--u)); transition: opacity .25s, transform .25s; }
.bottombar { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 calc(14px * var(--u)) calc(14px * var(--u)); display: flex; flex-direction: column; gap: 8px; align-items: center; transition: opacity .25s, transform .25s; }
.topbar.hide, .bottombar.hide { opacity: 0; pointer-events: none; }
.topbar.hide { transform: translateY(-8px); } .bottombar.hide { transform: translateY(8px); }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: calc(15px * var(--u)); opacity: .92; }
.brand svg { color: var(--gold); }
.gap { flex: 1; }
.pill { display: flex; align-items: center; gap: 4px; margin-left: auto; padding: 4px 10px; border-radius: 999px; background: rgba(28, 60, 52, .8); border: 1px solid var(--line); font-size: calc(13px * var(--u)); font-weight: 600; }
.pill svg { color: var(--gold); }
.ibtn { position: relative; width: calc(36px * var(--u)); height: calc(36px * var(--u)); border-radius: 50%; border: 1px solid var(--line); background: rgba(28, 60, 52, .8); color: var(--cream); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ibtn:active { transform: scale(.94); }
.ibtn.fav.on { color: #E86A8A; } .ibtn.fav.on svg { fill: #E86A8A; }
.badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.cap { display: flex; align-items: center; gap: 4px; font-size: calc(12px * var(--u)); color: rgba(239, 230, 207, .75); background: rgba(14, 29, 25, .55); padding: 2px 10px; border-radius: 999px; }
.bbar { display: flex; gap: calc(10px * var(--u)); width: 100%; }
.bbtn { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: calc(50px * var(--u)); border-radius: 999px; border: 1px solid var(--line); background: var(--teal); color: var(--cream); font-size: calc(14px * var(--u)); font-weight: 600; cursor: pointer; }
.bbtn.primary { background: var(--teal-2); border-color: var(--gold); }
.bbtn.off { opacity: .55; }
.bbtn:active { transform: scale(.97); }
.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; border: 2px solid var(--gold); animation: pulse 1.4s ease-out infinite; pointer-events: none; }
@keyframes pulse { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.16); opacity: 0; } }

/* ---------- 提示 / 空缸 ---------- */
.tips { position: absolute; inset: 0; pointer-events: none !important; }
.tips > * { pointer-events: auto; }
.tip { position: absolute; transform: translate(-50%, -100%); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 12px; font-size: calc(13px * var(--u)); font-weight: 600; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); animation: bob 1.6s ease-in-out infinite; pointer-events: none !important; }
.tip::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: var(--panel); transform: translateX(-50%) rotate(45deg); }
@keyframes bob { 50% { transform: translate(-50%, calc(-100% - 4px)); } }
.empty { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; background: var(--panel); color: var(--ink); padding: 22px 26px; border-radius: 20px; width: 78%; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: pop .3s ease-out; }
.empty svg { color: var(--teal); opacity: .6; }
.empty h2 { margin: 6px 0 4px; font-size: calc(19px * var(--u)); }
.empty p { margin: 0 0 14px; font-size: calc(13px * var(--u)); color: var(--ink-2); line-height: 1.5; text-wrap: balance; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: calc(44px * var(--u)); padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-size: calc(14px * var(--u)); font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--teal); color: var(--cream); border-color: var(--gold); }
.btn.ghost { background: transparent; color: var(--ink); border-color: rgba(31, 58, 52, .35); }
.btn.ghost.danger, .btn.danger { color: #B5533F; }
.btn.small { height: calc(34px * var(--u)); font-size: calc(12px * var(--u)); padding: 0 12px; background: rgba(31, 58, 52, .08); color: var(--ink); border-color: rgba(31, 58, 52, .25); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- 吐司 ---------- */
.toasts { position: absolute; left: 0; right: 0; top: calc(64px * var(--u)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none !important; }
.toast { display: flex; align-items: center; gap: 6px; max-width: 86%; padding: 8px 14px; border-radius: 999px; background: rgba(14, 29, 25, .92); color: var(--cream); border: 1px solid var(--line); font-size: calc(12.5px * var(--u)); animation: tin .3s ease-out; }
.toast.like { border-color: var(--gold); background: rgba(60, 45, 30, .94); }
.toast.like svg { color: #F28B9A; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 浮层 ---------- */
.scrim { position: absolute; inset: 0; background: rgba(10, 20, 18, .55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
.sheet { width: 100%; max-width: calc(360px * var(--u)); max-height: 86%; overflow: auto; background: var(--panel); color: var(--ink); border-radius: 20px; box-shadow: 0 16px 40px rgba(0, 0, 0, .4); animation: pop .22s ease-out; }
.pad { padding: 16px 18px 18px; }
.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sh .ibtn { background: rgba(31, 58, 52, .08); border-color: transparent; color: var(--ink); width: 30px; height: 30px; }
.sheet h3 { margin: 0 0 8px; font-size: calc(17px * var(--u)); }
.sheet p { margin: 6px 0 12px; line-height: 1.5; }
.muted { color: var(--muted); } .small { font-size: calc(12px * var(--u)); } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid rgba(31, 58, 52, .1); font-size: calc(14px * var(--u)); }
.switch { position: relative; width: 44px; height: 26px; margin-left: auto; display: inline-block; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 13px; background: rgba(31, 58, 52, .25); transition: .2s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .track { background: var(--teal); } .switch input:checked + .track .knob { left: 21px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: calc(12px * var(--u)); color: var(--ink-2); margin-bottom: 8px; }
.stats span { display: inline-flex; align-items: center; gap: 4px; }
.feedlist { max-height: 50vh; overflow: auto; }
.fitem { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid rgba(31, 58, 52, .08); font-size: calc(13px * var(--u)); }
.fitem svg { color: var(--teal); margin-top: 2px; } .fitem.k-like svg { color: #E86A8A; }
.fitem div { display: flex; flex-direction: column; } .fitem small { color: var(--muted); font-size: calc(11px * var(--u)); }
.fishcard { position: absolute; left: 10px; right: 10px; bottom: calc(112px * var(--u)); background: var(--panel); color: var(--ink); border-radius: 18px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: up .25s ease-out; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
.fc-head { display: flex; align-items: center; gap: 8px; }
.fc-head .ibtn { background: rgba(31, 58, 52, .08); border-color: transparent; color: var(--ink); width: 30px; height: 30px; }
.fc-title { display: flex; flex-direction: column; flex: 1; min-width: 0; } .fc-title b { font-size: calc(16px * var(--u)); }
.fc-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: calc(13px * var(--u)); }
.hbar { flex: 1; height: 6px; border-radius: 3px; background: rgba(31, 58, 52, .12); overflow: hidden; } .hbar i { display: block; height: 100%; background: var(--orange); }
.catch .reveal { display: block; width: 82%; margin: 4px auto; background: rgba(31, 58, 52, .06); border-radius: 14px; }
.ctitle { display: flex; align-items: baseline; justify-content: center; gap: 8px; } .ctitle b { font-size: calc(20px * var(--u)); } .cm { color: var(--ink-2); font-weight: 600; }
.likebox { background: rgba(232, 106, 138, .12); border-radius: 14px; padding: 10px 12px; margin-bottom: 6px; display: grid; grid-template-columns: 24px 1fr; gap: 2px 8px; align-items: center; }
.likebox svg { color: #E86A8A; grid-row: span 2; } .likebox b { font-size: calc(16px * var(--u)); }
.likebox .fitem { grid-column: 1 / -1; border: none; padding: 4px 0 0; }
.rows { max-height: 46vh; overflow: auto; }
.frow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(31, 58, 52, .08); }
.frow canvas { width: 48px; height: 30px; background: rgba(31, 58, 52, .08); border-radius: 8px; }
.frow > span { display: flex; flex-direction: column; }
.catchscrim { background: rgba(10, 20, 18, .5); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: scale(.96); } }

/* ---------- 画板 ---------- */
.overlay { position: absolute; inset: 0; display: none; }
.overlay.on { display: flex; }
.draw { flex-direction: column; gap: 6px; padding: 8px 12px 10px; background: linear-gradient(180deg, #17453F, #0E1D19); overflow: auto; }
.draw > * { flex-shrink: 0; }
.d-head { display: flex; align-items: center; justify-content: space-between; }
.d-title { font-weight: 700; font-size: calc(16px * var(--u)); }
.d-label { font-size: calc(11px * var(--u)); color: rgba(239, 230, 207, .7); margin-top: 2px; }
.seg { display: flex; gap: 6px; }
.segbtn { flex: 1; height: 30px; border-radius: 999px; border: 1px solid var(--line); background: rgba(28, 60, 52, .6); color: var(--cream); font-size: calc(12px * var(--u)); cursor: pointer; }
.segbtn.on { background: var(--panel); color: var(--ink); border-color: var(--gold); font-weight: 700; }
.d-canvas { position: relative; width: min(100%, 420px); aspect-ratio: 3 / 2; margin: 2px auto; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #3C7F78, #1F4E4D 70%); touch-action: none; box-shadow: inset 0 0 0 1px rgba(239, 230, 207, .15); }
.d-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.d-preview { display: flex; align-items: center; gap: 8px; }
.d-pl { display: grid; grid-template-columns: 18px 1fr; align-items: center; flex: 1; font-size: calc(13px * var(--u)); font-weight: 600; }
.d-pl svg { color: var(--gold); }
.d-pl small { grid-column: 1 / -1; font-weight: 400; color: rgba(239, 230, 207, .65); font-size: calc(11px * var(--u)); }
.d-prev { width: 130px; height: 55px; background: rgba(14, 29, 25, .5); border-radius: 10px; }
.tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tgroup { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(28, 60, 52, .6); }
.tbtn { display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 7px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: rgba(239, 230, 207, .8); font-size: calc(11px * var(--u)); cursor: pointer; }
.tbtn.on { background: var(--panel); color: var(--ink); border-color: var(--gold); }
.tbtn.dot i { display: block; border-radius: 50%; background: currentColor; }
.tsep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.sw { width: 21px; height: 21px; border-radius: 50%; border: 2px solid rgba(239, 230, 207, .25); cursor: pointer; padding: 0; }
.sw.on { border-color: var(--cream); box-shadow: 0 0 0 2px var(--gold); }
.d-meta { display: flex; gap: 6px; align-items: center; }
.d-name { flex: 1; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: rgba(28, 60, 52, .6); color: var(--cream); padding: 0 12px; font-size: calc(14px * var(--u)); font-family: inherit; outline: none; }
.d-name:focus { border-color: var(--gold); }
.d-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.d-count { font-size: calc(12px * var(--u)); color: rgba(239, 230, 207, .7); }
