:root { --bg: #0f1115; --card: #181b22; --line: #2a2f3a; --text: #e8eaee; --muted: #98a0ae; --accent: #6aa9ff; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 22px; }
.brand { margin: 0 0 10px; color: var(--muted); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.15; max-width: 22ch; }
.tagline { margin: 0 0 18px; color: var(--muted); max-width: 60ch; }
button { font: inherit; cursor: pointer; }
input[type=search], select { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; }
input[type=search] { width: 100%; min-width: 0; }
.search { position: relative; min-width: 0; }
.search.big { max-width: 640px; }
.search.big input[type=search] { padding: 14px 16px; font-size: 18px; border-radius: 12px; border: 2px solid var(--accent); }
.search.big input[type=search]:focus { outline: 3px solid rgba(106, 169, 255, .35); }
#suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
#suggest li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
#suggest li[aria-selected=true] { background: var(--accent); color: #0b1220; }
#suggest li .count { color: var(--muted); font-size: 14px; } #suggest li[aria-selected=true] .count { color: #0b1220; }
.picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 18px; }
.picks .label { color: var(--muted); font-size: 14px; }
.chip { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #0b1220; }
.chip .n { color: var(--muted); margin-left: 6px; } .chip[aria-pressed=true] .n { color: #0b1220; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: #0b1220; border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn:focus-visible, .chip:focus-visible { outline: 3px solid rgba(106, 169, 255, .5); outline-offset: 2px; }

/* featured clip */
#hero:empty { display: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 18px; }
.hero video, .hero .fallback { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; display: block; }
.hero .info { display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 0; }
.hero .kicker { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.hero .meta { color: var(--muted); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* mood tags: colour plus the word, never colour alone */
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 13px; margin: 0 6px 4px 0; }
.tag.mood { font-weight: 700; border-color: transparent; color: #0b1220; }
.tag.mood[data-mood=warm_friendly] { background: #f2b35e; }
.tag.mood[data-mood=routine_neutral] { background: #9fb4cc; }
.tag.mood[data-mood=emotional] { background: #c79bff; }
.tag.mood[data-mood=cold_curt] { background: #6fd0e6; }
.tag.mood[data-mood=tense_angry] { background: #ff7b7b; }
.hero .tag.mood { font-size: 15px; padding: 3px 14px; }
.tag.unchecked { color: var(--muted); border-style: dashed; }
.tag.cue { color: var(--muted); }

/* secondary filters */
details.more { margin: 0 0 14px; }
details.more summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
details.more .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
details.more .chip { font-size: 14px; padding: 4px 12px; }
details.more .selects { display: flex; flex-wrap: wrap; gap: 8px; }

#playerhead:empty { display: none; }
.playerhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 4px 0 8px; }
.playerhead h2 { margin: 0; font-size: 22px; }
.playerhead .stats { color: var(--muted); }
.playerhead button { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }
#summary { color: var(--muted); margin: 4px 0 12px; }
.clear-filters { color: var(--accent); text-decoration: underline; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 22px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.more-wrap { text-align: center; padding: 18px 0 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card video { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; }
.card .fallback { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; background: #000; color: var(--muted); }
.hero .fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; color: var(--muted); }
.body { padding: 10px 12px 12px; }
.players { font-weight: 600; } .players .win { color: #fff; } .players .lose { color: var(--muted); font-weight: 500; }
.meta { color: var(--muted); font-size: 14px; margin: 2px 0 6px; }
.src { font-size: 13px; color: var(--muted); }
footer { padding-top: 12px; padding-bottom: 36px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  h1 { font-size: 26px; }
  .hero { grid-template-columns: 1fr; padding: 10px; }
  .hero h2 { font-size: 21px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* seeds and the winner mark */
.seed { color: var(--muted); font-weight: 500; font-size: .78em; }
.hero h2 .seed { font-size: .6em; margin-right: .1em; vertical-align: .12em; }
.won-mark { color: var(--accent); font-size: .62em; font-weight: 700; vertical-align: .12em; }

/* ATP top 20 sidebar */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 22px; align-items: start; }
.content { min-width: 0; }
#rankings { position: sticky; top: 12px; }
details.rankings { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px 10px; }
details.rankings summary { cursor: pointer; font-weight: 700; padding: 8px 8px 6px; list-style-position: inside; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row { display: flex; align-items: baseline; gap: 8px; width: 100%; background: none; border: none; color: var(--text); text-align: left; padding: 5px 8px; border-radius: 8px; font-size: 15px; }
.rank-row:hover:not(:disabled) { background: rgba(106, 169, 255, .12); }
.rank-row[aria-pressed=true] { background: var(--accent); color: #0b1220; }
.rank-row .rk { width: 1.6em; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.rank-row .nm { flex: 1; min-width: 0; }
.rank-row .ct { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rank-row[aria-pressed=true] .rk, .rank-row[aria-pressed=true] .ct { color: #0b1220; }
.rank-row:disabled { opacity: .45; cursor: not-allowed; }
.rank-row:focus-visible { outline: 3px solid rgba(106, 169, 255, .5); outline-offset: 1px; }
.asof { margin: 8px 8px 0; font-size: 12px; color: var(--muted); }
@media (max-width: 899px) {
  .layout { grid-template-columns: 1fr; }
  #rankings { position: static; order: -1; margin-bottom: 14px; }
}
details.rankings summary .when { display: block; margin-top: 1px; font-size: 12px; font-weight: 500; color: var(--muted); }

/* permalink icon on each card, the confirmation toast, and the notice */
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-top .tags { flex: 1; min-width: 0; }
.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin: -4px -6px 0 0; background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 10px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); border-color: var(--line); }
.icon-btn:focus-visible { outline: 3px solid rgba(106, 169, 255, .5); outline-offset: 1px; }
.icon-btn.done { color: #7be0a0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: #e8eaee; color: #0b1220; padding: 9px 16px; border-radius: 999px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.notice { background: #3a2f12; border: 1px solid #6b5a22; color: #ffe39a; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }

/* country flags */
.flag { display: inline-block; width: 20px; height: 15px; border-radius: 2px; vertical-align: -.1em; box-shadow: 0 0 0 1px rgba(255,255,255,.18); object-fit: cover; }
.hero h2 .flag { width: 26px; height: 19.5px; vertical-align: -.02em; margin-left: .1em; }
.rank-row .nm .flag, .sug-name .flag { width: 18px; height: 13.5px; margin-right: .5em; vertical-align: -.05em; }
.playerhead h2 .flag { width: 26px; height: 19.5px; margin-left: .15em; }
.rank-row .nm .flag-gap { display: inline-block; width: 18px; margin-right: .5em; }
