:root {
  --af-bg: #090b11;
  --af-panel: rgba(14, 18, 30, 0.9);
  --af-border: rgba(255, 255, 255, 0.12);
  --af-text: #eef2ff;
  --af-muted: #bdc7e6;
  --af-accent: #f59e0b;
  --af-good: #67e8f9;
  --af-warn: #fca5a5;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(140% 120% at 10% 0%, rgba(245, 158, 11, 0.14), rgba(9, 11, 17, 0) 45%),
    radial-gradient(130% 110% at 90% 100%, rgba(56, 189, 248, 0.12), rgba(9, 11, 17, 0) 50%),
    var(--af-bg);
  color: var(--af-text);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.18;
}

body::after {
  background: radial-gradient(circle at 50% 22%, rgba(245, 158, 11, 0.12), transparent 58%);
}

.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 18px auto;
  padding: 0 18px 20px;
}

.title {
  margin: 0 0 8px;
  text-align: center;
  font-size: clamp(1.95rem, 3.6vw, 2.55rem) !important;
  line-height: 1.18;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0 auto 12px;
  max-width: 930px;
  text-align: center;
  color: var(--af-muted);
  font-size: clamp(0.95rem, 1.45vw, 1.12rem) !important;
  line-height: 1.48;
}

.game-shell {
  background: var(--af-panel);
  border: 1px solid var(--af-border);
  border-radius: 18px;
  padding: clamp(10px, 1.8vw, 16px);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.game-body {
  max-width: 760px;
  margin: 0 auto;
}

.level-complete {
  min-height: 30px;
  margin-bottom: 6px;
  text-align: center;
  white-space: pre-line;
  color: #ffd27a;
  font-weight: 700;
  font-size: 0.9rem;
}

.status-line {
  margin: 0 auto 8px;
  width: fit-content;
  text-align: center;
  font-size: 0.9rem;
  color: var(--af-muted);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(8, 12, 24, 0.66);
}

.sliding-puzzle-figure {
  box-sizing: border-box;
  margin: 0 auto;
  width: min(100%, 500px, calc(100vh - 300px));
  aspect-ratio: 1 / 1;
  position: relative;
  font-family: "Noto Sans Ethiopic", "Abyssinica SIL", sans-serif;
  font-weight: 700;
}

.sliding-puzzle {
  list-style: none;
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 11px solid rgba(6, 10, 19, 0.95);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(18, 24, 39, 0.96), rgba(7, 11, 22, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 36px rgba(0, 0, 0, 0.4);
}

.tile {
  position: absolute;
  width: 31%;
  height: 31%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #67e8f9, #38bdf8);
  color: #062333;
  cursor: pointer;
  font-size: clamp(1.5rem, 7.2vw, 2.5rem);
  transition: transform 0.5s ease;
  user-select: none;
  box-shadow:
    0 10px 20px rgba(6, 19, 38, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.tile.error {
  background: linear-gradient(145deg, #fca5a5, #fb7185);
  color: #3b0a10;
}

@media only screen and (max-width: 650px) {
  .page-wrap {
    margin-top: 16px;
    padding: 0 12px 18px;
  }

  .title {
    font-size: clamp(1.55rem, 7.2vw, 2.05rem) !important;
  }

  .subtitle {
    font-size: clamp(0.9rem, 3.6vw, 1rem) !important;
    line-height: 1.42;
  }

  .status-line {
    font-size: 0.84rem;
  }

  .sliding-puzzle-figure {
    width: min(100%, 420px, calc(100vh - 280px));
  }

  .sliding-puzzle {
    border-width: 8px;
    border-radius: 14px;
  }
}
