:root {

  /* 注册一个可动画的 CSS 属性，用于 SVG 路径变形 */
  @property --arrow-path {
    syntax: "<path()>";
    inherits: false;
    initial-value: path("M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z");
  }

  --arrow-path-down: path("M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z");
  --arrow-path-up: path("M11.9999 10.8286L16.9497 15.7783L18.3639 14.3641L11.9999 8.0001L5.63599 14.3641L7.0502 15.7783L11.9999 10.8286Z");
  --arrow-path-flat: path("M11.9999 12L16.9497 12L18.3639 12L11.9999 12L5.63599 12L7.0502 12L11.9999 12Z");
  --bg: #0d1117;
  --card-bg: rgba(13, 17, 23, 0.8);
  --card-border: rgba(255, 255, 255, 0.08);
  --fg: #f2f6ff;
  --muted: rgba(255, 255, 255, 0.6);
  --accent: #00ffa3;
  --accent-weak: rgba(0, 255, 163, 0.2);
  --loss: #ff5c8a;
  --gain: #6ee7b7;
  --surface-1: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-border: rgba(255, 255, 255, 0.12);
  --layout-max-width: 960px;
  font-family: "Inter",
  "SF Pro Display",
  "PingFang SC",
  system-ui,
  -apple-system,
  BlinkMacSystemFont,
  "Segoe UI",
  sans-serif;
}

body[data-theme="light"] {
  --bg: #fdf7ff;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(229, 140, 208, 0.35);
  --fg: #1b1324;
  --muted: rgba(27, 19, 36, 0.62);
  --accent: #ff5fbf;
  --accent-weak: rgba(255, 95, 191, 0.18);
  --loss: #e0487d;
  --gain: #0f9664;
  --surface-1: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(255, 255, 255, 0.96);
  --surface-border: rgba(231, 148, 204, 0.4);
  color-scheme: light;
  background: radial-gradient(circle at 20% 18%, rgba(255, 180, 220, 0.28), transparent 44%),
    radial-gradient(circle at 82% -4%, rgba(255, 225, 248, 0.55), transparent 52%),
    var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color-scheme: dark;
  background: radial-gradient(circle at 20% 20%, rgba(0, 255, 163, 0.08), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(100, 133, 255, 0.12), transparent 45%),
    var(--bg);
  color: var(--muted);
  padding: 0 1rem 3rem;
}


.app-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-top: 2.5rem;
  text-align: center;
  z-index: 2;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: 0.08em;
  text-wrap: balance;
}

.header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(var(--layout-max-width), 100%);
  margin: 0 auto;
  flex-wrap: wrap;
}




.header-toolbar .last-updated {
  margin-right: auto;
  font-size: 0.85rem;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
}

.header-actions-left,
.header-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.header-actions-left {
  justify-content: flex-start;
  flex: 1 1 auto;
}

.header-actions-right {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.header-actions-right .refresh-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.segmented-control {
  position: relative;
  display: inline-flex;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface-1);
  padding: 4px;
}

.segmented-control .segment {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  padding: 0 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 250ms ease;
  height: 2rem;
}

.segmented-control .segment+.segment {
  border-left: none; /* No longer needed with the glider */
}

.segmented-control .segment.is-active {
  color: var(--fg);
}

.segmented-control .segment-glider {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: var(--surface-2);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

#view-toggle[data-active-view="expanded"] .segment-glider,
#display-toggle[data-active-mode="price"] .segment-glider {
  transform: translateX(100%);
}

body[data-theme="light"] .segmented-control .segment-glider {
  background: var(--surface-1); /* Use a slightly different shade for light mode */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 2.4rem;
  padding: 0 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.header-action.theme-toggle {
  min-width: 2.4rem;
  padding: 0;
  font-size: 1.1rem;
  letter-spacing: 0;
}

.header-action.style-select {
  display: inline-block;
  min-width: 8.5rem;
  height: 2.4rem;
  padding: 0 2.4rem 0 0.85rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1rem center, right 0.65rem center;
  background-size: 0.45rem 0.45rem;
  background-repeat: no-repeat;
}

.header-action.style-select::-ms-expand {
  display: none;
}

.header-action.style-select option {
  background-color: var(--bg);
  color: var(--fg);
}


.header-action:hover {
  border-color: var(--accent);
  background-color: var(--accent-weak);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.header-action:active {
  transform: scale(0.96);
}

.header-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body[data-theme="light"] .header-action {
  box-shadow: 0 10px 24px rgba(221, 165, 206, 0.16);
}

body[data-theme="light"] .header-action:hover {
  box-shadow: 0 14px 28px rgba(221, 165, 206, 0.24);
}

.view-toggle {
  min-width: 6rem;
  padding: 0 0.9rem;
}

.refresh-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.refresh-inline .token-counter {
  font-size: 0.8rem;
  color: var(--fg);
  background: var(--surface-1);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  white-space: nowrap;
}

/* 背景计数器核心样式 */
.token-counter-container {
  position: fixed;
  top: 2rem;       /* 距离顶部 */
  right: 2rem;     /* 距离右侧 */
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* 移除容器自身样式 */
  background: none;
  border: none;
  padding: 0;
  opacity: 0.08; /* 设置整体透明度，使其成为背景 */
  pointer-events: none; /* 穿透鼠标事件 */
  transform: rotate(15deg); /* 旋转15度 */
  transform-origin: top right; /* 以右上角为轴心旋转 */
}

.token-counter-container .counter-separator {
  font-size: 8rem; /* 巨大的分隔符 */
  font-weight: 200;
}

.refresh-inline-select {
  display: inline-block;
  min-width: 7rem;
  height: 2.4rem;
  padding: 0 2.2rem 0 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 0.9rem center, right 0.55rem center;
  background-size: 0.45rem 0.45rem;
  background-repeat: no-repeat;
}



.refresh-inline-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.refresh-action {
  white-space: nowrap;
  min-width: 2.8rem;
}

.refresh-icon {
  width: 1rem;
  height: 1rem;
  display: block;
  fill: currentColor;
}

.control-select option,
.refresh-inline-select option {
  background: var(--bg);
  color: var(--fg);
}

.controls-placeholder {
  position: relative;
  /* 为哨兵提供定位上下文 */
  width: min(var(--layout-max-width), 100%);
  margin: 1.5rem auto 0;
  height: 74px;
  /* 预设高度，防止抖动 */
}

.sticky-wrapper {
  position: sticky;
  top: 1rem;
  z-index: 500;
  /* keep child controls centered */
  display: flex;
  width: 100%;
  margin-top: -74px;
  /* offset placeholder height */
  margin-bottom: 1.5rem;
}

.sticky-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
}

.filter-sort-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  width: min(var(--layout-max-width), 100%);
  margin-inline: auto;
  /* 默认水平居中 */
  flex-wrap: wrap;
  padding: 0.75rem;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface-1);
  backdrop-filter: blur(10px);
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 300ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1),
    padding 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-wrapper.is-stuck .filter-sort-controls {
  /* 灵动岛效果：缩小宽度、加大圆角 */
  width: min(880px, 90%);
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  padding-left: 1rem;
  padding-right: 1rem;
}

.sticky-wrapper.is-stuck .controls-left,
.sticky-wrapper.is-stuck .controls-right {
  /* sticky animation */
  animation: breathe-pop 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.sticky-wrapper.is-stuck .controls-left {
  gap: 0.75rem;
}

.controls-left {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: nowrap;
  transition: gap 300ms cubic-bezier(0.4, 0, 0.2, 1);
  flex: 0 1 auto;
  /* Do not grow, allow shrinking */
}


.controls-right {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control-set {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.85rem;
  color: var(--fg);
  white-space: nowrap;
}

.control-select {
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  color: inherit;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  color: inherit;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.control-button:hover {
  border-color: var(--accent);
}

.control-button .sort-arrow path {
  /* 使用我们注册的 --arrow-path 变量，并为其添加过渡效果 */
  d: var(--arrow-path, var(--arrow-path-down));
  transition: d 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.control-button[data-direction="asc"] {
  /* 升序时，改变 --arrow-path 变量的值 */
  --arrow-path: var(--arrow-path-up);
}

.control-select option {
  background: var(--bg);
  color: var(--fg);
}

.add-group-wrapper {
  position: relative;
}

.add-token-trigger {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  cursor: pointer;
  transition: all 160ms ease;
}

.add-token-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.add-token-trigger svg {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.add-token-trigger.is-active svg {
  /* 激活时向右旋转45度，变为关闭图标 */
  transform: rotate(45deg);
}

.add-token-trigger.is-active {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}

.add-token-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 400px;
  max-width: 90vw;
  background: var(--card-bg);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 10;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.add-token-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.search-group-wrapper {
  position: relative;
}

.search-token-trigger {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  cursor: pointer;
  transition: all 160ms ease;
}

.search-token-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.search-token-trigger svg use {
  /* 为 d (路径数据) 属性添加过渡效果 */
  transition: d 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.search-token-trigger.is-active {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}

.clipboard-trigger {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  cursor: pointer;
  transition: all 160ms ease;
}

.remove-dead-trigger svg use {
  transition: d 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.remove-dead-trigger.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

.clipboard-trigger.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

@keyframes breathe-pop {
  0% {
    transform: scale(1);
  }

  60% {
    transform: scale(1.03, 0.97);
  }

  100% {
    transform: scale(1);
  }
}

.remove-dead-trigger {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  cursor: pointer;
  transition: all 160ms ease;
}

.search-token-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 250px;
  background: var(--card-bg);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 10;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.search-token-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#token-search {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: inherit;
  font-size: 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.mint-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.mint-input-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.mint-input-row input {
  flex: 1;
  background: var(--surface-1);
  color: inherit;
  border: 1px solid var(--surface-border);
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  font-size: 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.mint-input-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

#token-search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 163, 0.18);
  /* background: var(--accent-weak); */
  /* 移除 focus 时的背景色变化，保持一致性 */
}

body[data-theme="light"] #token-search:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 95, 191, 0.2);
}

.controls button {
  background: linear-gradient(120deg, var(--accent-weak), rgba(100, 133, 255, 0.35));
  transition: transform 120ms ease, box-shadow 160ms ease;
}

body[data-theme="light"] .controls button {
  background: linear-gradient(120deg, var(--accent-weak), rgba(255, 182, 229, 0.4));
}

.controls button:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.controls button:active {
  transform: scale(0.97);
}

.mint-input-row button {
  background: var(--surface-1);
  color: inherit;
  border: 1px solid var(--surface-border);
  padding: 0.45rem 0.9rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 2.2rem;
}

.form-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--fg);
  opacity: 0.75;
}

.form-feedback {
  margin: 0;
  font-size: 0.8rem;
  color: var(--fg);
  min-height: 1.2rem;
}

.form-feedback[data-status="error"] {
  color: #ff8296;
}

.form-feedback[data-status="success"] {
  color: var(--gain);
}

.form-feedback[data-status="info"] {
  color: var(--fg);
}

.refresh-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(360px, 100%);
  align-items: center;
  margin: 0 auto;
}

.last-updated {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg);
}

.token-grid {
  margin-top: 2.5rem !important;
  /* 增加与筛选/排序栏的间距 */
  width: min(var(--layout-max-width), 100%);
  margin-inline: auto;
  display: grid;
  /* gap: 1rem; */
  row-gap: 2rem;
  column-gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.token-grid.loading {
  opacity: 0.55;
  transition: opacity 160ms ease;
}


.token-card {
  position: relative;
  /* position: relative; 已经存在，作为删除按钮的定位上下文 */
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 3rem 0.95rem 0.95rem; /* 调整顶部内边距 */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  overflow: visible;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.token-image {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; /* 调小图片尺寸 */
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(0, 255, 163, 0.22), rgba(100, 133, 255, 0.22));
  border: 1px solid var(--surface-border);
  /* box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38); */
  z-index: 2;
}

.token-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] .token-card {
  box-shadow: 0 20px 45px rgba(221, 165, 206, 0.16);
}

body[data-theme="light"] .token-card:hover {
  box-shadow: 0 24px 52px rgba(221, 165, 206, 0.22);
}

body[data-view="compact"] .token-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  row-gap: 0.4rem;
  column-gap: 0.4rem;
}

body[data-view="compact"] .token-card {
  position: relative;
  flex-direction: row;
  align-items: center;
  padding: 0.5rem 0.65rem;
  gap: 0.4rem;
  height: 52px; /* 调整高度为 52px */
  padding: 0.35rem 0.65rem; /* 调整内边距以适应新高度 */
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

body[data-view="compact"] .token-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

body[data-theme="light"][data-view="compact"] .token-card {
  box-shadow: 0 18px 32px rgba(221, 165, 206, 0.18);
}

body[data-theme="light"][data-view="compact"] .token-card:hover {
  box-shadow: 0 22px 40px rgba(221, 165, 206, 0.24);
}

body[data-view="compact"] .token-remove {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  background: var(--card-bg);
}

body[data-view="compact"] .token-card:hover .token-remove {
  opacity: 1;
  pointer-events: auto;
}

body[data-view="compact"] .token-image {
  position: static;
  transform: none;
  padding: 0; /* 移除图片容器内边距 */
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  box-shadow: none;
  margin-right: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; /* 调整图片容器尺寸 */
  height: 40px;
  min-width: 40px;
  flex: 0 0 40px;
}

body[data-view="compact"] .token-icon { /* 图标填充其容器 */
  width: 100%;
  height: 100%;
  min-width: auto; /* 重置 min-width */
  flex: none; /* 重置 flex */
}

body[data-view="compact"] .token-header {
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

body[data-view="compact"] .token-main {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
}

body[data-view="compact"] .token-title {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
}

body[data-view="compact"] .token-title h2 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left; /* 在紧凑模式下左对齐 */
}

body[data-view="compact"] .token-name,
body[data-view="compact"] .mint-row,
body[data-view="compact"] .token-stats-row,
body[data-view="compact"] .links,
body[data-view="compact"] .token-meta .meta-label,
body[data-view="compact"] .axiom-link {
  display: none;
}

body[data-view="compact"] .token-meta {
  margin-left: auto;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

body[data-view="compact"] .market-cap {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.token-header {
  display: flex;
  align-items: flex-start;
}

.token-main {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  width: 100%;
}

.token-icon {
  width: 40px;   /* 调整图片尺寸 */
  height: 40px;  /* 调整图片尺寸 */
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-2);
  object-fit: cover;
}

.token-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* 改为左对齐 */
  gap: 0.2rem;
  min-width: 0;
}

.token-title h2 {
  margin: 0;
  font-size: 1.2rem; /* 调整字号 */
  line-height: 1.2;
  text-align: left; /* 改为左对齐 */
  width: 100%;            /* 确保 h2 占满宽度以便居中 */
  margin-top: 0.75rem;    /* 统一顶部间距 */
}

.token-title .symbol {
  margin: 0;
  color: var(--fg);
  letter-spacing: 0.02em;
  font-size: 0.78rem;
  font-family: 'SFMono-Regular', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', 'Courier New', monospace;
  text-transform: none;
}

.token-title .mint {
  color: var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  font-family: "JetBrains Mono", "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.mint-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  color: var(--fg);
}

.copy-mint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.copy-mint svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.copy-mint:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.copy-mint:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-mint:active {
  transform: scale(0.96);
}

.token-remove {
  position: absolute; /* 将删除按钮脱离文档流 */
  top: 0.5rem;        /* 相对于卡片顶部定位 */
  right: 0.5rem;      /* 相对于卡片右侧定位 */
  z-index: 3;         /* 确保在内容之上 */
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  color: var(--fg);
  width: 1.75rem;
  height: 1.75rem;
  aspect-ratio: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.token-remove:hover {
  border-color: rgba(255, 93, 132, 0.6);
  color: #ff8296;
  background: rgba(255, 93, 132, 0.12);
}

.token-remove:active {
  opacity: 0.85;
}

.token-title h2.symbol {
  margin: 0;
  font-size: 1.25rem;
  /* letter-spacing: 0.08em; */
  /* text-transform: uppercase; */
}

.token-title .token-name {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg);
}

.token-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.token-meta .meta-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

.token-meta .market-cap {
  font-weight: 600;
  font-size: 0.95rem;
}

.token-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  /* margin-top: 1rem; */
  font-size: 0.72rem;
  color: var(--fg);
}

.token-stats-row .stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
}

.token-stats-row .stat.gain {
  color: var(--gain);
  border-color: rgba(110, 231, 183, 0.4);
}

.token-stats-row .stat.loss {
  color: var(--loss);
  border-color: rgba(255, 92, 138, 0.4);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: inherit;
  text-decoration: none;
  font-size: 0.78rem;
  transition: border-color 160ms ease, color 160ms ease;
}

.link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.link[hidden] {
  display: none;
}

.price-change.gain {
  color: var(--gain);
}

.price-change.loss {
  color: var(--loss);
}

.market-cap {
  font-weight: 600;
  font-size: 1.05rem;
}

.price-trend {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--fg);
}

.audit {
  border-top: 1px solid var(--surface-border);
  padding-top: 0.75rem;
}

.audit h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--fg);
}

.audit ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.audit li {
  font-size: 0.78rem;
  color: var(--fg);
  position: relative;
}

.audit li::marker {
  color: var(--accent);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--fg);
  border: 1px dashed var(--surface-border);
  border-radius: 16px;
}



@media (max-width: 768px) {
  .header-actions {
    position: static;
    transform: none;
    align-items: stretch;
    gap: 1.25rem;
    width: 100%;
  }

  .header-actions-left,
  .header-actions-right {
    width: 100%;
    justify-content: center;
  }

  .header-actions-right .refresh-inline {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .refresh-inline-select {
    width: 100%;
  }

  .refresh-action {
    width: 100%;
  }

  .header-action {
    min-width: auto;
    height: 2.2rem;
    padding: 0 0.7rem;
  }

  .header-action.theme-toggle {
    width: 2.2rem;
  }

  .controls {
    gap: 1rem;
  }

  .mint-input-row {
    display: flex;
    align-items: stretch;
  }

  .controls select,
  .controls button {
    width: 100%;
  }
}

.token-card {
  padding: 0.85rem;
}


.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, background 150ms ease, border-color 150ms ease;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  z-index: 999;
  opacity: 1;
  transition: opacity 300ms ease-in-out;
}

.loader[hidden] {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--surface-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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


.toast-root {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 1.5rem;
  z-index: 1000;
  pointer-events: none;
  width: min(90vw, 420px);
  justify-items: center;
}

.toast {
  min-width: 200px;
  max-width: 320px;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: rgba(13, 17, 23, 0.92);
  color: var(--fg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  transform: translateY(12px);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
}

body[data-theme="light"] .toast {
  background: rgba(255, 240, 251, 0.96);
  border-color: rgba(231, 148, 204, 0.45);
  box-shadow: 0 20px 36px rgba(221, 165, 206, 0.24);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-status="success"] {
  border-color: rgba(0, 255, 163, 0.6);
}

.toast[data-status="error"] {
  border-color: rgba(255, 92, 138, 0.6);
}

.toast-root .toast+.toast {
  margin-top: 0;
}



.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
}

.header-actions-left,
.header-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.header-actions-left {
  justify-content: flex-start;
  flex: 1 1 auto;
}

.header-actions-right {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.header-actions-right .refresh-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}


.header-action {
  min-width: auto;
}

.token-card {
  padding: 0.85rem;
}


@media (max-width: 640px) {
  body {
    padding: 0 0.75rem 2.5rem;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
    margin: 0 auto;
  }

  .header-actions-left,
  .header-actions-right {
    width: 100%;
    justify-content: center;
  }

  .segmented-control {
    width: 100%;
  }

  .header-actions-right .refresh-inline {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .refresh-inline-select {
    width: 100%;
  }

  .refresh-action {
    width: 100%;
  }

  .header-action {
    min-width: auto;
  }

  .mint-input-row {
    /* flex-direction: column; */
    align-items: stretch;
  }

  .token-card {
    padding: 0.85rem;
  }
}