html,
body {
  margin: 0;
  background: #05070c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.ndm-page {
  background:
    radial-gradient(circle at 18% 10%, rgba(38, 214, 191, 0.12), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(255, 181, 49, 0.1), transparent 26%),
    linear-gradient(180deg, #05070c 0%, #08101d 54%, #070b13 100%);
}

.ndm-root {
  padding: 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(101, 231, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(8, 14, 26, 0.94), rgba(4, 7, 13, 0.98));
}

.ndm-app {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.ndm-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ndm-stat,
.ndm-queue,
.ndm-controls,
.ndm-overlay-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 14, 26, 0.72);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.ndm-stat {
  min-width: 0;
  border-radius: 14px;
  padding: 10px 12px;
  text-align: center;
}

.ndm-stat span,
.ndm-queue {
  color: rgba(238, 244, 255, 0.62);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ndm-stat strong {
  display: block;
  margin-top: 4px;
  color: #f8fbff;
  font-size: clamp(18px, 3vw, 28px);
  line-height: 1;
}

.ndm-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.ndm-current {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  min-height: 58px;
}

.ndm-current .ndm-tile {
  grid-column: calc(var(--selected-col) + 1);
  justify-self: center;
}

.ndm-queue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  border-radius: 16px;
  padding: 8px 10px;
}

.ndm-stage {
  position: relative;
  min-height: 0;
  display: grid;
}

.ndm-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: clamp(6px, 1.2vw, 10px);
  min-height: 0;
  padding: clamp(8px, 1.4vw, 14px);
  border-radius: 20px;
  border: 1px solid rgba(101, 231, 255, 0.12);
  background:
    radial-gradient(circle at 50% 12%, rgba(101, 231, 255, 0.08), transparent 30%),
    rgba(4, 8, 15, 0.82);
}

.ndm-column {
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 0.9vw, 8px);
  min-width: 0;
  min-height: 0;
  padding: clamp(5px, 0.8vw, 8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 23, 39, 0.72), rgba(8, 13, 23, 0.88));
  cursor: pointer;
  touch-action: manipulation;
}

.ndm-column.is-selected {
  border-color: rgba(101, 231, 255, 0.46);
  box-shadow: 0 0 0 2px rgba(101, 231, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ndm-column.is-full {
  border-color: rgba(255, 95, 130, 0.28);
}

.ndm-column.is-blocked {
  animation: ndmBlocked 0.24s ease;
}

.ndm-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.ndm-tile {
  display: grid;
  place-items: center;
  width: min(100%, 70px);
  aspect-ratio: 1;
  border-radius: clamp(10px, 1.8vw, 16px);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(160deg, var(--tile-color), #111827);
  color: #fff;
  font-size: clamp(14px, 2.8vw, 24px);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform-origin: center;
}

.ndm-tile--appear {
  animation: ndmDrop 0.2s ease-out both;
}

.ndm-tile--pop {
  animation: ndmPop 0.24s ease-out both;
}

.ndm-tile--legendary {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.2),
    0 0 28px rgba(255, 213, 85, 0.42),
    0 10px 26px rgba(0, 0, 0, 0.3);
}

.ndm-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-radius: 16px;
  padding: 8px;
}

.ndm-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #edf4ff;
  font-weight: 900;
  cursor: pointer;
}

.ndm-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.ndm-button--primary {
  border-color: rgba(255, 181, 49, 0.38);
  background: linear-gradient(180deg, rgba(255, 181, 49, 0.22), rgba(255, 159, 67, 0.12));
}

.ndm-overlay,
.ndm-toast,
.ndm-combo,
.ndm-particles {
  position: absolute;
  pointer-events: none;
}

.ndm-overlay {
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 12, 0.64);
  pointer-events: auto;
}

.ndm-overlay[hidden] {
  display: none;
}

.ndm-overlay-card {
  width: min(92%, 420px);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

.ndm-eyebrow {
  margin: 0 0 8px;
  color: #65e7ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ndm-overlay-card h2 {
  margin: 0;
  color: #f8fbff;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
}

.ndm-overlay-card p {
  margin: 12px auto 0;
  max-width: 34em;
  color: rgba(238, 244, 255, 0.74);
  line-height: 1.5;
}

.ndm-overlay-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.ndm-toast,
.ndm-combo {
  z-index: 18;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  animation: ndmFloat 0.9s ease both;
}

.ndm-combo {
  top: 22%;
  background: rgba(101, 231, 255, 0.18);
  border: 1px solid rgba(101, 231, 255, 0.34);
}

.ndm-toast {
  top: 10%;
  background: rgba(255, 181, 49, 0.2);
  border: 1px solid rgba(255, 181, 49, 0.38);
}

.ndm-particles {
  z-index: 17;
  inset: 50% auto auto 50%;
}

.ndm-particles span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffd36b;
  animation: ndmParticle 0.8s ease-out both;
}

@keyframes ndmDrop {
  from { transform: translateY(-26px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes ndmPop {
  0% { transform: scale(0.86); }
  58% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@keyframes ndmBlocked {
  0%, 100% { transform: translateX(0); border-color: rgba(255, 95, 130, 0.34); }
  35% { transform: translateX(-4px); border-color: rgba(255, 95, 130, 0.78); }
  70% { transform: translateX(4px); border-color: rgba(255, 95, 130, 0.78); }
}

@keyframes ndmFloat {
  0% { transform: translate(-50%, 12px) scale(0.94); opacity: 0; }
  18%, 76% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -12px) scale(0.98); opacity: 0; }
}

@keyframes ndmParticle {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}

@media (max-width: 860px) {
  .ndm-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .ndm-main .gq-shell-ads {
    display: none;
  }
}

@media (max-width: 560px) {
  .ndm-root {
    padding: 7px;
  }

  .ndm-app {
    gap: 7px;
  }

  .ndm-panel,
  .ndm-controls {
    gap: 6px;
  }

  .ndm-stat {
    padding: 8px 6px;
  }

  .ndm-board {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border-radius: 14px;
  }

  .ndm-column {
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
  }

  .ndm-cell {
    border-radius: 8px;
  }

  .ndm-tile {
    border-radius: 9px;
    font-size: clamp(11px, 5.2vw, 18px);
  }

  .ndm-current {
    min-height: 44px;
  }

  .ndm-queue {
    gap: 5px;
    min-height: 44px;
    padding: 6px;
  }

  .ndm-queue .ndm-tile,
  .ndm-current .ndm-tile {
    width: 38px;
  }

  .ndm-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
