:root {
  --bg: #F3EEE3;
  --bg-2: #EAE2D2;
  --surface: #FBF8F1;
  --surface-2: #F1EBDD;
  --ink: #1B2620;
  --muted: #5A655E;
  --primary: #1F3D2B;
  --primary-2: #2E5A3F;
  --gold: #A87B2E;
  --gold-light: #D4AF37;
  --danger: #8B3A2B;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(27, 38, 32, .10);
  --shadow-sm: 0 2px 10px rgba(27, 38, 32, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
}

/* subtle paper texture */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(168,123,46,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(31,61,43,.08), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; letter-spacing: .2px; color: var(--primary); margin: 0 0 .4rem; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.3rem; }

a { color: var(--primary); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.4rem;
  background: rgba(251,248,241,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(31,61,43,.12);
}

.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--primary); }
.brand-mark { font-size: 1.8rem; color: var(--gold); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 1.15rem; }
.brand-sub { font-size: .78rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.nav-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--ink); padding: .45rem .85rem; border-radius: 999px;
  font-size: .92rem; font-weight: 500; cursor: pointer; transition: all .2s;
}
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.active { background: var(--primary); color: var(--surface); border-color: var(--primary); }

main { max-width: 1280px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }

.view { display: none; }
.view.active { display: block; }

.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--surface); border-radius: var(--radius); padding: 2.4rem;
  box-shadow: var(--shadow); margin-bottom: 1.6rem; overflow: hidden; position: relative;
}
.hero::after {
  content: "♠ ♥ ♦ ♣";
  position: absolute; right: -1rem; bottom: -2rem;
  font-size: 8rem; opacity: .08; letter-spacing: .3rem; pointer-events: none;
}
.hero-text { z-index: 1; }
.eyebrow { display: inline-block; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-light); margin-bottom: .6rem; }
.hero h1 { color: var(--surface); }
.lead { color: rgba(251,248,241,.85); font-size: 1.05rem; max-width: 52ch; margin: .6rem 0 1.2rem; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.btn-primary { background: var(--gold-light); color: var(--primary); }
.btn-primary:hover { background: var(--gold); color: var(--surface); }
.btn-ghost { background: transparent; border-color: rgba(251,248,241,.4); color: var(--surface); }
.btn-ghost:hover { background: rgba(251,248,241,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hero-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; align-content: center;
}
.stat {
  background: rgba(251,248,241,.10); border: 1px solid rgba(251,248,241,.18);
  border-radius: 12px; padding: 1rem; text-align: center;
}
.stat-num { display: block; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 2rem; font-weight: 700; color: var(--gold-light); }
.stat-label { display: block; font-size: .78rem; color: rgba(251,248,241,.75); margin-top: .2rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.card {
  background: var(--surface); border-radius: var(--radius); padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(31,61,43,.08);
  margin-bottom: 1.2rem;
}
.card h2 { margin-bottom: .3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .8rem 0 1rem; }
.toolbar input, .toolbar select {
  padding: .6rem .85rem; border-radius: 10px; border: 1px solid rgba(31,61,43,.18);
  background: var(--surface); font: inherit; color: var(--ink); min-width: 200px;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,61,43,.12); }

.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid rgba(31,61,43,.08); }
th { background: var(--surface-2); color: var(--primary); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; }
tbody tr:hover { background: rgba(31,61,43,.03); }
tbody tr:nth-child(even) { background: rgba(31,61,43,.015); }

.win-list {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  position: relative;
  border-left: 2px solid rgba(168, 123, 46, .28);
  padding-left: 1.1rem;
  margin-left: .5rem;
}
.win-item {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  padding: .7rem .85rem;
  border-radius: 10px;
  background: var(--surface-2);
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.win-item:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.win-item::before {
  content: "";
  position: absolute;
  left: calc(-1.1rem - 7px);
  top: 1.15rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-light);
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 2px var(--surface);
}
.win-year {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 4.6rem;
  flex-shrink: 0;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}
.win-month {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Inter', sans-serif;
}
.win-y {
  font-size: 1.25rem;
  color: var(--gold);
  font-weight: 700;
}
.win-body {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex: 1;
  min-width: 0;
}
.win-tourney {
  font-weight: 600;
  color: var(--primary);
  font-size: .94rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
}
.win-champ {
  font-size: .88rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  line-height: 1.4;
}
.champ-lead {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
}
.champ-sep {
  color: var(--gold);
  font-weight: 700;
  padding: 0 .15rem;
}

/* Team capsule & Hover Tooltip */
.team-capsule {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid rgba(31, 61, 43, .18);
  border-radius: 6px;
  padding: .15rem .5rem;
  cursor: pointer;
  transition: all .15s ease;
}
.team-capsule:hover,
.team-capsule:focus,
.team-capsule:focus-within {
  background: var(--surface-2);
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(31, 61, 43, .1);
}
.team-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  background: var(--ink);
  color: var(--surface);
  border-radius: 10px;
  padding: .65rem .85rem;
  font-size: .8rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .28);
  z-index: 1000;
  min-width: 220px;
  max-width: 320px;
  pointer-events: auto;
}
.team-capsule:hover .team-tooltip,
.team-capsule:focus .team-tooltip,
.team-capsule:focus-within .team-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}
.team-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.team-tt-head {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gold-light);
  margin-bottom: .4rem;
  border-bottom: 1px solid rgba(251, 248, 241, .15);
  padding-bottom: .25rem;
}
.team-tt-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.team-tt-list li {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  white-space: nowrap;
}
.team-tt-list li::before {
  content: "•";
  color: var(--gold-light);
  font-weight: bold;
}
.team-tt-list .profile-link {
  color: var(--surface);
  text-decoration: underline;
  text-decoration-color: rgba(212, 175, 55, .5);
}
.team-tt-list .profile-link:hover {
  color: var(--gold-light);
}

/* Women's badge */
.tag-womens {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #FDF2F7;
  color: #9D174D;
  border: 1px solid rgba(157, 23, 77, .25);
  vertical-align: middle;
}

.leader-list { display: flex; flex-direction: column; gap: .4rem; }
.leader-row {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 10px;
  background: var(--surface-2);
}
.leader-rank {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.leader-row:nth-child(1) .leader-rank { background: var(--gold-light); color: var(--primary); }
.leader-row:nth-child(2) .leader-rank { background: #C0C0C0; color: var(--ink); }
.leader-row:nth-child(3) .leader-rank { background: #CD7F32; color: var(--surface); }
.leader-name { flex: 1; font-weight: 500; }
.leader-badge { font-size: .8rem; color: var(--muted); background: var(--surface); padding: .25rem .6rem; border-radius: 999px; border: 1px solid rgba(31,61,43,.1); }

/* Profile */
.profile-area { margin-top: 1rem; }
.profile-header {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.2rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--surface); margin-bottom: 1rem;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gold-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.8rem; font-weight: 700;
  flex-shrink: 0;
}
.profile-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.8rem; margin: 0; color: var(--surface); }
.profile-code { font-size: .85rem; color: rgba(251,248,241,.75); margin: .1rem 0 .4rem; }
.profile-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: rgba(251,248,241,.15); color: var(--surface); border: 1px solid rgba(251,248,241,.25);
}
.badge.gold { background: var(--gold-light); color: var(--primary); }

.profile-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem;
}
.pstat {
  background: var(--surface-2); border-radius: 12px; padding: .9rem; text-align: center;
}
.pstat-num { display: block; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.7rem; font-weight: 700; color: var(--primary); }
.pstat-label { display: block; font-size: .76rem; color: var(--muted); margin-top: .15rem; }

.trophy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem;
  margin: 1rem 0;
}
.trophy {
  background: var(--surface-2); border-radius: 12px; padding: 1rem;
  border-left: 4px solid var(--gold); transition: transform .2s;
}
.trophy:hover { transform: translateY(-2px); }
.trophy-name { font-weight: 600; color: var(--primary); font-size: .92rem; margin-bottom: .3rem; }
.trophy-meta { font-size: .8rem; color: var(--muted); }
.trophy-count {
  display: inline-block; background: var(--gold-light); color: var(--primary);
  font-weight: 700; font-size: .78rem; padding: .15rem .5rem; border-radius: 999px; margin-top: .4rem;
}

.subsection { margin-top: 1.2rem; }
.subsection h3 { margin-bottom: .5rem; }

.scroll-area { max-height: 420px; overflow-y: auto; padding-right: .4rem; }
.tourn-leader {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-bottom: 1px solid rgba(31,61,43,.06);
}
.tourn-leader:last-child { border-bottom: none; }
.tourn-name { flex: 1; font-size: .9rem; }
.tourn-top { font-weight: 600; color: var(--primary); font-size: .88rem; }
.tourn-count { font-size: .78rem; color: var(--muted); white-space: nowrap; }

.chart-wrap { background: var(--surface-2); border-radius: 12px; padding: 1rem; margin-top: .8rem; }
canvas { width: 100%; height: 180px; display: block; }

.podium-list { display: flex; flex-direction: column; gap: .4rem; }

.badge-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.milestone {
  display: inline-block; padding: .25rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--primary); border: 1px solid rgba(31,61,43,.12);
}
.milestone:hover { background: var(--primary); color: var(--surface); }
.subh { margin: 1rem 0 .4rem; font-size: 1.15rem; color: var(--primary); }
.footer p { margin: .35rem 0; }
.footer a { color: inherit; text-underline-offset: .2em; }
.footer a:hover, .footer a:focus-visible { color: var(--primary); }

/* profile links */
.profile-link { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); font-weight: 600; }
.profile-link:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* tournament tier badges */
.tier {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 700; padding: .18rem .5rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap; vertical-align: middle;
}
.tier-intl { background: linear-gradient(135deg,#D4AF37,#A87B2E); color: #1B2620; }
.tier-national { background: #2E5A3F; color: #FBF8F1; }
.tier-state { background: #1F3D2B; color: #FBF8F1; }
.tier-club { background: var(--surface-2); color: var(--muted); border-color: rgba(31,61,43,.15); }
.kind { font-size: .72rem; padding: .18rem .5rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; margin-left: .2rem; }
.kind-champ { background: rgba(168,123,46,.15); color: var(--gold); border: 1px solid rgba(168,123,46,.3); }
.kind-open { background: rgba(31,61,43,.08); color: var(--primary); border: 1px solid rgba(31,61,43,.18); }
.fmt { font-size: .72rem; color: var(--muted); margin-left: .2rem; white-space: nowrap; vertical-align: middle; }
.tourn-name-inline { font-weight: 600; color: var(--primary); }

.trophy.tier-intl { border-left-color: var(--gold-light); background: linear-gradient(135deg, #FBF8F1, #F3E9C8); }
.trophy.tier-national { border-left-color: #2E5A3F; }
.trophy.tier-state { border-left-color: var(--primary); }
.trophy.tier-club { border-left-color: #B7A98A; }

.wiki-link { color: var(--gold); font-size: .85rem; margin-left: .4rem; }
.win-tourney { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 1.8rem; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .nav { justify-content: center; }
}
@media (max-width: 520px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-header { flex-direction: column; align-items: flex-start; }
}

/* timeline (Hall da Fama) */
.timeline {
  display: flex; align-items: stretch; gap: .5rem; overflow-x: auto; padding: .6rem .2rem 1.2rem;
  position: relative;
}
.timeline::before {
  content: ''; position: absolute; left: 1rem; right: 1rem; top: 50%; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--gold-light)); opacity: .25; z-index: 0; transform: translateY(-50%);
}
.timeline-node {
  position: relative; z-index: 1; flex: 1; min-width: 62px;
  background: var(--surface); border: 1px solid rgba(31,61,43,.18);
  border-radius: 12px; padding: .55rem .35rem; text-align: center; cursor: pointer;
  transition: all .2s; color: var(--muted); font-weight: 600; font-size: .85rem;
}
.timeline-node:hover { transform: translateY(-4px); box-shadow: var(--shadow-sm); color: var(--primary); border-color: var(--primary); }
.timeline-node.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--surface);
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(168,123,46,.35);
}
.timeline-node .node-year { display:block; font-family:'Cormorant Garamond', Georgia, serif; font-size: 1.15rem; font-weight: 700; }
