:root {
  --bg: #0b1020;
  --card: #141b34;
  --card-2: #1b2445;
  --text: #eef2ff;
  --muted: #a5b4fc;
  --accent: #60a5fa;
  --danger: #fb7185;
  --border: rgba(255,255,255,0.12);
  --flower-cell-size: min(4.9vw, 34px);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, var(--bg) 55%);
  color: var(--text);
}
.app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0 0 8px; font-size: 40px; }
.topbar p { margin: 0; color: var(--muted); }
.actions, .helper-actions, .numbers, .controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.numbers-wrap {
  display: grid;
  gap: 10px;
}
.selected-digit-hint {
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 24px;
}
.selected-digit-hint.active {
  color: #86efac;
}
.panel {
  background: rgba(20,27,52,0.92);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}
.controls {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
label, .stat {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--muted);
}
select, button { font: inherit; }
select {
  margin-left: 10px;
  background: transparent;
  color: var(--text);
  border: 0;
  outline: none;
}
button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform .08s ease, opacity .2s ease, background .2s ease;
}
button:hover { opacity: .95; }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.board-wrap, .flower-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 18px;
  overflow-x: auto;
}
.board {
  width: min(90vw, 540px);
  height: min(90vw, 540px);
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid rgba(255,255,255,0.8);
  background: #0f172a;
}
.hidden { display: none; }
.cell {
  border: 1px solid rgba(255,255,255,0.12);
  border-style: solid;
  display: grid;
  place-items: center;
  font-size: clamp(18px, 2.8vw, 28px);
  font-weight: 600;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  user-select: none;
}
.cell.given { color: #f8fafc; background: rgba(255,255,255,0.06); }
.cell.selected { background: rgba(96,165,250,0.24) !important; }
.cell.related { background: rgba(96,165,250,0.10); }
.cell.error { color: var(--danger); }
.cell.row-divider { border-bottom: 2px solid rgba(255,255,255,0.45); }
.classic-cell:nth-child(3n) { border-right: 2px solid rgba(255,255,255,0.45); }
.num-btn {
  min-width: 52px;
  min-height: 52px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
}
.num-btn.active {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.16) inset;
}
.message {
  min-height: 28px;
  margin-top: 14px;
  color: var(--muted);
}
.message.ok { color: #86efac; }
.message.bad { color: #fda4af; }
.flower-board {
  display: grid;
  grid-template-columns: repeat(15, var(--flower-cell-size));
  grid-template-rows: repeat(15, var(--flower-cell-size));
  gap: 0;
  justify-content: center;
  align-content: center;
  padding: 10px;
  background: radial-gradient(circle at center, rgba(96,165,250,0.08), transparent 56%);
}
.flower-cell {
  width: var(--flower-cell-size);
  height: var(--flower-cell-size);
  padding: 0;
  margin: 0;
  border-radius: 0;
  border-color: rgba(255,255,255,0.18);
  background: rgba(15, 23, 42, 0.94);
  color: var(--text);
  font-size: clamp(12px, 1.6vw, 19px);
  line-height: 1;
  box-shadow: none;
}
.flower-cell.given { background: rgba(255,255,255,0.08); }
@media (max-width: 920px) {
  :root { --flower-cell-size: min(5.3vw, 28px); }
}
@media (max-width: 720px) {
  .topbar, .controls { flex-direction: column; align-items: stretch; }
  .actions { width: 100%; }
  .actions button, .helper-actions button { flex: 1; }
  :root { --flower-cell-size: min(5.55vw, 22px); }
  .flower-cell { font-size: clamp(10px, 2.5vw, 15px); }
}
