/* ===== 跨页面过渡动画 (View Transitions API) ===== */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-fade-out 0.35s ease-out both;
  pointer-events: none;
}

::view-transition-new(root) {
  animation: vt-fade-in 0.35s ease-in both;
  pointer-events: none;
}

@keyframes vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

* { box-sizing: border-box; }

:root {
    color-scheme: light;
    --bg: #f0f6f8;
    --card: rgba(255, 255, 255, .78);
    --text: #172033;
    --sub: #687289;
    --line: rgba(23, 32, 51, .09);
    --blue: #0d9488;
    --blue-soft: #e6f7f5;
    --green: #16875b;
    --amber: #c47a08;
    --red: #d64545;
    --teal: #0d9488;
    --shadow: 0 24px 70px rgba(41, 57, 90, .12);
}

body.dark {
    color-scheme: dark;
    --bg: #090b11;
    --card: rgba(25, 29, 39, .78);
    --text: #f3f6fc;
    --sub: #9da7ba;
    --line: rgba(255, 255, 255, .09);
    --blue: #5eead4;
    --blue-soft: rgba(45, 212, 191, .12);
    --green: #53d39e;
    --amber: #ffba52;
    --red: #ff7777;
    --teal: #5eead4;
    --shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

body {
    margin: 0;
    min-height: 100vh;
    padding-bottom: 125px;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    transition: color .3s, background .3s;
}

body::before, body::after {
    content: "";
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .38;
    z-index: -1;
    animation: float 18s infinite alternate ease-in-out;
}

body::before { top: -240px; left: -160px; background: #0d9488; }
body::after { right: -220px; bottom: -260px; background: #0ea5e9; animation-delay: -8s; }
@keyframes float { to { transform: translate(70px, 60px) scale(1.12); } }

.theme-toggle {
    position: fixed;
    top: 28px;
    right: 30px;
    z-index: 10;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.theme-toggle svg { width: 21px; }
.hero { max-width: 720px; margin: auto; padding: 92px 24px 42px; text-align: center; }
.eyebrow { color: var(--teal); font-size: 13px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 12px 0 14px; font-size: clamp(42px, 7vw, 64px); letter-spacing: -.06em; line-height: 1.08; }
.hero p { max-width: 600px; margin: auto; color: var(--sub); font-size: 17px; line-height: 1.8; }
.container { width: min(820px, calc(100% - 36px)); margin: auto; }

/* ----- IP 地址卡片 ----- */
.ip-card {
    margin-bottom: 22px;
    padding: 20px clamp(20px, 5vw, 32px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--card);
    backdrop-filter: blur(30px);
    box-shadow: var(--shadow);
}

.ip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.ip-header svg {
    width: 20px;
    height: 20px;
    color: var(--teal);
}

.ip-refresh {
    margin-left: auto;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--sub);
    cursor: pointer;
    transition: color .2s, border-color .2s;
}

.ip-refresh svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

.ip-refresh:hover {
    color: var(--teal);
    border-color: var(--teal);
}

.ip-refresh.loading svg {
    animation: spin 1s linear infinite;
}

.ip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(127, 127, 127, .035);
    min-width: 0;
}

.ip-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sub);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.ip-label svg {
    width: 16px;
    height: 16px;
}

.ip-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ip-badge {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
}

.ip-ok { color: var(--green); }
.ip-err { color: var(--red); }
.ip-na { color: var(--sub); }

.scope-global { color: var(--green); }
.scope-local { color: var(--amber); }
.scope-link { color: var(--sub); }
.scope-host { color: var(--sub); }

@media (max-width: 900px) {
    .guide-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .ip-grid { grid-template-columns: 1fr; }
    .ip-item { flex-wrap: wrap; }
    .ip-value { width: 100%; order: 1; font-size: 12px; }
}

/* ----- 检测器卡片 ----- */
.detector-card, .type-guide, .details, .results-section {
    border: 1px solid var(--line);
    background: var(--card);
    backdrop-filter: blur(30px);
    box-shadow: var(--shadow);
}

.detector-card { padding: 46px clamp(24px, 7vw, 70px); border-radius: 34px; text-align: center; }
.result-icon { display: grid; width: 76px; height: 76px; margin: auto; place-items: center; color: var(--teal); border-radius: 24px; background: var(--blue-soft); transition: .3s; }
.result-icon svg { width: 38px; height: 38px; }
.result-icon[data-state="loading"] { animation: pulse 1.5s ease-in-out infinite; }
.result-icon[data-state="good"] { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.result-icon[data-state="limited"] { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.result-icon[data-state="poor"], .result-icon[data-state="error"] { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
@keyframes pulse { 50% { transform: scale(.92); opacity: .65; } }

.status { display: inline-flex; align-items: center; gap: 7px; margin-top: 24px; color: var(--sub); font-size: 14px; font-weight: 650; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status[data-state="loading"] { color: var(--teal); }
.status[data-state="good"] { color: var(--green); }
.status[data-state="limited"] { color: var(--amber); }
.status[data-state="poor"], .status[data-state="error"] { color: var(--red); }

.detector-card h2 { margin: 10px 0 6px; font-size: clamp(29px, 5vw, 39px); letter-spacing: -.04em; }
.type-code { margin: 0; color: var(--teal); font-size: 16px; font-weight: 750; }
.description { max-width: 590px; min-height: 52px; margin: 18px auto 0; color: var(--sub); line-height: 1.75; }

/* ----- 分项检测网格 ----- */
.checks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 600px;
    margin: 28px auto 0;
    text-align: left;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(127, 127, 127, .03);
    font-size: 13px;
}

.check-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.check-item .check-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.check-item .check-icon svg {
    width: 18px;
    height: 18px;
}

.check-label {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.check-result {
    font-weight: 650;
    font-size: 12px;
    color: var(--sub);
}

@media (max-width: 500px) {
    .checks-grid { grid-template-columns: 1fr; }
}

/* ----- 开始按钮 ----- */
.start {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 30px;
    padding: 14px 26px;
    color: #fff;
    border: 0;
    border-radius: 14px;
    background: #0d9488;
    box-shadow: 0 10px 24px rgba(13, 148, 136, .25);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s, opacity .2s;
}

.start:hover:not(:disabled) { transform: translateY(-2px); }
.start:disabled { cursor: wait; opacity: .72; }
.start svg { width: 19px; }
.start.loading svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- 结果详情区域 ----- */
.results-section {
    margin-top: 22px;
    padding: 26px 28px;
    border-radius: 24px;
}

.results-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    font-size: 18px;
}

.results-section h3 svg {
    width: 22px;
    height: 22px;
    color: var(--teal);
}

.result-group {
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.result-group:last-child { margin-bottom: 0; }

.result-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(127, 127, 127, .035);
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
}

.result-group-header svg {
    width: 18px;
    height: 18px;
    color: var(--teal);
}

.result-group-body {
    padding: 14px 18px;
}

.detail-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    flex-shrink: 0;
    min-width: 70px;
    font-weight: 650;
    color: var(--sub);
}

.detail-label.ok { color: var(--green); }
.detail-label.err { color: var(--red); }
.detail-label.na { color: var(--sub); }

.detail-value {
    color: var(--text);
    line-height: 1.5;
}

.detail-value.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

.detail-value.sub {
    color: var(--sub);
    font-size: 12px;
}

/* ----- 检测说明 ----- */
.type-guide { margin-top: 22px; padding: 26px 28px; border-radius: 24px; }
.type-guide h3 { margin: 0 0 17px; font-size: 17px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.guide-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(127, 127, 127, .035); }
.guide-grid b { display: block; margin-bottom: 7px; color: var(--teal); font-size: 15px; }
.guide-grid span { color: var(--sub); font-size: 13px; line-height: 1.6; }

/* ----- 日志详情 ----- */
.details { margin-top: 22px; padding: 0 26px; border-radius: 22px; }
.details summary { display: flex; align-items: center; justify-content: space-between; padding: 21px 0; font-weight: 700; cursor: pointer; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary span { display: flex; align-items: center; gap: 10px; }
.details summary svg { width: 19px; }
.details .chevron { transition: transform .2s; }
.details[open] .chevron { transform: rotate(180deg); }
.details pre { margin: 0; padding: 0 0 23px; overflow-x: auto; color: var(--sub); border-top: 1px solid var(--line); padding-top: 20px; font: 12px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.notice { margin: 18px auto 0; padding: 0 12px; color: var(--sub); font-size: 12px; line-height: 1.7; text-align: center; }

/* ----- Dock 导航 ----- */
.dock {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line, rgba(128, 128, 128, 0.12));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transition: background 0.3s, border-color 0.3s;
}

body.dark .dock {
  border-color: rgba(255, 255, 255, 0.06);
}

.dock-item {
  position: relative;
  color: var(--sub);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  transition: transform 0.25s;
}

.github-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.dock-item span {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

.dock-item:hover {
  color: var(--text);
  background: rgba(128, 128, 128, 0.08);
}

.dock-item:hover svg {
  transform: translateY(-6px) scale(1.1);
}

.dock-item:hover span {
  opacity: 1;
}

.dock-item.active {
  color: var(--blue);
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
}

.dock-item.active:hover::after {
  display: none;
}

@media (max-width: 640px) {
    body::before, body::after {
        width: 320px;
        height: 320px;
        filter: blur(60px);
    }
    body::before { top: -120px; left: -100px; }
    body::after { right: -100px; bottom: -140px; }

    .hero { padding: 72px 20px 30px; }
    .hero h1 { font-size: 36px; }
    .hero p { font-size: 15px; }

    .theme-toggle { top: 20px; right: 20px; width: 43px; height: 43px; }
    .theme-toggle svg { width: 18px; }

    .container { width: calc(100% - 24px); }

    .ip-card { padding: 16px; border-radius: 18px; }
    .ip-grid { gap: 8px; }
    .ip-item { padding: 10px 12px; border-radius: 12px; }
    .ip-label { font-size: 12px; }
    .ip-label svg { width: 14px; height: 14px; }
    .ip-value { font-size: 12px; }

    .detector-card { padding: 32px 20px; border-radius: 24px; }
    .detector-card h2 { font-size: 28px; }
    .description { font-size: 14px; min-height: auto; }
    .result-icon { width: 60px; height: 60px; border-radius: 18px; }
    .result-icon svg { width: 30px; height: 30px; }

    .checks-grid { gap: 8px; }
    .check-item { padding: 10px 12px; font-size: 12px; border-radius: 10px; }

    .start { padding: 12px 22px; font-size: 14px; }

    .results-section { padding: 18px; border-radius: 18px; }
    .results-section h3 { font-size: 16px; }
    .result-group-header { padding: 12px 14px; font-size: 13px; }
    .result-group-body { padding: 12px 14px; }
    .detail-row { flex-wrap: wrap; font-size: 12px; }
    .detail-label { min-width: 60px; }
    .detail-value.mono { width: 100%; font-size: 11px; }

    .guide-grid { grid-template-columns: 1fr; gap: 10px; }
    .type-guide { padding: 20px; border-radius: 18px; }
    .type-guide h3 { font-size: 15px; }
    .guide-grid article { padding: 12px; }
    .guide-grid b { font-size: 14px; }
    .guide-grid span { font-size: 12px; }

    .details { padding: 0 18px; border-radius: 18px; }
    .details summary { padding: 16px 0; font-size: 13px; }
    .details pre { font-size: 11px; }

    .notice { font-size: 11px; padding: 0 8px; }

  .dock { gap: 1px; padding: 4px; bottom: 20px; }
  .dock-item { width: 40px; height: 40px; }
  .dock-item svg { width: 18px; height: 18px; }
  .dock-item span { display: none; }
}

@media (max-width: 400px) {
    .hero { padding: 56px 14px 20px; }
    .hero h1 { font-size: 28px; }
    .detector-card { padding: 24px 14px; border-radius: 20px; }
    .detector-card h2 { font-size: 22px; }
    .ip-card { padding: 12px; }
    .result-icon { width: 48px; height: 48px; border-radius: 14px; }
    .result-icon svg { width: 24px; height: 24px; }
    .start { width: 100%; justify-content: center; }
    .container { width: calc(100% - 12px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
