/* FrogPath - tool-specific styles. Chrome, hero, privacy badge, and tokens
   come from the shared shell; this file carries the board, numpad, stats, and controls. */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.panel {
  background: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.panel__title {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}


/* ─── How to play (popup, opened from the (i) button in the topbar) ─────── */

.fdp-how-to-play {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.fdp-help-wrap { position: relative; display: flex; }
.fdp-info-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(229, 231, 235, 0.4);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.fdp-info-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(25, 195, 125, 0.08); }
.fdp-info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fdp-help-popup {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  width: min(20rem, 80vw);
  padding: 1rem 1.1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.fdp-help-popup[hidden] { display: none; }
.fdp-help-popup p:last-child { margin-bottom: 0; }
.fdp-help-close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.fdp-help-close:hover { color: var(--accent); }
.fdp-help-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Header row (mode label) ─────────────────────────────────────────── */

.fdp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

#modeLabel {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ─── Stats row ───────────────────────────────────────────────────────── */

.fdp-stats {
  display: flex;
  gap: 1.25rem;
}
.fdp-stat { display: flex; flex-direction: column; align-items: center; text-align: center; }
.fdp-stat__num {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.fdp-stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ─── Difficulty selector ─────────────────────────────────────────────── */

.fdp-difficulty {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.fdp-difficulty-help {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}
.fdp-difficulty-help strong { color: var(--text-light); }

.difficulty__btn {
  flex: 1 1 auto;
  min-width: 4.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.difficulty__btn:hover { border-color: var(--accent); color: var(--accent); }
.difficulty__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.difficulty__btn--active {
  background: var(--accent);
  color: #07140d;
  border-color: var(--accent);
}
.difficulty__btn--active:hover { color: #07140d; }

/* ─── Board ───────────────────────────────────────────────────────────── */

#board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  background: var(--bg-deep);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 8px;
  margin: 0 auto 1rem;
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;
}

.cell {
  aspect-ratio: 1;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  border: 0;
  background: none;
  color: #ffffff;
  text-shadow: 0 0 2px #000, 0 0 4px #000, 0 1px 2px #000;
  min-width: 0;
}
/* the lily pad sits BEHIND the number (z-index -1, contained by isolation) so the number stays readable */
.cell::before {
  content: "";
  position: absolute;
  inset: 4%;
  background: url('./lillypad.png') center / contain no-repeat;
  filter: grayscale(0.5) brightness(0.45);   /* blank = dim empty pad */
  transition: filter 140ms ease, transform 140ms ease;
  z-index: -1;
  pointer-events: none;
}
.cell:focus-visible { outline: 2px solid #ffffff; outline-offset: -2px; border-radius: 12px; }

/* given clue - locked, gray pad */
.cell--given { cursor: default; }
.cell--given::before { filter: grayscale(1) brightness(0.8); }

/* a value you placed - full-colour green pad */
.cell--filled::before { filter: none; }

/* a placed value that's wrong - red NUMBER only, pad stays its green (no red pad, per design) */
.cell--bad { color: #ff6b6b; }
.cell--bad::before { filter: none; }

/* selected cell - bright ring + glow over any pad state */
.is-selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 12px 2px rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  z-index: 2;
}

/* win reveal - app.js adds .cell--lit to each cell in path order 1..N so the
   solved path lights up one pad at a time */
.cell--lit { z-index: 1; }
.cell--lit::before {
  filter: brightness(1.25) drop-shadow(0 0 8px rgba(25, 230, 150, 0.95)) drop-shadow(0 0 16px rgba(25, 230, 150, 0.6)) !important;
  animation: lily-pop 360ms ease;
  transform: scale(1.07);
}
@keyframes lily-pop {
  0% { transform: scale(1); }
  55% { transform: scale(1.2); }
  100% { transform: scale(1.07); }
}

/* ─── Numpad ──────────────────────────────────────────────────────────── */

#numpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 320px;
  margin-bottom: 1.25rem;
}

.numpad__btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text-light);
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
.numpad__btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(25, 195, 125, 0.08); }
.numpad__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.numpad__back,
.numpad__clear {
  font-size: 1rem;
  color: var(--muted);
}

/* ─── Input mode toggle + number bank ─────────────────────────────────── */

.fdp-input-mode {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.input-mode__btn {
  flex: 0 0 auto;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.input-mode__btn:hover { border-color: var(--accent); color: var(--accent); }
.input-mode__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input-mode__btn--active { background: var(--accent); color: #07140d; border-color: var(--accent); }

/* the hidden attribute must win over the grid display on these containers */
#numberBank[hidden], #numpad[hidden] { display: none; }

.fdp-number-bank {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-bottom: 1.25rem;
}
.bank-chip {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text-light);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
.bank-chip:hover { border-color: var(--accent); color: var(--accent); background: rgba(25, 195, 125, 0.08); }
.bank-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bank-chip--used {
  color: rgba(229, 231, 235, 0.22);
  background: transparent;
  cursor: default;
  pointer-events: none;
}
@media (max-width: 560px) {
  .fdp-number-bank { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .bank-chip { min-height: 34px; font-size: 0.8rem; }
}

/* ─── Status ──────────────────────────────────────────────────────────── */

#status {
  min-height: 1.4em;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ─── Controls row ────────────────────────────────────────────────────── */

.fdp-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* ─── Result panel ────────────────────────────────────────────────────── */

#resultPanel {
  background: var(--bg-deep);
  border: 1px solid rgba(25, 195, 125, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 0.5rem;
}
#resultPanel[hidden] { display: none; }

/* desktop: keep the interactive column centered under the (centered) board */
.fdp-number-bank,
#numpad,
.fdp-input-mode,
#status,
.fdp-controls,
#resultPanel {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.fdp-input-mode,
.fdp-controls { justify-content: center; }
#status { text-align: center; }

#resultSummary {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1rem;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .fdp-stats { gap: 1.75rem; }
  .fdp-stat__num { font-size: 1.4rem; }

  .difficulty__btn { font-size: 0.76rem; padding: 0.5rem 0.35rem; min-width: 0; }

  #board {
    gap: 3px;
    padding: 6px;
  }
  .cell { font-size: 0.8rem; }

  #numpad {
    gap: 6px;
    max-width: none;
  }
  .numpad__btn { font-size: 0.95rem; min-height: 44px; }

  .fdp-controls {
    gap: 0.5rem;
  }
  .fdp-controls .btn {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }
}
