/* ==========================================================================
   碎星者 H5 · «STARSHATTER CONSOLE» 设计系统
   事实源：docs/h5_design_system.md
   三条方针：双生骰运（青=希望/琥珀=恐惧/紫=关键，彩色只承载规则语义）、
   舰桥终端（发丝线、切角、等宽读数、刻字标签）、机械动效（120–220ms，唯掷骰戏剧化）。
   ========================================================================== */

:root {
  /* ── 色板（深空蓝黑） ── */
  --bg-0: #04060d;
  --bg-1: #090e1a;
  --bg-2: #0e1526;
  --line: rgba(148, 178, 255, 0.13);
  --line-hi: rgba(148, 178, 255, 0.32);
  --tx-0: #edf2ff;
  --tx-1: #96a3c6;
  --tx-2: #5b6889;

  /* 语义色：青=希望 / 琥珀=恐惧 / 紫=关键 / 红=系统危险 */
  --hope: #55eedd;
  --hope-deep: #149e8f;
  --hope-dim: rgba(85, 238, 221, 0.11);
  --hope-ink: #052723;
  --fear: #ffb04a;
  --fear-deep: #d9821e;
  --fear-dim: rgba(255, 176, 74, 0.11);
  --fear-ink: #2c1a02;
  --crit: #caa2ff;
  --crit-dim: rgba(202, 162, 255, 0.12);
  --danger: #ff6d7a;

  /* 资源色：生命红 / 压力琥珀（恐惧家族）/ 希望青 / 护甲钢蓝 */
  --res-hp: #fb7f8c;
  --res-stress: #ffb04a;
  --res-hope: #55eedd;
  --res-armor: #8fa8e8;

  /* ── 字阶 ── */
  --fs-micro: 11px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 26px;
  --fs-xxl: 40px;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ── 尺度（4px 基栅） ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --touch: 44px;
  --r-sm: 3px;
  --chamfer: 10px;

  /* ── 动效 ── */
  --dur-1: 120ms;
  --dur-2: 220ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-snap: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* ── 基础 ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg-0);
  color: var(--tx-0);
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(85, 238, 221, 0.25);
}

[x-cloak] {
  display: none !important;
}

code {
  font-family: var(--font-mono);
  color: var(--hope);
}

:focus-visible {
  outline: 1px solid var(--hope);
  outline-offset: 2px;
}

button {
  font-family: inherit;
}

/* 等宽读数：一切数字的基准样式 */
.readout {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 刻字标签：盘面丝印感（小号加宽字距，中英双语） */
.micro-label {
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--tx-2);
}

/* 细滚动条（终端质感） */
.panel-scroll,
.notes-list {
  scrollbar-width: thin;
  scrollbar-color: var(--line-hi) transparent;
}

.panel-scroll::-webkit-scrollbar,
.notes-list::-webkit-scrollbar {
  width: 4px;
}

.panel-scroll::-webkit-scrollbar-thumb,
.notes-list::-webkit-scrollbar-thumb {
  background: var(--line-hi);
}

/* ── 深空背景层（纯装饰） ── */
.stars,
.nebula,
.dotgrid,
.vignette,
.meteor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.stars {
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 28% 64%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 41% 12%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 55% 44%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 63% 81%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 74% 28%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 82% 58%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 90% 14%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 8% 86%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 33% 90%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 47% 71%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 69% 5%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 95% 76%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 21% 45%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 87% 91%, rgba(255, 255, 255, 0.45), transparent);
  animation: twinkle 7s ease-in-out infinite alternate;
}

.stars-far {
  background-image:
    radial-gradient(1px 1px at 18% 38%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 36% 8%, rgba(255, 255, 255, 0.26), transparent),
    radial-gradient(1px 1px at 52% 72%, rgba(255, 255, 255, 0.34), transparent),
    radial-gradient(1px 1px at 66% 18%, rgba(255, 255, 255, 0.26), transparent),
    radial-gradient(1px 1px at 78% 52%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 88% 84%, rgba(255, 255, 255, 0.26), transparent),
    radial-gradient(1px 1px at 6% 60%, rgba(255, 255, 255, 0.26), transparent),
    radial-gradient(1px 1px at 44% 92%, rgba(255, 255, 255, 0.3), transparent);
  animation: twinkle 10s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

.nebula {
  background:
    radial-gradient(ellipse 70% 45% at 75% -10%, rgba(85, 238, 221, 0.07), transparent 62%),
    radial-gradient(ellipse 55% 38% at 5% 108%, rgba(255, 176, 74, 0.06), transparent 62%),
    radial-gradient(ellipse 90% 65% at 50% 55%, rgba(58, 80, 170, 0.13), transparent 72%);
  animation: nebula-drift 30s ease-in-out infinite alternate;
}

@keyframes nebula-drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.07) translate(-1.5%, 1.5%);
  }
}

/* 仪盘点阵底纹 */
.dotgrid {
  background-image: radial-gradient(rgba(148, 178, 255, 0.055) 1px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

/* 边缘暗角，聚焦中央 */
.vignette {
  background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(2, 4, 10, 0.55));
}

/* 流星 */
.meteor {
  inset: auto;
  top: 12%;
  left: 100%;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), transparent);
  opacity: 0;
  transform: rotate(-32deg);
  animation: meteor-fly 11s linear infinite;
}

.meteor-2 {
  top: 46%;
  animation-delay: 5.5s;
  animation-duration: 14s;
}

@keyframes meteor-fly {
  0% {
    opacity: 0;
    transform: translateX(0) translateY(0) rotate(-32deg);
  }
  2.5% {
    opacity: 1;
  }
  12% {
    opacity: 0;
    transform: translateX(-120vw) translateY(38vh) rotate(-32deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-120vw) translateY(38vh) rotate(-32deg);
  }
}

/* ── 布局 ── */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
}

.view {
  height: 100%;
}

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}

.app-view {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}

.panels {
  flex: 1;
  min-height: 0;
  display: flex;
}

.panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-3);
  gap: var(--sp-3);
}

.panel-scroll > * {
  flex: none;
}

.notes-panel {
  display: flex;
  flex-direction: column;
}

/* ── 舱室面板 ── */
.panel-box {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  /* 边缘光：顶部 1px 高光 */
  box-shadow: inset 0 1px 0 rgba(190, 210, 255, 0.06);
  padding: var(--sp-4);
}

/* 四角括线（关键面板的仪器框签名，背景渐变实现） */
.frame-corners {
  background:
    linear-gradient(var(--line-hi), var(--line-hi)) left top / 12px 1px,
    linear-gradient(var(--line-hi), var(--line-hi)) left top / 1px 12px,
    linear-gradient(var(--line-hi), var(--line-hi)) right top / 12px 1px,
    linear-gradient(var(--line-hi), var(--line-hi)) right top / 1px 12px,
    linear-gradient(var(--line-hi), var(--line-hi)) left bottom / 12px 1px,
    linear-gradient(var(--line-hi), var(--line-hi)) left bottom / 1px 12px,
    linear-gradient(var(--line-hi), var(--line-hi)) right bottom / 12px 1px,
    linear-gradient(var(--line-hi), var(--line-hi)) right bottom / 1px 12px,
    linear-gradient(var(--bg-1), var(--bg-1)) left top / 100% 100%;
  background-repeat: no-repeat;
  border-color: transparent;
}

/* ── 按钮 ── */
.btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition:
    background var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out),
    filter var(--dur-1) var(--ease-out),
    opacity var(--dur-1) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 主按钮：切角 + 希望青渐变（全应用唯一的主动作形态） */
.btn-primary {
  clip-path: polygon(
    var(--chamfer) 0,
    100% 0,
    100% calc(100% - var(--chamfer)),
    calc(100% - var(--chamfer)) 100%,
    0 100%,
    0 var(--chamfer)
  );
  background: linear-gradient(160deg, var(--hope) 0%, var(--hope-deep) 100%);
  color: var(--hope-ink);
  font-weight: 700;
  letter-spacing: 0.12em;
  border: none;
  border-radius: 0;
}

.btn-primary:not(:disabled):hover {
  filter: drop-shadow(0 0 10px rgba(85, 238, 221, 0.45));
}

.btn-block {
  width: 100%;
  margin-top: var(--sp-3);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--tx-1);
}

.btn-ghost:hover {
  border-color: var(--line-hi);
  color: var(--tx-0);
}

.btn-danger-ghost.armed {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 109, 122, 0.08);
}

/* 加载态圆环（主按钮上为深底） */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(5, 39, 35, 0.3);
  border-top-color: var(--hope-ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 分段选择器 ── */
.seg-group {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.seg {
  flex: 1;
  min-height: calc(var(--touch) - 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-2);
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--tx-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    background var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.seg svg {
  width: 16px;
  height: 16px;
}

.seg.active {
  border-color: rgba(85, 238, 221, 0.5);
  color: var(--hope);
  background: var(--hope-dim);
}

.seg-dis.active {
  border-color: rgba(255, 176, 74, 0.5);
  color: var(--fear);
  background: var(--fear-dim);
}

/* ── 表单 ── */
.field-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}

.field-row {
  display: flex;
  gap: var(--sp-3);
}

.field-row .field-block {
  flex: 1;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--tx-2);
}

.text-input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--tx-0);
  font-size: var(--fs-md);
  font-family: inherit;
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out);
}

.text-input::placeholder {
  color: var(--tx-2);
}

.text-input:focus {
  outline: none;
  border-color: rgba(85, 238, 221, 0.55);
  box-shadow: 0 0 0 1px rgba(85, 238, 221, 0.25);
}

.error-text {
  min-height: 20px;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--danger);
}

.hint-text {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--tx-1);
  line-height: 1.9;
}

/* ── 登录页 ── */
.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  animation: card-rise 0.5s var(--ease-out);
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.brand {
  margin-bottom: var(--sp-5);
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-3);
  color: var(--hope);
  filter: drop-shadow(0 0 14px rgba(85, 238, 221, 0.4));
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 断裂轨道环缓慢旋转（品牌唯一常动元素） */
.brand-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: ring-rotate 24s linear infinite;
}

@keyframes ring-rotate {
  to {
    transform: rotate(360deg);
  }
}

.brand-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* 视觉居中补偿字距 */
}

.brand-sub {
  margin-top: var(--sp-2);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--tx-2);
}

/* 六格配对码：真实 input 透明覆盖（保留粘贴/系统键盘/无障碍） */
.code-field {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  cursor: text;
}

.code-cell {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--hope);
  transition:
    border-color var(--dur-1) var(--ease-out),
    background var(--dur-1) var(--ease-out);
}

.code-cell.filled {
  border-color: rgba(85, 238, 221, 0.4);
  background: var(--hope-dim);
}

.code-field:focus-within .code-cell.active {
  border-color: var(--hope);
  box-shadow: 0 0 0 1px rgba(85, 238, 221, 0.3);
}

.code-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  border: none;
  background: transparent;
  cursor: text;
}

/* 登录失败抖动 */
.shake {
  animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-3);
  margin-bottom: 0;
  padding: var(--sp-2) var(--sp-3);
  padding-top: calc(var(--sp-2) + env(safe-area-inset-top, 0px));
}

.player {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.topbar-mark {
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--hope);
  filter: drop-shadow(0 0 6px rgba(85, 238, 221, 0.35));
}

.player-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.player-name {
  font-size: var(--fs-lg);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-char {
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  color: var(--tx-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-gm {
  flex: none;
  padding: 1px var(--sp-2);
  border: 1px solid rgba(255, 176, 74, 0.45);
  color: var(--fear);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  background: var(--fear-dim);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
}

/* WS 链路指示灯：青=在线 / 琥珀=重连中 */
.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tx-2);
  transition: background var(--dur-2) var(--ease-out);
}

.ws-dot.on {
  background: var(--hope);
  box-shadow: 0 0 8px rgba(85, 238, 221, 0.7);
  animation: dot-breathe 2.4s ease-in-out infinite;
}

.ws-dot.retry {
  background: var(--fear);
  box-shadow: 0 0 8px rgba(255, 176, 74, 0.7);
  animation: dot-blink 0.8s steps(2, start) infinite;
}

@keyframes dot-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes dot-blink {
  50% {
    opacity: 0.25;
  }
}

.topbar-actions .btn {
  min-height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}

/* 顶栏恐惧点徽标：琥珀语义，所有用户可见（PL 只读）；与大卡共用 pulse 脉冲动画 */
.dread-badge {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  padding: 3px var(--sp-2);
  border: 1px solid rgba(255, 176, 74, 0.4);
  background: var(--fear-dim);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.dread-badge-label {
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(255, 176, 74, 0.75);
}

.dread-badge-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--fear);
}

.dread-badge-max {
  color: var(--tx-2);
  font-weight: 400;
}

.dread-badge.pulse {
  animation: dread-pulse 0.6s var(--ease-out);
}

.dread-badge.pulse .dread-badge-num {
  display: inline-block;
  animation: num-pop 0.5s var(--ease-snap);
}

/* 窄屏保护：顶栏拥挤时隐藏刻字标签，仅留读数 */
@media (max-width: 420px) {
  .dread-badge-label {
    display: none;
  }
}

/* ════════════════════════════════════════════════════════════
   掷骰面板
   ════════════════════════════════════════════════════════════ */

/* 六维属性格 */
.attr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.attr-btn {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  color: var(--tx-1);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition:
    border-color var(--dur-1) var(--ease-out),
    background var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.attr-btn svg {
  width: 18px;
  height: 18px;
  color: var(--tx-2);
  transition: color var(--dur-1) var(--ease-out);
}

.attr-btn .attr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attr-btn .attr-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--tx-2);
}

.attr-btn.active {
  border-color: rgba(85, 238, 221, 0.55);
  background: var(--hope-dim);
  color: var(--tx-0);
}

.attr-btn.active svg,
.attr-btn.active .attr-val {
  color: var(--hope);
}

/* 大投掷按钮 */
.btn-roll {
  width: 100%;
  min-height: 58px;
  font-size: var(--fs-lg);
}

.btn-roll svg {
  width: 20px;
  height: 20px;
}

.btn-roll:not(:disabled) {
  animation: roll-btn-glow 3.2s ease-in-out infinite;
}

@keyframes roll-btn-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(85, 238, 221, 0));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(85, 238, 221, 0.4));
  }
}

/* ── 掷骰结果（仪器读数区） ── */
.roll-result {
  overflow: visible;
  transition:
    border-color var(--dur-2) var(--ease-out),
    filter 0.4s var(--ease-out);
}

.result-in {
  animation: result-in 0.3s var(--ease-out);
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dice-row {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  margin-bottom: var(--sp-3);
}

/* 十二面骰：dodecagon 切形 + drop-shadow 发光（跟随轮廓） */
.die {
  width: 82px;
  height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  clip-path: polygon(
    50% 0%,
    75% 6.7%,
    93.3% 25%,
    100% 50%,
    93.3% 75%,
    75% 93.3%,
    50% 100%,
    25% 93.3%,
    6.7% 75%,
    0% 50%,
    6.7% 25%,
    25% 6.7%
  );
  background: linear-gradient(160deg, var(--bg-2), rgba(9, 14, 26, 0.4));
}

.die-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--tx-2);
}

.die-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--tx-0);
}

.die-hope {
  background: linear-gradient(160deg, rgba(85, 238, 221, 0.2), rgba(9, 14, 26, 0.35));
  filter: drop-shadow(0 0 10px rgba(85, 238, 221, 0.35));
}

.die-hope .die-value {
  color: var(--hope);
}

.die-hope .die-label {
  color: rgba(85, 238, 221, 0.65);
}

.die-fear {
  background: linear-gradient(160deg, rgba(255, 176, 74, 0.18), rgba(9, 14, 26, 0.35));
  filter: drop-shadow(0 0 10px rgba(255, 176, 74, 0.3));
}

.die-fear .die-value {
  color: var(--fear);
}

.die-fear .die-label {
  color: rgba(255, 176, 74, 0.65);
}

.die-adv .die-value {
  color: var(--hope);
}

.die-dis .die-value {
  color: var(--fear);
}

/* 翻滚 / 落定（全应用唯一的戏剧性动效区） */
.die.tumbling {
  animation: dice-tumble 0.22s linear infinite;
}

@keyframes dice-tumble {
  0% {
    transform: rotate(-7deg) scale(1.04) translateY(-2px);
  }
  25% {
    transform: rotate(5deg) scale(0.97) translateY(1px);
  }
  50% {
    transform: rotate(-4deg) scale(1.05) translateY(-3px);
  }
  75% {
    transform: rotate(6deg) scale(0.98) translateY(2px);
  }
  100% {
    transform: rotate(-7deg) scale(1.04) translateY(-2px);
  }
}

.die-land {
  animation: die-land 0.45s var(--ease-snap) backwards;
}

@keyframes die-land {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(1.22) rotate(10deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.roll-total-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
}

.roll-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  animation: total-pop 0.4s var(--ease-snap) 0.12s backwards;
}

@keyframes total-pop {
  from {
    opacity: 0;
    transform: scale(0.65);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 结果徽标：切角 */
.outcome-badge {
  padding: 3px var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  border: none;
  background: var(--bg-2);
  color: var(--tx-1);
}

.badge-good {
  background: var(--hope-dim);
  color: var(--hope);
}

.badge-bad {
  background: var(--fear-dim);
  color: var(--fear);
}

.badge-crit {
  background: var(--crit-dim);
  color: var(--crit);
  filter: drop-shadow(0 0 8px rgba(202, 162, 255, 0.4));
}

/* 结果卡语义光效 */
.result-crit {
  filter: drop-shadow(0 0 14px rgba(202, 162, 255, 0.35));
}

.result-hope {
  filter: drop-shadow(0 0 12px rgba(85, 238, 221, 0.16));
}

.result-fear {
  filter: drop-shadow(0 0 12px rgba(255, 176, 74, 0.2));
}

.calc-line {
  margin-top: var(--sp-2);
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--tx-1);
  word-break: break-all;
}

.point-notes {
  margin-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}

.point-note {
  padding: 2px var(--sp-3);
  border: 1px solid rgba(85, 238, 221, 0.35);
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--hope);
  background: var(--hope-dim);
}

/* 风味文本：叙事引文（左侧光轨 + 斜体） */
.flavor-text {
  margin-top: var(--sp-3);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-3);
  border-left: 2px solid rgba(85, 238, 221, 0.4);
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--tx-1);
  line-height: 1.9;
}

/* 关键一击：星尘从结果中心向四周迸发 */
.sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.spark {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 13px;
  color: var(--crit);
  text-shadow: 0 0 10px rgba(202, 162, 255, 0.8);
  opacity: 0;
  animation: spark-fly 0.9s ease-out 0.1s forwards;
}

.spark.s2 { animation-delay: 0.16s; color: var(--hope); }
.spark.s3 { animation-delay: 0.22s; }
.spark.s4 { animation-delay: 0.12s; color: var(--fear); }
.spark.s5 { animation-delay: 0.26s; color: var(--hope); }
.spark.s6 { animation-delay: 0.18s; }
.spark.s7 { animation-delay: 0.3s; color: var(--fear); }
.spark.s8 { animation-delay: 0.24s; color: var(--hope); }

.spark.s1 { --sx: -70px; --sy: -52px; }
.spark.s2 { --sx: 64px; --sy: -60px; }
.spark.s3 { --sx: -84px; --sy: 8px; }
.spark.s4 { --sx: 88px; --sy: 16px; }
.spark.s5 { --sx: -46px; --sy: 56px; }
.spark.s6 { --sx: 52px; --sy: 62px; }
.spark.s7 { --sx: -12px; --sy: -72px; }
.spark.s8 { --sx: 16px; --sy: 74px; }

@keyframes spark-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sx, 0px)), calc(-50% + var(--sy, 0px))) scale(1.3) rotate(160deg);
  }
}

/* ════════════════════════════════════════════════════════════
   状态面板
   ════════════════════════════════════════════════════════════ */

.stat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.stat-name {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.stat-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--tx-1);
}

.stat-title-line {
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--fear);
}

.card-heading {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--tx-2);
  margin-bottom: var(--sp-3);
}

/* 标题后的发丝延伸线 */
.card-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* 资源行：标签 + 槽位 + 读数 + 步进 */
.res-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.res-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.res-label {
  flex: none;
  width: 58px;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--tx-1);
}

.res-label svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.res-ico-hp { color: var(--res-hp); }
.res-ico-stress { color: var(--res-stress); }
.res-ico-hope { color: var(--res-hope); }
.res-ico-armor { color: var(--res-armor); }

/* 槽位（斜切仪表格；≤14 上限时替代进度条） */
.pips {
  flex: 1;
  display: flex;
  gap: 3px;
  min-width: 0;
}

.pip {
  flex: 1;
  max-width: 16px;
  height: 16px;
  transform: skewX(-10deg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition:
    background var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    filter var(--dur-2) var(--ease-out);
}

.pip.filled-hp {
  background: var(--res-hp);
  border-color: transparent;
  filter: drop-shadow(0 0 3px rgba(251, 127, 140, 0.5));
}

.pip.filled-stress {
  background: var(--res-stress);
  border-color: transparent;
  filter: drop-shadow(0 0 3px rgba(255, 176, 74, 0.5));
}

.pip.filled-hope {
  background: var(--res-hope);
  border-color: transparent;
  filter: drop-shadow(0 0 3px rgba(85, 238, 221, 0.5));
}

.pip.filled-armor {
  background: var(--res-armor);
  border-color: transparent;
  filter: drop-shadow(0 0 3px rgba(143, 168, 232, 0.5));
}

/* >14 上限退化为细进度条 */
.res-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.res-fill {
  height: 100%;
  transition: width 0.35s var(--ease-out);
}

.res-fill-hp { background: var(--res-hp); }
.res-fill-stress { background: var(--res-stress); }
.res-fill-hope { background: var(--res-hope); }
.res-fill-armor { background: var(--res-armor); }
.res-fill-dread { background: var(--fear); }

.res-num {
  flex: none;
  min-width: 52px;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.res-num .res-max {
  color: var(--tx-2);
  font-weight: 400;
}

/* 危急：标签与读数转系统红并呼吸 */
.res-danger .res-label,
.res-danger .res-num {
  color: var(--danger);
}

.res-danger .pip:not([class*="filled"]) {
  border-color: rgba(255, 109, 122, 0.45);
  animation: danger-breathe 1.6s ease-in-out infinite;
}

@keyframes danger-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* 资源步进钮 */
.stepper {
  flex: none;
  width: 30px;
  height: 30px;
  min-height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

/* 属性栅格（状态页只读） */
.stat-attr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.stat-attr {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--tx-1);
}

.stat-attr svg {
  width: 16px;
  height: 16px;
  color: var(--tx-2);
}

.stat-attr-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--hope);
}

.stat-meta-line {
  margin-top: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--tx-1);
  word-break: break-all;
}

.weapon-line {
  font-size: var(--fs-sm);
  color: var(--tx-0);
  padding: var(--sp-1) 0;
}

.weapon-line + .weapon-line {
  border-top: 1px solid var(--line);
}

.marker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.marker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}

.marker-key {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx-1);
}

.marker-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--hope);
}

/* 原生 select 的体系化配色（掷骰页标记物下拉等通用）：--bg-2 底、发丝边、44px 触控 */
.select-input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--tx-0);
  font-size: var(--fs-md);
  font-family: inherit;
  transition: border-color var(--dur-1) var(--ease-out);
}

.select-input:focus {
  outline: none;
  border-color: var(--line-hi);
}

.select-input:disabled {
  color: var(--tx-2);
  opacity: 0.6;
}

.select-input option {
  background: var(--bg-1);
  color: var(--tx-0);
}

/* ════════════════════════════════════════════════════════════
   笔记面板（舰桥日志）
   ════════════════════════════════════════════════════════════ */

.notes-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.note-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid rgba(85, 238, 221, 0.4);
  border-radius: var(--r-sm);
}

.note-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro);
  color: var(--tx-2);
  line-height: 1.5;
  padding-top: 2px;
  white-space: pre-line;
  text-align: right;
}

.note-content {
  font-size: var(--fs-sm);
  word-break: break-word;
  white-space: pre-wrap;
}

.note-in {
  animation: note-in 0.4s var(--ease-out);
  border-left-color: var(--hope);
  filter: drop-shadow(0 0 8px rgba(85, 238, 221, 0.25));
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 底部输入栏（安全区适配） */
.input-bar {
  display: flex;
  gap: var(--sp-2);
  margin: var(--sp-3);
  margin-top: 0;
  padding: var(--sp-2);
  padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
}

.note-input {
  flex: 1;
  min-height: var(--touch);
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--tx-0);
  font-size: var(--fs-md);
  font-family: inherit;
  transition: border-color var(--dur-1) var(--ease-out);
}

.note-input::placeholder {
  color: var(--tx-2);
}

.note-input:focus {
  outline: none;
  border-color: rgba(85, 238, 221, 0.55);
}

.note-input:disabled {
  opacity: 0.5;
}

.btn-send {
  flex: none;
  min-height: var(--touch);
}

/* ════════════════════════════════════════════════════════════
   动态面板（全团掷骰流）
   ════════════════════════════════════════════════════════════ */

.feed-card {
  padding: var(--sp-3) var(--sp-4);
  border-left: 2px solid rgba(85, 238, 221, 0.35);
}

.feed-new {
  animation: feed-in 0.35s var(--ease-out);
  border-left-color: var(--hope);
}

@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.feed-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.feed-user {
  font-weight: 700;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-kind {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--line-hi);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tx-1);
  clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

.feed-kind-kind-gm {
  border-color: rgba(255, 176, 74, 0.5);
  color: var(--fear);
}

.feed-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro);
  color: var(--tx-2);
}

.feed-cmd {
  margin-top: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--tx-1);
  word-break: break-all;
}

.feed-summary {
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--hope);
}

.feed-summary::before {
  content: "› ";
  color: var(--tx-2);
}

/* ════════════════════════════════════════════════════════════
   GM 面板
   ════════════════════════════════════════════════════════════ */

.dread-card {
  text-align: center;
}

.dread-number {
  line-height: 1;
  margin: var(--sp-2) 0 var(--sp-3);
}

.dread-current {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 64px;
  font-weight: 800;
  color: var(--fear);
  filter: drop-shadow(0 0 18px rgba(255, 176, 74, 0.4));
}

.dread-max {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  color: var(--tx-2);
}

.dread-pips {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: var(--sp-4);
}

.dread-pip {
  width: 14px;
  height: 18px;
  transform: skewX(-10deg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition:
    background var(--dur-2) var(--ease-out),
    filter var(--dur-2) var(--ease-out);
}

.dread-pip.filled {
  background: var(--fear);
  border-color: transparent;
  filter: drop-shadow(0 0 4px rgba(255, 176, 74, 0.55));
}

.dread-actions {
  display: flex;
  gap: var(--sp-2);
}

.dread-btn {
  flex: 1;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* 恐惧点变化脉冲（卡片 + 数字弹跳） */
.dread-card.pulse {
  animation: dread-pulse 0.6s var(--ease-out);
}

@keyframes dread-pulse {
  0% {
    filter: drop-shadow(0 0 0 rgba(255, 176, 74, 0));
  }
  35% {
    filter: drop-shadow(0 0 22px rgba(255, 176, 74, 0.55));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 176, 74, 0));
  }
}

.dread-card.pulse .dread-current {
  display: inline-block;
  animation: num-pop 0.5s var(--ease-snap);
}

@keyframes num-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

.section-heading {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--tx-2);
  padding: 0 var(--sp-1);
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pc-card {
  padding: var(--sp-3) var(--sp-4);
}

.pc-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.pc-name {
  font-weight: 700;
}

.pc-player {
  font-size: var(--fs-sm);
  color: var(--tx-2);
}

.pc-res {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
}

.pc-res-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--tx-1);
}

.pc-res-item svg {
  width: 14px;
  height: 14px;
}

.pc-res-item .pc-res-max {
  color: var(--tx-2);
}

.pc-danger {
  color: var(--danger);
  font-weight: 700;
}

.pc-alerts {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--fear);
}

/* ════════════════════════════════════════════════════════════
   toast 事件通知（console-panel 体系新组件）
   --bg-2 底 + 发丝边 + 切角 + 左侧 2px 语义色条；层级高于一切面板
   ════════════════════════════════════════════════════════════ */

.toast-stack {
  position: fixed;
  top: calc(var(--sp-3) + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  /* 左侧 2px 语义色条：背景渐变实现（跟随切角轮廓，不占伪元素） */
  --toast-bar: var(--line-hi);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  padding-left: calc(var(--sp-3) + 2px);
  background:
    linear-gradient(var(--toast-bar), var(--toast-bar)) left top / 2px 100% no-repeat,
    var(--bg-2);
  border: 1px solid var(--line);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  animation: toast-in 0.22s var(--ease-out);
}

.toast-hope { --toast-bar: var(--hope); }
.toast-fear { --toast-bar: var(--fear); }
.toast-crit { --toast-bar: var(--crit); }

.toast.leaving {
  animation: toast-out 0.22s var(--ease-out) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.toast-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-detail {
  font-size: var(--fs-sm);
  color: var(--tx-1);
}

/* ════════════════════════════════════════════════════════════
   队伍面板（所有用户可见；资源复用状态页 pip/细进度条只读样式）
   ════════════════════════════════════════════════════════════ */

.party-card {
  padding: var(--sp-3) var(--sp-4);
}

.party-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: 2px;
}

.party-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 「我」徽标：切角小芯片，希望青 */
.badge-me {
  flex: none;
  padding: 0 6px;
  border: 1px solid rgba(85, 238, 221, 0.5);
  background: var(--hope-dim);
  color: var(--hope);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

.party-player {
  font-size: var(--fs-sm);
  color: var(--tx-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-evasion {
  flex: none;
  margin-left: auto;
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  color: var(--tx-2);
}

.party-class {
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--tx-1);
}

/* ════════════════════════════════════════════════════════════
   空状态 / 底部导航
   ════════════════════════════════════════════════════════════ */

.empty-state {
  margin: auto;
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--tx-1);
}

.empty-mark {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--sp-3);
  color: var(--hope);
  opacity: 0.75;
  filter: drop-shadow(0 0 10px rgba(85, 238, 221, 0.35));
  animation: drift 4.5s ease-in-out infinite alternate;
}

.empty-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes drift {
  from {
    transform: translateY(0) rotate(0deg);
  }
  to {
    transform: translateY(-7px) rotate(14deg);
  }
}

.empty-title {
  font-size: var(--fs-lg);
  color: var(--tx-0);
  margin-bottom: var(--sp-1);
}

.empty-hint {
  font-size: var(--fs-sm);
}

/* 底部 tab 导航 */
.tabbar {
  display: flex;
  gap: var(--sp-1);
  margin: var(--sp-3);
  margin-top: 0;
  padding: var(--sp-1);
  padding-bottom: calc(var(--sp-1) + env(safe-area-inset-bottom, 0px));
}

.tab-btn {
  position: relative;
  flex: 1;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--tx-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition:
    color var(--dur-1) var(--ease-out),
    background var(--dur-1) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn svg {
  width: 21px;
  height: 21px;
}

/* 激活指示：顶部 2px 光轨 */
.tab-btn::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  transform: translateX(-50%);
  background: var(--hope);
  transition: width var(--dur-2) var(--ease-out);
}

.tab-btn.active {
  color: var(--hope);
  background: var(--hope-dim);
}

.tab-btn.active::before {
  width: 22px;
}

.tab-gm.active {
  color: var(--fear);
  background: var(--fear-dim);
}

.tab-gm::before {
  background: var(--fear);
}

.tab-btn.active svg {
  animation: tab-pop 0.25s var(--ease-snap);
}

@keyframes tab-pop {
  from {
    transform: scale(0.7);
  }
  to {
    transform: scale(1);
  }
}

/* ── 桌面端适度放宽 ── */
@media (min-width: 641px) {
  .app-view {
    padding-top: var(--sp-4);
  }
}

/* ── 尊重系统减弱动效偏好 ── */
@media (prefers-reduced-motion: reduce) {
  .stars,
  .stars-far,
  .nebula,
  .meteor,
  .empty-mark,
  .brand-ring,
  .result-in,
  .feed-new,
  .dread-card.pulse,
  .dread-card.pulse .dread-current,
  .dread-badge.pulse,
  .dread-badge.pulse .dread-badge-num,
  .toast,
  .toast.leaving,
  .res-danger .pip,
  .login-card,
  .btn-roll:not(:disabled),
  .die.tumbling,
  .die-land,
  .roll-total,
  .note-in,
  .ws-dot.on,
  .ws-dot.retry,
  .tab-btn.active svg {
    animation: none;
  }
  .spark {
    display: none;
  }
  .notes-list {
    scroll-behavior: auto;
  }
  .res-fill {
    transition: none;
  }
}
