:root {
  --bg: #f6f1e8;
  --paper: #fffaf0;
  --ink: #272016;
  --muted: #756b5b;
  --line: #d8cbb7;
  --accent: #7b4f24;
  --accent-2: #315c48;
  --danger: #8a3d2c;
  --shadow: 0 18px 50px rgba(47, 35, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #fff8e6 0, var(--bg) 42%, #eadfcb 100%);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

button,
.import-label {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 700;
}

button:hover,
.import-label:hover {
  filter: brightness(1.05);
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

.import-label input {
  display: none;
}

.app-header {
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: stretch;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
}

.subtitle,
.muted {
  color: var(--muted);
}

.player-card {
  min-width: 230px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

.panel {
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.domain-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem;
  background: #fffdf7;
}

.domain-card strong {
  display: block;
  margin-bottom: 0.4rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid var(--line);
}

.green_path {
  background: #dff1df;
  color: #23512a;
}

.yellow_bridge {
  background: #fff2bf;
  color: #6b4c00;
}

.red_ruin {
  background: #f7d6cf;
  color: #742718;
}

.spark {
  background: #e7ddff;
  color: #412471;
}

.unknown {
  background: #eee8dc;
  color: #5c5245;
}

.scan-card {
  display: grid;
  gap: 1rem;
}

.story-box,
.challenge-box,
.parent-box {
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: #fffdf7;
  padding: 1rem;
}

.challenge-box ol,
.challenge-box ul {
  padding-left: 1.25rem;
}

code {
  background: #efe4d2;
  border-radius: 0.3rem;
  padding: 0.08rem 0.3rem;
}

.feedback-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

label.full {
  grid-column: 1 / -1;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fffdf7;
  color: var(--ink);
  padding: 0.7rem;
}

.feedback-form button {
  grid-column: 1 / -1;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recommendations {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recommendation {
  border-left: 4px solid var(--accent-2);
  background: #fffdf7;
  border-radius: 0.5rem;
  padding: 0.7rem;
}

.history-output {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  background: #2a2118;
  color: #fff2d6;
  border-radius: 1rem;
  padding: 1rem;
  font-size: 0.82rem;
}

@media (max-width: 980px) {
  .app-header,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .app-header {
    padding: 1rem;
  }

  .layout {
    padding: 0 1rem 1rem;
  }

  .feedback-form {
    grid-template-columns: 1fr;
  }
}
