:root {
  --red: #b3202a;
  --green: #1f6b45;
  --gold: #c99a2e;
  --cream: #fff8ec;
  --ink: #2b2220;
  --muted: #7a6a63;
  --line: #ecdfc8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-rounded, "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
}
header.hero {
  background: linear-gradient(135deg, var(--red), #7e141c);
  color: #fff;
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  border-bottom: 6px solid var(--gold);
}
header.hero h1 { margin: 0 0 .25rem; font-size: clamp(1.6rem, 5vw, 2.4rem); }
header.hero p { margin: 0; opacity: .9; }
main { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 6px rgb(0 0 0 / .04);
}
.card h2 { margin: 0 0 .5rem; font-size: 1.2rem; color: var(--red); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; flex-direction: column; gap: .15rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.steps li b { color: var(--red); }
.steps li span { color: var(--ink); }
.steps li:last-child { border-bottom: 0; }
.step-label {
  flex: none; min-width: 4.5rem; text-align: center;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--red); color: #fff; padding: .15rem .6rem; border-radius: 999px;
}
form.row, .row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=password], select {
  flex: 1 1 200px;
  font: inherit;
  padding: .6rem .75rem;
  border: 1px solid #d8c8ac;
  border-radius: 10px;
  background: #fff;
}
button {
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.1rem;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.secondary { background: #efe5d2; color: var(--ink); }
button.danger { background: #efd6d6; color: var(--red); }
button.small { padding: .3rem .6rem; font-size: .85rem; }
.msg { margin: .6rem 0 0; min-height: 1.2em; font-size: .95rem; }
.msg.error { color: var(--red); }
.msg.ok { color: var(--green); }
.muted { color: var(--muted); }
ul.entrants { list-style: none; margin: .5rem 0 0; padding: 0; }
ul.entrants li {
  display: flex; justify-content: space-between; gap: .5rem; align-items: center;
  padding: .5rem 0; border-bottom: 1px dashed var(--line);
}
ul.entrants li:last-child { border-bottom: 0; }
ul.entrants li.me { background: #fff6d9; margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 8px; }
.tag {
  font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px;
  background: #e4f1e9; color: var(--green); white-space: nowrap;
}
.tag.pending { background: #f3ede0; color: var(--muted); font-weight: 500; }
ul.ideas { list-style: none; margin: .25rem 0 0; padding: 0; }
ul.ideas li { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
ul.ideas li:last-child { border-bottom: 0; }
.cat-icon { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.cat-body { flex: 1; min-width: 0; }
.cat-name { font-weight: 700; }
.cat-counts { color: var(--muted); font-size: .9rem; }
.cat-score { color: var(--green); font-size: .85rem; font-weight: 700; margin-top: .1rem; }
.picks-summary { font-weight: 650; margin: .35rem 0 .15rem; min-height: 1.4em; }
button.rank { min-width: 4.4rem; background: var(--gold); color: #2b2220; }
button.pick { min-width: 4.4rem; }
button.mine { background: var(--gold); color: #2b2220; }
ul.tiers { margin: .4rem 0 .6rem; padding-left: 1.2rem; }
ul.tiers li { margin: .2rem 0; }
ul.tiers b { color: var(--red); }
.footnote { margin: .25rem 0 0; font-size: .78rem; line-height: 1.4; color: var(--muted); }
.h2h { margin: .9rem 0 1rem; }
.h2h-labels { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.h2h-side { flex: 1; min-width: 0; }
.h2h-side.right { text-align: right; }
.h2h-side .n { font-weight: 700; line-height: 1.25; }
.h2h-side .v { font-size: .9rem; font-weight: 700; }
.h2h-side.left .v { color: var(--green); }
.h2h-side.right .v { color: var(--red); }
.h2h-bar { display: flex; height: 1.7rem; border-radius: 999px; overflow: hidden; background: #e6dac4; gap: 2px; }
.h2h-seg { height: 100%; transition: width .6s ease; }
.h2h-seg.a { background: var(--green); }
.h2h-seg.b { background: var(--red); }
.h2h-bar.empty .h2h-seg { background: #e6dac4; }
.h2h-note { margin: .4rem 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
ol.trend { list-style: none; margin: .6rem 0 0; padding: 0; }
ol.trend li { display: grid; grid-template-columns: 1.6rem 2.4rem 1fr; gap: .6rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
ol.trend li:last-child { border-bottom: 0; }
.trend-rank { font-weight: 800; color: var(--red); text-align: center; }
.trend-icon { width: 2.4rem; height: 2.4rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.trend-name { font-weight: 700; line-height: 1.2; min-width: 0; }
.trend-track { height: .75rem; background: #f3ead8; border-radius: 999px; overflow: hidden; margin: .3rem 0 .25rem; }
.trend-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .6s ease; }
.trend-meta { font-size: .82rem; color: var(--muted); }
.trend-meta b { color: var(--green); }
ol.trend li.top .trend-rank { color: var(--gold); }
button:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.banner {
  background: #e4f1e9; border: 1px solid #b9dcc6; color: var(--green);
  padding: .9rem 1rem; border-radius: 12px; margin-bottom: 1.25rem; font-weight: 600;
}
.bracket-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: .5rem; }
.bracket-grid div { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.bracket-grid b { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #e4f1e9; color: var(--green); padding: .25rem .4rem .25rem .7rem; border-radius: 999px; font-weight: 600; }
.chip button { padding: 0 .4rem; background: transparent; color: var(--green); font-size: 1.1rem; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: .45rem .25rem; border-bottom: 1px dashed var(--line); }
td.actions { text-align: right; white-space: nowrap; }
textarea { width: 100%; min-height: 8rem; font: inherit; padding: .6rem; border: 1px solid #d8c8ac; border-radius: 10px; }
.hidden { display: none !important; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Phones */
@media (max-width: 520px) {
  header.hero { padding: 1.75rem 1rem 1.4rem; }
  header.hero h1 { font-size: 1.5rem; line-height: 1.2; }
  main { padding: .9rem .7rem 2.5rem; }
  .card { padding: 1rem; border-radius: 12px; margin-bottom: 1rem; }
  .card h2 { font-size: 1.1rem; }
  .steps li { padding: .6rem 0; }
  .muted, .footnote { font-size: .92rem; }
  .footnote { font-size: .78rem; }
  input[type=text], input[type=password] { flex-basis: 100%; font-size: 16px; }
  ul.tiers { padding-left: 1.1rem; }
  ul.ideas li { gap: .6rem; padding: .6rem 0; }
  .cat-icon { width: 46px; height: 46px; border-radius: 10px; }
  .cat-name { font-size: .97rem; line-height: 1.25; }
  .cat-counts { font-size: .85rem; line-height: 1.35; }
  button.rank, button.pick { min-width: 3.5rem; padding: .5rem .6rem; }
  .h2h-labels { gap: .5rem; }
  .h2h-side .n { font-size: .92rem; }
  .h2h-side .v { font-size: .82rem; }
  .h2h-note { font-size: .8rem; }
  .banner { font-size: .95rem; }
  .bracket-grid { grid-template-columns: 1fr 1fr; }
}

/* Finger-friendly tap targets */
@media (pointer: coarse) {
  button { min-height: 44px; }
  button.small { min-height: 40px; padding: .4rem .7rem; }
  .chip button { min-height: 32px; }
  input[type=text], input[type=password], select { min-height: 44px; }
}
