/* 灵犀 · 样式
   系统字体与分组背景；所有卡片、按钮、输入框都用连续曲率圆角（.sq，见 squircle.js）；
   毛玻璃只用在浮在内容之上的表情栏、提示和倒数上。 */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;

  --bg: #f2f2f7;
  --card: #ffffff;
  --label: #000000;
  --label-2: #6c6c70;
  --label-3: #8a8a8e;
  --sep: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);

  /* 我 = 靛蓝，TA = 青色；文字色在各自的浅底上对比度 ≥ 4.5:1 */
  --me: #5856d6;
  --me-ink: #4b49c8;
  --me-tint: rgba(88, 86, 214, 0.12);
  --peer: #30b0c7;
  --peer-ink: #06707f;
  --peer-tint: rgba(48, 176, 199, 0.14);
  --green: #34c759;
  --green-ink: #248a3d;
  --orange: #ff9500;
  --pink: #ff2d55;
  --red: #ff3b30;
  --red-ink: #d70015;
  --red-tint: rgba(255, 59, 48, 0.12);

  --glass: rgba(255, 255, 255, 0.68);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  --icon-shadow: rgba(0, 0, 0, 0.14);
  --veil: rgba(242, 242, 247, 0.55);
  --scrim: rgba(0, 0, 0, 0.24);
  --focus: #000000;

  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.45, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --label: #ffffff;
    --label-2: #98989f;
    --label-3: #8e8e93;
    --sep: rgba(84, 84, 88, 0.65);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.36);
    --me: #5e5ce6;
    --me-ink: #a9a8ff;
    --me-tint: rgba(94, 92, 230, 0.26);
    --peer: #40c8e0;
    --peer-ink: #6edcec;
    --peer-tint: rgba(64, 200, 224, 0.2);
    --green: #30d158;
    --green-ink: #30d158;
    --orange: #ff9f0a;
    --pink: #ff375f;
    --red: #ff453a;
    --red-ink: #ff6961;
    --red-tint: rgba(255, 69, 58, 0.2);
    --glass: rgba(44, 44, 46, 0.62);
    --glass-edge: rgba(255, 255, 255, 0.16);
    --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
    --icon-shadow: rgba(0, 0, 0, 0.6);
    --veil: rgba(0, 0, 0, 0.45);
    --scrim: rgba(0, 0, 0, 0.55);
    --focus: #ffffff;
  }
}

@media (prefers-contrast: more) {
  :root {
    --label-2: #3c3c43;
    --label-3: #5c5c62;
    --sep: rgba(60, 60, 67, 0.45);
    --fill: rgba(118, 118, 128, 0.22);
    --me-tint: rgba(88, 86, 214, 0.2);
    --peer-tint: rgba(48, 176, 199, 0.24);
    --glass: var(--card);
    --glass-edge: var(--sep);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --label-2: #d1d1d6;
    --label-3: #aeaeb2;
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass: var(--card);
    --veil: var(--bg);
  }
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* iOS：跟随系统「文字大小」（Dynamic Type），所有字号都用 rem */
@supports (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  /* 像原生 App 一样：界面文字不能被选中，连点、长按时不会弹出选择菜单 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button,
input {
  font: inherit;
  color: inherit;
}
input {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
p,
h1,
h2,
ul {
  margin: 0;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(20px, env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 28px) max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
body.has-tray .screen {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 124px);
}
body.booting .screen {
  visibility: hidden;
}
@media (min-width: 640px) and (min-height: 760px) {
  .screen {
    padding-top: 6vh;
  }
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- 文字 ---------- */

.large-title {
  font-size: 2rem;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lede {
  font-size: 1.0588rem;
  line-height: 1.5;
  color: var(--label-2);
}
.eyebrow {
  font-size: 0.7647rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--label-2);
}
.footnote {
  font-size: 0.7647rem;
  line-height: 1.45;
  color: var(--label-2);
}
.footnote,
.list .txt,
.done-sub {
  text-wrap: pretty;
}
/* 居中的竖排容器里，文字段落撑满宽度：否则 Safari 会按第一行的宽度收缩，导致多余的换行 */
.hero > p,
.done-hero > p,
.code-card > p,
.invite > p,
.locked > p,
.pause-card > p {
  align-self: stretch;
}
.center {
  text-align: center;
}
.section-label {
  padding: 0 16px 8px;
  font-size: 0.7647rem;
  font-weight: 500;
  color: var(--label-2);
}

/* ---------- 连续曲率圆角与环 ---------- */

.sq {
  position: relative;
  border-radius: var(--r, 0);
}
.ring {
  --ring-w: 2.5px;
  --ring-c: transparent; /* 不继承外层（比如表情栏）的描边色 */
}
.ring::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--ring-c, transparent);
  clip-path: var(--sq-ring, inset(50%));
  transition: background-color 0.15s;
}
.ring:focus-visible {
  outline: none;
  --ring-c: var(--focus);
}
.card {
  --r: 22px;
  background: var(--card);
}

/* ---------- 按钮 ---------- */

.btn {
  --r: 16px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
  min-height: 52px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--fill);
  color: var(--label);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease), opacity 0.2s, background-color 0.2s, color 0.2s;
}
.btn.block {
  display: flex;
  width: 100%;
}
.btn.primary {
  background: var(--me);
  color: #fff;
}
.btn.tinted {
  background: var(--me-tint);
  color: var(--me-ink);
}
.btn.danger {
  background: var(--red-tint);
  color: var(--red-ink);
}
.btn.plain {
  background: none;
  color: var(--me-ink);
  font-weight: 500;
  min-height: 44px;
  padding: 0 12px;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
  opacity: 0.8;
}
.btn:disabled {
  opacity: 0.38;
  cursor: default;
}
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.05);
  }
  .btn.plain:hover {
    opacity: 0.75;
  }
}
.btn.busy {
  pointer-events: none;
}
.btn .spinner {
  display: none;
}
.btn.busy .spinner {
  display: block;
}
.spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2.25px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  --r: 999px;
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease), background-color 0.2s;
}
.icon-btn:active {
  transform: scale(0.9);
}
.icon-btn .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2.6;
}

/* ---------- 首页 ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 0 6px;
  text-align: center;
}
.app-icon-wrap {
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 18px var(--icon-shadow));
}
.app-icon {
  --r: 21px;
  width: 92px;
  height: 92px;
  background: var(--card);
  isolation: isolate;
}
.orb {
  position: absolute;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-top: -23px;
  border-radius: 50%;
  mix-blend-mode: multiply;
}
.orb.a {
  left: 13px;
  background: var(--me);
  animation: drift-a 5.6s var(--ease) infinite alternate;
}
.orb.b {
  right: 13px;
  background: var(--peer);
  animation: drift-b 5.6s var(--ease) infinite alternate;
}
@keyframes drift-a {
  to {
    transform: translateX(6px);
  }
}
@keyframes drift-b {
  to {
    transform: translateX(-6px);
  }
}
@media (prefers-color-scheme: dark) {
  .orb {
    mix-blend-mode: screen;
  }
}

.invite {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.invite-code {
  font-family: var(--rounded);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.field-row {
  --r: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  background: var(--card);
  cursor: text;
}
.field-row > span {
  flex: none;
  font-weight: 500;
}
.field-row input {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 1rem;
  text-align: right;
}
.field-row input::placeholder,
.field input::placeholder {
  color: var(--label-3);
}
.field-row:focus-within,
.field:focus-within {
  --ring-c: var(--me);
}

.join {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.join .section-label {
  padding-bottom: 0;
  text-align: center;
}
.code-entry {
  position: relative;
}
.code-entry input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  background: none;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  cursor: text;
}
.code-boxes {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.code-box {
  --r: 13px;
  flex: 1 1 0;
  max-width: 54px;
  height: 62px;
  display: grid;
  place-items: center;
  background: var(--card);
  font-family: var(--rounded);
  font-size: 1.647rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.code-box:nth-child(4) {
  margin-left: 10px;
}
.code-entry.focused .code-box.active {
  --ring-c: var(--me);
}
.code-entry.focused .code-box.active:empty::before {
  content: "";
  width: 2px;
  height: 28px;
  border-radius: 1px;
  background: var(--me);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.code-entry.error .code-box,
.code-entry.error.focused .code-box.active {
  --ring-c: var(--red);
}
.field-error {
  font-size: 0.7647rem;
  color: var(--red-ink);
  text-align: center;
}

.list {
  --r: 20px;
  list-style: none;
  padding: 0 0 0 16px;
  background: var(--card);
}
.list li {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
}
.list .txt {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 12px 0;
  font-size: 0.9412rem;
  line-height: 1.4;
}
.list li + li .txt {
  border-top: 0.5px solid var(--sep);
}
.tile {
  --r: 8px;
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
}
.tile .icon {
  width: 18px;
  height: 18px;
}
.tile.indigo {
  background: var(--me);
}
.tile.teal {
  background: var(--peer);
}
.tile.orange {
  background: var(--orange);
}
.tile.pink {
  background: var(--pink);
}

/* ---------- 导航栏 ---------- */

.nav {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) auto minmax(48px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 52px;
}
.nav > :first-child {
  justify-self: start;
}
.nav > :last-child {
  justify-self: end;
}
.nav .btn.plain {
  gap: 2px;
  margin-left: -10px;
  padding: 0 10px 0 6px;
}
.nav-title {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}
#play .nav-title {
  font-size: 1.294rem;
  font-weight: 700;
}
.nav-sub {
  margin-top: 1px;
  font-size: 0.7059rem;
  color: var(--label-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- 房间 ---------- */

.code-card {
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.code-big {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 2px 14px;
  background: none;
  font-family: var(--rounded);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 0.2s var(--ease), opacity 0.2s;
}
.code-big:active {
  transform: scale(0.97);
  opacity: 0.6;
}
.code-big:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 2px;
}
.code-card .btn {
  margin-top: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 600;
}
.avatar.me {
  background: var(--me-tint);
  color: var(--me-ink);
}
.avatar.peer {
  background: var(--peer-tint);
  color: var(--peer-ink);
}
.avatar.empty {
  background: none;
  border: 1.5px dashed var(--label-3);
  animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    opacity: 0.4;
  }
}
.seats li {
  min-height: 66px;
}
.seat-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.seat-text b {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-text small {
  font-size: 0.7647rem;
  color: var(--label-2);
}
.status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 0.7647rem;
  color: var(--label-2);
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--label-3);
}
.status.on::before {
  background: var(--green);
}

/* ---------- 回合 ---------- */

.timer {
  position: relative;
  width: 48px;
  height: 48px;
}
.timer svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer circle {
  fill: none;
  stroke-width: 4.5;
}
.timer .track {
  stroke: var(--fill-2);
}
.timer .bar {
  stroke: var(--label);
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  transition: stroke 0.3s;
}
.timer.warn .bar {
  stroke: var(--orange);
}
.timer.crit .bar {
  stroke: var(--red);
}
.timer.paused .bar {
  stroke: var(--label-3);
}
.timer-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--rounded);
  font-size: 0.9412rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timer.crit .timer-num {
  color: var(--red-ink);
}

.versus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pill {
  --r: 18px;
  min-height: 58px;
  padding: 9px 12px 9px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
}
.pill .avatar {
  width: 38px;
  height: 38px;
  font-size: 0.9412rem;
  transition: opacity 0.2s;
}
.pill-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pill-text b {
  overflow: hidden;
  font-size: 0.8824rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill-text small {
  font-size: 0.7647rem;
  color: var(--label-2);
  white-space: nowrap;
}
.pill-check {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--green);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s, transform 0.35s var(--spring);
}
.pill.done .pill-check {
  opacity: 1;
  transform: none;
}
.pill.done small {
  color: var(--green-ink);
}
.pill.off small {
  color: var(--red-ink);
}
.pill.off .avatar {
  opacity: 0.4;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prompt {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}
.prompt > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prompt-title {
  font-size: 1.294rem;
  font-weight: 700;
}
.pair,
.duel,
.duel-names {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}
.vs {
  color: var(--label-3);
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
}
.chip {
  --r: 14px;
  min-height: 48px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0588rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}
.chip.me {
  background: var(--me-tint);
  color: var(--me-ink);
}
.chip.peer {
  background: var(--peer-tint);
  color: var(--peer-ink);
}
.chip.none {
  background: var(--fill);
  color: var(--label-2);
  font-size: 0.8824rem;
  font-weight: 500;
}
.chip.big {
  --r: 20px;
  min-height: 88px;
  padding: 12px;
  font-size: 1.412rem;
  font-weight: 700;
}

.compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field {
  --r: 18px;
  display: flex;
  background: var(--card);
}
.field input {
  flex: 1;
  min-width: 0;
  height: 64px;
  padding: 0 16px;
  border: 0;
  outline: 0;
  background: none;
  font-size: 1.412rem;
  font-weight: 600;
  text-align: center;
}
.field input:disabled {
  opacity: 0.45;
}

.locked,
.pause-card {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.locked-word {
  font-size: 1.647rem;
  font-weight: 700;
  color: var(--me-ink);
  overflow-wrap: anywhere;
}
.paused-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}
.dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: dot 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes dot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: none;
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.reveal {
  gap: 14px;
  padding-top: 6px;
  text-align: center;
}
.reveal-title {
  font-size: 1.647rem;
  font-weight: 700;
}
.duel-names span {
  overflow: hidden;
  font-size: 0.7647rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-names .me {
  color: var(--me-ink);
}
.duel-names .peer {
  color: var(--peer-ink);
}
.next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}
.progress {
  width: 120px;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--fill-2);
}
.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--label-2);
  transform-origin: left center;
}

/* ---------- 结果 ---------- */

.done-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
  text-align: center;
}
.merge {
  position: relative;
  width: 100%;
  height: 116px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
}
.merge > * {
  grid-area: 1 / 1;
}
.merge .chip {
  min-width: 9.5rem;
  max-width: 86%;
}
.chip.both {
  min-height: 96px;
  padding: 12px 30px;
  font-size: 1.882rem;
  background: linear-gradient(105deg, var(--me-tint), var(--peer-tint));
}
.chip.both span {
  background: linear-gradient(105deg, var(--me-ink), var(--peer-ink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.merge-pulse {
  width: 116px;
  height: 116px;
  border: 2px solid var(--me);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.done-sub {
  font-size: 1.0588rem;
  line-height: 1.45;
}
.history {
  padding: 16px 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}
.h-name {
  overflow: hidden;
  font-size: 0.7647rem;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.h-name.me {
  color: var(--me-ink);
}
.h-name.peer {
  color: var(--peer-ink);
}
.h-label {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 0.7647rem;
  color: var(--label-2);
}
.h-mark {
  color: var(--label-3);
  font-weight: 600;
  text-align: center;
}
.h-mark.ok {
  color: var(--green-ink);
  font-size: 1.2rem;
}

/* ---------- 表情栏（浮动的玻璃层） ---------- */

.dock {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px)
    max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.dock-box {
  position: relative;
  width: 100%;
  max-width: 440px;
  pointer-events: auto;
}
.dock-shadow {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  box-shadow: var(--glass-shadow);
}
.tray {
  --r: 28px;
  --ring-w: 1px;
  --ring-c: var(--glass-edge);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  padding: 7px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.8);
  backdrop-filter: blur(26px) saturate(1.8);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (max-width: 370px) {
  .tray {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.emoji-key {
  --r: 16px;
  appearance: none;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background-color 0.15s;
}
.emoji-key span {
  display: block;
  font-family: var(--emoji);
  font-size: 27px;
  line-height: 1;
  pointer-events: none;
}
.emoji-key:active {
  background: var(--fill);
}
@media (hover: hover) {
  .emoji-key:hover {
    background: var(--fill);
  }
}

.fx {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  pointer-events: none;
}
.float {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--emoji);
  line-height: 1;
  will-change: transform, opacity;
}

.burst {
  position: fixed;
  z-index: 45;
  top: calc(env(safe-area-inset-top, 0px) + 66px);
  right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px 5px 5px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: var(--glass-shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
  transition: opacity 0.2s, transform 0.3s var(--spring);
}
.burst.show {
  opacity: 1;
  transform: none;
}
.burst .avatar {
  width: 30px;
  height: 30px;
  font-size: 0.8235rem;
}
.burst-emoji {
  font-family: var(--emoji);
  font-size: 22px;
  line-height: 1;
}
.burst b {
  font-family: var(--rounded);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- 浮层：提示、连接状态、倒数、对话框 ---------- */

.toast,
.banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 16px;
  right: 16px;
  width: -webkit-fit-content;
  width: fit-content;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: var(--glass-shadow);
  font-weight: 600;
  pointer-events: none;
}
.toast {
  z-index: 80;
  padding: 11px 18px;
  font-size: 0.8824rem;
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s, transform 0.35s var(--spring);
}
.toast.show {
  opacity: 1;
  transform: none;
}
.banner {
  z-index: 75;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8235rem;
  color: var(--label-2);
}
.banner .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.countdown {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--veil);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
}
.cd-label {
  font-size: 1.0588rem;
  font-weight: 600;
  color: var(--label-2);
}
.cd-num {
  font-family: var(--rounded);
  font-size: 8rem;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--me), var(--peer));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.alert-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  animation: fade 0.2s ease;
}
.alert {
  --r: 28px;
  width: min(320px, 100%);
  padding: 24px 18px 16px;
  background: var(--card);
  text-align: center;
  animation: pop 0.32s var(--spring);
}
.alert h2 {
  font-size: 1.0588rem;
  font-weight: 600;
}
.alert p {
  margin: 6px 0 20px;
  font-size: 0.8235rem;
  line-height: 1.45;
  color: var(--label-2);
}
.alert-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.alert-actions.single {
  grid-template-columns: 1fr;
}
.alert .btn {
  --r: 999px;
  min-height: 46px;
  font-size: 0.9412rem;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
