:root {
  color-scheme: light;
  --bg: #f4ecdf;
  --bg-deep: #ead7bc;
  --panel: rgba(255, 248, 239, 0.9);
  --line: rgba(97, 63, 38, 0.16);
  --ink: #352014;
  --muted: #7f644f;
  --brand: #9f4f2b;
  --brand-soft: #f1d0ba;
  --accent: #d58d45;
  --shadow: 0 18px 45px rgba(85, 48, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.58), transparent 24rem),
    linear-gradient(160deg, #f8f3ea 0%, #f1e3cf 54%, #e7caa9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

#app {
  position: relative;
  padding: 20px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 248, 239, 0.95), rgba(245, 225, 199, 0.9));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brand);
}

h1,
.panel-title,
.stat-card strong,
.producer-card strong,
.order-card strong,
.insight-box strong,
.inspector-box strong {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.5vw, 2.7rem);
}

.hero-copy {
  max-width: 760px;
  margin: 10px 0 0;
  line-height: 1.55;
}

.hero-copy,
.hero-note,
.micro-copy,
.order-card p,
.producer-card p,
.inspector-box p {
  color: var(--muted);
}

.hero-note {
  min-width: 280px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(122, 85, 53, 0.14);
  align-self: flex-end;
}

.hero-action {
  margin-top: 12px;
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 12px 14px;
  border-radius: 16px;
}

.stat-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(560px, 1fr) minmax(300px, 400px);
  gap: 14px;
}

.left-column,
.center-column,
.right-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel {
  border-radius: 24px;
  padding: 16px;
}

.level-list {
  display: grid;
  gap: 10px;
}

.level-card {
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(122, 85, 53, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
}

.level-card.selected {
  border-color: rgba(63, 107, 130, 0.62);
  box-shadow: 0 0 0 3px rgba(63, 107, 130, 0.12);
}

.challenge-entry {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(253, 238, 210, 0.92), rgba(255, 255, 255, 0.78));
}

.level-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.level-card strong {
  display: block;
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
}

.level-card p,
.level-card small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.level-index {
  color: #476f78;
  font-weight: 900;
}

.status-banner {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(122, 85, 53, 0.14);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.status-banner strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
}

.status-banner p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-banner.success {
  border-color: rgba(68, 113, 78, 0.35);
  background: linear-gradient(135deg, rgba(227, 246, 228, 0.94), rgba(255, 255, 255, 0.84));
}

.status-banner.warning {
  border-color: rgba(156, 80, 63, 0.38);
  background: linear-gradient(135deg, rgba(252, 228, 219, 0.94), rgba(255, 255, 255, 0.84));
}

.coach-panel {
  padding: 18px 20px;
  border-radius: 18px;
  color: #263522;
  background: linear-gradient(135deg, rgba(224, 241, 196, 0.96), rgba(255, 252, 236, 0.96));
  border: 2px solid rgba(80, 126, 55, 0.32);
  box-shadow: 0 16px 35px rgba(73, 112, 50, 0.14);
}

.coach-panel strong {
  display: block;
  margin-top: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
}

.coach-panel p {
  margin: 8px 0 0;
  color: #526548;
  line-height: 1.55;
}

.coach-label {
  color: #47712f;
  font-size: 12px;
  font-weight: 800;
}

.panel-title {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.producer-list,
.order-list {
  display: grid;
  gap: 10px;
}

.center-column .order-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.center-column .order-card {
  display: grid;
  align-content: space-between;
  min-height: 210px;
}

.producer-card,
.order-card,
.board-cell,
.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.producer-card,
.order-card {
  width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(122, 85, 53, 0.12);
  text-align: left;
}

.producer-card:hover,
.order-card:hover,
.board-cell:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
}

.board-cell.blocked:hover {
  transform: none;
}

.producer-card.recommended,
.order-card.recommended,
.board-cell.recommended,
.secondary-button.recommended {
  border-color: rgba(74, 135, 45, 0.65);
  box-shadow: 0 0 0 3px rgba(112, 172, 77, 0.2), 0 14px 28px rgba(74, 135, 45, 0.14);
}

.producer-top,
.order-head,
.order-meta,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.producer-meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--brand);
}

.rule-hint {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 250, 244, 0.78);
  border: 1px solid rgba(115, 83, 55, 0.12);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rule-hint strong {
  color: var(--ink);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
}

.button-row {
  margin-top: 12px;
}

.progress-row {
  display: grid;
  gap: 7px;
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(97, 63, 38, 0.12);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5f983f, #b4c95d);
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, #b45d35, #8d3f1d);
  color: #fffaf7;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.ghost-button {
  background: rgba(210, 154, 112, 0.18);
  color: var(--brand);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.board-panel {
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96), rgba(241, 225, 205, 0.9));
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.board-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.board-cell {
  min-height: 94px;
  border-radius: 18px;
  padding: 10px;
  border: 1px solid rgba(115, 83, 55, 0.12);
}

.board-cell.empty {
  background: rgba(255, 255, 255, 0.46);
  color: rgba(114, 86, 68, 0.48);
  font-size: 30px;
}

.board-cell.blocked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  cursor: not-allowed;
  color: rgba(88, 69, 55, 0.58);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(120, 94, 72, 0.12),
      rgba(120, 94, 72, 0.12) 8px,
      rgba(255, 255, 255, 0.4) 8px,
      rgba(255, 255, 255, 0.4) 16px
    );
}

.board-cell.filled {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  color: #2c1d13;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.56)),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, white), color-mix(in srgb, var(--accent) 62%, white));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.board-cell.selected {
  outline: 3px solid rgba(181, 95, 51, 0.85);
  outline-offset: 1px;
}

.cell-tier {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(53, 32, 20, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.board-cell small {
  color: rgba(53, 32, 20, 0.7);
}

.insight-box,
.inspector-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(115, 83, 55, 0.12);
}

.challenge-summary {
  background:
    linear-gradient(135deg, rgba(255, 247, 232, 0.96), rgba(234, 246, 231, 0.9));
}

.score-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(115, 83, 55, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.score-card.settled {
  border-color: rgba(74, 135, 45, 0.38);
}

.score-grade {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #476f38;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.metric-grid div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(115, 83, 55, 0.1);
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
}

.score-reasons {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.score-reasons li + li {
  margin-top: 6px;
}

.insight-box {
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(240, 217, 193, 0.62), rgba(255, 255, 255, 0.75));
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.reference-table th,
.reference-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(115, 83, 55, 0.1);
  text-align: left;
}

.reference-table th {
  color: var(--brand);
  font-weight: 700;
}

.log-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.log-list li + li {
  margin-top: 8px;
}

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

  .center-column .order-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  #app {
    padding: 16px;
  }

  .hero {
    flex-direction: column;
    padding: 20px;
  }

  .hero-note {
    min-width: 0;
    width: 100%;
  }

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

  .board-grid {
    gap: 8px;
  }

  .board-cell {
    min-height: 84px;
    padding: 8px;
  }
}
