:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #aeb8c7;
  --line: rgba(255, 255, 255, 0.18);
  --panel: rgba(12, 18, 32, 0.72);
  --panel-strong: rgba(18, 28, 48, 0.9);
  --cyan: #54e7ff;
  --mint: #67ffbd;
  --rose: #ff6c9d;
  --amber: #ffcf5a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(84, 231, 255, 0.2), transparent 34%),
    radial-gradient(circle at 84% 18%, rgba(255, 108, 157, 0.18), transparent 30%),
    linear-gradient(135deg, #050711 0%, #101826 48%, #071c21 100%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

#spaceScene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 46px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(8, 13, 25, 0.72);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(22px);
}

.brand-mark,
.nav-actions,
.admin-tools,
.hero-stats {
  display: flex;
  align-items: center;
}

.brand-mark {
  gap: 12px;
  min-width: 0;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark strong {
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.brand-mark small,
.eyebrow,
.hero-text,
.panel-head p,
.empty-state p {
  color: var(--muted);
}

.brand-orbit {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(84, 231, 255, 0.95), rgba(103, 255, 189, 0.7)),
    radial-gradient(circle at 70% 25%, white, transparent 18%);
  box-shadow: 0 12px 28px rgba(84, 231, 255, 0.35), inset -8px -8px 18px rgba(3, 20, 35, 0.35);
  transform: perspective(420px) rotateX(18deg) rotateY(-24deg);
}

.nav-actions {
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-pill,
.ghost-button,
.admin-shortcut,
.count-pill {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.nav-pill {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.nav-pill-strong,
.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--cyan), var(--mint));
  color: #041016;
  box-shadow: 0 14px 34px rgba(84, 231, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.view {
  padding-top: 42px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(300px, 0.82fr);
  align-items: center;
  gap: min(7vw, 72px);
  min-height: calc(100vh - 152px);
  perspective: 1200px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(3.1rem, 8vw, 6.7rem);
  line-height: 0.93;
  letter-spacing: 0;
  text-shadow: 0 20px 42px rgba(0, 0, 0, 0.4);
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.05;
}

h3 {
  margin: 0;
}

.hero-text {
  max-width: 640px;
  margin: 24px 0 0;
  font-size: clamp(1.04rem, 2vw, 1.28rem);
  line-height: 1.7;
}

.hero-stats {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-stats span {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.iphone-stage {
  position: relative;
  display: grid;
  min-height: 560px;
  place-items: center;
  transform-style: preserve-3d;
}

.phone-3d {
  position: relative;
  width: min(300px, 72vw);
  aspect-ratio: 0.49;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 46px;
  background: linear-gradient(145deg, #f8fbff, #8ca1bc 38%, #172134 42%, #060910 100%);
  box-shadow:
    28px 34px 80px rgba(0, 0, 0, 0.52),
    -12px -12px 36px rgba(84, 231, 255, 0.16),
    inset 10px 0 22px rgba(255, 255, 255, 0.28),
    inset -16px -12px 30px rgba(0, 0, 0, 0.55);
  transform: rotateX(10deg) rotateY(-19deg) rotateZ(3deg);
  transform-style: preserve-3d;
  animation: phoneFloat 7s ease-in-out infinite;
}

.phone-3d::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 38px;
  background: #020510;
  transform: translateZ(24px);
}

.phone-screen {
  position: absolute;
  inset: 17px;
  z-index: 1;
  overflow: hidden;
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 22%, rgba(103, 255, 189, 0.42), transparent 24%),
    radial-gradient(circle at 78% 15%, rgba(255, 207, 90, 0.36), transparent 24%),
    linear-gradient(160deg, #082a3d, #07101f 48%, #0c0918);
  transform: translateZ(32px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.dynamic-island {
  width: 34%;
  height: 25px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: #02030a;
}

.mini-brand {
  margin: 54px 24px 22px;
  font-size: 1.35rem;
  font-weight: 800;
}

.mini-stack {
  display: grid;
  gap: 14px;
  margin: 0 22px;
}

.mini-stack span {
  height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.mini-dock {
  position: absolute;
  right: 20px;
  bottom: 24px;
  left: 20px;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(16px);
}

.mini-dock i {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--rose));
}

.glass-ring {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  box-shadow: inset 0 0 38px rgba(255, 255, 255, 0.09), 0 0 50px rgba(84, 231, 255, 0.14);
  transform-style: preserve-3d;
}

.ring-one {
  width: 420px;
  height: 420px;
  transform: rotateX(72deg) rotateZ(15deg) translateZ(-50px);
}

.ring-two {
  width: 260px;
  height: 260px;
  transform: rotateX(78deg) rotateZ(-22deg) translateZ(90px);
}

.link-zone,
.dashboard,
.admin-header {
  margin-top: 28px;
}

.section-heading,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.compact {
  margin-bottom: 20px;
}

.admin-shortcut,
.ghost-button,
.primary-button,
.icon-button {
  min-height: 46px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.admin-shortcut,
.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}

.primary-button {
  min-width: 150px;
  border-radius: 16px;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 54px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-shortcut:hover,
.ghost-button:hover,
.primary-button:hover,
.icon-button:hover,
.link-card:hover {
  transform: translateY(-3px);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.link-card {
  position: relative;
  min-height: 150px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: perspective(900px) rotateX(0deg) rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 220ms ease, border-color 220ms ease;
}

.link-card::before {
  content: "";
  position: absolute;
  inset: -55% auto auto -22%;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(84, 231, 255, 0.45), transparent 62%);
}

.link-card strong,
.link-card span {
  position: relative;
  z-index: 1;
  display: block;
}

.link-card strong {
  min-height: 64px;
  font-size: 1.32rem;
  line-height: 1.18;
}

.link-card span {
  margin-top: 24px;
  color: var(--mint);
  font-weight: 800;
}

.panel-3d {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(26px);
}

.login-card,
.editor-panel,
.list-panel,
.settings-card {
  padding: clamp(20px, 4vw, 30px);
}

.login-card {
  width: min(480px, 100%);
  margin: 34px auto 0;
  transform: perspective(900px) rotateX(4deg);
}

.panel-head {
  display: flex;
  gap: 15px;
  margin-bottom: 22px;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head p {
  margin-top: 5px;
}

.lock-cube {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--rose), var(--amber));
  box-shadow: 0 14px 34px rgba(255, 108, 157, 0.25), inset -8px -8px 16px rgba(82, 28, 45, 0.32);
  transform: rotateX(18deg) rotateY(-28deg);
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #dce7f3;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  outline: 0;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

input:focus {
  border-color: rgba(84, 231, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(84, 231, 255, 0.14);
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--amber);
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 22px;
  align-items: start;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.admin-row strong,
.admin-row small {
  display: block;
}

.admin-row small {
  margin-top: 5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.tiny-button {
  min-width: 44px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.danger {
  color: #ffd4df;
  border-color: rgba(255, 108, 157, 0.38);
  background: rgba(255, 108, 157, 0.14);
}

.count-pill {
  padding: 10px 12px;
  color: var(--mint);
}

.empty-state {
  display: grid;
  gap: 10px;
  place-items: center;
  margin-top: 24px;
  padding: 34px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.empty-state.small {
  padding: 24px;
}

.empty-state p {
  margin: 0;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: rgba(103, 255, 189, 0.16);
  color: var(--mint);
  font-size: 2rem;
  font-weight: 800;
}

.settings-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.settings-dialog::backdrop {
  background: rgba(1, 4, 10, 0.72);
  backdrop-filter: blur(8px);
}

.settings-card {
  background: var(--panel-strong);
}

@keyframes phoneFloat {
  0%,
  100% {
    transform: rotateX(10deg) rotateY(-19deg) rotateZ(3deg) translateY(0);
  }
  50% {
    transform: rotateX(13deg) rotateY(-12deg) rotateZ(-2deg) translateY(-18px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 22px, 680px);
  }

  .topbar {
    border-radius: 22px;
  }

  .hero-grid,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: 20px;
    min-height: auto;
  }

  .iphone-stage {
    min-height: 420px;
  }

  .ring-one {
    width: 310px;
    height: 310px;
  }

  .ring-two {
    width: 210px;
    height: 210px;
  }

  .section-heading,
  .admin-header,
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: stretch;
  }

  .tiny-button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .brand-mark small {
    display: none;
  }

  .nav-pill {
    padding: 10px 11px;
  }

  h1 {
    font-size: clamp(2.7rem, 15vw, 4.1rem);
  }

  .iphone-stage {
    min-height: 380px;
  }

  .phone-3d {
    width: min(245px, 78vw);
  }
}
