:root {
  --bg: #07111a;
  --bg-2: #0b1924;
  --text: #eef6ff;
  --muted: #a8bfd5;
  --ink: #eef6ff;
  --ink-strong: #f7fbff;
  --line: rgba(124, 168, 205, 0.38);
  --line-strong: rgba(171, 213, 245, 0.72);
  --shadow: 0 36px 92px rgba(0, 0, 0, 0.36);
  --font-body: "Manrope", sans-serif;
  --font-display: "Syne", sans-serif;
  --font-accent: "Space Grotesk", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 16% 18%, rgba(89, 151, 255, 0.12), transparent 25%),
    radial-gradient(circle at 84% 16%, rgba(118, 198, 255, 0.12), transparent 24%),
    linear-gradient(145deg, #02060a 0%, var(--bg) 48%, var(--bg-2) 100%);
  overflow: hidden;
}

body.tiles-mode {
  overflow-y: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(176, 212, 224, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 212, 224, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.26;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(96px);
  pointer-events: none;
}

.ambient-left {
  width: 320px;
  height: 320px;
  left: -100px;
  top: 12vh;
  background: rgba(86, 139, 246, 0.16);
}

.ambient-right {
  width: 380px;
  height: 380px;
  right: -130px;
  bottom: 10vh;
  background: rgba(74, 183, 255, 0.16);
}

.grid-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: radial-gradient(rgba(255, 255, 255, 0.72) 0.45px, transparent 0.45px);
  background-size: 6px 6px;
  mix-blend-mode: soft-light;
}

.fullscreen-shell {
  position: relative;
  z-index: 1;
  height: 100svh;
  padding: 0.45rem;
}

.launcher-grid {
  position: relative;
  --spot-x: 50%;
  --spot-y: 50%;
  height: 100%;
  border: 1px solid rgba(145, 187, 205, 0.28);
  border-radius: 34px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 50%, rgba(132, 182, 201, 0.16), transparent 16%),
    linear-gradient(160deg, rgba(8, 16, 24, 0.94), rgba(8, 17, 24, 0.8));
  box-shadow: var(--shadow);
}

.launcher-grid.is-tile-layout {
  display: grid;
  min-height: calc(100svh - 1rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(188px, auto);
  gap: 0.72rem;
  padding: 0.72rem;
}

.launcher-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(255, 255, 255, 0.12), transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(189, 238, 255, 0.1), transparent 32%);
}

.launcher-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.tool-panel {
  --panel-fill: linear-gradient(155deg, #132c49, #173a63);
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  border: 1.8px solid var(--line);
  transition: filter 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.launcher-grid.is-tile-layout .tool-panel {
  position: relative;
  inset: auto;
  min-height: 188px;
  clip-path: none !important;
  border-radius: 24px;
}

.tool-panel:hover,
.tool-panel:focus-visible {
  filter: saturate(1.05) brightness(1.02);
  border-color: var(--line-strong);
}

.tool-panel:focus-visible {
  outline: 2px solid rgba(160, 214, 232, 0.56);
  outline-offset: 3px;
}

.tool-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 44%, rgba(16, 28, 34, 0.08)),
    var(--panel-fill);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 0 0 2px rgba(23, 45, 72, 0.28);
}

.tool-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(126, 196, 255, 0.12), transparent 38%),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.08), transparent 30%);
  pointer-events: none;
}

.tool-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.25rem;
  width: min(43vw, 680px);
  min-height: clamp(150px, 19vh, 210px);
  max-width: calc(100% - 2rem);
  transform: translate3d(-50%, -50%, 0);
  padding: 1rem 1.4rem 1.05rem;
  border-radius: 34px;
  border: 1.8px solid rgba(126, 174, 194, 0.34);
  background:
    radial-gradient(circle at 50% 0%, rgba(130, 209, 255, 0.11), transparent 46%),
    linear-gradient(160deg, rgba(10, 21, 33, 0.98), rgba(11, 24, 37, 0.96));
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  text-align: center;
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.launcher-grid.is-tile-layout .tool-core {
  position: relative;
  left: auto;
  top: auto;
  width: auto;
  max-width: none;
  min-height: 30svh;
  transform: none;
  grid-column: 1 / -1;
  text-align: left;
  justify-items: start;
}

.tool-core::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.tool-core h1 {
  margin: 0;
  font-family: var(--font-display);
  max-width: 100%;
  font-size: clamp(2rem, 3.7vw, 3.8rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.09em;
  text-shadow: 0 4px 20px rgba(10, 23, 33, 0.16);
  white-space: nowrap;
}

.core-copy {
  margin: 0;
  max-width: 12ch;
  color: var(--muted);
  font-family: var(--font-accent);
  font-size: clamp(0.78rem, 0.82vw, 0.9rem);
  font-weight: 500;
  line-height: 1.3;
}

.core-extra-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.launcher-grid.is-tile-layout .core-extra-links {
  justify-content: flex-start;
}

.core-extra-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(166, 212, 238, 0.18);
  background: rgba(236, 246, 255, 0.08);
  color: var(--ink-strong);
  font-family: var(--font-accent);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.core-extra-link:hover,
.core-extra-link:focus-visible {
  border-color: rgba(171, 213, 245, 0.42);
  background: rgba(236, 246, 255, 0.14);
}

.edge-content {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.12rem;
  width: min(16vw, 220px);
  max-width: 220px;
  transform: translate(-50%, -50%);
  transform-origin: center;
  text-align: center;
  pointer-events: none;
}

.launcher-grid.is-tile-layout .edge-content {
  left: 0.95rem !important;
  right: 0.95rem !important;
  top: auto !important;
  bottom: 0.95rem !important;
  width: auto;
  max-width: none;
  transform: none !important;
  justify-content: end;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.panel-title {
  font-family: var(--font-accent);
  font-size: clamp(0.82rem, 0.84vw, 0.98rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.035em;
  color: var(--ink-strong);
  text-shadow: 0 2px 10px rgba(4, 11, 20, 0.35);
  text-wrap: balance;
}

.launcher-grid.is-tile-layout .panel-title {
  font-size: clamp(0.82rem, 1vw, 0.98rem);
}

.mini-preview {
  position: relative;
  width: clamp(62px, 4.8vw, 86px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  border: 1.5px solid rgba(27, 43, 58, 0.22);
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 14px 24px rgba(30, 42, 48, 0.16);
  flex: 0 0 auto;
}

.launcher-grid.is-tile-layout .mini-preview {
  width: clamp(54px, 16vw, 88px);
}

.mini-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 34%);
  pointer-events: none;
}

.mini-preview iframe {
  width: 1280px;
  height: 900px;
  border: 0;
  pointer-events: none;
  transform: scale(0.067);
  transform-origin: top left;
  filter: saturate(0.9) contrast(0.97);
}

.preview-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(1.04) contrast(1.02);
}

.slot-a { --panel-fill: linear-gradient(155deg, #276399, #235b8d); clip-path: polygon(50% 50%, 0 0, 37% 0); }
.slot-b { --panel-fill: linear-gradient(155deg, #255c8f, #225584); clip-path: polygon(50% 50%, 37% 0, 63% 0); }
.slot-c { --panel-fill: linear-gradient(155deg, #235684, #204f7a); clip-path: polygon(50% 50%, 63% 0, 100% 0); }
.slot-d { --panel-fill: linear-gradient(155deg, #214f7a, #1e4970); clip-path: polygon(50% 50%, 100% 0, 100% 25%); }
.slot-e { --panel-fill: linear-gradient(155deg, #1f4970, #1c4367); clip-path: polygon(50% 50%, 100% 25%, 100% 50%); }
.slot-f { --panel-fill: linear-gradient(155deg, #1d4266, #1a3c5d); clip-path: polygon(50% 50%, 100% 50%, 100% 75%); }
.slot-n { --panel-fill: linear-gradient(155deg, #1b3c5c, #183653); clip-path: polygon(50% 50%, 100% 75%, 100% 100%); }
.slot-g { --panel-fill: linear-gradient(155deg, #193552, #172f49); clip-path: polygon(50% 50%, 100% 100%, 66% 100%); }
.slot-h { --panel-fill: linear-gradient(155deg, #172f48, #152a40); clip-path: polygon(50% 48%, 66% 100%, 34% 100%); }
.slot-i { --panel-fill: linear-gradient(155deg, #15283e, #14263a); clip-path: polygon(50% 50%, 34% 100%, 0 100%); }
.slot-j { --panel-fill: linear-gradient(155deg, #14263b, #132438); clip-path: polygon(50% 50%, 0 100%, 0 75%); }
.slot-k { --panel-fill: linear-gradient(155deg, #132438, #122337); clip-path: polygon(50% 50%, 0 75%, 0 50%); }
.slot-l { --panel-fill: linear-gradient(155deg, #122337, #122236); clip-path: polygon(50% 50%, 0 50%, 0 25%); }
.slot-m { --panel-fill: linear-gradient(155deg, #122236, #102032); clip-path: polygon(50% 50%, 0 25%, 0 0); }

.slot-a .edge-content {
  top: 16.7%;
  left: 28.8%;
}

.slot-b .edge-content {
  top: 16.7%;
  left: 49.7%;
}

.slot-c .edge-content {
  top: 16.7%;
  left: 71.5%;
}

.slot-d .edge-content {
  top: 25%;
  left: 83.33%;
}

.slot-e .edge-content {
  top: 41.67%;
  left: 83.33%;
}

.slot-f .edge-content {
  top: 58.33%;
  left: 83.33%;
}

.slot-n .edge-content {
  top: 75%;
  left: 83.33%;
}

.slot-g .edge-content {
  top: 83.33%;
  left: 72.33%;
}

.slot-h .edge-content {
  top: 80%;
  left: 50.33%;
}

.slot-i .edge-content {
  top: 83.33%;
  left: 28%;
}

.slot-j .edge-content {
  top: 75%;
  left: 16.67%;
}

.slot-k .edge-content {
  top: 58.33%;
  left: 16.67%;
}

.slot-l .edge-content {
  top: 41.67%;
  left: 16.67%;
}

.slot-m .edge-content {
  top: 25%;
  left: 16.67%;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1200px) {
  .tool-core {
    width: min(46vw, 560px);
  }

  .edge-content {
    width: min(17vw, 188px);
    max-width: 188px;
  }

  .mini-preview {
    width: clamp(54px, 4vw, 74px);
  }
}

@media (orientation: portrait), (max-aspect-ratio: 10 / 11) {
  body,
  body.tiles-mode {
    overflow-y: auto;
  }

  .fullscreen-shell,
  body.tiles-mode .fullscreen-shell {
    height: auto;
    min-height: 100svh;
  }

  .launcher-grid,
  .launcher-grid.is-tile-layout {
    display: grid;
    min-height: calc(100svh - 1rem);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(170px, auto);
    gap: 0.6rem;
    padding: 0.6rem;
  }

  .tool-panel,
  .launcher-grid.is-tile-layout .tool-panel {
    position: relative;
    inset: auto;
    clip-path: none !important;
    border-radius: 22px;
  }

  .tool-core,
  .launcher-grid.is-tile-layout .tool-core {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    max-width: none;
    min-height: 30svh;
    transform: none;
    grid-column: 1 / -1;
    text-align: left;
    justify-items: start;
  }

  .core-copy {
    margin-left: 0;
    max-width: 22ch;
  }

  .edge-content,
  .launcher-grid.is-tile-layout .edge-content {
    left: 0.8rem !important;
    right: 0.8rem !important;
    top: auto !important;
    bottom: 0.8rem !important;
    transform: none !important;
    flex-direction: column !important;
    justify-content: end;
    align-items: center;
    gap: 0.12rem;
    text-align: center;
  }

  .panel-title,
  .launcher-grid.is-tile-layout .panel-title {
    writing-mode: initial !important;
    transform: none !important;
  }
}

@media (orientation: portrait) and (max-width: 560px), (max-aspect-ratio: 2 / 3) {
  .fullscreen-shell,
  body.tiles-mode .fullscreen-shell {
    padding: 0.5rem;
  }

  .launcher-grid,
  .launcher-grid.is-tile-layout {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.55rem;
    border-radius: 24px;
  }

  .tool-panel,
  .tool-core,
  .launcher-grid.is-tile-layout .tool-panel,
  .launcher-grid.is-tile-layout .tool-core {
    border-radius: 22px;
  }

  .tool-core,
  .launcher-grid.is-tile-layout .tool-core {
    min-height: 34svh;
  }

  .launcher-grid.is-tile-layout .edge-content {
    align-items: center;
  }

  .launcher-grid.is-tile-layout .panel-title {
    max-width: none;
  }
}
