/* 墨线分镜 Ink Panels —— 设计令牌与组件库（浏览器专属，不进微信包）
 * 规格：docs/superpowers/specs/2026-10-13-ink-panels-ui-design.md
 * 约定：新界面只用 ink- 前缀类名；界面自己的样式写在 ui-ink/screens/<组>.css，不改本文件。 */

@font-face {
  font-family: "InkAnton";
  src: url("fonts/Anton.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #111111;
  --ink-2: #2b2b2b;
  --paper: #f3eee3;
  --paper-2: #e3dccb;
  --paper-3: #cfc6b2;
  --white: #ffffff;
  --red: #e8402f;
  --red-dk: #b8281b;
  --yellow: #ffd400;
  --gain: #1d9a3c;
  --gain-on-dark: #6ee07a;
  --loss: #d33a2c;
  --hero: #3ba7ff;
  --r1: #d9d4c8;
  --r2: #65c174;
  --r3: #4b9fe1;
  --r4: #9764d6;
  --r5: #ff5a3c;
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-num: "InkAnton", "Anton", "Impact", "Arial Narrow", sans-serif;
  --line: 3px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --safe-top: calc(env(safe-area-inset-top, 0px) + 10px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --capsule-w: 100px; /* 微信胶囊预留：顶部右侧这块不放关键交互，移植微信端时不用改布局 */
  --nav-h: 72px;
  --ease-pop: cubic-bezier(.3, 1.6, .5, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- 屏幕外壳与重置 ---------- */
.ink-screen,
.ink-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  overflow: hidden;
  font-family: var(--font-cjk);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1.35;
}
.ink-screen { display: flex; flex-direction: column; background: var(--paper); }
.ink-screen--ink { background: var(--ink); color: var(--white); }
.ink-screen--red { background: var(--red); }
/* 重置用 :where 压到零特异性，组件类名（.ink-btn 等）总能覆盖它 */
:where(.ink-screen, .ink-overlay) * { box-sizing: border-box; }
:where(.ink-screen, .ink-overlay) button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
:where(.ink-screen, .ink-overlay) img { -webkit-user-drag: none; }
.ink-num { font-family: var(--font-num); font-weight: 400; letter-spacing: .03em; }

/* ---------- 质感 ---------- */
.ink-halftone {
  background-image: radial-gradient(var(--ink) 22%, transparent 24%);
  background-size: 7px 7px;
}
.ink-halftone--white { background-image: radial-gradient(rgba(255,255,255,.9) 22%, transparent 24%); }
.ink-speedlines {
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.16) 0 2deg, transparent 2deg 9deg);
}
.ink-speedlines--dark { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(17,17,17,.14) 0 2deg, transparent 2deg 9deg); }

/* ---------- 格子 / 面板 ---------- */
.ink-panel {
  position: relative;
  background: var(--white);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
}
.ink-panel--paper { background: var(--paper); }
.ink-panel--black { background: var(--ink); color: var(--white); }
.ink-panel--tilt-l { transform: rotate(-1.2deg); }
.ink-panel--tilt-r { transform: rotate(1deg); }

/* ---------- 拟声大字 ---------- */
.ink-sfx {
  display: inline-block;
  font-family: var(--font-cjk);
  font-weight: 900;
  font-size: var(--sfx-size, 40px);
  line-height: 1;
  letter-spacing: .02em;
  color: var(--sfx-fill, var(--yellow));
  -webkit-text-stroke: var(--sfx-stroke, 3px) var(--ink);
  paint-order: stroke fill;
  text-shadow: var(--sfx-off, 5px) var(--sfx-off, 5px) 0 var(--sfx-shadow, var(--ink));
  transform: skewX(-10deg) rotate(-4deg);
  white-space: nowrap;
}
.ink-sfx--white { --sfx-fill: var(--white); }
.ink-sfx--red-shadow { --sfx-shadow: var(--red); }

/* ---------- 贴纸 / 胶带 / 爆炸贴 / 印章 ---------- */
.ink-sticker {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--white); color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 3px 9px;
  font-weight: 900; font-size: 12px; line-height: 1.2;
  transform: skewX(-10deg);
  white-space: nowrap;
}
.ink-sticker--yellow { background: var(--yellow); }
.ink-sticker--black { background: var(--ink); color: var(--white); box-shadow: 3px 3px 0 rgba(0,0,0,.35); }
.ink-sticker--red { background: var(--red); color: var(--white); }
.ink-sticker--flat { box-shadow: none; }

.ink-tape {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 212, 0, .88);
  border-left: 2px dashed rgba(17,17,17,.35);
  border-right: 2px dashed rgba(17,17,17,.35);
  padding: 2px 10px;
  font-weight: 900; font-size: 11px; color: var(--ink);
  transform: rotate(-3deg);
  white-space: nowrap;
}
.ink-tape--black { background: var(--ink); color: var(--yellow); border-color: rgba(255,255,255,.25); }

.ink-burst {
  position: relative; display: grid; place-items: center;
  width: var(--burst, 60px); height: var(--burst, 60px);
  background: var(--burst-fill, var(--yellow)); color: var(--ink);
  clip-path: polygon(50% 0, 61% 18%, 82% 8%, 80% 30%, 100% 36%, 86% 52%, 100% 68%, 79% 72%, 82% 94%, 61% 84%, 50% 100%, 39% 84%, 18% 94%, 21% 72%, 0 68%, 14% 52%, 0 36%, 20% 30%, 18% 8%, 39% 18%);
  font-family: var(--font-num); font-size: 20px; line-height: 1;
}
.ink-burst-wrap { filter: drop-shadow(1.5px 1.5px 0 var(--ink)) drop-shadow(-1.5px -1.5px 0 var(--ink)) drop-shadow(1.5px -1.5px 0 var(--ink)) drop-shadow(-1.5px 1.5px 0 var(--ink)); }

.ink-stamp {
  display: inline-block;
  border: 4px solid var(--stamp, var(--red));
  color: var(--stamp, var(--red));
  padding: 0 10px;
  font-weight: 900; font-size: var(--stamp-size, 28px); letter-spacing: .1em; line-height: 1.25;
  transform: rotate(-14deg);
  background: rgba(255,255,255,.08);
}
.ink-stamp.is-slam { animation: ink-slam .32s var(--ease-pop) both; }

/* ---------- 按钮 ---------- */
.ink-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border: var(--line) solid var(--ink);
  background: var(--white); color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 900; font-size: 16px; letter-spacing: .04em; line-height: 1.1;
  transform: skewX(-8deg);
  transition: transform .1s, box-shadow .1s, opacity .15s;
  white-space: nowrap;
}
.ink-btn:active { transform: skewX(-8deg) translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.ink-btn--primary { background: var(--ink); color: var(--yellow); box-shadow: 5px 5px 0 var(--red); }
.ink-btn--primary:active { box-shadow: 1px 1px 0 var(--red); }
.ink-btn--go { background: var(--yellow); color: var(--ink); box-shadow: 5px 5px 0 var(--red); }
.ink-btn--go:active { box-shadow: 1px 1px 0 var(--red); }
.ink-btn--danger { background: var(--red); color: var(--white); }
.ink-btn--ghost { background: transparent; color: var(--white); border-color: var(--white); box-shadow: none; }
.ink-btn--block { display: flex; width: 100%; }
.ink-btn--lg { min-height: 60px; font-size: 22px; }
.ink-btn--sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.ink-btn[disabled], .ink-btn.is-disabled { opacity: .4; filter: grayscale(1); pointer-events: none; box-shadow: none; }
.ink-btn__sub { font-family: var(--font-num); font-weight: 400; font-size: .72em; opacity: .85; letter-spacing: .06em; }

.ink-back {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 12px;
  background: var(--white); color: var(--ink);
  border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900; font-size: 14px;
  transform: skewX(-10deg);
}
.ink-back:active { transform: skewX(-10deg) translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- 顶栏 ---------- */
.ink-topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: var(--safe-top) calc(12px + var(--capsule-w)) 6px 12px;
  flex: none;
}
.ink-topbar__title { min-width: 0; }

/* ---------- 图标（图集，纯黑底板） ---------- */
.ink-icon {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: var(--icon, 44px); height: var(--icon, 44px);
  background: #000;
  border: 2.5px solid var(--ink);
  overflow: hidden;
}
.ink-icon--round { border-radius: 50%; }
.ink-icon--bare { border: 0; }
.ink-icon > i {
  display: block; width: 100%; height: 100%;
  background-image: url("../assets/icons-atlas/atlas_0.webp");
  background-size: 2133.3333% 2133.3333%;
  background-repeat: no-repeat;
  transform: scale(var(--zoom, 1.3));
}

/* ---------- 英雄头像裁切 ---------- */
.ink-face {
  flex: none;
  width: var(--face, 44px); height: var(--face, 44px);
  border: 2.5px solid var(--ink);
  background-color: var(--hero);
  background-repeat: no-repeat;
}
.ink-face.is-locked { filter: grayscale(1) brightness(.6); }

/* ---------- 进度条 ---------- */
.ink-bar {
  position: relative;
  height: var(--bar-h, 12px);
  background: var(--ink);
  padding: 2px;
  transform: skewX(-18deg);
}
.ink-bar > i { display: block; height: 100%; width: var(--v, 50%); background: var(--bar-color, var(--yellow)); transition: width .3s var(--ease-out); }
.ink-bar > b { position: absolute; right: 8px; top: 50%; transform: translateY(-50%) skewX(18deg); font-family: var(--font-num); font-weight: 400; font-size: 13px; color: var(--white); }

/* ---------- 分页标签（胶带） ---------- */
.ink-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 12px 8px; flex: none; }
.ink-tabs::-webkit-scrollbar { display: none; }
.ink-tab {
  flex: none; min-height: 44px; padding: 0 14px;
  border: 2.5px solid var(--ink); background: var(--white); color: var(--ink);
  font-weight: 900; font-size: 13px;
  transform: skewX(-10deg);
}
.ink-tab.is-on { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.ink-screen--ink .ink-tab { border-color: var(--white); background: transparent; color: var(--white); }
.ink-screen--ink .ink-tab.is-on { background: var(--yellow); color: var(--ink); border-color: var(--ink); }

/* ---------- 数值格 ---------- */
.ink-cell { background: var(--white); border: 2.5px solid var(--ink); padding: 5px 8px; min-width: 0; }
.ink-cell__k { display: block; font-size: 10px; font-weight: 900; color: #555; }
.ink-cell__v { display: block; font-family: var(--font-num); font-size: 18px; line-height: 1.15; letter-spacing: .02em; }
.ink-gain { color: var(--gain); }
.ink-loss { color: var(--loss); }

/* ---------- 滚动区 ---------- */
.ink-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  mask: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  padding-bottom: 22px;
}
.ink-scroll::-webkit-scrollbar { display: none; }

/* ---------- 弹层 ---------- */
.ink-overlay {
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
  background: rgba(17,17,17,.62);
}
.ink-overlay--sheet { align-items: flex-end; padding: 0; }
.ink-modal {
  position: relative;
  width: min(100%, 340px);
  max-height: calc(100% - 20px);
  display: flex; flex-direction: column;
  background: var(--white);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  animation: ink-pop .3s var(--ease-pop) both;
}
.ink-overlay--sheet .ink-modal { width: 100%; max-height: 88%; border-width: 4px 0 0; box-shadow: 0 -6px 0 var(--ink); animation: ink-rise .28s var(--ease-out) both; }
/* 底部弹层贴屏幕右缘，关闭钮收进屏内 */
.ink-overlay--sheet .ink-modal__x { top: -22px; right: 12px; }
.ink-modal__head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--modal-band, var(--yellow)); border-bottom: 4px solid var(--ink); flex: none; }
.ink-modal__title { font-weight: 900; font-size: 20px; transform: skewX(-8deg); }
.ink-modal__body { padding: 12px 14px; overflow-y: auto; min-height: 0; }
.ink-modal__actions { display: flex; gap: 10px; padding: 0 14px 14px; flex: none; }
.ink-modal__actions .ink-btn { flex: 1; }
.ink-modal__x {
  position: absolute; top: -18px; right: -14px; z-index: 2;
  width: 44px; height: 44px;
  background: var(--red); color: var(--white);
  border: 3px solid var(--ink);
  font-weight: 900; font-size: 20px; line-height: 1;
  transform: rotate(8deg);
}

/* ---------- 吐司 ---------- */
#toast.show {
  background: var(--ink) !important;
  color: var(--yellow) !important;
  border: 3px solid var(--yellow) !important;
  border-radius: 0 !important;
  box-shadow: 4px 4px 0 var(--red) !important;
  font-family: var(--font-cjk) !important;
  font-weight: 900 !important;
}

/* ---------- 动效 ---------- */
@keyframes ink-pop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
@keyframes ink-rise { from { transform: translateY(100%); } }
@keyframes ink-slam { 0% { transform: rotate(-14deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-14deg) scale(.92); opacity: 1; } 100% { transform: rotate(-14deg) scale(1); } }
@keyframes ink-shake { 20% { transform: translateX(-6px) rotate(-1deg); } 50% { transform: translateX(5px) rotate(1deg); } 80% { transform: translateX(-3px); } }
@keyframes ink-slide-in { from { transform: translateX(110%) skewX(-12deg); opacity: 0; } }
@keyframes ink-drop-in { from { transform: translateY(-40px) rotate(-4deg); opacity: 0; } }
@keyframes ink-blink { 50% { opacity: .35; } }
.ink-anim-pop { animation: ink-pop .32s var(--ease-pop) both; }
.ink-anim-shake { animation: ink-shake .4s both; }
.ink-anim-slide { animation: ink-slide-in .42s var(--ease-out) both; }
.ink-anim-drop { animation: ink-drop-in .36s var(--ease-pop) both; }

@media (prefers-reduced-motion: reduce) {
  .ink-screen *, .ink-overlay *, .ink-screen, .ink-overlay { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
