:root {
  --bg: #04060c; --panel: rgba(14, 18, 32, .78); --line: rgba(122, 92, 255, .28); --line2: rgba(62, 240, 255, .35);
  --txt: #e8ecf8; --mut: #8e98b8; --c1: #3ef0ff; --c2: #7a5cff; --c3: #ff4fd8; --ok: #3ad29f; --bad: #ff6b6b; --warn: #ffcc66;
  --sans: 'SF Pro Display', 'SF Pro Text', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--txt); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.grid-bg {
  position: fixed; left: -50%; right: -50%; bottom: -10%; height: 55%; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(62,240,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(122,92,255,.16) 1px, transparent 1px);
  background-size: 64px 64px; transform: perspective(380px) rotateX(62deg); transform-origin: top center;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  animation: drift 7s linear infinite;
}
@keyframes drift { to { background-position: 0 64px, 0 0; } }
.glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 60% 40% at 50% 20%, rgba(122,92,255,.18), transparent 70%); }
@media (prefers-reduced-motion: reduce) { .grid-bg { animation: none; } }

.top, main, .foot { position: relative; z-index: 1; }
.top { max-width: 1100px; margin: 0 auto; padding: 28px 16px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mark { width: min(520px, 92vw); height: auto; }
.who { font-size: 13px; color: var(--mut); display: flex; gap: 10px; align-items: center; }
.who b { color: var(--txt); font-weight: 600; }
.who a { color: var(--c1); }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 26px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.center { max-width: 420px; margin: 40px auto 0; text-align: center; }
.muted { color: var(--mut); }
.spinner { width: 34px; height: 34px; margin: 4px auto 14px; border-radius: 50%; border: 3px solid rgba(122,92,255,.25); border-top-color: var(--c1); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tailscale required */
.warn h1 { font-size: 20px; margin: 10px 0 6px; }
.warn p { color: var(--mut); line-height: 1.55; margin: 6px 0; font-size: 14.5px; }
.ts-big { width: 64px; height: 64px; margin: 0 auto; display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 11px; color: #05070d; background: linear-gradient(90deg, var(--c1), var(--c2) 60%, var(--c3)); margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--txt); border: 1px solid var(--line2); }
.btn:focus-visible, input:focus-visible, .card:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

/* login */
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p { color: var(--mut); margin: 0 0 16px; font-size: 14px; }
.login label { display: block; text-align: left; font-size: 12.5px; color: var(--mut); margin: 12px 0 5px; }
.login input { width: 100%; font: inherit; font-size: 16px; color: var(--txt); background: rgba(4,6,12,.7); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.login .btn { width: 100%; margin-top: 20px; }
.err { color: var(--bad); font-size: 13.5px; margin-top: 12px; }

/* tabs (signed in) */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.tabs a, .tabs .refresh { font-size: 13.5px; font-weight: 600; color: var(--mut); padding: 7px 14px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; font-family: inherit; }
.tabs a:hover, .tabs .refresh:hover { color: var(--txt); border-color: var(--line); }
.tabs a.on { color: #05070d; background: linear-gradient(90deg, var(--c1), var(--c2) 60%, var(--c3)); }
.tabs a .n { display: inline-block; min-width: 17px; margin-left: 6px; padding: 0 5px; border-radius: 9px; font-size: 11px; background: rgba(255,204,102,.2); color: var(--warn); text-align: center; }
.tabs a.on .n { background: rgba(5,7,13,.25); color: #05070d; }
body.wide main { max-width: 1240px; }

/* project galleries: one horizontal row per place, cards cascade in, coverflow tilt while scrolling */
.gallery { margin-bottom: 8px; }
.section-h { display: flex; align-items: center; gap: 10px; margin: 26px 2px 6px; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mut); }
.section-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); order: 3; }
.section-h .nav { order: 4; display: flex; gap: 6px; }
.where-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mut); box-shadow: 0 0 10px currentColor; }
.gallery.ai .where-dot { background: var(--c1); color: var(--c1); }
.gallery.nas .where-dot { background: #ffb547; color: #ffb547; }
.gallery.ext .where-dot { background: var(--c3); color: var(--c3); }
.arrow { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--txt); font-size: 18px; line-height: 1; cursor: pointer; }
.arrow:disabled { opacity: .25; cursor: default; }
.arrow:not(:disabled):hover { border-color: var(--line2); }
.rail { display: flex; gap: 18px; overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity;
  /* full-bleed: the row runs edge to edge, its first card lines up with the page */
  margin: 0 calc(50% - 50vw); padding: 14px 12vw 26px max(16px, calc(50vw - 50% + 6px)); scroll-padding-left: max(16px, calc(50vw - 50% + 6px));
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6vw, #000 calc(100% - 8vw), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 6vw, #000 calc(100% - 8vw), transparent);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; outline: none; }
.rail::-webkit-scrollbar { height: 6px; } .rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.pcard { flex: 0 0 248px; scroll-snap-align: start; display: block; position: relative; animation: cascade .75s cubic-bezier(.2,.85,.25,1) both; animation-delay: calc(var(--g, 0) * 160ms + var(--i, 0) * 75ms); }
@keyframes cascade { from { opacity: 0; transform: translate3d(90px, 26px, 0) rotate(3deg) scale(.9); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
.pcard .face { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; height: 100%; min-height: 168px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); transition: border-color .2s ease, box-shadow .2s ease, transform .12s linear; transform-origin: center; will-change: transform;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pcard:hover .face, .pcard:focus-visible .face { border-color: var(--line2); box-shadow: 0 18px 50px rgba(62,240,255,.12), 0 0 0 1px rgba(62,240,255,.15); }
.gallery.nas .pcard:hover .face { box-shadow: 0 18px 50px rgba(255,181,71,.12), 0 0 0 1px rgba(255,181,71,.18); }
.pcard .ic { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.pcard .ic svg { width: 100%; height: 100%; display: block; }
.pcard h2 { font-size: 16px; margin: 0; font-weight: 600; }
.pcard p { margin: 0; color: var(--mut); font-size: 13px; line-height: 1.45; }
.pcard .host { margin-top: auto; font-size: 11.5px; color: var(--mut); opacity: .8; word-break: break-all; }
.badge { position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .5px; padding: 3px 8px 3px 5px; border-radius: 999px; border: 1px solid; }
.badge.ts { color: #cfd6ea; border-color: rgba(207,214,234,.35); background: rgba(207,214,234,.06); }
.badge.net { color: var(--c1); border-color: rgba(62,240,255,.35); background: rgba(62,240,255,.06); }
.badge svg { width: 14px; height: 14px; }
.dot { position: absolute; top: 20px; left: 74px; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.dot.up { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.down { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
@media (prefers-reduced-motion: reduce) { .pcard { animation: none; } .pcard .face { transform: none !important; } }
@media (max-width: 520px) { .panel { padding: 22px 18px; } .pcard { flex-basis: 74vw; } .rail { padding-right: 20vw; -webkit-mask-image: none; mask-image: none; } .section-h .nav { display: none; } .tabs a { padding: 6px 11px; } }

.foot { position: relative; z-index: 1; }
.top { max-width: 1100px; margin: 0 auto; padding: 28px 16px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mark { width: min(520px, 92vw); height: auto; }
.who { font-size: 13px; color: var(--mut); display: flex; gap: 10px; align-items: center; }
.who b { color: var(--txt); font-weight: 600; }
.who a { color: var(--c1); }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 26px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.center { max-width: 420px; margin: 40px auto 0; text-align: center; }
.muted { color: var(--mut); }
.spinner { width: 34px; height: 34px; margin: 4px auto 14px; border-radius: 50%; border: 3px solid rgba(122,92,255,.25); border-top-color: var(--c1); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tailscale required */
.warn h1 { font-size: 20px; margin: 10px 0 6px; }
.warn p { color: var(--mut); line-height: 1.55; margin: 6px 0; font-size: 14.5px; }
.ts-big { width: 64px; height: 64px; margin: 0 auto; display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 11px; color: #05070d; background: linear-gradient(90deg, var(--c1), var(--c2) 60%, var(--c3)); margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--txt); border: 1px solid var(--line2); }
.btn:focus-visible, input:focus-visible, .card:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

/* login */
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p { color: var(--mut); margin: 0 0 16px; font-size: 14px; }
.login label { display: block; text-align: left; font-size: 12.5px; color: var(--mut); margin: 12px 0 5px; }
.login input { width: 100%; font: inherit; font-size: 16px; color: var(--txt); background: rgba(4,6,12,.7); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.login .btn { width: 100%; margin-top: 20px; }
.err { color: var(--bad); font-size: 13.5px; margin-top: 12px; }

/* cards */
.section-h { display: flex; align-items: center; gap: 10px; margin: 26px 2px 12px; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mut); }
.section-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; min-height: 150px; }
.card:hover { transform: translateY(-2px); border-color: var(--line2); box-shadow: 0 12px 40px rgba(62,240,255,.08); }
.card .ic { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.card .ic svg { width: 100%; height: 100%; display: block; }
.card h2 { font-size: 16px; margin: 0; font-weight: 600; }
.card p { margin: 0; color: var(--mut); font-size: 13px; line-height: 1.45; }
.card .host { margin-top: auto; font-size: 11.5px; color: var(--mut); opacity: .8; word-break: break-all; }
.badge { position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .5px; padding: 3px 8px 3px 5px; border-radius: 999px; border: 1px solid; }
.badge.ts { color: #cfd6ea; border-color: rgba(207,214,234,.35); background: rgba(207,214,234,.06); }
.badge.net { color: var(--c1); border-color: rgba(62,240,255,.35); background: rgba(62,240,255,.06); }
.badge svg { width: 14px; height: 14px; }
.dot { position: absolute; top: 20px; left: 74px; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.dot.up { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.down { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.foot { text-align: center; color: var(--mut); font-size: 12px; padding: 0 16px 30px; opacity: .8; }

.section-h .count { font-size: 11px; letter-spacing: 0; color: var(--mut); opacity: .7; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
