:root {
  --bg: #0f172a;            /* slate-900 */
  --panel: #111827;         /* gray-900 */
  --panel-2: #0b1220;       /* deeper */
  --text: #e5e7eb;          /* gray-200 */
  --muted: #9ca3af;         /* gray-400 */
  --primary: #60a5fa;       /* blue-400 */
  --primary-2: #93c5fd;     /* blue-300 */
  --accent: #34d399;        /* emerald-400 */
  --danger: #f87171;        /* red-400 */
  --warn: #fbbf24;          /* amber-400 */
  --grid: #1f2937;          /* gray-800 */
  --grid-strong: #374151;   /* gray-700 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--panel-2));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.app-header, .app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(17, 24, 39, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--grid);
}
.app-footer { border-top: 1px solid var(--grid); border-bottom: none; }
.app-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.5px;
}
.header-actions { display: flex; gap: 8px; align-items: center; }
.api-label { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.api-label input { width: 320px; max-width: 45vw; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--grid); background: #0b1220; color: var(--text); }

.container { max-width: 1000px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 1fr; gap: 16px; }

.controls { background: rgba(17,24,39, 0.5); border: 1px solid var(--grid); border-radius: 12px; padding: 12px; }
.controls .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.controls label { color: var(--muted); }
.controls select, .controls button { height: 36px; }
.controls select { background: #0b1220; color: var(--text); border: 1px solid var(--grid); border-radius: 10px; padding: 0 8px; }
.controls button {
  border: 1px solid var(--grid);
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
  padding: 0 12px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 80ms ease, background-color 120ms ease;
}
.controls button:hover { border-color: var(--primary); }
.controls button:active { transform: translateY(1px); }
#enterModeBtn[data-active="true"] { background: rgba(52,211,153,0.15); border-color: var(--accent); }

.board-section { display: grid; grid-template-columns: auto; justify-content: center; position: relative; }
.board { display: grid; grid-template-columns: repeat(9, 48px); grid-template-rows: repeat(9, 48px); gap: 0; background: var(--grid-strong); padding: 3px; border-radius: 12px; box-shadow: 0 14px 32px rgba(0,0,0,0.35); }
.cell { position: relative; }
.cell input {
  width: 48px; height: 48px; text-align: center; font-size: 20px; font-weight: 600; letter-spacing: 1px;
  border: none; outline: none; background: var(--panel); color: var(--text); border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid);
}
.cell:nth-child(9n) input { border-right: none; }
.cell input.fixed { background: #0d1628; color: var(--primary-2); font-weight: 700; }
.cell input.invalid { color: var(--danger); }
.cell input:focus { box-shadow: inset 0 0 0 2px var(--primary); z-index: 2; position: relative; }

/* bold borders for 3x3 boxes */
.cell[data-br="1"] input { border-right: 2px solid var(--grid-strong); }
.cell[data-bb="1"] input { border-bottom: 2px solid var(--grid-strong); }

.board-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,23,42,0.6); border-radius: 12px; }
.board-overlay.hidden { display: none; }
.overlay-card { background: #0b1220; border: 1px solid var(--grid); padding: 16px 20px; border-radius: 12px; box-shadow: 0 14px 30px rgba(0,0,0,0.45); display: grid; gap: 8px; min-width: 260px; text-align: center; }
.overlay-card h3 { margin: 0; font-size: 18px; }
.overlay-card p { margin: 0; color: var(--muted); }
.overlay-card .ok { background: rgba(52,211,153,0.15); border: 1px solid var(--accent); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--text); }

.info { display: grid; gap: 12px; }
.status-line { color: var(--muted); background: rgba(17,24,39, 0.5); border: 1px solid var(--grid); border-radius: 12px; padding: 10px 12px; }
.explain { background: rgba(17,24,39, 0.5); border: 1px solid var(--grid); border-radius: 12px; padding: 10px 12px; }
.explain summary { cursor: pointer; color: var(--primary-2); }
.explain ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.explain li { color: var(--text); }

@media (max-width: 520px) {
  .board { grid-template-columns: repeat(9, 38px); grid-template-rows: repeat(9, 38px); }
  .cell input { width: 38px; height: 38px; font-size: 18px; }
}

