/* 完整導航頁 */
.nav {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(100% 40% at 50% 30%, var(--bg-2) 0%, transparent 70%),
    var(--bg);
}

/* ---------- Banner ---------- */
.banner {
  position: relative;
  aspect-ratio: 750 / 640;      /* 素材建議尺寸 750×640 */
  overflow: hidden;
}
.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner::after {                /* 底部漸層，讓 banner 自然接到頁面 */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 30%;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.banner-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(60% 50% at 70% 30%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    radial-gradient(50% 50% at 20% 70%, rgba(90, 140, 255, 0.28), transparent 70%),
    linear-gradient(160deg, var(--bg-2), var(--bg));
}
.banner-ph::before {            /* 佔位標示，換上正式素材後會被 img 取代 */
  content: "BANNER 750×640";
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  opacity: 0.6;
}
.banner-brand {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff 30%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.banner-slogan {
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0.3em;
  opacity: 0.85;
}

/* ---------- Logo 與描述 ---------- */
.identity {
  position: relative;
  margin-top: -36px;
  padding: 0 20px;
  text-align: center;
}
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 72px;
  padding: 0 18px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.logo img { height: 52px; width: auto; }
.logo.has-img { background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.desc {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}
.config-warn { margin: 8px 0 0; }

/* ---------- 功能方塊 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 24px 16px 0;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 1 / 0.9;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}
.tile:active { transform: scale(0.96); background: var(--surface-strong); }
.tile.is-disabled { opacity: 0.5; pointer-events: none; }
.tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.tile-icon svg { width: 26px; height: 26px; }
.tile-icon img { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; }
.tile-icon.is-img { background: none; }
.tile-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.tile-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-dim);
}

/* ---------- 主要按鈕 ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 18px 16px 0;
}
.actions .btn {
  padding: 0 8px;
  font-size: 15px;
  white-space: nowrap;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 16px 0;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ---------- 頁尾 ---------- */
.foot {
  margin-top: 28px;
  padding: 0 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.foot p { margin: 6px 0; }
.age {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.badge {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
  line-height: 18px;
}
.rg-link, .license a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 線路清單（底部彈出） ---------- */
.sheet {
  width: 100%;
  max-width: var(--page-max);
  max-height: 80vh;
  margin: auto auto 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--bg-2);
  color: var(--text);
}
.sheet[open] { animation: sheet-in 0.25s ease-out; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-desc { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.sheet-close {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
}

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.line.is-best { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.line-main { min-width: 0; }
.line-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.line-tag {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  line-height: 18px;
}
.line-url {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.line-btns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.line-btns .btn { min-height: 36px; font-size: 13px; }

.retest { width: 100%; margin-top: 14px; }
