:root {
  --navy: #1b2a4a;
  --gold: #b8862b;
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #222222;
  --muted: #6b7280;
  --green: #1a7f4b;
  --red: #b3261e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
.wide { max-width: 1100px; }
.card {
  background: var(--card); border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px;
}
.brand { color: var(--navy); font-weight: 800; letter-spacing: .5px; }
.brand span { color: var(--gold); }
h1 { font-size: 1.5rem; color: var(--navy); }
h2 { font-size: 1.15rem; color: var(--navy); margin-bottom: 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.score-ring {
  width: 160px; height: 160px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 16px auto; color: #fff; text-align: center;
}
.score-ring .num { font-size: 2.4rem; font-weight: 800; }
.grade-A\+, .grade-A { background: var(--green); }
.grade-B { background: #4a7c1a; }
.grade-C { background: var(--gold); }
.grade-D { background: #c46a1a; }
.grade-E { background: var(--red); }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; }
.stat-row:last-child { border-bottom: none; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee; }
th { background: var(--navy); color: #fff; }
tr:nth-child(even) td { background: #faf8f4; }
.btn {
  display: inline-block; background: var(--navy); color: #fff; border: none;
  padding: 12px 18px; border-radius: 8px; font-size: 1rem; cursor: pointer;
  text-decoration: none; min-height: 44px; box-sizing: border-box;
  line-height: 1.2;
}
.btn.gold { background: var(--gold); }
input, select {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 1rem; margin-bottom: 12px;
}
.error { color: var(--red); margin-bottom: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .75rem; color: #fff; }
.badge.high { background: var(--green); }
.badge.medium { background: var(--gold); }
.badge.low { background: var(--muted); }
.badge.flagged { background: var(--red); }
.topbar { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.topbar a { color: #f0d9a8; text-decoration: none; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 14px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-card .big { font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.center { text-align: center; }
.mt { margin-top: 16px; }

.explain-row { margin-bottom: 16px; }
.explain-row:last-child { margin-bottom: 0; }
.explain-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.explain-head .label { font-weight: 700; color: var(--navy); }
.explain-head .weight { color: var(--muted); font-size: .8rem; margin-left: 6px; font-weight: 400; }
.explain-rating { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; color: #fff; }
.rating-excellent { background: var(--green); }
.rating-strong { background: #4a7c1a; }
.rating-fair { background: var(--gold); }
.rating-weak { background: #c46a1a; }
.rating-very-weak { background: var(--red); }
.explain-bar-bg { background: #eee; border-radius: 6px; height: 10px; overflow: hidden; }
.explain-bar-fill { height: 100%; border-radius: 6px; }
.explain-detail { color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* Mobile: this app is primarily used on phones — tighten touch targets and
   fix layouts that only worked in a wide flex row (topbar, wide tables). */
@media (max-width: 480px) {
  .topbar {
    flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 16px;
  }
  .topbar > span:last-child {
    display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .85rem; width: 100%;
  }
  .container { padding: 12px; }
  .card { padding: 16px; }
  h1 { font-size: 1.3rem; }
  .score-ring { width: 140px; height: 140px; }
  .score-ring .num { font-size: 2rem; }
  table { font-size: .82rem; }
  th, td { padding: 7px 8px; }
  .stat-row { flex-wrap: wrap; gap: 2px 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  input, select, textarea { font-size: 16px; } /* prevents iOS auto-zoom on focus */
}
