:root {
  --bg: #05070d;
  --panel: rgba(8, 12, 24, 0.7);
  --panel-strong: rgba(10, 16, 32, 0.88);
  --line: rgba(255, 255, 255, 0.18);
  --line-bright: rgba(255, 255, 255, 0.36);
  --text: #f6f8ff;
  --muted: #aab4cb;
  --cyan: #67e8f9;
  --gold: #ffd166;
  --rose: #ff4d8d;
  --green: #7cff9b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(5, 7, 13, 0.12), rgba(5, 7, 13, 0.9)),
    url("assets/mastermind-background.png") center / cover fixed,
    var(--bg);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 15%, rgba(103, 232, 249, 0.24), transparent 34%),
    radial-gradient(circle at 80% 24%, rgba(255, 77, 141, 0.18), transparent 26%),
    linear-gradient(90deg, rgba(5, 7, 13, 0.42), rgba(5, 7, 13, 0.14) 48%, rgba(5, 7, 13, 0.62));
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, transparent 92%);
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.72;
  z-index: 0;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  width: min(470px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 250px;
  gap: 0;
}

.brand-mark {
  position: relative;
  z-index: 2;
  width: 58px;
  height: 58px;
  margin-right: -12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, #fff, transparent 10%),
    conic-gradient(from 10deg, #67e8f9, #7cff9b, #ffd166, #ff4d8d, #8b5cf6, #67e8f9);
  box-shadow:
    0 0 28px rgba(103, 232, 249, 0.52),
    inset 0 -16px 28px rgba(0, 0, 0, 0.45);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(2, 6, 14, 0.68);
}

.brand-sign {
  position: relative;
  min-width: min(520px, calc(100vw - 104px));
  padding: 13px 56px 15px 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.035) 42%, rgba(0, 0, 0, 0.24)),
    linear-gradient(115deg, rgba(103, 232, 249, 0.24), rgba(255, 209, 102, 0.12) 46%, rgba(255, 77, 141, 0.18)),
    rgba(6, 10, 22, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -20px 38px rgba(0, 0, 0, 0.38),
    0 0 36px rgba(103, 232, 249, 0.26),
    0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px) saturate(138%);
}

.brand-sign::before {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.13), transparent),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 28px);
  opacity: 0.72;
}

.brand-sign::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 44px;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #67e8f9 0 26%, transparent 26% 36%, #ffd166 36% 62%, transparent 62% 72%, #ff4d8d 72%);
  box-shadow:
    0 0 12px rgba(103, 232, 249, 0.5),
    0 0 18px rgba(255, 77, 141, 0.28);
  transform: translateY(-50%);
}

.sign-bolt {
  position: absolute;
  z-index: 1;
  top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff, rgba(255, 255, 255, 0.35) 28%, rgba(0, 0, 0, 0.5) 72%),
    #9fb6c4;
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.32);
}

.sign-bolt-left {
  left: 14px;
}

.sign-bolt-right {
  right: 14px;
}

.kicker,
.label {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-sign .kicker {
  position: relative;
  z-index: 1;
  margin-bottom: 7px;
  color: #cfe8f0;
  text-shadow: 0 0 10px rgba(103, 232, 249, 0.32);
}

h1 {
  margin: 0;
}

.brand-title {
  position: relative;
  z-index: 1;
  font-family:
    "Segoe UI Variable Display", "Arial Black", Impact, Inter, system-ui, sans-serif;
  font-size: clamp(2rem, 4.5vw, 4.35rem);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: 0.035em;
  color: #f4fbff;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(5, 12, 20, 0.88);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.86),
    0 5px 0 rgba(0, 0, 0, 0.4),
    0 12px 22px rgba(0, 0, 0, 0.72),
    0 0 18px rgba(103, 232, 249, 0.62),
    0 0 34px rgba(255, 209, 102, 0.18);
}

.difficulty {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 6px;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 18, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.difficulty-btn {
  min-height: 46px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.difficulty-btn:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.difficulty-btn.is-active {
  color: #06101a;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  box-shadow: 0 0 28px rgba(103, 232, 249, 0.42);
}

.utility-controls {
  display: flex;
  justify-content: end;
  flex-wrap: wrap;
  gap: 8px;
}

.language-toggle,
.attempt-toggle {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 18, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.language-toggle {
  grid-template-columns: repeat(2, 46px);
}

.attempt-toggle {
  grid-template-columns: repeat(2, 54px);
}

.language-btn,
.attempt-btn,
.info-btn {
  min-height: 38px;
  border-radius: 6px;
  font-weight: 900;
}

.language-btn,
.attempt-btn {
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
}

.attempt-btn {
  font-size: 0.95rem;
}

.language-btn.is-active,
.attempt-btn.is-active {
  color: #06101a;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
}

.info-btn {
  display: grid;
  width: 42px;
  place-items: center;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.35), transparent 22%),
    rgba(5, 8, 18, 0.72);
  color: #f5fbff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-style: italic;
  box-shadow:
    0 0 20px rgba(103, 232, 249, 0.2),
    var(--shadow);
  backdrop-filter: blur(18px);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.info-btn:hover,
.info-btn:focus-visible {
  border-color: rgba(103, 232, 249, 0.72);
  box-shadow:
    0 0 24px rgba(103, 232, 249, 0.4),
    var(--shadow);
  outline: none;
  transform: translateY(-1px);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.control-panel,
.board-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 36%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(130%);
}

.control-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.status-module {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.status-module > div {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
}

.status-module strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.35rem;
  transition:
    transform 180ms ease,
    background 180ms ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.guess-slots,
.palette,
.secret-rail,
.guess-pegs,
.feedback {
  display: flex;
  align-items: center;
}

.guess-slots {
  min-height: 70px;
  gap: 10px;
}

.slot,
.peg,
.secret-peg,
.palette-btn {
  border-radius: 50%;
}

.slot {
  width: clamp(45px, 7vw, 58px);
  height: clamp(45px, 7vw, 58px);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.18), transparent 22%),
    rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.62);
}

.slot.is-filled,
.peg,
.palette-btn {
  border: 1px solid rgba(255, 255, 255, 0.48);
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.88), transparent 15%),
    radial-gradient(circle at 62% 72%, rgba(0, 0, 0, 0.44), transparent 38%),
    var(--orb);
  box-shadow:
    0 0 22px color-mix(in srgb, var(--orb), white 20%),
    inset 0 -15px 18px rgba(0, 0, 0, 0.28);
}

.palette-module .label {
  margin-bottom: 10px;
}

.palette {
  display: grid;
  grid-template-columns: repeat(var(--palette-count, 6), minmax(0, 1fr));
  gap: 8px;
}

.palette-btn {
  width: 100%;
  max-width: 54px;
  height: auto;
  aspect-ratio: 1;
  justify-self: center;
  transition:
    transform 170ms ease,
    filter 170ms ease;
}

.palette-btn:hover,
.palette-btn:focus-visible {
  filter: saturate(130%) brightness(1.12);
  transform: translateY(-4px) scale(1.04);
  outline: none;
}

.actions {
  display: grid;
  grid-template-columns: 1.35fr 0.75fr;
  gap: 10px;
}

.primary-btn,
.ghost-btn {
  min-height: 50px;
  border-radius: 6px;
  font-weight: 900;
}

.primary-btn {
  color: #041018;
  background: linear-gradient(135deg, #78f3ff, #ffd166 54%, #ff6aa3);
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.32);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.075);
}

.board-wrap {
  position: relative;
  min-height: 270px;
  padding: 18px;
  overflow: hidden;
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.09), transparent),
    radial-gradient(circle at 45% 0%, rgba(255, 209, 102, 0.16), transparent 34%);
}

.secret-rail {
  position: relative;
  z-index: 1;
  justify-content: center;
  min-height: 78px;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(0, 0, 0, 0.32);
}

.secret-peg {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02)),
    rgba(5, 8, 18, 0.92);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.7),
    0 0 18px rgba(103, 232, 249, 0.18);
}

.secret-peg.is-revealed {
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.88), transparent 15%),
    radial-gradient(circle at 62% 72%, rgba(0, 0, 0, 0.44), transparent 38%),
    var(--orb);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--orb), white 24%),
    inset 0 -14px 18px rgba(0, 0, 0, 0.3);
}

.board {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(70px, 110px);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 8px;
  background: rgba(3, 6, 14, 0.48);
  transition:
    border 180ms ease,
    background 180ms ease,
    transform 180ms ease;
  animation: row-reveal 240ms ease-out;
}

.turn-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 24%),
    rgba(255, 255, 255, 0.06);
  color: #dce8ff;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow:
    inset 0 -10px 18px rgba(0, 0, 0, 0.28),
    0 0 14px rgba(103, 232, 249, 0.12);
}

.row.is-current .turn-index {
  border-color: rgba(103, 232, 249, 0.62);
  color: #fff;
  box-shadow:
    inset 0 -10px 18px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(103, 232, 249, 0.34);
}

.row.is-current {
  border-color: rgba(103, 232, 249, 0.62);
  background:
    linear-gradient(90deg, rgba(103, 232, 249, 0.13), transparent),
    rgba(3, 6, 14, 0.62);
  transform: translateX(-2px);
}

.guess-pegs {
  min-width: 0;
  gap: 8px;
}

.peg {
  width: clamp(31px, 5vw, 42px);
  height: clamp(31px, 5vw, 42px);
  flex: 0 0 auto;
}

.peg.empty {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.62);
}

.feedback {
  justify-content: end;
  flex-wrap: wrap;
  gap: 6px;
}

.pin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.pin.hit {
  border-color: rgba(255, 255, 255, 0.7);
  background: #0a0c12;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.55),
    inset 0 0 4px rgba(255, 255, 255, 0.5);
}

.pin.near {
  border-color: rgba(255, 255, 255, 0.72);
  background: #f7f1df;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.6);
}

.message {
  position: relative;
  z-index: 1;
  min-height: 28px;
  margin: 14px 2px 0;
  color: #dce8ff;
  font-weight: 760;
  text-align: center;
}

.pop {
  animation: pop 260ms ease-out;
}

.win-flare {
  animation: win-flare 900ms ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0.72);
    filter: brightness(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes win-flare {
  0% {
    box-shadow: 0 0 0 rgba(124, 255, 155, 0);
  }
  45% {
    box-shadow: 0 0 90px rgba(124, 255, 155, 0.72);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes row-reveal {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(103, 232, 249, 0.24), transparent 34%),
    rgba(0, 0, 0, 0.24);
  transition:
    opacity 240ms ease,
    visibility 240ms ease;
}

.celebration.is-visible {
  opacity: 1;
  visibility: visible;
}

.celebration-card {
  position: relative;
  display: grid;
  min-width: min(560px, 100%);
  min-height: 210px;
  place-items: center;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 36%),
    rgba(5, 8, 18, 0.82);
  box-shadow:
    0 0 70px rgba(103, 232, 249, 0.44),
    0 0 110px rgba(255, 77, 141, 0.22),
    0 28px 90px rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(24px) saturate(140%);
  transform: scale(0.9);
}

.celebration.is-visible .celebration-card {
  animation: solved-card 760ms cubic-bezier(0.2, 0.9, 0.18, 1.18) forwards;
}

.celebration-ring {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, #67e8f9, #7cff9b, #ffd166, #ff4d8d, #9b7cff, #67e8f9);
  filter: blur(4px);
  opacity: 0.82;
  animation: ring-spin 3s linear infinite;
}

.celebration-ring::after {
  position: absolute;
  inset: 18px;
  content: "";
  border-radius: inherit;
  background: rgba(5, 8, 18, 0.92);
}

.celebration-card p,
.celebration-card small {
  position: relative;
  z-index: 1;
  margin: 0;
}

.rules-modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 22px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

.rules-modal.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.rules-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 36%, rgba(103, 232, 249, 0.16), transparent 36%),
    rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(10px);
}

.rules-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 34%),
    rgba(7, 11, 23, 0.92);
  box-shadow:
    0 0 48px rgba(103, 232, 249, 0.28),
    0 28px 90px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(24px) saturate(140%);
  transform: translateY(10px) scale(0.98);
  transition: transform 220ms ease;
}

.rules-modal.is-visible .rules-dialog {
  transform: translateY(0) scale(1);
}

.rules-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.rules-header h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 0 22px rgba(103, 232, 249, 0.42);
}

.close-btn {
  flex: 0 0 auto;
  font-size: 1.8rem;
  line-height: 1;
}

.rules-content {
  display: grid;
  gap: 18px;
}

.rules-content p {
  margin: 0;
  color: #dbe6fb;
  line-height: 1.58;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rule-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.rule-grid strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 0.95rem;
}

.rule-grid p {
  color: var(--muted);
  font-size: 0.94rem;
}

.feedback-legend {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: #dce8ff;
  font-weight: 760;
}

.signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  margin: 22px auto 0;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 42%),
    rgba(5, 8, 18, 0.62);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow:
    0 0 22px rgba(103, 232, 249, 0.12),
    0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.signature strong {
  position: relative;
  color: #fff;
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  text-shadow:
    0 0 12px rgba(103, 232, 249, 0.78),
    0 0 22px rgba(255, 77, 141, 0.42);
}

.signature strong::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow:
    0 0 10px var(--cyan),
    0 0 18px var(--rose);
  transform: translateY(-50%);
}

.celebration-card p {
  color: #fff;
  font-size: clamp(3rem, 11vw, 7.5rem);
  font-weight: 950;
  line-height: 0.85;
  letter-spacing: 0;
  text-shadow:
    0 0 22px rgba(103, 232, 249, 0.78),
    0 0 48px rgba(255, 209, 102, 0.42),
    0 10px 28px rgba(0, 0, 0, 0.72);
}

.celebration-card small {
  color: #dbeafe;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes solved-card {
  0% {
    opacity: 0;
    transform: scale(0.84) translateY(18px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .topbar,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    width: 100%;
    justify-items: stretch;
  }

  .utility-controls {
    justify-content: start;
  }

  .game-layout {
    display: grid;
  }

  .control-panel {
    order: 2;
  }

  .board-wrap {
    order: 1;
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1280px);
    padding: 14px 0;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    margin-right: -9px;
  }

  .brand-sign {
    min-width: 0;
    width: calc(100vw - 72px);
    padding: 10px 18px 12px 24px;
  }

  .brand-sign::after {
    display: none;
  }

  .brand-title {
    font-size: clamp(1.75rem, 8.2vw, 2.85rem);
  }

  .difficulty {
    grid-template-columns: 1fr;
  }

  .rule-grid {
    grid-template-columns: 1fr;
  }

  .rules-modal {
    padding: 14px;
  }

  .rules-dialog {
    max-height: calc(100vh - 28px);
    padding: 18px;
  }

  .feedback-legend {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .feedback-legend .pin {
    margin-top: 3px;
  }

  .status-module {
    grid-template-columns: 1fr;
  }

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

  .turn-index {
    width: 30px;
    height: 30px;
  }

  .feedback {
    grid-column: 2;
    justify-content: start;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .signature {
    width: 100%;
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }
}
