/* /css/SudokuNextMove.css
// ==========================================================
// Sudoku Paradise — Explain My Next Sudoku Move
// ========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --next-ink: #18383c;
  --next-muted: #4d696c;
  --next-teal: #0b6870;
  --next-teal-dark: #084f56;
  --next-pale: #edf8f6;
  --next-line: rgba(11, 104, 112, 0.24);
  --next-card: rgba(255, 255, 255, 0.96);
  --next-amber: #ffe4a3;
  --next-amber-deep: #8b5900;
  --next-blue: #d8edff;
  --next-red: #ffd9d5;
  --next-red-deep: #912d25;
  --next-green: #d9f1df;
  --next-green-deep: #22653a;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(91, 190, 180, 0.16), transparent 28rem),
    linear-gradient(180deg, #f7fbfa 0%, #eef7f5 100%);
  color: var(--next-ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

a {
  color: var(--next-teal);
}

.next-page-header {
  display: flex;
  justify-content: center;
  padding: 1.1rem 5rem 0.4rem;
}

.next-brand {
  color: var(--next-teal);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.next-page-main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.next-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  max-width: 980px;
  margin: 0 auto 1rem;
  color: var(--next-muted);
  font-size: 0.88rem;
}

.next-breadcrumbs a {
  font-weight: 700;
  text-decoration: none;
}

.next-hero {
  max-width: 900px;
  margin: 0 auto 1.4rem;
  text-align: center;
}

.next-eyebrow,
.section-kicker {
  margin: 0 0 0.38rem;
  color: var(--next-teal);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.next-hero h1 {
  margin: 0;
  color: #174f55;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.06;
}

.next-lead {
  max-width: 820px;
  margin: 1rem auto 0;
  color: #315458;
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  line-height: 1.65;
}

.import-card,
.board-card,
.result-card,
.explanation-card,
.faq-card {
  border: 1px solid var(--next-line);
  border-radius: 16px;
  background: var(--next-card);
  box-shadow: 0 9px 24px rgba(20, 55, 60, 0.09);
}

.import-card,
.explanation-card,
.faq-card {
  max-width: 980px;
  margin: 1.1rem auto;
  padding: clamp(1rem, 3vw, 1.6rem);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.section-heading h2,
.explanation-card h2,
.faq-card h2 {
  margin: 0;
  color: #174f55;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
}

.source-badge,
.result-badge,
.state-summary {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(11, 104, 112, 0.1);
  color: var(--next-teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.result-badge[data-state="working"] {
  background: var(--next-blue);
  color: #24567a;
}

.result-badge[data-state="success"] {
  background: var(--next-green);
  color: var(--next-green-deep);
}

.result-badge[data-state="failed"] {
  background: var(--next-red);
  color: var(--next-red-deep);
}

.import-card label {
  display: block;
  margin-bottom: 0.42rem;
  font-weight: 800;
}

#puzzleInput {
  display: block;
  width: 100%;
  min-height: 8.2rem;
  resize: vertical;
  padding: 0.82rem;
  border: 2px solid rgba(11, 104, 112, 0.34);
  border-radius: 10px;
  background: #ffffff;
  color: #162f32;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#puzzleInput:focus {
  border-color: var(--next-teal);
  outline: 3px solid rgba(11, 104, 112, 0.15);
}

#puzzleInput.is-invalid {
  border-color: #a52f29;
  outline-color: rgba(165, 47, 41, 0.13);
}

.field-help,
.status-message,
.engine-status {
  color: var(--next-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.field-help {
  margin: 0.55rem 0 0;
}

.field-help code {
  padding: 0.08rem 0.25rem;
  border-radius: 4px;
  background: #e7f2f0;
  color: #174f55;
}

.status-message {
  min-height: 1.35rem;
  margin: 0.6rem 0 0;
  font-weight: 700;
}

.status-message.is-error {
  color: #982d27;
}

.import-actions,
.board-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.65rem 0.95rem;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  border: 1px solid var(--next-teal);
  background: var(--next-teal);
  color: #ffffff;
}

.button-primary:not(:disabled):hover,
.button-primary:not(:disabled):focus-visible {
  background: var(--next-teal-dark);
}

.button-secondary {
  border: 1px solid rgba(11, 104, 112, 0.4);
  background: #ffffff;
  color: var(--next-teal);
}

.button-secondary:not(:disabled):hover,
.button-secondary:not(:disabled):focus-visible {
  background: #edf8f6;
}

.button-link {
  border: 1px solid rgba(11, 104, 112, 0.34);
  background: #edf8f6;
  color: var(--next-teal);
}

.move-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(320px, 0.97fr);
  gap: 1rem;
  max-width: 1180px;
  margin: 1rem auto;
  align-items: start;
}

.board-card,
.result-card {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.45rem);
}

.grid-shell {
  width: min(100%, 38rem);
  margin: 0 auto;
  padding: clamp(0.35rem, 1vw, 0.6rem);
  border-radius: 12px;
  background: #dce7e6;
}

.next-sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid #263f43;
  background: #263f43;
}

.sudoku-cell {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid #aab8b9;
  border-bottom: 1px solid #aab8b9;
  border-radius: 0;
  background: #ffffff;
  color: #17383c;
  cursor: default;
  font: inherit;
}

.sudoku-cell.is-entry-cell {
  cursor: pointer;
}

.sudoku-cell.is-entry-cell:hover {
  background: #f2faf9;
}

.sudoku-cell.is-entry-selected,
.sudoku-cell.is-entry-cell:focus-visible {
  z-index: 2;
  background: #dff3f0;
  box-shadow: inset 0 0 0 3px var(--next-teal);
  outline: 0;
}

.sudoku-cell:nth-child(9n) {
  border-right: 0;
}

.sudoku-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.sudoku-cell:nth-child(9n + 3),
.sudoku-cell:nth-child(9n + 6) {
  border-right: 3px solid #263f43;
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 3px solid #263f43;
}

.sudoku-cell.is-given,
.sudoku-cell.is-solved {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sudoku-cell.is-given {
  background: #f5f7f6;
}

.sudoku-cell.is-solved {
  background: #eef8f7;
}

.cell-value {
  font-size: clamp(1rem, 3.1vw, 2rem);
  font-weight: 800;
  line-height: 1;
}

.sudoku-cell.is-solved:not(.is-given) .cell-value {
  color: #126cba;
}

.candidate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: #347a40;
  font-size: clamp(0.42rem, 1.25vw, 0.73rem);
  font-weight: 680;
  line-height: 1;
}

.grid-entry-tools {
  width: min(100%, 38rem);
  margin: 0.85rem auto 0;
  padding: 0.85rem;
  border: 1px solid rgba(11, 104, 112, 0.22);
  border-radius: 11px;
  background: #f2faf8;
  text-align: center;
}

.grid-entry-tools h3 {
  margin: 0;
  color: #174f55;
  font-size: 1rem;
}

.grid-entry-tools p {
  margin: 0.4rem auto 0.7rem;
  color: var(--next-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.grid-entry-pad {
  display: grid;
  grid-template-columns: repeat(10, minmax(2.4rem, 1fr));
  gap: 0.38rem;
}

.grid-entry-pad button {
  min-height: 2.65rem;
  padding: 0.35rem;
  border: 1px solid rgba(11, 104, 112, 0.38);
  border-radius: 8px;
  background: #ffffff;
  color: var(--next-teal);
  cursor: pointer;
  font-weight: 850;
}

.grid-entry-pad button:hover,
.grid-entry-pad button:focus-visible {
  border-color: var(--next-teal);
  background: #dff3f0;
  outline: 2px solid rgba(11, 104, 112, 0.16);
}

.grid-entry-pad .entry-clear {
  min-width: 5.5rem;
  color: #8a342e;
  font-size: 0.78rem;
}

.load-grid-puzzle {
  margin-top: 0.75rem;
}

.sudoku-cell.is-proof-cell {
  background: #fff5d8;
}

.candidate.is-proof-candidate {
  border-radius: 50%;
  background: var(--next-amber);
  color: var(--next-amber-deep);
}

.sudoku-cell.is-target-cell.is-elimination {
  background: var(--next-red);
  box-shadow: inset 0 0 0 3px #c34a40;
}

.sudoku-cell.is-target-cell.is-placement {
  background: var(--next-green);
  box-shadow: inset 0 0 0 3px #3f9b5d;
}

.candidate.is-target-candidate {
  border-radius: 50%;
  background: #c83f35;
  color: #ffffff;
}

.sudoku-cell.is-spotlit-current {
  z-index: 2;
  box-shadow: inset 0 0 0 4px #0b6870;
}

.sudoku-cell.is-spotlit-trail {
  background: #fff5d8;
}

.board-actions {
  justify-content: center;
}

.button-explain {
  min-width: min(100%, 15rem);
}

.engine-status {
  min-height: 1.35rem;
  margin: 0.7rem 0 0;
  text-align: center;
}

.empty-result,
.no-move-result {
  min-height: 11rem;
  padding: 1.1rem;
  border: 1px dashed rgba(11, 104, 112, 0.34);
  border-radius: 11px;
  background: rgba(237, 248, 246, 0.72);
  color: #31575b;
}

.empty-result strong,
.no-move-result strong {
  color: #174f55;
}

.empty-result p,
.no-move-result p {
  margin-bottom: 0;
  line-height: 1.65;
}

.result-facts {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.result-facts > div {
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(11, 104, 112, 0.18);
  border-radius: 10px;
  background: #f6fbfa;
}

.result-facts dt {
  margin-bottom: 0.2rem;
  color: var(--next-muted);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-facts dd {
  margin: 0;
  color: #143f44;
  font-size: 1.03rem;
  font-weight: 800;
}

.reason-panel,
.evidence-panel {
  margin-top: 0.9rem;
}

.reason-panel h3,
.evidence-panel h3 {
  margin: 0 0 0.42rem;
  color: #174f55;
  font-size: 1rem;
}

.reason-panel p {
  margin: 0;
  padding: 0.9rem;
  border-left: 4px solid #d5a128;
  border-radius: 0 9px 9px 0;
  background: #fff8e5;
  line-height: 1.65;
}

.evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.evidence-chip {
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(139, 89, 0, 0.25);
  border-radius: 999px;
  background: #fff3cf;
  color: #664300;
  font-family: "Courier New", monospace;
  font-size: 0.79rem;
  font-weight: 800;
}

.evidence-empty {
  color: var(--next-muted);
  font-size: 0.9rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.feature-grid article {
  position: relative;
  padding: 1rem;
  border: 1px solid rgba(11, 104, 112, 0.16);
  border-radius: 11px;
  background: rgba(237, 248, 246, 0.75);
}

.feature-number {
  display: inline-flex;
  width: 1.8rem;
  height: 1.8rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--next-teal);
  color: #ffffff;
  font-weight: 850;
}

.feature-grid h3 {
  margin: 0.65rem 0 0.35rem;
  color: #174f55;
  font-size: 1.02rem;
}

.feature-grid p {
  margin: 0;
  line-height: 1.6;
}

.faq-card details {
  border-top: 1px solid rgba(11, 104, 112, 0.17);
  padding: 0.85rem 0;
}

.faq-card details:first-of-type {
  margin-top: 0.75rem;
}

.faq-card summary {
  color: #174f55;
  cursor: pointer;
  font-weight: 800;
}

.faq-card details p {
  margin: 0.6rem 0 0;
  color: #385b5f;
  line-height: 1.65;
}

.next-page-footer {
  padding: 1rem;
  color: var(--next-muted);
  font-size: 0.9rem;
  text-align: center;
}

.next-page-footer a {
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .move-workbench {
    grid-template-columns: 1fr;
    max-width: 680px;
  }

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

@media (max-width: 680px) {
  .next-page-header {
    padding-top: 3.6rem;
  }

  .next-page-main {
    width: min(100% - 1rem, 1180px);
  }

  .next-breadcrumbs {
    padding: 0 0.25rem;
  }

  .section-heading {
    flex-direction: column;
    gap: 0.55rem;
  }

  .board-heading {
    flex-direction: row;
  }

  .import-actions .button,
  .board-actions .button,
  .result-actions .button {
    width: 100%;
  }

  .candidate {
    font-size: clamp(0.39rem, 2.3vw, 0.62rem);
  }

  .cell-value {
    font-size: clamp(1.05rem, 7.3vw, 1.72rem);
  }

  .grid-entry-pad {
    grid-template-columns: repeat(5, minmax(2.5rem, 1fr));
  }

  .grid-entry-pad .entry-clear {
    min-width: 0;
  }

  .load-grid-puzzle {
    width: 100%;
  }
}
