:root {
  --bg: #05080b;
  --panel: rgba(4, 14, 20, 0.82);
  --cyan: #3fd8ff;
  --cyan-glow: rgba(63, 216, 255, 0.45);
  --cyan-line: rgba(63, 216, 255, 0.28);
  --cyan-faint: rgba(63, 216, 255, 0.06);
  --red: #ff3b5c;
  --text: #d6f3ff;
  --muted: #6f97ab;
  --vh: 100vh;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.panel input:focus-visible { outline: none; } /* has the glow ring instead */

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 35%, rgba(63, 216, 255, 0.10), transparent 60%),
    linear-gradient(var(--cyan-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--cyan-faint) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  color: var(--text);
  font-family: "Rajdhani", system-ui, sans-serif;
  font-size: 16px;
}

/* ---------- lock screen ---------- */

.lock-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.hero {
  position: relative;
  width: min(100%, 900px);
  overflow: hidden;
  /* fade all four edges so the photo melts into the grid */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
    linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
    linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
          mask-composite: intersect;
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 18px rgba(63, 216, 255, 0.25));
}

.scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0, rgba(63, 216, 255, 0.10) 50%, transparent 100%);
  height: 10%;
  animation: scan 5s linear infinite;
  pointer-events: none;
}

@keyframes scan {
  from { transform: translateY(-120%); }
  to   { transform: translateY(1100%); }
}

/* blueprint side panels: wide screens only, tucked in next to the main image */
.blueprint {
  --bpw: clamp(180px, 15vw, 260px);
  position: fixed;
  top: 50%;
  width: var(--bpw);
  height: auto;
  transform: translateY(-50%);
  opacity: 0.8;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 6px rgba(63, 216, 255, 0.25));
}
.blueprint.left  { left:  max(16px, calc(50% - 470px - var(--bpw))); }
.blueprint.right { right: max(16px, calc(50% - 470px - var(--bpw))); }
.lock-screen { position: relative; z-index: 1; }

@media (max-width: 1180px), (max-height: 640px) {
  .blueprint { display: none; }
}

.panel {
  width: min(100%, 400px);
  display: grid;
  gap: 16px;
  padding: 24px 24px 16px;
  background: var(--panel);
  border: 1px solid var(--cyan-line);
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(63, 216, 255, 0.10), inset 0 0 28px rgba(63, 216, 255, 0.05);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.14em;
}

.brand { color: var(--cyan); font-weight: 700; font-size: 15px; text-shadow: 0 0 10px var(--cyan-glow); }
.sub   { color: var(--muted); font-size: 11px; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  align-self: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

.panel label {
  display: grid;
  gap: 8px;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel input {
  width: 100%;
  padding: 11px 12px;
  font: 600 16px "Rajdhani", system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(63, 216, 255, 0.05);
  border: 1px solid var(--cyan-line);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.panel input::placeholder { color: var(--muted); letter-spacing: 0.02em; }

.panel input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(63, 216, 255, 0.35), 0 0 16px rgba(63, 216, 255, 0.2);
}

.panel input[name="code"] { letter-spacing: 0.45em; font-size: 18px; }
.panel input[name="code"]::placeholder { letter-spacing: 0.02em; font-size: 15px; }

.panel button {
  margin-top: 4px;
  padding: 12px;
  font: 700 13px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #00141d;
  background: linear-gradient(180deg, #7fe6ff, var(--cyan));
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(63, 216, 255, 0.35);
  transition: box-shadow 0.15s, transform 0.05s;
}

.panel button:hover  { box-shadow: 0 0 32px rgba(63, 216, 255, 0.6); }
.panel button:active { transform: translateY(1px); }
.panel button { transition: box-shadow 0.15s, transform 0.1s; }
.panel button:disabled { opacity: 0.6; cursor: wait; }

.status {
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.status.err { color: var(--red); text-shadow: 0 0 10px rgba(255, 59, 92, 0.45); }
.status.ok  { color: var(--cyan); text-shadow: 0 0 10px var(--cyan-glow); }

body.unlocked .hero-img { animation: power-up 0.9s ease-out forwards; }
@keyframes power-up {
  to { filter: drop-shadow(0 0 40px rgba(63, 216, 255, 0.9)) brightness(1.5); }
}

/* ---------- terminal ---------- */

body.term {
  height: var(--vh);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--cyan-line);
  background: rgba(4, 14, 20, 0.9);
  font-family: "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.12em;
}

.bar .brand { font-size: 13px; }
.bar .sub   { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conn { font-size: 11px; color: var(--muted); }
.conn.online  { color: var(--cyan); }
.conn.offline { color: var(--red); }

.bar button, .keys button {
  font: 600 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.12em;
  color: var(--cyan);
  background: rgba(63, 216, 255, 0.06);
  border: 1px solid var(--cyan-line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.bar button:hover, .keys button:hover { border-color: var(--cyan); }

#terms {
  flex: 1;
  min-height: 0;
  position: relative;
}
.term-pane { position: absolute; inset: 6px 4px 0 8px; }
.term-pane.off { visibility: hidden; pointer-events: none; }

.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  border: 1px solid var(--cyan-line);
  border-radius: 6px;
  background: rgba(63, 216, 255, 0.04);
}
.tab.active {
  border-color: var(--cyan);
  background: rgba(63, 216, 255, 0.14);
  box-shadow: 0 0 10px rgba(63, 216, 255, 0.2);
}
.bar .tab-label, .bar .tab-x {
  border: 0;
  background: none;
  border-radius: 0;
  color: var(--muted);
}
.bar .tab-label { padding: 5px 4px 5px 10px; }
.bar .tab-x { padding: 4px 9px 5px 6px; font: 400 15px/1 system-ui, sans-serif; letter-spacing: 0; }
.bar .tab.active .tab-label { color: var(--cyan); }
.bar .tab-x:hover { color: var(--red); }
.tab.only .tab-x { display: none; }
.bar .tab.only .tab-label { padding-right: 10px; }
.bar #newtab { padding: 3px 10px 4px; font: 400 17px/1 system-ui, sans-serif; letter-spacing: 0; }

.keys {
  display: flex;
  gap: 8px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  overflow-x: auto;
  border-top: 1px solid var(--cyan-line);
  background: rgba(4, 14, 20, 0.9);
}
.keys button { flex: 0 0 auto; padding: 8px 12px; font-family: "Rajdhani", system-ui, sans-serif; font-size: 15px; }

@media (hover: hover) and (pointer: fine) {
  .keys { display: none; }   /* real keyboard: no need for the extra key row */
}

/* Fingers, not mouse pointers: Apple asks for 44px tap targets. */
@media (pointer: coarse) {
  .keys button, .copy, .panel button { min-height: 44px; }
  .bar button, .bar .tab-label { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan, .dot { animation: none; }
  .scan { display: none; }
}

/* ---------- shayanisaac.cc home page ---------- */

.hub-wrap {
  max-width: 980px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.hub-head { display: flex; align-items: center; gap: 16px; }
.hub-logo { width: 54px; height: 54px; flex: 0 0 auto; filter: drop-shadow(0 0 12px var(--cyan-glow)); }
.hub-logo circle:first-child { transform-origin: 16px 16px; animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hub-head h1 {
  margin: 0;
  font: 700 clamp(20px, 4.5vw, 34px) "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.12em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(63, 216, 255, 0.35);
  overflow-wrap: anywhere;
}
.hub-head h1 span { color: var(--cyan); }
.hub-head p {
  margin: 6px 0 0;
  font: 500 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 24px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--cyan-line);
  border-radius: 14px;
  box-shadow: inset 0 0 28px rgba(63, 216, 255, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.card:hover, a.card:focus-visible {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 28px rgba(63, 216, 255, 0.22), inset 0 0 28px rgba(63, 216, 255, 0.08);
  transform: translateY(-2px);
}

.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-icon { width: 34px; height: 34px; color: var(--cyan); filter: drop-shadow(0 0 6px rgba(63, 216, 255, 0.4)); }

.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.on { color: var(--cyan); }
.state.on::before { box-shadow: 0 0 8px var(--cyan); animation: pulse 2s ease-in-out infinite; }
.state.off { color: var(--red); }

.card h2 { margin: 8px 0 0; font: 700 18px "Orbitron", system-ui, sans-serif; letter-spacing: 0.16em; }
.card p { margin: 0; font-size: 16px; color: var(--muted); }

.addr {
  margin-top: auto;
  padding-top: 8px;
  font: 600 15px "Rajdhani", system-ui, sans-serif;
  letter-spacing: 0.05em;
  color: var(--cyan);
}

.copy {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font: 600 15px "Rajdhani", system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(63, 216, 255, 0.05);
  border: 1px solid var(--cyan-line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}
.copy:hover { border-color: var(--cyan); }
.copy-addr { min-width: 0; overflow-wrap: anywhere; user-select: all; }
.copy-tag {
  flex: 0 0 auto;
  font: 700 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}

.hub-foot {
  text-align: center;
  font: 500 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.3em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .hub-logo circle:first-child, .state.on::before { animation: none; }
}

/* home page: armory schematics */

.section-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0 0;
  font: 500 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--cyan-line); }

.armory { display: grid; gap: 16px; }
.armory-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.armory-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--cyan-line);
  border-radius: 14px;
  box-shadow: inset 0 0 28px rgba(63, 216, 255, 0.04);
}
.frame img { display: block; width: 100%; height: auto; }
.bp-suit { border-color: rgba(63, 216, 255, 0.45); box-shadow: 0 0 30px rgba(63, 216, 255, 0.12), inset 0 0 28px rgba(63, 216, 255, 0.06); }

.registry { flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 16px; gap: 16px; }
.reg-head {
  display: flex;
  justify-content: space-between;
  font: 600 11px "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8fe9ff;
}
.reg-head span:last-child { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.registry ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.registry li { display: grid; grid-template-columns: 76px 1fr; grid-template-rows: auto 4px; column-gap: 8px; row-gap: 4px; }
.registry b { font: 700 13px "Orbitron", system-ui, sans-serif; letter-spacing: 0.08em; color: var(--cyan); }
.registry span { font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.registry i {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan) calc(var(--p) * 100%), rgba(63, 216, 255, 0.12) 0);
}

@media (max-width: 860px) {
  .armory-main, .armory-row { grid-template-columns: minmax(0, 1fr); }
  .bp-suit { order: -1; }
  .armory-main .bp-side img, .armory-row .frame img { max-width: 300px; }
  .bp-suit img { max-width: 380px; }
}

/* ---------- hand gestures (gesture-detect.js debug overlay) ---------- */

.bar #hand.on {
  border-color: var(--cyan);
  background: rgba(63, 216, 255, 0.18);
  box-shadow: 0 0 10px rgba(63, 216, 255, 0.25);
}

.gesture-hud {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: 240px;
  padding: 8px;
  border: 1px solid var(--cyan-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 0 18px rgba(63, 216, 255, 0.15);
  font-family: "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.1em;
}
.gesture-hud[hidden] { display: none; }

.gesture-name {
  min-height: 18px;
  font-size: 14px;
  color: var(--cyan);
  text-align: center;
  text-transform: uppercase;
}
.gesture-hud canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 6px;
  border-radius: 4px;
  background: #000;
}
.gesture-action {
  min-height: 14px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--red);
  text-align: center;
}
.gesture-info {
  margin-top: 4px;
  font: 500 12px/1.3 "Rajdhani", system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: pre-wrap;
}
.gesture-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 600px) {
  .gesture-hud { right: 8px; bottom: 8px; width: 170px; }
}

/* gesture overlay: the "does" menu (gesture-map.js) */
.gesture-map {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--cyan-line);
  font: 500 12px/1.4 "Rajdhani", system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.gesture-map-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gesture-map-row b { color: var(--cyan); font-weight: 600; text-transform: uppercase; }
.gesture-map select {
  flex: 1;
  min-width: 90px;
  font: inherit;
  color: var(--text);
  background: rgba(63, 216, 255, 0.06);
  border: 1px solid var(--cyan-line);
  border-radius: 6px;
  padding: 4px 6px;
}
.gesture-map select:disabled { opacity: 0.5; }
.gesture-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 90px; overflow-y: auto; }
.gesture-list li { display: flex; align-items: center; gap: 6px; color: var(--text); }
.gesture-list li.empty { color: var(--muted); }
.gesture-list button {
  margin-left: auto;
  padding: 0 4px;
  font: 400 15px/1 system-ui, sans-serif;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.gesture-list button:hover { color: var(--red); }
