:root {
  color-scheme: dark light;
  --bg: #06111f;
  --bg-deep: #040b15;
  --text: #edf8ff;
  --text-soft: #c6d9e8;
  --text-muted: #8faabe;
  --glass: rgba(10, 31, 52, 0.56);
  --glass-strong: rgba(10, 30, 50, 0.76);
  --glass-fallback: rgba(10, 30, 50, 0.92);
  --glass-border: rgba(196, 235, 255, 0.18);
  --inner-highlight: rgba(255, 255, 255, 0.13);
  --shadow: 0 22px 60px rgba(0, 6, 19, 0.34), 0 6px 18px rgba(0, 9, 24, 0.2);
  --cyan: #55ddff;
  --blue: #4285ff;
  --purple: #9e7cff;
  --good: #64e7a4;
  --warning: #ffb65c;
  --error: #ff6f7d;
  --chart-down: #59dcff;
  --chart-up: #a68aff;
  --chart-grid: rgba(182, 224, 245, 0.12);
  --control: rgba(255, 255, 255, 0.075);
  --control-hover: rgba(255, 255, 255, 0.13);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #e8f7ff;
    --bg-deep: #d6edfa;
    --text: #102d45;
    --text-soft: #36546b;
    --text-muted: #5f7b8f;
    --glass: rgba(248, 253, 255, 0.57);
    --glass-strong: rgba(248, 253, 255, 0.78);
    --glass-fallback: rgba(247, 252, 255, 0.94);
    --glass-border: rgba(255, 255, 255, 0.82);
    --inner-highlight: rgba(255, 255, 255, 0.86);
    --shadow: 0 22px 55px rgba(32, 91, 126, 0.15), 0 7px 20px rgba(42, 93, 124, 0.09);
    --chart-grid: rgba(45, 99, 130, 0.12);
    --control: rgba(255, 255, 255, 0.48);
    --control-hover: rgba(255, 255, 255, 0.72);
  }
}

:root[data-theme="light"] {
  --bg: #e8f7ff;
  --bg-deep: #d6edfa;
  --text: #102d45;
  --text-soft: #36546b;
  --text-muted: #5f7b8f;
  --glass: rgba(248, 253, 255, 0.57);
  --glass-strong: rgba(248, 253, 255, 0.78);
  --glass-fallback: rgba(247, 252, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.82);
  --inner-highlight: rgba(255, 255, 255, 0.86);
  --shadow: 0 22px 55px rgba(32, 91, 126, 0.15), 0 7px 20px rgba(42, 93, 124, 0.09);
  --chart-grid: rgba(45, 99, 130, 0.12);
  --control: rgba(255, 255, 255, 0.48);
  --control-hover: rgba(255, 255, 255, 0.72);
}

:root[data-theme="dark"] {
  --bg: #06111f;
  --bg-deep: #040b15;
  --text: #edf8ff;
  --text-soft: #c6d9e8;
  --text-muted: #8faabe;
  --glass: rgba(10, 31, 52, 0.56);
  --glass-strong: rgba(10, 30, 50, 0.76);
  --glass-fallback: rgba(10, 30, 50, 0.92);
  --glass-border: rgba(196, 235, 255, 0.18);
  --inner-highlight: rgba(255, 255, 255, 0.13);
  --shadow: 0 22px 60px rgba(0, 6, 19, 0.34), 0 6px 18px rgba(0, 9, 24, 0.2);
  --chart-grid: rgba(182, 224, 245, 0.12);
  --control: rgba(255, 255, 255, 0.075);
  --control-hover: rgba(255, 255, 255, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 152, 255, 0.23), transparent 33rem),
    radial-gradient(circle at 90% 18%, rgba(61, 232, 238, 0.16), transparent 29rem),
    linear-gradient(145deg, var(--bg), var(--bg-deep));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(85, 221, 255, 0.48);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 32rem;
  height: 32rem;
  border-radius: 48% 52% 60% 40% / 42% 46% 54% 58%;
  opacity: 0.42;
  filter: blur(55px);
  will-change: transform;
  animation: liquid-drift 22s ease-in-out infinite alternate;
}

.orb-one {
  top: -14rem;
  left: -9rem;
  background: linear-gradient(140deg, #006eff, #42e9ff);
}

.orb-two {
  top: 18%;
  right: -15rem;
  background: linear-gradient(140deg, #12d9e8, #866bff);
  animation-delay: -7s;
  animation-duration: 27s;
}

.orb-three {
  bottom: -18rem;
  left: 28%;
  background: linear-gradient(140deg, #276fff, #a45cff);
  animation-delay: -13s;
  animation-duration: 31s;
}

@keyframes liquid-drift {
  0% { transform: translate3d(-2%, -2%, 0) rotate(-5deg) scale(0.96); }
  50% { transform: translate3d(6%, 5%, 0) rotate(7deg) scale(1.05); }
  100% { transform: translate3d(-1%, 11%, 0) rotate(-2deg) scale(1); }
}

.glass {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass-fallback);
  box-shadow: inset 0 1px 0 var(--inner-highlight), var(--shadow);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(28px) saturate(165%);
    backdrop-filter: blur(28px) saturate(165%);
  }
}

.glass::before {
  position: absolute;
  top: -45%;
  left: -20%;
  z-index: -1;
  width: 68%;
  height: 68%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 68%);
  content: "";
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.17em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.62rem);
  letter-spacing: -0.035em;
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px 20px;
  border-radius: 26px;
}

.brand-row,
.topbar-actions,
.service-tile,
.listener-row,
.section-heading,
.metric-top,
.quota-head,
.quota-foot,
.latency-list > div,
.legend {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 23px 27px 22px 28px;
  background: linear-gradient(145deg, rgba(64, 217, 255, 0.92), rgba(72, 95, 255, 0.88) 58%, rgba(158, 91, 255, 0.84));
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.38), 0 12px 30px rgba(30, 129, 255, 0.3);
  transform: rotate(-4deg);
}

.brand-mark span {
  width: 26px;
  height: 26px;
  border: 5px solid rgba(255, 255, 255, 0.95);
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(35deg);
}

.brand-mark.compact {
  width: 45px;
  height: 45px;
  border-radius: 16px 19px 15px 20px;
}

.brand-mark.compact span {
  width: 19px;
  height: 19px;
  border-width: 4px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.updated-pill,
.soft-pill,
.ghost-button,
.tutorial-button,
.back-button,
.status-pill,
.uptime-pill {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--control);
  color: var(--text-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.button-link,
.claim-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-only[hidden] {
  display: none !important;
}

.claim-nav-button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: linear-gradient(105deg, #14a9df, #3575f4 54%, #8a5ff2);
  color: #fff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.42), 0 9px 26px rgba(37, 113, 239, 0.32);
  font-size: 0.8rem;
  font-weight: 760;
  white-space: nowrap;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.claim-nav-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.46), 0 13px 30px rgba(37, 113, 239, 0.37);
}

.ghost-button {
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.ghost-button:hover {
  border-color: rgba(96, 220, 255, 0.38);
  background: var(--control-hover);
  transform: translateY(-1px);
}

.tutorial-button,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: transform 180ms ease, filter 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tutorial-button {
  border-color: rgba(143, 225, 255, 0.32);
  background: linear-gradient(120deg, rgba(7, 91, 174, 0.94), rgba(36, 109, 226, 0.9) 58%, rgba(99, 78, 214, 0.84));
  color: #f6fcff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 8px 24px rgba(22, 102, 222, 0.26);
  font-weight: 720;
}

.tutorial-button:hover,
.back-button:hover {
  filter: brightness(1.09);
  transform: translateY(-1px);
}

.tutorial-button svg,
.back-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.danger-hover:hover {
  border-color: rgba(255, 111, 125, 0.42);
  color: var(--error);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.hero-card,
.network-card,
.latency-card,
.chart-card {
  padding: clamp(20px, 3vw, 30px);
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.hero-meta {
  text-align: right;
}

.hero-meta span,
.hero-meta strong {
  display: block;
}

.meta-label {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.service-tile {
  position: relative;
  gap: 12px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(180, 225, 247, 0.13);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.service-tile:hover {
  transform: translateY(-2px);
}

.service-tile p {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.service-tile strong {
  font-size: 0.92rem;
}

.service-icon {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(64, 186, 255, 0.25), rgba(123, 96, 255, 0.2));
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.status-light {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.service-tile[data-state="good"] {
  border-color: rgba(100, 231, 164, 0.22);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 9px 28px rgba(50, 220, 145, 0.07);
}

.service-tile[data-state="good"] .status-light,
.status-dot.good,
.status-pill.good i {
  background: var(--good);
  box-shadow: 0 0 15px rgba(100, 231, 164, 0.8);
}

.service-tile[data-state="warning"] .status-light,
.status-pill.warning i {
  background: var(--warning);
  box-shadow: 0 0 15px rgba(255, 182, 92, 0.7);
}

.service-tile[data-state="error"] .status-light,
.status-pill.error i {
  background: var(--error);
  box-shadow: 0 0 15px rgba(255, 111, 125, 0.72);
}

.service-tile[data-state="warning"] { border-color: rgba(255, 182, 92, 0.24); }
.service-tile[data-state="error"] { border-color: rgba(255, 111, 125, 0.28); }

.listener-row {
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.status-pill i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
}

.uptime-pill {
  margin-left: auto;
}

.resource-card {
  min-height: 150px;
  padding: 20px;
}

.metric-top {
  justify-content: space-between;
  gap: 12px;
}

.metric-top span {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.metric-top strong {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.04em;
}

.resource-card > p {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.mini-track,
.quota-track {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(3, 16, 29, 0.25);
}

.mini-track {
  height: 7px;
  margin-top: 18px;
}

.mini-track span,
.quota-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--purple));
  box-shadow: 0 0 17px rgba(74, 182, 255, 0.38);
  transition: width 520ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.load-dots {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}

.load-dots i {
  width: 34px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(85, 221, 255, 0.45), rgba(158, 124, 255, 0.72));
}

.speed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.speed-grid article {
  position: relative;
  min-height: 112px;
  padding: 17px;
  border: 1px solid rgba(180, 225, 247, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.speed-grid p {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.speed-grid strong {
  font-size: clamp(1rem, 1.7vw, 1.32rem);
  letter-spacing: -0.025em;
}

.direction {
  position: absolute;
  top: 14px;
  right: 15px;
  font-size: 1.1rem;
  font-weight: 800;
}

.direction.down { color: var(--chart-down); }
.direction.up { color: var(--chart-up); }

.quota-block {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(178, 226, 248, 0.14);
  border-radius: 22px;
  background: linear-gradient(130deg, rgba(40, 151, 255, 0.08), rgba(139, 91, 255, 0.06));
}

.quota-head,
.quota-foot {
  justify-content: space-between;
  gap: 18px;
}

.quota-head span,
.quota-head strong {
  display: block;
}

.quota-head span,
.quota-foot {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.quota-head strong {
  margin-top: 5px;
  font-size: 1rem;
}

.quota-right {
  text-align: right;
}

.quota-track {
  height: 13px;
  margin: 17px 0 11px;
}

.data-note {
  margin: 15px 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.latency-feature {
  padding: 18px;
  border: 1px solid rgba(84, 215, 255, 0.2);
  border-radius: 21px;
  background: linear-gradient(140deg, rgba(55, 185, 255, 0.12), rgba(97, 93, 255, 0.07));
}

.latency-feature span,
.latency-feature strong,
.latency-feature p {
  display: block;
}

.latency-feature span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.latency-feature strong {
  margin: 8px 0;
  color: var(--cyan);
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.latency-feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.latency-list {
  margin-top: 12px;
}

.latency-list > div {
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 3px;
  border-bottom: 1px solid rgba(177, 221, 241, 0.1);
  font-size: 0.76rem;
}

.latency-list span { color: var(--text-muted); }
.latency-list strong { font-size: 0.78rem; }
.latency-good { color: var(--good); }
.latency-error { color: var(--error); }

.chart-heading {
  align-items: flex-end;
}

.legend {
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.legend span::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  content: "";
}

.download-legend::before { background: var(--chart-down); }
.upload-legend::before { background: var(--chart-up); }

canvas {
  display: block;
  width: 100%;
  height: 225px;
}

footer {
  padding: 22px 8px 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
}

footer p { margin: 0; }

.tutorial-shell {
  width: min(1240px, calc(100% - 40px));
}

.tutorial-topbar {
  gap: 20px;
}

.tutorial-header-left,
.warning-heading,
.step-copy {
  display: flex;
  align-items: center;
}

.tutorial-header-left {
  min-width: 0;
  gap: 18px;
}

.back-button {
  flex: 0 0 auto;
}

.tutorial-title-block {
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid var(--glass-border);
}

.tutorial-main {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.tutorial-intro {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: clamp(22px, 4vw, 34px);
}

.tutorial-intro > div:last-child {
  min-width: 0;
}

.tutorial-intro h2,
.security-warning h2,
.panel-heading h2 {
  margin-bottom: 10px;
}

.tutorial-intro p:last-child,
.panel-heading > p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.intro-icon,
.warning-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(145deg, rgba(61, 200, 255, 0.26), rgba(82, 92, 246, 0.25));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.22), 0 12px 28px rgba(18, 102, 218, 0.14);
}

.intro-icon {
  width: 66px;
  height: 66px;
  border-radius: 22px;
  color: var(--cyan);
}

.intro-icon svg,
.warning-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.security-warning {
  padding: clamp(22px, 4vw, 32px);
  border-color: rgba(255, 182, 92, 0.34);
  background: rgba(75, 46, 19, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 231, 196, 0.18), 0 18px 52px rgba(45, 20, 0, 0.2), 0 0 35px rgba(255, 153, 65, 0.06);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .security-warning {
    background: rgba(74, 43, 15, 0.5);
  }
}

:root[data-theme="light"] .security-warning {
  background: rgba(255, 245, 225, 0.82);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .security-warning { background: rgba(255, 245, 225, 0.82); }
}

.warning-heading {
  gap: 14px;
}

.warning-icon {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  background: rgba(255, 166, 70, 0.16);
  color: var(--warning);
}

.warning-icon svg {
  width: 25px;
  height: 25px;
}

.warning-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  margin: 20px 0 0;
  padding-left: 1.25rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.65;
}

.warning-list li::marker {
  color: var(--warning);
}

code {
  padding: 0.1em 0.38em;
  border: 1px solid rgba(118, 212, 255, 0.18);
  border-radius: 7px;
  background: rgba(17, 116, 184, 0.11);
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

.tutorial-content {
  display: grid;
  gap: 14px;
}

.tutorial-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
}

.tutorial-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 64px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.tutorial-tab:hover {
  border-color: rgba(95, 213, 255, 0.16);
  background: var(--control);
  transform: translateY(-1px);
}

.tutorial-tab[aria-selected="true"] {
  border-color: rgba(95, 213, 255, 0.3);
  background: linear-gradient(125deg, rgba(24, 136, 226, 0.28), rgba(74, 91, 230, 0.24));
  color: var(--text);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.14), 0 8px 24px rgba(18, 91, 189, 0.12);
}

.tutorial-tab svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.tutorial-tab span {
  display: block;
  font-size: 0.84rem;
  font-weight: 720;
  line-height: 1.25;
  text-align: left;
}

.tutorial-tab small {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 600;
}

.tutorial-panel {
  padding: clamp(22px, 4vw, 34px);
}

.tutorial-panel[hidden] {
  display: none;
}

.panel-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(177, 221, 241, 0.12);
}

.tutorial-steps {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.tutorial-steps > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: 18px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(180, 225, 247, 0.13);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.tutorial-steps > li:hover {
  border-color: rgba(95, 213, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.tutorial-steps > li.no-shot {
  grid-template-columns: minmax(0, 1fr);
}

.step-copy {
  min-width: 0;
  gap: 15px;
}

.step-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.step-number {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(95, 213, 255, 0.24);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(38, 171, 238, 0.16), rgba(86, 83, 230, 0.16));
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.screenshot-placeholder {
  display: grid;
  min-height: 74px;
  place-items: center;
  border: 1px dashed rgba(130, 206, 238, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(52, 165, 225, 0.05), rgba(121, 83, 224, 0.06));
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.tutorial-shot {
  display: grid;
  min-height: 96px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(130, 206, 238, 0.24);
  border-radius: 18px;
  background: rgba(4, 18, 38, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 9, 25, 0.18);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tutorial-shot:hover,
.tutorial-shot:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(86, 217, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 34px rgba(0, 9, 25, 0.26);
}

.tutorial-shot img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
}

.tutorial-shot.portrait-shot img {
  max-height: 390px;
}

html[data-theme="light"] .tutorial-shot {
  background: rgba(226, 241, 252, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 28px rgba(30, 73, 108, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-shot {
    transition: none;
  }

  .tutorial-shot:hover,
  .tutorial-shot:focus-visible {
    transform: none;
  }
}

/* Secure claim delivery */
.claim-shell {
  width: min(1080px, calc(100% - 40px));
}

.claim-main,
.admin-claims-main {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.claim-entry-card {
  width: min(100%, 620px);
  margin: 6vh auto 0;
  padding: clamp(28px, 6vw, 48px);
  text-align: center;
}

.claim-lock {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  place-items: center;
  border: 1px solid rgba(121, 225, 255, 0.35);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(38, 186, 240, 0.22), rgba(99, 90, 236, 0.2));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.25), 0 14px 30px rgba(27, 117, 226, 0.16);
  color: var(--cyan);
}

.claim-lock svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.claim-copy {
  max-width: 520px;
  margin: 12px auto 25px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.claim-form {
  margin-top: 26px;
  text-align: left;
}

.claim-form label,
.link-card label,
.admin-key-form > label:not(.check-label) {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 660;
}

.admin-key-form small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.claim-form input,
.secret-link-row input,
.admin-key-form input:not([type="checkbox"]),
.admin-key-form select {
  width: 100%;
  min-height: 52px;
  padding: 0 17px;
  border: 1px solid rgba(180, 226, 247, 0.18);
  border-radius: 17px;
  background: rgba(1, 15, 28, 0.25);
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(0, 3, 12, 0.13), 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .claim-form input,
:root[data-theme="light"] .secret-link-row input,
:root[data-theme="light"] .admin-key-form input:not([type="checkbox"]),
:root[data-theme="light"] .admin-key-form select {
  background: rgba(255, 255, 255, 0.58);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .claim-form input,
  :root:not([data-theme]) .secret-link-row input,
  :root:not([data-theme]) .admin-key-form input:not([type="checkbox"]),
  :root:not([data-theme]) .admin-key-form select { background: rgba(255, 255, 255, 0.58); }
}

.claim-form .form-message {
  margin: 10px 4px;
}

.claim-result {
  display: grid;
  gap: 18px;
}

.claim-result[hidden],
.modal-backdrop[hidden] {
  display: none;
}

.claim-summary-card,
.qr-card,
.link-card,
.claim-guide,
.device-create-card,
.key-create-card,
.key-list-card {
  padding: clamp(22px, 4vw, 32px);
}

.claim-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.claim-summary-card .claim-copy {
  margin: 8px 0 0;
}

.platform-badge,
.security-chip,
.key-state {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(100, 231, 164, 0.28);
  border-radius: 999px;
  background: rgba(100, 231, 164, 0.1);
  color: var(--good);
  font-size: 0.72rem;
  font-weight: 720;
  white-space: nowrap;
}

.claim-tools-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 18px;
}

.qr-card {
  text-align: center;
}

.qr-card .section-heading {
  text-align: left;
}

.qr-frame {
  width: min(100%, 310px);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  padding: 16px;
  border: 1px solid rgba(202, 239, 255, 0.32);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(0, 7, 24, 0.28);
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-card > p,
.link-card > p,
.secret-dialog > p {
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.secret-link-row {
  position: relative;
  margin-top: 8px;
}

.secret-link-row input {
  padding-right: 76px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.inline-action {
  top: 9px;
}

.claim-action-row,
.dialog-actions,
.key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.claim-action-row > *,
.dialog-actions > * {
  flex: 1 1 180px;
}

.compact-primary {
  width: auto;
}

.action-message {
  min-height: 20px;
  margin: 12px 2px 0;
  color: var(--good);
  font-size: 0.74rem;
}

.text-button {
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  font-size: 0.75rem;
}

.claim-guide h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.claim-guide ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.35rem;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.7;
}

.login-claim-button {
  width: 100%;
  min-height: 52px;
  margin-bottom: 8px;
}

.login-claim-note {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.admin-claims-shell {
  width: min(1320px, calc(100% - 40px));
}

.admin-claims-main {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  align-items: start;
}

.key-list-card {
  grid-column: 1 / -1;
}

.key-create-card {
  /* Long admin forms must scroll with the page so every control stays reachable. */
  position: relative;
}

.security-chip {
  border-color: rgba(85, 221, 255, 0.26);
  background: rgba(85, 221, 255, 0.09);
  color: var(--cyan);
}

.admin-key-form {
  display: grid;
  gap: 16px;
}

.admin-key-form select {
  appearance: none;
  cursor: pointer;
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.check-label input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}

.warning-check {
  padding: 12px;
  border: 1px solid rgba(255, 182, 92, 0.3);
  border-radius: 14px;
  background: rgba(255, 182, 92, 0.08);
  color: var(--warning);
}

.key-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.key-item {
  padding: 18px;
  border: 1px solid rgba(180, 225, 247, 0.13);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.key-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.key-item h3 {
  margin: 0 0 7px;
  font-size: 0.96rem;
}

.key-item code {
  font-size: 0.74rem;
}

.key-state.disabled,
.key-state.expired {
  border-color: rgba(255, 182, 92, 0.3);
  background: rgba(255, 182, 92, 0.08);
  color: var(--warning);
}

.key-state.revoked {
  border-color: rgba(255, 111, 125, 0.3);
  background: rgba(255, 111, 125, 0.08);
  color: var(--error);
}

.key-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.key-details div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.key-details dt {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.key-details dd {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 0.76rem;
  text-overflow: ellipsis;
}

.key-action {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 0.7rem;
}

.empty-state {
  margin: 28px 0;
  color: var(--text-muted);
  text-align: center;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(0, 7, 20, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.secret-dialog {
  width: min(100%, 590px);
  padding: clamp(26px, 5vw, 38px);
}

.one-time-secret {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 20px;
  padding: 18px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  user-select: all;
}

@media (max-width: 960px) {
  .admin-claims-main { grid-template-columns: 1fr; }
  .key-create-card { position: static; }
  .claim-tools-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .claim-shell,
  .admin-claims-shell { width: min(100% - 24px, 680px); }
  .claim-topbar { align-items: stretch; flex-direction: column; gap: 14px; }
  .claim-topbar .topbar-actions { width: 100%; max-width: none; }
  .claim-topbar .topbar-actions > * { flex: 1 1 auto; }
  .claim-entry-card { margin-top: 0; }
  .claim-summary-card { align-items: flex-start; flex-direction: column; }
  .key-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .claim-shell .topbar-actions,
  .admin-claims-shell .topbar-actions { width: 100%; max-width: none; justify-content: stretch; }
  .claim-shell .topbar-actions > *,
  .admin-claims-shell .topbar-actions > * { flex: 1 1 auto; }
  .claim-entry-card,
  .claim-summary-card,
  .qr-card,
  .link-card,
  .claim-guide,
  .device-create-card,
  .key-create-card,
  .key-list-card { padding: 20px; }
  .key-details { grid-template-columns: 1fr; }
  .key-item-head { flex-direction: column; }
  .claim-action-row > *,
  .dialog-actions > * { flex-basis: 100%; }
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.login-stage {
  width: min(100%, 460px);
}

.login-panel {
  padding: clamp(28px, 7vw, 44px);
  border-radius: 30px;
  text-align: center;
}

.login-panel .brand-mark {
  margin: 0 auto 25px;
}

.login-panel h1 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 7vw, 2.4rem);
}

.login-copy {
  max-width: 330px;
  margin: 0 auto 28px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.login-form {
  text-align: left;
}

.login-form label {
  display: block;
  margin: 0 0 8px 4px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 650;
}

.login-form input {
  width: 100%;
  height: 52px;
  margin-bottom: 18px;
  padding: 0 18px;
  border: 1px solid rgba(180, 226, 247, 0.18);
  border-radius: 18px;
  background: rgba(1, 15, 28, 0.2);
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(0, 3, 12, 0.13), 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .login-form input {
  background: rgba(255, 255, 255, 0.48);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .login-form input { background: rgba(255, 255, 255, 0.48); }
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 70px;
}

.field-action {
  position: absolute;
  top: 9px;
  right: 9px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--control);
  color: var(--cyan);
  cursor: pointer;
  font-size: 0.72rem;
}

.form-message {
  min-height: 20px;
  margin: -3px 4px 11px;
  color: var(--error);
  font-size: 0.75rem;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 54px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: linear-gradient(105deg, #168fe8, #346ff3 55%, #865ff0);
  color: white;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 14px 30px rgba(40, 108, 240, 0.28);
  cursor: pointer;
  font-weight: 720;
  transition: transform 180ms ease, filter 180ms ease;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 0;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.shake {
  animation: soft-shake 320ms ease;
}

@keyframes soft-shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1024px) {
  .span-8,
  .span-4 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
  .speed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warning-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 620px);
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .topbar {
    align-items: flex-start;
    min-height: 0;
    padding: 15px;
  }

  .topbar-actions {
    max-width: 45%;
  }

  .updated-pill { display: none; }
  .ghost-button { min-height: 32px; padding: 6px 10px; font-size: 0.7rem; }
  .tutorial-button { min-height: 32px; padding: 6px 10px; font-size: 0.7rem; }
  .dashboard-grid { gap: 12px; margin-top: 12px; }
  .hero-card,
  .network-card,
  .latency-card,
  .chart-card { padding: 19px; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-tile { min-height: 78px; padding: 12px; }
  .service-icon { width: 38px; height: 38px; border-radius: 14px; }
  .status-light { top: 12px; right: 12px; }
  .span-6 { grid-column: span 12; }
  canvas { height: 205px; }

  .tutorial-shell { width: min(100% - 24px, 680px); }
  .tutorial-topbar { align-items: stretch; flex-direction: column; }
  .tutorial-topbar > .ghost-button { align-self: flex-end; }
  .tutorial-header-left { align-items: flex-start; flex-direction: column; gap: 13px; }
  .tutorial-title-block { width: 100%; padding: 13px 0 0; border-top: 1px solid var(--glass-border); border-left: 0; }
  .tutorial-tabs { grid-template-columns: 1fr; }
  .tutorial-tab { justify-content: flex-start; min-height: 58px; padding-inline: 18px; }
  .tutorial-steps > li { grid-template-columns: 1fr; gap: 12px; }
  .screenshot-placeholder { min-height: 82px; }
}

@media (max-width: 520px) {
  .brand-mark.compact { width: 40px; height: 40px; }
  .topbar h1 { font-size: 0.96rem; }
  .topbar .eyebrow { font-size: 0.57rem; }
  .topbar-actions { gap: 5px; }
  .ghost-button { padding-inline: 9px; }
  .topbar:not(.tutorial-topbar) { flex-direction: column; gap: 13px; }
  .topbar:not(.tutorial-topbar) .topbar-actions { width: 100%; max-width: none; justify-content: stretch; }
  .topbar:not(.tutorial-topbar) .tutorial-button { flex: 1 1 auto; }
  .hero-heading { align-items: flex-start; }
  .hero-meta { max-width: 90px; }
  .span-3 { grid-column: span 6; }
  .resource-card { min-height: 138px; padding: 16px; }
  .metric-top { display: block; }
  .metric-top strong { display: block; margin-top: 5px; font-size: 1.4rem; }
  .service-tile { align-items: flex-end; min-height: 104px; }
  .service-tile .service-icon { position: absolute; top: 12px; left: 12px; }
  .service-tile p { font-size: 0.66rem; }
  .service-tile strong { font-size: 0.8rem; }
  .listener-row { align-items: stretch; }
  .status-pill { flex: 1 1 100%; }
  .uptime-pill { margin-left: 0; }
  .speed-grid { gap: 8px; }
  .speed-grid article { min-height: 101px; padding: 14px; }
  .speed-grid strong { font-size: 0.9rem; }
  .quota-head { align-items: flex-start; }
  .quota-foot { align-items: flex-start; flex-direction: column; gap: 3px; }
  canvas { height: 188px; }

  .tutorial-main { gap: 12px; margin-top: 12px; }
  .tutorial-intro { align-items: flex-start; flex-direction: column; padding: 20px; }
  .intro-icon { width: 54px; height: 54px; border-radius: 18px; }
  .security-warning,
  .tutorial-panel { padding: 20px; }
  .warning-heading { align-items: flex-start; }
  .warning-list { padding-left: 1.1rem; font-size: 0.76rem; }
  .step-copy { align-items: flex-start; }
  .step-number { width: 38px; height: 38px; border-radius: 13px; }
}

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

  .orb {
    animation: none !important;
    will-change: auto;
  }
}
.claim-mode-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.claim-mode-stack[hidden] { display: none; }
#claim-tools-single[hidden] { display: none; }
.claim-mode-card .qr-frame { margin: 1.25rem 0; }
.claim-mode-card .secret-link-row { margin: 1rem 0; }
