:root {
  --ink: #171610;
  --muted: #777267;
  --line: rgba(43, 39, 29, .16);
  --paper: #f6f2e9;
  --paper-bright: #fffdf8;
  --dark: #15140f;
  --dark-2: #1d1b14;
  --amber: #ffc552;
  --amber-deep: #cc8919;
  --green: #5fbf73;
  --red: #d1715a;
  --serif: Iowan Old Style, Baskerville, 'Times New Roman', serif;
  --sans: 'Avenir Next', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--dark);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--dark); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { color: var(--dark); background: var(--amber); }

.app-shell { position: relative; isolation: isolate; width: 100%; height: 100dvh; min-height: 500px; display: grid; grid-template-rows: 64px minmax(0, 1fr) 48px; overflow: hidden; color: #fff9ea; background: radial-gradient(ellipse 84% 108% at 75% 50%, #403421 0%, #242017 36%, #15140f 76%); }
.app-shell::before { content: ''; position: absolute; inset: 0; z-index: -2; opacity: .28; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.37'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }

.app-header { position: relative; z-index: 3; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 26px; padding: 0 clamp(20px, 4vw, 62px); border-bottom: 1px solid rgba(255, 247, 225, .14); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #fff8e9; text-decoration: none; }
.brand-mark { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-family: var(--serif); font-size: 20px; line-height: 1; font-style: italic; }
.brand-wordmark { font-size: 13px; font-weight: 800; letter-spacing: .17em; }
.brand-wordmark span { margin-left: 2px; color: var(--amber); }
.header-label { justify-self: start; display: flex; align-items: center; gap: 8px; margin: 0; color: rgba(255,248,229,.5); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.header-pip, .live-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 0 rgba(255,197,82,.55); animation: pulse 2s infinite; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-button, .refresh-button { min-height: 32px; padding: 0; border: 0; color: #fff9ea; background: transparent; font-size: 11px; font-weight: 800; letter-spacing: .04em; transition: color .18s ease, opacity .18s ease; }
.header-button { border-bottom: 1px solid var(--amber); }
.header-button:hover, .refresh-button:hover { color: var(--amber); }
.refresh-button { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,248,229,.72); }
.refresh-icon { display: inline-block; color: var(--amber); font-size: 15px; transition: transform .3s ease; }
.is-loading .refresh-icon { animation: spin .8s linear infinite; }
.refresh-button:disabled { cursor: wait; opacity: .5; }

.workbench { position: relative; z-index: 1; min-height: 0; display: grid; grid-template-columns: minmax(245px, .66fr) minmax(520px, 1.34fr); gap: clamp(24px, 4vw, 72px); padding: clamp(28px, 4vw, 66px) clamp(20px, 4vw, 62px) clamp(19px, 3vw, 40px); overflow: hidden; }
.ambient-map { position: absolute; z-index: -1; width: min(58vw, 800px); right: clamp(-100px, -8vw, -20px); bottom: -38%; opacity: .71; pointer-events: none; }
.ambient-map svg { display: block; width: 100%; overflow: visible; }
.map-grid { fill: none; stroke: rgba(255,248,229,.06); stroke-width: 1; }
.map-orbit { fill: none; stroke: rgba(255,197,82,.12); stroke-width: 1; }
.map-orbit.faint { stroke: rgba(255,197,82,.07); }
.map-route { fill: none; stroke: var(--amber); stroke-width: 1.8; stroke-dasharray: 8 11; opacity: .78; animation: travel 2.8s linear infinite; }
.map-route.b { animation-direction: reverse; animation-duration: 3.4s; }
.map-route.c { animation-duration: 2.1s; }
.map-node > circle:not(.node-ring) { fill: var(--amber); filter: drop-shadow(0 0 5px var(--amber)); }
.node-ring { fill: rgba(255,197,82,.08); stroke: rgba(255,197,82,.28); stroke-width: 1; transform-origin: center; animation: halo 2.5s ease-in-out infinite; }
.map-node.hk .node-ring { animation-delay: .8s; }
.map-node.cn .node-ring { animation-delay: 1.4s; }
.map-node text { fill: rgba(255,248,229,.74); font-size: 11px; font-weight: 800; letter-spacing: .15em; }

.intro-panel { position: relative; align-self: center; max-width: 390px; padding-bottom: 18px; animation: enter .65s cubic-bezier(.16,1,.3,1) both; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: rgba(255,248,229,.55); font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.intro-brand { margin: 0 0 9px; color: var(--amber); font-size: 12px; font-weight: 800; letter-spacing: .36em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0 0 17px; font-family: var(--serif); font-size: clamp(52px, 5.6vw, 86px); font-weight: 400; letter-spacing: -.072em; line-height: .86; }
h1 em, .dialog-copy em { color: var(--amber); font-style: italic; font-weight: 400; }
.intro-copy { max-width: 340px; margin-bottom: 19px; color: rgba(255,248,229,.68); font-size: 13px; line-height: 1.75; }
.intro-notes { display: flex; flex-wrap: wrap; gap: 8px 15px; margin-bottom: 21px; color: rgba(255,248,229,.45); font-size: 9px; letter-spacing: .06em; }
.intro-notes span + span::before { content: '·'; margin-right: 15px; color: var(--amber); }
.intro-verifier { display: inline-flex; align-items: center; gap: 14px; padding: 0 0 7px; border: 0; border-bottom: 1px solid rgba(255,248,229,.5); color: #fff9ea; background: transparent; font-size: 11px; font-weight: 800; transition: color .18s ease, border-color .18s ease; }
.intro-verifier span { color: var(--amber); font-size: 17px; transition: transform .18s ease; }
.intro-verifier:hover { color: var(--amber); border-color: var(--amber); }
.intro-verifier:hover span { transform: translateX(3px); }

.routes-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); animation: enter .7s .08s cubic-bezier(.16,1,.3,1) both; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
.panel-heading h2 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 3.1vw, 44px); font-weight: 400; letter-spacing: -.065em; line-height: .9; }
#status-summary { max-width: 225px; margin: 0 0 2px; color: rgba(255,248,229,.52); font-size: 10px; line-height: 1.55; text-align: right; }
.route-list { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; }
.route-card { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: clamp(16px, 2vw, 25px); border: 1px solid rgba(255,248,229,.19); background: linear-gradient(135deg, rgba(255,255,255,.085), rgba(255,255,255,.024)); box-shadow: inset 0 1px 0 rgba(255,255,255,.045); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.route-card:hover { z-index: 1; transform: translateY(-3px); border-color: rgba(255,197,82,.68); background: linear-gradient(135deg, rgba(255,197,82,.13), rgba(255,255,255,.055)); }
.route-topline { display: flex; justify-content: space-between; gap: 12px; color: rgba(255,248,229,.5); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.route-topline span:last-child { color: var(--amber); }
.route-name { margin: clamp(15px, 2.2vw, 27px) 0 8px; }
.route-name h3 { overflow: hidden; margin: 0 0 8px; color: #fff9ea; font-size: clamp(15px, 1.28vw, 19px); letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.route-name code { color: rgba(255,248,229,.66); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; overflow-wrap: anywhere; }
.route-description { margin: 0; color: rgba(255,248,229,.5); font-size: 10px; line-height: 1.55; }
.route-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 16px; }
.route-health { display: flex; min-width: 0; align-items: center; gap: 8px; }
.health-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #aaa396; }
.health-dot.checking { background: var(--amber); box-shadow: 0 0 0 0 rgba(255,197,82,.45); animation: pulse 1.5s infinite; }
.health-dot.available { background: var(--green); box-shadow: 0 0 0 4px rgba(95,191,115,.12); }
.health-dot.attention { background: var(--red); box-shadow: 0 0 0 4px rgba(209,113,90,.12); }
.route-health strong { display: block; overflow: hidden; color: #fff9ea; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.route-health small { display: block; overflow: hidden; margin-top: 4px; color: rgba(255,248,229,.47); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.route-actions { display: flex; align-items: center; gap: 9px; }
.copy-button { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,248,229,.22); border-radius: 50%; color: #fff9ea; background: transparent; font-size: 14px; transition: transform .18s ease, color .18s ease, background .18s ease; }
.copy-button:hover { transform: rotate(-8deg); color: var(--dark); background: var(--amber); border-color: var(--amber); }
.go-link { display: inline-flex; align-items: center; gap: 5px; color: #fff9ea; font-size: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.go-link span { color: var(--amber); font-size: 17px; transition: transform .18s ease; }
.go-link:hover span { transform: translate(2px,-2px); }

.app-footer { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: 24px; padding: 0 clamp(20px, 4vw, 62px); border-top: 1px solid rgba(255,248,229,.14); background: rgba(10,10,8,.11); }
.usage-copy, .probe-copy { margin: 0; color: rgba(255,248,229,.47); font-size: 9px; line-height: 1.45; }
.usage-copy strong { color: rgba(255,248,229,.74); }
.probe-copy { text-align: right; }
.friend-links { display: flex; align-items: center; gap: 7px; }
.friend-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 25px; padding: 0 9px; border: 1px solid rgba(255,248,229,.2); color: rgba(255,248,229,.7); font-size: 9px; font-weight: 800; text-decoration: none; white-space: nowrap; transition: color .18s ease, border-color .18s ease, background .18s ease; }
.friend-links a:hover { border-color: var(--amber); color: var(--dark); background: var(--amber); }

.verify-dialog { width: min(510px, calc(100vw - 32px)); max-width: none; max-height: min(590px, calc(100dvh - 32px)); padding: 0; overflow: hidden; border: 1px solid rgba(255,248,229,.24); color: #fff9ea; background: #1b1912; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.verify-dialog::backdrop { background: rgba(8,8,6,.76); backdrop-filter: blur(6px); }
.verify-dialog[open] { animation: dialog-in .22s cubic-bezier(.16,1,.3,1) both; }
.dialog-shell { position: relative; min-height: 485px; padding: clamp(24px, 5vw, 42px); overflow: hidden; background: radial-gradient(circle at 92% 0%, rgba(255,197,82,.15), transparent 38%), #1b1912; }
.dialog-shell::after { content: ''; position: absolute; z-index: -1; width: 300px; height: 300px; right: -170px; bottom: -170px; border: 1px solid rgba(255,197,82,.18); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,197,82,.025), 0 0 0 90px rgba(255,197,82,.015); }
.dialog-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 31px; color: rgba(255,248,229,.48); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.close-button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,248,229,.24); border-radius: 50%; color: #fff9ea; background: transparent; font-size: 20px; font-weight: 300; line-height: 1; transition: background .18s ease, color .18s ease; }
.close-button:hover { color: var(--dark); background: var(--amber); }
.dialog-copy h2 { margin: 0 0 15px; font-family: var(--serif); font-size: clamp(40px, 7vw, 60px); font-weight: 400; letter-spacing: -.065em; line-height: .88; }
.dialog-copy p { max-width: 365px; margin: 0 0 23px; color: rgba(255,248,229,.6); font-size: 12px; line-height: 1.65; }
.verify-dialog label { display: block; margin-bottom: 9px; color: rgba(255,248,229,.62); font-size: 10px; font-weight: 800; letter-spacing: .07em; }
.input-row { display: flex; gap: 8px; }
.input-row input { min-width: 0; flex: 1; height: 47px; padding: 0 13px; border: 1px solid rgba(255,248,229,.27); outline: 0; color: #fff9ea; background: rgba(0,0,0,.18); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; transition: border-color .18s ease, background .18s ease; }
.input-row input::placeholder { color: rgba(255,248,229,.34); }
.input-row input:focus { border-color: var(--amber); background: rgba(0,0,0,.32); }
.verify-submit { flex: 0 0 auto; min-width: 86px; padding: 0 13px; border: 1px solid var(--amber); color: var(--dark); background: var(--amber); font-size: 11px; font-weight: 800; transition: background .18s ease, transform .18s ease; }
.verify-submit:hover { background: #ffdb8f; transform: translateY(-1px); }
.verify-result { min-height: 92px; display: flex; align-items: flex-start; gap: 12px; margin-top: 23px; padding: 16px 0; border-top: 1px solid rgba(255,248,229,.14); border-bottom: 1px solid rgba(255,248,229,.14); }
.result-icon { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,248,229,.32); border-radius: 50%; color: rgba(255,248,229,.68); font-size: 13px; }
.verify-result strong { display: block; color: #fff9ea; font-size: 12px; }
.verify-result p { margin: 4px 0 0; color: rgba(255,248,229,.54); font-size: 10px; line-height: 1.45; }
.verify-result code { display: block; margin-top: 7px; color: var(--amber); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.verify-result a { display: inline-block; margin-top: 6px; color: var(--amber); font-size: 10px; font-weight: 800; text-decoration: none; }
.verify-result.verified { padding-left: 10px; background: rgba(95,191,115,.12); }
.verify-result.verified .result-icon { border-color: var(--green); color: var(--green); background: rgba(95,191,115,.1); }
.verify-result.checking .result-icon { color: var(--amber); border-color: var(--amber); animation: spin 1s linear infinite; }
.dialog-note { margin: 14px 0 0; color: rgba(255,248,229,.39); font-size: 9px; line-height: 1.55; }

.toast { position: fixed; z-index: 10; left: 50%; bottom: 63px; transform: translate(-50%, 12px); padding: 9px 13px; border: 1px solid rgba(255,248,229,.17); color: #fff9ea; background: rgba(20,19,14,.96); box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,197,82,.5); } 72% { box-shadow: 0 0 0 8px rgba(255,197,82,0); } 100% { box-shadow: 0 0 0 0 rgba(255,197,82,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes travel { to { stroke-dashoffset: -38; } }
@keyframes halo { 0%,100% { transform: scale(.92); opacity: .62; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 980px) {
  .workbench { grid-template-columns: minmax(210px, .55fr) minmax(460px, 1.45fr); gap: 25px; }
  .intro-copy { max-width: 270px; }
  h1 { font-size: clamp(47px, 6.5vw, 66px); }
  .route-card { padding: 15px; }
  .route-name { margin: 15px 0 7px; }
  .route-description { display: none; }
  .route-bottom { padding-top: 14px; }
  .probe-copy { display: none; }
  .app-footer { grid-template-columns: 1fr auto; }
}

@media (max-width: 720px) {
  .app-shell { min-height: 470px; grid-template-rows: 56px minmax(0, 1fr) 43px; }
  .app-header { grid-template-columns: auto 1fr auto; gap: 9px; padding: 0 16px; }
  .brand-mark { width: 27px; height: 27px; font-size: 18px; }
  .brand-wordmark { font-size: 12px; }
  .header-label { display: none; }
  .header-actions { justify-self: end; gap: 13px; }
  .header-button, .refresh-button { min-height: 36px; font-size: 10px; }
  .refresh-button span:last-child { display: none; }
  .refresh-icon { font-size: 18px; }
  .workbench { display: flex; flex-direction: column; gap: 11px; padding: 18px 16px 12px; }
  .ambient-map { width: 125%; right: -56%; bottom: -40%; opacity: .5; }
  .intro-panel { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: end; width: 100%; max-width: none; padding: 0; }
  .intro-panel .eyebrow, .intro-brand { display: none; }
  h1 { grid-column: 1; margin: 0; font-size: clamp(29px, 9.3vw, 39px); line-height: .92; }
  .intro-copy { grid-column: 2; align-self: center; max-width: 155px; margin: 0; color: rgba(255,248,229,.58); font-size: 9px; line-height: 1.55; }
  .intro-notes, .intro-verifier { display: none; }
  .routes-panel { flex: 1; min-height: 0; }
  .panel-heading { align-items: center; margin-bottom: 7px; }
  .panel-heading .eyebrow { display: none; }
  .panel-heading h2 { font-family: var(--sans); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
  #status-summary { max-width: 210px; margin: 0; font-size: 9px; }
  .route-list { grid-template-columns: 1fr; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .route-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; padding: 11px 12px; }
  .route-card:hover { transform: none; }
  .route-topline { grid-column: 1 / -1; margin-bottom: 4px; font-size: 8px; }
  .route-topline span:last-child { display: none; }
  .route-name { grid-column: 1; grid-row: 2; min-width: 0; align-self: center; margin: 0; }
  .route-name h3 { margin-bottom: 5px; font-size: 13px; }
  .route-name code { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .route-description { display: none; }
  .route-bottom { grid-column: 2; grid-row: 2; min-width: 0; align-self: center; display: block; margin: 0; padding: 0; }
  .route-health { margin-bottom: 7px; justify-content: flex-end; gap: 5px; }
  .route-health strong { font-size: 9px; }
  .route-health small { display: none; }
  .route-actions { justify-content: flex-end; gap: 5px; }
  .copy-button { width: 28px; height: 28px; font-size: 12px; }
  .go-link { font-size: 9px; }
  .go-link span { font-size: 14px; }
  .app-footer { grid-template-columns: 1fr auto; gap: 9px; padding: 0 16px; }
  .usage-copy { display: none; }
  .friend-links { justify-content: flex-end; gap: 5px; }
  .friend-links a { min-height: 24px; padding: 0 7px; font-size: 8px; }
  .verify-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .dialog-shell { min-height: 0; padding: 24px; }
  .dialog-topline { margin-bottom: 25px; }
  .dialog-copy h2 { font-size: clamp(39px, 12vw, 54px); }
  .dialog-copy p { margin-bottom: 20px; font-size: 11px; }
  .input-row { flex-direction: column; }
  .input-row input { flex: none; width: 100%; }
  .verify-submit { min-height: 42px; }
  .verify-result { min-height: 78px; margin-top: 17px; padding: 12px 0; }
  .dialog-note { margin-top: 11px; }
  .toast { bottom: 52px; }
}

@media (max-height: 670px) and (min-width: 721px) {
  .app-shell { grid-template-rows: 54px minmax(0, 1fr) 38px; }
  .workbench { padding-top: 20px; padding-bottom: 14px; }
  .intro-copy { font-size: 11px; line-height: 1.6; }
  .intro-notes { display: none; }
  .intro-verifier { margin-top: 2px; }
  .route-name { margin-top: 12px; }
  .route-description { display: none; }
  .route-bottom { padding-top: 10px; }
  .app-footer { min-height: 38px; }
}

@media (max-height: 620px) and (max-width: 720px) {
  .app-shell { grid-template-rows: 49px minmax(0, 1fr) 37px; }
  .app-header { padding: 0 13px; }
  .header-button { font-size: 9px; }
  .workbench { gap: 6px; padding: 10px 13px 7px; }
  .intro-copy { display: none; }
  h1 { font-size: 27px; }
  .panel-heading { margin-bottom: 4px; }
  .route-list { gap: 4px; }
  .route-card { padding: 7px 9px; }
  .route-topline { font-size: 7px; }
  .route-name h3 { margin-bottom: 3px; font-size: 12px; }
  .route-name code { font-size: 8px; }
  .copy-button { width: 25px; height: 25px; }
  .app-footer { padding: 0 13px; }
}

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