/* 与主站 tapeout.link 同一套设计语言：浅薰衣草 + 深紫黑，跟随主站顶部明暗设置 */
:root {
  --bg: #f4f3fa; --panel: #ffffff; --ink: #15132c; --muted: #8b88a6; --line: #e8e6f2;
  --accent: #5b4be0; --accent-2: #7c6bff; --accent-soft: #eeebff; --on-accent: #ffffff;
  --ok: #1a7f37; --warn: #9a6700; --bad: #b42318; --chip: #efeef7; --hover: #f2f0fb;
  --ring: rgba(124, 107, 255, .13); --r-md: 13px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f0e18; --panel: #181628; --ink: #eceaf6; --muted: #85819e; --line: #2b2842;
  --accent: #8b7cff; --accent-2: #9d8fff; --accent-soft: #241f45; --on-accent: #ffffff;
  --ok: #56d364; --warn: #e3b341; --bad: #ff7b72; --chip: #262338; --hover: #221f36;
  --ring: rgba(139, 124, 255, .22);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }

.bar { display: flex; gap: 10px; align-items: center; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font: 600 15px/1 var(--mono); color: var(--accent); white-space: nowrap; }
.nav { display: flex; gap: 2px; flex: none; }
.nav-btn { display: grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background .18s, color .18s; }
.nav-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.nav-btn:disabled { opacity: .3; cursor: default; }
.nav-btn svg { display: block; }
.address { flex: 1; display: flex; gap: 8px; min-width: 0; }
.address input { flex: 1; min-width: 0; padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink); font: 14px var(--mono); }
.address input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }

/* 顶栏收藏夹：列出主站收录的链上站点，点一条直接切过去 */
.fav { position: relative; flex: none; }
/* 默认就着色，带圆角底座，跟后退/前进那两个灰色图标区分开 */
#favBtn { background: var(--accent-soft); color: var(--accent); }
#favBtn:hover { background: var(--accent); color: var(--on-accent); }
.fav__pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: min(320px, 82vw); max-height: 62vh; overflow: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
}
.fav__item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink);
  text-align: left; cursor: pointer; font: inherit;
}
.fav__item:hover { background: var(--hover); }
.fav__item.is-on { background: var(--accent-soft); color: var(--accent); }
.fav__ico {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  overflow: hidden; font-size: 14px; line-height: 1;
}
.fav__ico img { width: 15px; height: 15px; object-fit: contain; }
.fav__body { min-width: 0; }
.fav__item b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav__item small { display: block; margin-top: 2px; font: 11.5px var(--mono); color: var(--muted); }
.fav__item.is-on small { color: var(--accent); }
.fav__empty { margin: 8px 10px; color: var(--muted); font-size: 12.5px; }
/* 面板底部的出口：一条分隔线加一个回导航站的入口 */
.fav__home {
  display: flex; align-items: center; gap: 7px;
  margin-top: 5px; padding: 9px 10px 6px;
  border-top: 1px solid var(--line);
  color: var(--accent); text-decoration: none;
  font-size: 12.5px; font-weight: 600;
}
.fav__home:hover { color: var(--accent-2); }
.fav__home svg { flex: none; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; align-items: center; }
.badges:empty { display: none; }
.badges li { padding: 3px 9px; border-radius: 999px; background: var(--chip); font-size: 12px; white-space: nowrap; }
.badges li.ok { color: var(--ok); } .badges li.warn { color: var(--warn); } .badges li.bad { color: var(--bad); }
.banners:empty { display: none; }

.stage { flex: 1; position: relative; min-height: 0; display: flex; }
.stage iframe { flex: 1; width: 100%; border: 0; background: #fff; animation: fadein .25s ease both; }
.message { margin: auto; max-width: 560px; padding: 32px 24px; text-align: center; }
.message h1 { font-size: 20px; margin: 0 0 10px; }
.message p { color: var(--muted); margin: 6px 0; }
.message .hint { font-size: 13px; }
.message.bad h1 { color: var(--bad); } .message.warn h1 { color: var(--warn); }
.message code { font-family: var(--mono); background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.message h2 { font-size: 13px; color: var(--muted); margin: 18px 0 6px; text-align: left; font-weight: 600; }
.message .samples, .message .steps { list-style: none; margin: 0 auto; padding: 0; }
.message .samples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.message .sample { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--chip); color: var(--accent); font: 13px var(--mono); cursor: pointer; }
.message .sample:hover { background: var(--accent-soft); border-color: var(--accent-2); }
.message .steps { list-style: decimal; padding-left: 20px; text-align: left; color: var(--muted); font-size: 13px; }
.message .steps li { margin: 4px 0; }
.message .actions { margin-top: 14px; display: flex; gap: 8px; justify-content: center; }
.message button { padding: 7px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); cursor: pointer; }
.progress { position: relative; width: 260px; height: 6px; margin: 14px auto 0; border-radius: 3px; background: var(--chip); overflow: hidden; }
.progress > div { position: relative; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
/* 进度条上一道流光扫过，说明还在读 */
.progress > div::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%);
  animation: sweep 1.4s linear infinite;
}
/* 还不知道总量：短条来回跑，比空槽有信息 */
.progress.is-idle > div { width: 40% !important; animation: slide 1.2s ease-in-out infinite; }
.progress.is-idle > div::after { animation: none; }

/* 文案后面的三个小点 */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: 1px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .3; animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

@keyframes sweep { to { transform: translateX(100%); } }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .progress > div::after, .progress.is-idle > div, .dots i { animation: none; }
  .progress.is-idle > div { width: 100% !important; margin: 0; opacity: .5; }
  .dots { display: none; }
}

/* 顶栏详情：站点身份、徽章、节点与缓存都在这里，不再占底部一条栏 */
.info { position: relative; flex: none; }
/* 与收藏夹同样默认着色、带圆角底座；没打开站点时按钮禁用 */
#infoBtn { background: var(--accent-soft); color: var(--accent); }
#infoBtn:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
#infoBtn:disabled { background: transparent; color: var(--muted); cursor: default; }
.info__pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(560px, 88vw); max-height: 62vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .16); }
.info__pop .pop-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 16px/1 var(--font); cursor: pointer; }
.info__pop .pop-close:hover { background: var(--chip); color: var(--ink); }
.info__pop .pop-head { padding-right: 28px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.info__pop .pop-name { font: 600 15px/1.3 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.info__pop .pop-title { margin-left: 8px; font: 400 12px/1.3 var(--font); color: var(--muted); }
.info__pop .pop-sub { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.info__pop .pop-badges { margin-bottom: 10px; }
.info__pop .pop-badges:empty { margin-bottom: 0; }
.info__pop .pop-foot { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.info__pop dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; }
.info__pop dt { color: var(--muted); }
.info__pop dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; color: var(--ink); }
.info__pop dd ul { margin: 0; padding-left: 16px; }

@media (max-width: 640px) {
  .brand { display: none; }
}

.update-bar { display: flex; gap: 10px; align-items: center; margin: 8px 14px 0; padding: 6px 10px; border-radius: var(--r-md); background: var(--chip); color: var(--warn); font-size: 13px; }
.update-bar button { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
