* { box-sizing: border-box; }
:root {
  --bg: #0b1021;
  --card: #141a33;
  --ink: #e9ecf1;
  --muted: #b9c0cf;
  --accent: #7aa2ff;
  --success: #51cf66;
  --warn: #ffd43b;
  --grid: #1c2444;
  --found: #2a945b;
  --select: #4361ee;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1e2750 0%, #0b1021 60%);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(20,26,51,.6);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
}
.topbar h1 {
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: .3px;
}
.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.controls select, .controls button {
  background: var(--card);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.08);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.controls button:hover { filter: brightness(1.1); }

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
  width: min(1200px, 100%);
  margin: 0 auto;
  flex: 1;
}

.grid-panel, .wordlist-panel {
  background: rgba(20,26,51,.55);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid {
  display: grid;
  gap: 4px;
  justify-content: center;
}

.cell {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--grid);
  border-radius: 6px;
  user-select: none;
  transition: transform .06s ease, background .15s ease, color .15s ease;
  border: 1px solid rgba(255,255,255,.05);
}
.cell:hover { transform: translateY(-1px); }
.cell.selected { outline: 2px solid var(--select); }
.cell.found { background: var(--found); color: #0b1021; }

.wordlist-panel h2 { margin-top: 4px; }
.word-list {
  list-style: none;
  padding: 0; margin: 8px 0 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.word-list li {
  background: var(--card);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted);
  font-weight: 600;
}
.word-list li.found {
  color: var(--success);
  text-decoration: line-through;
}
.progress { margin-top: 10px; color: var(--muted); }

.footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--muted);
  opacity: .9;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .grid {
    gap: 3px;
  }
  .cell {
    width: 30px; height: 30px;
  }
}