@import url("https://fonts.googleapis.com/css2?family=STIX+Two+Text:ital,wght@0,400;0,600;0,700;1,400&display=swap");

:root {
  font-family: "STIX Two Text", Georgia, serif;
  color: #000;
  background: #fff;
  font-size: 18px;
  line-height: 1.6;
  --accent: #00529b;
  --accent-dark: #003b70;
  --muted: #5b5b5b;
  --border: #ccc;
  --soft: #f6f6f6;
}

* { box-sizing: border-box; }
body { margin: 0; padding: 2rem 1rem; }
button, input, select { font: inherit; }
main { width: 100%; max-width: 680px; margin: 0 auto; }

.calculator { padding: 1rem 0 3.5rem; }
header { text-align: center; margin-bottom: 2.5rem; }
.knight { color: var(--accent); font-family: Georgia, serif; font-size: 2.3rem; line-height: 1; margin-bottom: .6rem; }
h1 { margin: 0; font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1.15; letter-spacing: -.025em; }
header p { margin: .6rem 0 0; color: var(--muted); font-size: 1.05rem; font-style: italic; }

.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.player-column { min-width: 0; }
.field { margin: 0 0 1.5rem; }
.player-column .field:last-child, .setup-grid > .field { margin-bottom: 0; }
.label { display: block; margin-bottom: .35rem; color: #333; font-size: .86rem; font-weight: 600; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; }
.tab { padding: .55rem 1rem; border: 1px solid var(--border); background: #fff; color: #333; cursor: pointer; }
.tab:first-child { border-radius: 2px 0 0 2px; }
.tab:last-child { margin-left: -1px; border-radius: 0 2px 2px 0; }
.tab:hover { background: var(--soft); }
.tab.active { position: relative; z-index: 1; border-color: var(--accent); background: var(--accent); color: #fff; }

.creator-picker { position: relative; }
.creator-trigger {
  width: 100%; min-height: 70px; padding: .55rem .7rem; display: flex; align-items: center; gap: .75rem;
  border: 1px solid var(--border); border-radius: 4px; background: #fff; color: #000; text-align: left; cursor: pointer;
}
.creator-trigger:hover, .creator-trigger[aria-expanded="true"] { border-color: var(--accent); }
.avatar-wrap {
  position: relative; width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; overflow: hidden;
  border-radius: 50%; color: #fff; background: var(--accent); font-size: .8rem; font-weight: 700;
}
.avatar-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.creator-trigger-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.creator-trigger-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator-trigger-copy small { color: var(--muted); font-size: .75rem; font-weight: 400; }
.chevron { color: var(--muted); font-size: 1.3rem; transition: transform .15s; }
.creator-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.creator-menu {
  position: absolute; z-index: 10; top: calc(100% + 5px); left: 0; right: 0; max-height: 330px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 4px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.13);
}
.creator-option {
  width: 100%; padding: .55rem .7rem; display: flex; align-items: center; gap: .7rem;
  border: 0; border-bottom: 1px solid #e8e8e8; background: #fff; color: #000; text-align: left; cursor: pointer;
}
.creator-option:last-child { border-bottom: 0; }
.creator-option:hover, .creator-option[aria-selected="true"] { background: #f0f6fb; }
.creator-option .avatar-wrap { width: 40px; height: 40px; flex-basis: 40px; }
.creator-option-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.creator-option-copy strong { font-size: .9rem; }
.creator-option-copy small { color: var(--muted); font-size: .7rem; }
.creator-option-rating { color: var(--accent); font-size: .8rem; font-weight: 700; }
.rating-entry { width: 100%; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.creator-trigger:focus-visible, .rating-entry:focus-within { outline: 1px solid var(--accent); border-color: var(--accent); }
.rating-note { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; font-style: italic; }
#liveStatus { color: var(--accent); }
.rating-entry { padding: .25rem; }
.rating-entry input { flex: 1; min-width: 0; padding: 0 .5rem; border: 0; outline: 0; text-align: center; font-size: 2rem; font-weight: 700; color: #000; background: transparent; }
.rating-entry > span { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.rating-entry button {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 3px; background: var(--soft); color: var(--accent); font-size: 1.1rem; cursor: pointer;
}
.rating-entry button:hover { background: #e8f1f8; }

input[type="range"] { width: 100%; height: 4px; margin: 1.25rem 0 0; appearance: none; background: #ddd; }
input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; appearance: none; border: 2px solid #fff; outline: 1px solid var(--accent); border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #fff; outline: 1px solid var(--accent); border-radius: 50%; background: var(--accent); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: #888; font-size: .67rem; }

.answer { margin-top: 2.25rem; padding: 1.7rem; text-align: center; border: 1px solid var(--border); border-radius: 2px; background: var(--soft); }
.answer > p:first-child { margin: 0; color: var(--muted); font-style: italic; }
.percent { margin: .3rem 0; color: var(--accent); font-size: clamp(4rem, 16vw, 6rem); font-weight: 700; line-height: 1; letter-spacing: -.06em; }
.percent small { font-size: .38em; letter-spacing: 0; }
.plain-english { min-height: 1.6em; margin: .5rem 0 1.4rem; }
.odds-track { height: 8px; overflow: hidden; background: #d6d6d6; }
.odds-track div { width: 1%; min-width: 2px; height: 100%; background: var(--accent); transition: width .25s; }
.odds-labels { display: flex; justify-content: space-between; margin-top: .25rem; color: #777; font-size: .67rem; }
.disclaimer { margin: .65rem 0 0; color: var(--muted); text-align: center; font-size: .75rem; font-style: italic; }

.context { padding: 3.5rem 0 2rem; border-top: 1px solid var(--border); }
.context h2 { margin: 2.5rem 0 .6rem; font-size: 1.35rem; line-height: 1.3; }
.context h2:first-child { margin-top: 0; }
.context p { margin: 0 0 1rem; color: #333; }
.context ul { margin: .4rem 0 0; padding-left: 1.3rem; color: #333; }
.context li { margin-bottom: .45rem; }
.formula { margin: 1.5rem 0; padding: 1.5rem 1rem; display: flex; align-items: center; justify-content: center; gap: .65rem; border: 1px solid var(--border); background: var(--soft); font-size: 1.5rem; }
.fraction { display: inline-flex; flex-direction: column; text-align: center; line-height: 1.35; }
.fraction > span:first-child { border-bottom: 1px solid #000; }
.fraction > span:last-child { padding-top: .2rem; font-size: .8em; }

footer { width: 100%; max-width: 680px; margin: 0 auto; padding: 1.5rem 0 0; border-top: 1px solid var(--border); color: #888; text-align: center; font-size: .75rem; }

@media (max-width: 600px) {
  body { padding: 1rem .75rem; }
  .calculator { padding-top: .5rem; }
  header { margin-bottom: 2rem; }
  .setup-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .player-column .field:last-child { margin-bottom: 0; }
  .answer { padding: 1.5rem .8rem; }
  .formula { font-size: 1.15rem; padding: 1.25rem .5rem; }
}
