:root {
  --bg: #050716;
  --bg-soft: #090b1e;
  --text-main: #f5f7ff;
  --text-dim: #7b82a8;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 10% 0, #182042 0, #050716 40%, #000 100%);
  color: var(--text-main);
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}



/* SCREEN WRAPPER  */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.screen-hidden {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

/* HOME SCREEN */
.home-shell {
  max-width: 920px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2.2rem;
  align-items: center;
  padding: 2.1rem 2.3rem;
  border-radius: 32px;
  background: radial-gradient(circle at 0 0, #151a3a 0, #050716 55%);
  border: 1px solid rgba(0, 245, 255, 0.36);
  box-shadow:
    0 0 60px rgba(0, 245, 255, 0.5),
    0 0 130px rgba(255, 63, 142, 0.35);
  position: relative;
}

.home-left {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.home-logo-orb {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, #00f5ff 0, #005cff 45%, #050716 90%);
  box-shadow: 0 0 32px rgba(0, 245, 255, 0.9);
  position: relative;
}

.home-logo-orb::before,
.home-logo-orb::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  border: 2px solid rgba(0, 5, 32, 0.9);
}

.home-logo-orb::before {
  inset: 8px;
}

.home-logo-orb::after {
  inset: 3px;
  border-style: dashed;
  border-color: rgba(0, 245, 255, 0.8);
  animation: spin 10s linear infinite;
}

.home-heading-block {
  max-width: 340px;
}

.home-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #9ef8ff;
  margin-bottom: 0.2rem;
}

.home-game-title {
  font-size: 1.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.home-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.home-right {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: stretch;
}

.home-menu-card {
  border-radius: 22px;
  padding: 1.1rem 1.2rem 1.2rem;
  background: radial-gradient(circle at 0 0, #10142b 0, #050716 60%);
  border: 1px solid rgba(0, 245, 255, 0.25);
  box-shadow: 0 0 26px rgba(0, 245, 255, 0.25);
}

.home-menu-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.home-menu-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
}

.home-menu-btn.primary {
  background: radial-gradient(circle at 0 0, rgba(0, 245, 255, 0.6), transparent 60%);
  box-shadow:
    0 0 20px rgba(0, 245, 255, 0.8),
    0 0 38px rgba(0, 245, 255, 0.5);
}

.home-build-meta {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(124, 134, 188, 0.85);
  padding-left: 0.2rem;
}

@media (max-width: 780px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.5rem 1.6rem;
  }
  .home-left {
    flex-direction: row;
  }
}

/* HOME MODALS */
.home-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.home-modal.home-modal-open {
  pointer-events: auto;
  opacity: 1;
}

.home-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.95));
  backdrop-filter: blur(10px);
}

.home-modal-card {
  position: relative;
  max-width: 420px;
  width: 90%;
  border-radius: 24px;
  padding: 1.2rem 1.3rem 1.3rem;
  background: radial-gradient(circle at 0 0, #151832 0, #050716 60%);
  border: 1px solid rgba(0, 245, 255, 0.35);
  box-shadow:
    0 0 32px rgba(0, 245, 255, 0.6),
    0 0 60px rgba(255, 63, 142, 0.35);
  z-index: 11;
}

.home-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.home-modal-header h2 {
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.home-close-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.15rem 0.3rem;
}

.home-modal-list {
  list-style: none;
  font-size: 0.82rem;
  color: #d3d8ff;
  line-height: 1.6;
  margin-bottom: 0.6rem;
}

.home-modal-list li::before {
  content: "• ";
  color: #00f5ff;
}

.home-modal-footer {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.home-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #dde3ff;
  margin-bottom: 0.55rem;
}

.home-setting-row span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
}

.home-setting-pills {
  display: flex;
  gap: 0.25rem;
}

.pill-mini {
  font-size: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(102, 119, 190, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.7;
}

.pill-mini.pill-on {
  border-color: rgba(0, 245, 255, 0.9);
  opacity: 1;
}

.home-slider-shell {
  width: 120px;
}

.home-slider-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 245, 255, 0.9), rgba(255, 63, 142, 0.7));
  position: relative;
  overflow: hidden;
}

.home-slider-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #050716;
  background: #f5f7ff;
  top: 50%;
  transform: translate(70px, -50%);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.85);
}

/* MAIN GAME SHELL */
.app-shell {
  width: 100%;
  max-width: 920px;
  background: linear-gradient(145deg, #050716 0%, #050712 45%, #050716 100%);
  border-radius: 32px;
  border: 1px solid rgba(160, 243, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(0, 255, 255, 0.25);
  padding: 1.25rem 1.75rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease-out, border-color 0.3s ease-out;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(0, 255, 255, 0.25), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(255, 63, 142, 0.18), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.3;
  pointer-events: none;
}

.app-inner {
  position: relative;
  z-index: 1;
}

/* GAME HEADER */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #00f5ff 0, #0056ff 45%, #050716 80%);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.7);
  position: relative;
  overflow: hidden;
}

.brand-icon::before,
.brand-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 2px solid rgba(5, 7, 22, 0.8);
}

.brand-icon::before {
  inset: 7px;
}

.brand-icon::after {
  inset: 3px;
  border-style: dashed;
  border-color: rgba(0, 245, 255, 0.75);
  animation: spin 8s linear infinite;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-text span {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.18em;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.45);
  color: #d7ffd7;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: radial-gradient(circle at 0 0, rgba(0, 245, 255, 0.25), transparent 65%);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.45);
}

.pill small {
  opacity: 0.6;
}

.stat {
  min-width: 70px;
  text-align: right;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.16em;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.level-select-shell {
  max-width: 640px;
  width: 100%;
  padding: 1.2rem 1.4rem;
  border-radius: 24px;
  background: radial-gradient(circle at 0 0, #151832 0, #050716 60%);
  border: 1px solid rgba(0, 245, 255, 0.4);
  box-shadow:
    0 0 40px rgba(0, 245, 255, 0.4),
    0 0 80px rgba(255, 63, 142, 0.35);
}

.level-select-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.level-select-header h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #9ef8ff;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.7rem;
}

.level-card {
  border-radius: 18px;
  padding: 0.5rem 0.55rem 0.6rem;
  background: radial-gradient(circle at 0 0, #111827 0, #020617 70%);
  border: 1px solid rgba(51, 65, 85, 0.9);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.level-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 245, 255, 0.9);
  box-shadow:
    0 0 18px rgba(0, 245, 255, 0.6),
    0 0 30px rgba(59, 130, 246, 0.45);
}

.level-card.locked {
  cursor: default;
  opacity: 0.4;
  border-style: dashed;
}

.level-number {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e5e7eb;
  margin-bottom: 0.2rem;
}

.level-meta {
  font-size: 0.7rem;
  color: #9ca3af;
}

.level-stars {
  margin-top: 0.25rem;
  font-size: 0.7rem;
}

.star {
  color: #374151;
  text-shadow: none;
}

.star.filled {
  color: #facc15;
  text-shadow:
    0 0 6px rgba(250, 204, 21, 0.9),
    0 0 16px rgba(251, 191, 36, 0.7);
}

.achievements-card {
  max-width: 520px;
}

.achievement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.55rem;
  border-radius: 16px;
  background: radial-gradient(circle at 0 0, #020617 0, #020617 70%);
  border: 1px solid rgba(51, 65, 85, 0.9);
  opacity: 0.45;
  position: relative;
  overflow: hidden;
}

.achievement.unlocked {
  opacity: 1;
  border-color: rgba(0, 245, 255, 0.95);
  box-shadow:
    0 0 16px rgba(0, 245, 255, 0.7),
    0 0 30px rgba(59, 130, 246, 0.6);
}

.achievement.unlocked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(0, 245, 255, 0.25), transparent 60%);
  mix-blend-mode: screen;
}

.achievement-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #00f5ff 0, #0057ff 50%, #020617 90%);
  box-shadow:
    0 0 12px rgba(0, 245, 255, 0.9),
    0 0 20px rgba(59, 130, 246, 0.7);
  font-size: 1.1rem;
}

.achievement-text h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.achievement-text p {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* GAME LAYOUT */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1.4rem;
}

@media (max-width: 780px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .hud-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .hud-stats {
    justify-content: flex-start;
  }
}

/* GRID CARD */
.grid-card {
  background: radial-gradient(circle at 0 0, #15182f 0, #050716 55%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(0, 245, 255, 0.18);
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.12);
  padding: 1.1rem 1.1rem 1.25rem;
  position: relative;
}

.grid-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), transparent 50%, rgba(255, 63, 142, 0.2));
  opacity: 0.08;
  pointer-events: none;
}

.grid-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}

.grid-card-header h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.pattern-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pattern-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.45);
  color: #bdf7ff;
  background: radial-gradient(circle at 0 0, rgba(0, 245, 255, 0.22), transparent 65%);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.pattern-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #00f5ff;
  box-shadow: 0 0 8px rgba(0, 245, 255, 0.7);
}

/* GRID */
.grid-wrapper {
  background: radial-gradient(circle at 20% 0, #161a36 0, #070917 45%, #03040c 100%);
  padding: 0.8rem;
  border-radius: 22px;
  border: 1px solid rgba(0, 245, 255, 0.12);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.grid-wrapper.fade-out {
  opacity: 0;
  transform: scale(0.92);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  aspect-ratio: 1 / 1;
}

.tile {
  position: relative;
  border-radius: 16px;
  background: radial-gradient(circle at top, #020617 0%, #020617 80%);
  border: 1px solid rgba(15, 23, 42, 0.95);
  box-shadow:
    inset 0 0 12px rgba(15, 23, 42, 1),
    0 0 0 1px rgba(15, 23, 42, 0.8);
  cursor: pointer;
  padding: 0;
  outline: none;
}

.tile:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(0, 245, 255, 0.35),
    0 0 16px rgba(0, 245, 255, 0.18);
}

.tile::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: inherit;
  border: 2px solid rgba(32, 38, 82, 0.9);
  transition: inset 0.18s ease-out, border-color 0.18s ease-out;
}

.tile-ring {
  position: absolute;
  inset: 6px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, #020617 0%, #020617 60%);
  box-shadow:
    inset 0 0 10px rgba(15, 23, 42, 1),
    0 0 16px rgba(15, 23, 42, 1);
}

.tile-notch {
  position: absolute;
  width: 6px;
  height: 26px;
  border-radius: 999px;
  background: #00f5ff;
  top: 18%;
  left: 50%;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(90deg);
  box-shadow:
    0 0 10px rgba(0, 245, 255, 0.9),
    0 0 24px rgba(0, 245, 255, 0.7);
}

.tile.inactive {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.tile.inactive::before {
  inset: 22%;
  border-color: rgba(49, 56, 90, 0.9);
}

.tile.inactive .tile-ring {
  border-radius: 999px;
  border: 2px solid rgba(30, 64, 175, 0.3);
  background: radial-gradient(circle at 50% 50%, #020617 0%, #020617 65%);
  box-shadow:
    0 0 10px rgba(15, 23, 42, 0.9),
    inset 0 0 6px rgba(15, 23, 42, 1);
}

.tile.inactive .tile-notch {
  opacity: 0;
}

.tile.inactive:hover {
  box-shadow: none;
  transform: none;
}

.tile.movable.active-blue .tile-ring {
  border-radius: 16px;
  box-shadow:
    0 0 10px rgba(23, 233, 205, 0.3),
    0 0 26px rgba(43, 183, 243, 0.5),
    inset 0 0 10px rgba(6, 36, 106, 0.9);
}

.tile.movable.active-blue .tile-notch {
  background: #00f5ff;
  box-shadow:
    0 0 10px rgba(0, 245, 255, 0.75),
    0 0 24px rgba(0, 245, 255, 0.6);
}

.tile.active-blue .tile-ring,
.tile.active-green .tile-ring,
.tile.active-pink .tile-ring {
  background: radial-gradient(circle at 50% 50%, #111827 0%, #020617 60%);
  border-radius: 999px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

.tile .tile-notch {
  position: absolute;
  width: 14px;          
  height: 70%;           
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    #ff8a7a 0%,
    #ff5240 40%,
    #c62d24 100%
  );                   
  box-shadow:
    0 0 4px rgba(0, 0, 0, 0.8),
    inset 0 0 3px rgba(0, 0, 0, 0.7);
}

.tile .tile-notch {
  display: none;
}

.tile.active-green .tile-notch,
.tile.active-pink .tile-notch {
  display: block;
}

.tile.active-green .tile-ring {
  background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 60%);
  box-shadow:
    0 0 16px rgba(34, 197, 94, 0.75),
    0 0 34px rgba(45, 212, 191, 0.65),
    inset 0 0 10px rgba(15, 23, 42, 0.9);
}

.tile.active-green .tile-notch {
  background: #7bff6a;
  box-shadow:
    0 0 10px rgba(123, 255, 106, 0.8),
    0 0 24px rgba(123, 255, 106, 0.6);
}

.tile.active-green.solved .tile-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: radial-gradient(circle, #bbf7d0 0%, #22c55e 38%, transparent 80%);
  box-shadow:
    0 0 16px rgba(34, 197, 94, 1),
    0 0 32px rgba(16, 185, 129, 0.9);
}

.tile.active-pink {
  background: radial-gradient(circle at 30% 10%, #251329 0, #190614 40%, #050716 120%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 63, 142, 0.5),
    0 0 20px rgba(255, 63, 142, 0.7);
}

.tile.active-pink .tile-ring {
  background: radial-gradient(circle at 50% 50%, #111827 0%, #020617 60%);
  box-shadow:
    0 0 16px rgba(236, 72, 153, 0.8),
    0 0 34px rgba(248, 113, 113, 0.7),
    inset 0 0 10px rgba(15, 23, 42, 0.9);
}

.tile.active-pink .tile-notch {
  background: #ff3f8e;
  box-shadow:
    0 0 12px rgba(255, 63, 142, 0.9),
    0 0 28px rgba(255, 63, 142, 0.7);
}

.tile.active-pink.solved .tile-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: radial-gradient(circle, #f9a8d4 0%, #ec4899 38%, transparent 80%);
  box-shadow:
    0 0 16px rgba(236, 72, 153, 1),
    0 0 32px rgba(244, 63, 94, 0.9);
}

.tile.solved {
  animation: solvedPulse 1.3s ease-out forwards;
}

.tile.solved .tile-notch {
  position: relative;
}

.tile.solved .tile-notch::after {
  content: "";
  position: absolute;
  inset: 3px;             
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    #bbf7d0 0%,
    #22c55e 40%,
    #16a34a 100%
  );
  box-shadow:
    0 0 6px rgba(16, 185, 129, 0.9),
    0 0 18px rgba(52, 211, 153, 0.7);
}

.tile.solved .pipe-straight,
.tile.solved .pipe-curve::before,
.tile.solved .pipe-curve::after {
  background: var(--solved-color);
  filter: brightness(1.6);
  box-shadow:
    0 0 12px var(--solved-color),
    0 0 28px var(--solved-color),
}

.tile.path-glow .tile-ring {
  box-shadow:
    0 0 14px var(--solved-color),
    0 0 34px var(--solved-color),
    inset 0 0 10px rgba(0, 0, 0, 0.4);
}

.pipe-straight {
  position: absolute;
  width: 20%;
  height: 70%;
  background: var(--pipe-color);   
  border-radius: 6px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    inset 0 0 4px rgba(0, 0, 0, 0.6),
    0 0 2px rgba(15, 23, 42, 0.7);
  display: none;
}

.pipe-curve {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  box-sizing: border-box;
  display: none; 
}

.pipe-curve::before,
.pipe-curve::after {
  content: "";
  position: absolute;
  background: var(--pipe-color);
  border-radius: 6px;
  box-shadow:
    inset 0 0 4px rgba(0, 0, 0, 0.65),
    0 0 2px rgba(15, 23, 42, 0.7),
    0 0 10px rgba(255, 110, 138, 0.7),
    0 0 20px rgba(255, 110, 138, 0.5);
}

.pipe-curve::before {
  width: 22%;
  height: 50%;
  left: 39%;
  top: 0;
}

.pipe-curve::after {
  width: 50%;
  height: 22%;
  left: 50%;
  top: 39%;
}

/* GRID FOOTER CONTROLS */
.grid-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.btn-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn {
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.55);
  background: radial-gradient(circle at 0 0, rgba(0, 245, 255, 0.35), transparent 60%);
  color: #e9fbff;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn span {
  font-weight: 500;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 30%);
  transform: translateX(-120%);
  transition: transform 0.35s ease-out;
}

.btn:hover::after {
  transform: translateX(60%);
}

.btn-secondary {
  border-color: rgba(92, 102, 162, 0.9);
  background: radial-gradient(circle at 0 0, rgba(92, 102, 162, 0.4), transparent 65%);
  color: #d3d7ff;
}

.btn-danger {
  border-color: rgba(255, 63, 142, 0.7);
  background: radial-gradient(circle at 0 0, rgba(255, 63, 142, 0.45), transparent 65%);
  color: #ffe7f1;
}

.hint-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.8;
}

/* SIDEBAR */
.side-panel {
  background: radial-gradient(circle at 0 0, #151832 0, #050716 55%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(40, 53, 96, 0.85);
  padding: 1rem 1.1rem 1.15rem;
  position: relative;
  overflow: hidden;
}

.side-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), transparent 40%, rgba(255, 63, 142, 0.12));
  opacity: 0.4;
  pointer-events: none;
}

.side-panel-inner {
  position: relative;
  z-index: 1;
}

.tagline-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #9ef8ff;
  margin-bottom: 0.5rem;
}

.side-panel h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}

.side-panel p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.feature-list {
  margin: 0.85rem 0 0.95rem;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.83rem;
  color: #ced3ff;
  margin-bottom: 0.4rem;
}

.feature-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #00f5ff;
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.9);
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  background: radial-gradient(circle at 0 0, rgba(255, 63, 142, 0.4), transparent 70%);
  border: 1px solid rgba(255, 63, 142, 0.7);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  color: #ffe9f5;
}

.timer-chip-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  opacity: 0.8;
}

.timer-display {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.88rem;
}

.footer-note {
  margin-top: 0.8rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(125, 134, 188, 0.9);
}

.footer-note span {
  color: rgba(189, 247, 255, 0.95);
}

/* THEMES */

body.theme-easy .app-shell {
  border-color: rgba(0, 245, 255, 0.4);
  box-shadow: 0 0 45px rgba(0, 245, 255, 0.35);
}

body.theme-medium .app-shell {
  border-color: rgba(123, 255, 106, 0.35);
  box-shadow: 0 0 45px rgba(123, 255, 106, 0.3);
}

body.theme-hard .app-shell {
  border-color: rgba(255, 63, 142, 0.4);
  box-shadow: 0 0 45px rgba(255, 63, 142, 0.35);
}

body.theme-neon {
  --bg: #050716;
  --bg-soft: #090b1e;
  --text-main: #f5f7ff;
  --text-dim: #7b82a8;
  --pipe-color: #ff6b5a;
}

body.theme-vapor {
  --bg: #120323;
  --bg-soft: #1a1034;
  --text-main: #ffeafc;
  --text-dim: #c084fc;
  --pipe-color: #ff7ad9;
}

body.theme-matrix {
  --bg: #000000;
  --bg-soft: #020712;
  --text-main: #e5ffe5;
  --text-dim: #4ade80;
  --pipe-color: #22c55e;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes solvedPulse {
  0% {
    box-shadow:
      inset 0 0 0 1px rgba(123, 255, 106, 0.5),
      0 0 10px rgba(123, 255, 106, 0.6);
  }
  70% {
    box-shadow:
      inset 0 0 0 1px rgba(123, 255, 106, 0.8),
      0 0 30px rgba(123, 255, 106, 1);
  }
  100% {
    box-shadow:
      inset 0 0 0 1px rgba(123, 255, 106, 0.8),
      0 0 16px rgba(123, 255, 106, 0.7);
  }
}

/* flowing neon pulse along solved path */
.tile.path-glow .tile-ring {
  border-color: rgba(0, 245, 255, 1);
  box-shadow:
    0 0 16px rgba(0, 245, 255, 0.9),
    0 0 38px rgba(0, 245, 255, 0.7);
}

.tile.path-glow .tile-notch {
  background: #00f5ff;
  box-shadow:
    0 0 14px rgba(0, 245, 255, 0.95),
    0 0 32px rgba(0, 245, 255, 0.8);
}

.tile.path-glow .pipe-straight,
.tile.path-glow .pipe-curve {
  animation: pathPulse 0.4s ease-out;
}

/* optional subtle "wave" motion */
@keyframes pathWave {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

@keyframes pathPulse {
  0% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.5);
  }
  100% {
    filter: brightness(1);
  }
}

.tile.path-glow {
  animation: pathWave 0.35s ease-out;
}

.tile.dead-end .tile-ring {
  box-shadow:
    0 0 10px rgba(249, 255, 63, 0.6),
    0 0 24px rgba(233, 255, 63, 0.4);
  border-color: rgba(249, 255, 63, 0.8);
}

.tile.dead-end .tile-notch {
  box-shadow:
    0 0 10px rgba(252, 255, 63, 0.7),
    0 0 20px rgba(242, 255, 63, 0.5);
}
