:root {
  --bg: #0b0b0c;
  --card: #121214;
  --text: #f4f4f5;
  --muted: #b3b3b8;
  --accent: #5AAA50;
  --danger: #c23b22;

  --border: #232327;
  --border2: #2a2a2f;
  --chip: #1b1b1e;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1000px 600px at 10% 0%, rgba(90,170,80,0.10), rgba(0,0,0,0)) , var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  background: var(--chip);
  border: 1px solid var(--border2);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.pill-btn {
  background: transparent;
  border: 1px solid var(--border2);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.pill-btn:hover {
  border-color: rgba(90,170,80,0.55);
}

.card {
  margin-top: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0)) , var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
}

.card p {
  margin: 0 0 10px 0;
  color: var(--muted);
}

.hidden { display: none; }

/* Forms */
.formRow {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.formRow label {
  color: var(--muted);
  font-size: 13px;
}

.formRow input {
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: #0f0f11;
  padding: 10px;
  color: var(--text);
}

.formRow input:focus {
  outline: 3px solid rgba(90,170,80,0.25);
  border-color: rgba(90,170,80,0.60);
}

.checkboxRow {
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px;
}

.checkboxRow label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

/* Buttons */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}

button,
.btn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: #17171a;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
}

button:hover,
.btn:hover {
  border-color: rgba(90,170,80,0.55);
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary,
.btnPrimary {
  border-color: rgba(90,170,80,0.55);
  background: rgba(90,170,80,0.16);
}

.msg {
  margin-top: 10px;
  min-height: 20px;
  color: var(--danger);
  line-height: 1.25;
}

/* Puzzle layout: desktop uses 2 columns, mobile stacks */
#stepGame {
  padding: 16px;
}

#grid {
  margin-top: 10px;
}

.gameLayout {
  display: grid;
  grid-template-columns: minmax(320px, 720px) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

/* If you don't have .gameLayout in HTML, this keeps things sane anyway */
#grid.grid {
  width: 100%;
}

/* Grid container */
.grid {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 760px;
  margin: 10px 0 0 0;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Block and active cells */
.block {
  background: #070708;
  border: 1px solid #1f1f23;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xs);
}

/* Wrap that holds number + input */
.cellWrap {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xs);
}

.cellWrap.active {
  background: transparent;
}

.cellWrap.highlight {
  outline: 3px solid rgba(90,170,80,0.20);
  outline-offset: 0;
  border-radius: var(--radius-xs);
}

.cellNum {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  color: var(--card);
  pointer-events: none;
  user-select: none;
}

/* Input */
.cell {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border2);
  background: #f7f7f8;
  color: #121214;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  padding: 0;
}

.cell:focus {
  outline: 3px solid rgba(90,170,80,0.35);
  border-color: rgba(90,170,80,0.75);
}

@media (max-width: 520px) {
  .cell { font-size: 16px; }
}

/* Clues */
.clues {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.clues h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  letter-spacing: 0.2px;
  color: var(--text);
}

.clues ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.clueItem {
  cursor: pointer;
  line-height: 1.35;
  margin: 8px 0;
}

.clueItem:hover {
  color: rgba(255,255,255,0.92);
}

.clueItem.active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(90,170,80,0.7);
  text-underline-offset: 4px;
}

/* Leaderboard */
.board {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.boardRow {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #101012;
  color: var(--muted);
}

/* Footer */
.footer {
  margin-top: 18px;
  color: #7e7e86;
  font-size: 13px;
}

/* Hint panel injected by app.js */
.hintPanel {
  margin: 0 0 14px 0;
  border: 1px solid rgba(90,170,80,0.35);
  background: rgba(90,170,80,0.08);
  border-radius: var(--radius);
  padding: 12px;
}

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

.hintTitle {
  font-weight: 800;
  color: var(--text);
}

.hintBody {
  white-space: pre-line;
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 10px;
}

.hintApplyRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Mobile friendly layout */
@media (max-width: 980px) {
  .wrap { padding: 16px; }
  .header h1 { font-size: 24px; }
  .gameLayout {
    grid-template-columns: 1fr;
  }
  .grid {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .card { padding: 14px; }
  .actions { gap: 8px; }
  button, .btn { padding: 9px 10px; }
  .clues {
    grid-template-columns: 1fr;
  }
  .clues ul {
    max-height: 300px;
  }
}