/* A* Pathfinder Studio — high-contrast domain polish */

:root {
  --pf-ink: #14201a;
  --pf-paper: #f3f6f0;
  --pf-panel: #ffffff;
  --pf-line: #d5ddd3;
  --pf-wall: #243028;
  --pf-path: #d4a017;
  --pf-start: #1f7a4d;
  --pf-goal: #b33b3b;
  --pf-explored: #e8d9a8;
  --pf-accent: #2f6b4f;
  --pf-cell-size: clamp(1.75rem, 4vw, 2.5rem);
}

body.forge-page {
  color: var(--pf-ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(47, 107, 79, 0.16), transparent 42%),
    linear-gradient(180deg, #e8efe4 0%, var(--pf-paper) 48%, #eef2ea 100%);
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.25rem 0 0.75rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: #dce9e0;
  border: 1px solid var(--pf-line);
  box-shadow: 0 10px 24px rgba(20, 32, 26, 0.08);
}

.forge-title,
.forge-subtitle,
.section-title,
.kpi-label,
.kpi-value,
.hint,
.beta-note,
.result-banner {
  color: var(--pf-ink);
}

.forge-subtitle,
.hint,
.beta-note,
.kpi-label {
  opacity: 0.82;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(5.5rem, 1fr));
  gap: 0.65rem;
  width: min(100%, 42rem);
}

.kpi {
  background: var(--pf-panel);
  border: 1px solid var(--pf-line);
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
  box-shadow: 0 4px 14px rgba(20, 32, 26, 0.04);
}

.kpi-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.9fr);
  gap: 1.25rem;
  padding: 1rem 0 2rem;
}

.stage {
  min-height: 24rem;
}

.result-banner {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.95rem;
  border: 1px solid var(--pf-line);
  background: #fff;
}

.result-banner.neutral {
  background: #f7f8f5;
}

.result-banner.success {
  background: #e5f4ea;
  border-color: #b7d8c2;
  color: #145536;
}

.result-banner.error {
  background: #fceceb;
  border-color: #e5b4b4;
  color: #7a2020;
}

.path-grid {
  display: grid;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  padding: 0.9rem;
  border-radius: 1rem;
  background: var(--pf-panel);
  border: 1px solid var(--pf-line);
  box-shadow: 0 16px 40px rgba(20, 32, 26, 0.08);
}

.cell {
  width: var(--pf-cell-size);
  height: var(--pf-cell-size);
  border: 1px solid #c9d2c7;
  border-radius: 0.35rem;
  background: #f8faf6;
  color: var(--pf-ink);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.cell:hover,
.cell:focus-visible {
  transform: scale(1.04);
  outline: 2px solid #c9a227;
  outline-offset: 1px;
}

.cell.wall {
  background: var(--pf-wall);
  border-color: #141c17;
}

.cell.start {
  background: #3aa56c;
  color: #062416;
  border-color: #1f7a4d;
}

.cell.goal {
  background: #d65a5a;
  color: #3a1212;
  border-color: #b33b3b;
}

.cell.path {
  background: #f0c44a;
  border-color: #c9a227;
  box-shadow: inset 0 0 0 1px rgba(90, 60, 0, 0.2);
}

.cell.explored {
  background: var(--pf-explored);
  border-color: #d2bc7a;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  padding: 1rem;
  border-radius: 0.9rem;
  background: var(--pf-panel);
  border: 1px solid var(--pf-line);
  box-shadow: 0 8px 22px rgba(20, 32, 26, 0.05);
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mode-btn,
.forge-btn,
button.full {
  min-height: 2.75rem;
  border: 1px solid var(--pf-line);
  border-radius: 0.65rem;
  background: #f4f7f2;
  color: var(--pf-ink);
  font-weight: 600;
}

.mode-btn.active,
.forge-btn.primary,
button.primary {
  background: var(--pf-accent);
  border-color: #24563f;
  color: #fff;
}

.full {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.beta-note {
  margin-top: 0.85rem;
  font-size: 0.85rem;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.feedback-card textarea,
.card input,
.card select {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid var(--pf-line);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--pf-ink);
  padding: 0.55rem 0.7rem;
}

.feedback-card textarea {
  min-height: 4.5rem;
  resize: vertical;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
