:root {
  --ink: #17130f;
  --muted: #6d6258;
  --paper: #f7f1e7;
  --surface: #fffaf0;
  --line: #d9cbb8;
  --accent: #b64d2e;
  --accent-dark: #7f2e1b;
  --gold: #d39b34;
  --green: #2f7a58;
  --amber: #a46b16;
  --red: #9b2f23;
  --shadow: 0 22px 70px rgba(58, 36, 20, 0.16);
}

* {
  box-sizing: border-box;
}
/* Top Navigation */
.top-nav{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:16px;
    margin-bottom:20px;
    flex-wrap:wrap;
}

.top-nav a{
    text-decoration:none;
    color:var(--accent-dark,#2b2118);
    font-weight:600;
    padding:8px 16px;
    border:1px solid var(--line,#ddd);
    border-radius:8px;
    background:var(--paper,#fff);
    transition:.25s;
}

.top-nav a:hover,
.top-nav a.active{
    background:#ff6b00;
    color:#fff;
    border-color:#ff6b00;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    linear-gradient(90deg, rgba(23, 19, 15, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 19, 15, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 22% 12%, rgba(211, 155, 52, 0.2), transparent 28rem),
    radial-gradient(circle at 90% 4%, rgba(182, 77, 46, 0.16), transparent 24rem),
    var(--paper);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.4vw, 2.1rem);
  line-height: 1;
}

.lede {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  line-height: 1.55;
}

.weight-strip {
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 16px;
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: 7px 7px 0 var(--ink);
  font-family: "Trebuchet MS", Verdana, sans-serif;
}
a:link {
  color: rgb(55, 0, 128);
  background-color: transparent;
  text-decoration: none;
}
.weight-strip span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(320px, 1.12fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.input-panel {
  padding: 22px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fffdf7;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(182, 77, 46, 0.18);
}

button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  color: #fffaf0;
  background: var(--accent);
  cursor: pointer;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover,
button:focus-visible {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.hint,
.error {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.error {
  color: var(--red);
  font-weight: 700;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.summary-card {
  display: grid;
  min-height: 148px;
  padding: 18px;
  background: #fffaf0;
}

.summary-card span,
.summary-card small,
.metric-label,
.category-chip,
th,
td,
.score-note {
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  align-self: center;
  font-size: clamp(3rem, 6vw, 5rem);
  line-height: 0.9;
}

.summary-card small {
  color: var(--muted);
  line-height: 1.35;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.compat-card {
  padding: 22px;
}

.compat-card.combined {
  grid-column: 1 / -1;
  border-color: var(--ink);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card-top h3 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.metric-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.number-seal {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
  font-size: 2rem;
  font-weight: 800;
}

.compat-list,
.score-list {
  display: grid;
  gap: 8px;
}

.compat-row,
.score-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
}

.num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf7;
  font-weight: 800;
}

.bar {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eee2d0;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: var(--bar-color);
  transition: width 360ms ease;
}

.category-chip {
  min-width: 120px;
  padding: 6px 9px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cat-most {
  --bar-color: var(--green);
  color: #f7fff9;
  background: var(--green);
}

.cat-compatible {
  --bar-color: #5f8752;
  color: #f7fff9;
  background: #5f8752;
}

.cat-neutral {
  --bar-color: var(--gold);
  color: var(--ink);
  background: #efc76d;
}

.cat-caution {
  --bar-color: var(--amber);
  color: #fffaf0;
  background: var(--amber);
}

.cat-avoid {
  --bar-color: var(--red);
  color: #fffaf0;
  background: var(--red);
}

.score-row {
  grid-template-columns: 42px 1fr 64px;
}

.score-value {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 900;
  text-align: right;
}

.score-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.rules-panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.rules-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td:first-child {
  font-weight: 900;
}

@media (max-width: 860px) {
  .intro,
  .workbench,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .compat-card.combined {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 22px 0;
  }

  .card-top,
  .section-heading {
    display: grid;
  }

  .category-chip {
    min-width: 94px;
    font-size: 0.68rem;
  }
}

/* Compact mobile-first dashboard pass */
:root {
  --shadow: 0 10px 28px rgba(58, 36, 20, 0.11);
}

.shell {
  width: min(100% - 16px, 1180px);
  padding: 10px 0 18px;
}

.intro {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.eyebrow {
  margin-bottom: 3px;
  font-size: 0.62rem;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 10vw, 2.7rem);
  line-height: 0.95;
}

.lede,
.hint {
  display: none;
}

.weight-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 0;
  gap: 1px;
  padding: 0;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.68rem;
}

.weight-strip span {
  display: grid;
  gap: 1px;
  justify-items: center;
  padding: 6px 5px;
  background: #fffaf0;
}

.workbench {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.panel {
  border-radius: 6px;
}

.input-panel,
.compat-card,
.rules-panel {
  padding: 10px;
}

label {
  margin-bottom: 5px;
  font-size: 0.76rem;
}

.input-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

input,
button {
  min-height: 38px;
  border-radius: 5px;
}

input {
  padding: 0 9px;
}

button {
  padding: 0 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.error {
  margin-top: 6px;
  font-size: 0.76rem;
}

.summary-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-card {
  min-height: 62px;
  padding: 7px;
  align-content: center;
  gap: 2px;
}

.summary-card span {
  font-size: 0.58rem;
}

.summary-card strong {
  font-size: clamp(1.8rem, 10vw, 2.45rem);
}

.summary-card small {
  font-size: 0.62rem;
  line-height: 1.15;
}

.results-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.empty-state {
  padding: 14px;
  font-size: 0.82rem;
}

.compat-card.combined {
  grid-column: 1 / -1;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-top h3 {
  font-size: 0.96rem;
  line-height: 1.05;
}

.metric-label {
  margin-top: 2px;
  font-size: 0.66rem;
  line-height: 1.2;
}

.number-seal {
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
}

.compact-list {
  gap: 4px;
}

.compat-bucket {
  display: grid;
  grid-template-columns: minmax(58px, 0.82fr) minmax(0, 1fr);
  gap: 5px;
  align-items: center;
}

.compat-bucket strong {
  overflow: hidden;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chip {
  min-width: 0;
  padding: 3px 5px;
  font-size: 0.54rem;
  line-height: 1.05;
}

.score-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.score-row {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
}

.score-row .bar {
  display: none;
}

.num {
  width: 22px;
  height: 22px;
  font-size: 0.78rem;
}

.score-value {
  font-size: 0.78rem;
  text-align: left;
}

.score-note {
  display: none;
}

.rules-panel {
  margin-top: 4px;
}

.section-heading {
  display: flex;
  margin-bottom: 8px;
}

th,
td {
  padding: 8px;
  font-size: 0.8rem;
}

@media (min-width: 720px) {
  .shell {
    width: min(1180px, calc(100% - 32px));
    padding: 24px 0;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 310px;
    align-items: end;
    gap: 18px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: clamp(2.4rem, 5vw, 4.6rem);
  }

  .lede,
  .hint {
    display: block;
  }

  .workbench {
    grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
    gap: 12px;
    margin-bottom: 12px;
  }

  .input-panel,
  .compat-card,
  .rules-panel {
    padding: 16px;
  }

  input,
  button {
    min-height: 44px;
  }

  .summary-card {
    min-height: 94px;
    padding: 12px;
  }

  .summary-card strong {
    font-size: 3.25rem;
  }

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

  .compat-card.combined {
    grid-column: 1 / -1;
  }

  .score-list {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .score-row {
    grid-template-columns: 26px 1fr;
  }
}

/* Compact progress bars restored */
.bucket-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.bucket-bar {
  display: block;
  height: 5px;
  border: 0;
  background: #eadbc8;
}

.score-row {
  grid-template-columns: 22px minmax(0, 1fr) 34px;
  border-radius: 7px;
}

.score-row .bar {
  display: block;
  height: 7px;
}

.score-value {
  font-size: 0.72rem;
  text-align: right;
}

@media (min-width: 720px) {
  .score-row {
    grid-template-columns: 24px minmax(0, 1fr) 34px;
  }

  .score-row .bar {
    height: 8px;
  }
}

/* Desktop restores the original spacious design */
.full-list {
  display: none;
}

@media (min-width: 1024px) {
  :root {
    --shadow: 0 22px 70px rgba(58, 36, 20, 0.16);
  }

  .shell {
    width: min(1180px, calc(100% - 32px));
    padding: 40px 0;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    margin-bottom: 24px;
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 0.76rem;
  }

  h1 {
    max-width: 760px;
    margin-bottom: 12px;
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    line-height: 0.92;
  }

  .lede,
  .hint {
    display: block;
  }

  .weight-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 220px;
    padding: 16px;
    overflow: visible;
    box-shadow: 7px 7px 0 var(--ink);
    font-size: 1rem;
  }

  .weight-strip span {
    display: flex;
    justify-content: space-between;
    justify-items: normal;
    gap: 16px;
    padding: 0;
    background: transparent;
  }

  .workbench {
    grid-template-columns: minmax(280px, 0.88fr) minmax(320px, 1.12fr);
    gap: 18px;
    margin-bottom: 18px;
  }

  .panel {
    border-radius: 8px;
  }

  .input-panel,
  .compat-card,
  .rules-panel {
    padding: 22px;
  }

  label {
    margin-bottom: 10px;
    font-size: 0.9rem;
  }

  .input-row {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  input,
  button {
    min-height: 48px;
    border-radius: 6px;
  }

  input {
    padding: 0 14px;
  }

  button {
    padding: 0 18px;
    font-size: 1rem;
  }

  .hint,
  .error {
    margin-top: 12px;
    font-size: 0.9rem;
  }

  .summary-panel {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-card {
    min-height: 148px;
    padding: 18px;
    align-content: normal;
  }

  .summary-card span {
    font-size: 0.78rem;
  }

  .summary-card strong {
    font-size: clamp(3rem, 6vw, 5rem);
  }

  .summary-card small {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
  }

  .compat-card.combined {
    grid-column: 1 / -1;
  }

  .card-top {
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
  }

  .card-top h3 {
    font-size: 1.55rem;
    line-height: 1.1;
  }

  .metric-label {
    margin-top: 5px;
    font-size: 0.82rem;
    line-height: normal;
  }

  .number-seal {
    width: 58px;
    height: 58px;
    font-size: 2rem;
  }

  .compact-list {
    display: none;
  }

  .full-list {
    display: grid;
    gap: 8px;
  }

  .compat-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 10px;
    align-items: center;
  }

  .score-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .score-row {
    grid-template-columns: 42px 1fr 64px;
    gap: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .score-row .bar {
    display: block;
    height: 12px;
  }

  .num {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .bar {
    height: 12px;
  }

  .category-chip {
    min-width: 120px;
    padding: 6px 9px;
    font-size: 0.76rem;
    line-height: normal;
  }

  .score-value {
    font-size: 1rem;
    text-align: right;
  }

  .score-note {
    display: block;
    margin-top: 14px;
    font-size: 0.86rem;
  }

  .section-heading {
    margin-bottom: 16px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 1rem;
  }
}
