:root {
  color-scheme: light;
  --ink: #202b29;
  --muted: #52615c;
  --line: #d0d6cc;
  --paper: #fafbf5;
  --panel: #fff;
  --accent: #00644e;
  --pale: #e8f3e9;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
.app-header,
main {
  max-width: 1240px;
  margin: auto;
  padding-inline: clamp(12px, 4.4vw, 66px);
}
.app-header {
  padding-top: clamp(16px, 2.4vw, 32px);
}
main {
  padding-bottom: 70px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
.app-name,
.metrics strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.046em;
}
.mast,
.card-heading,
.ref-control,
.legend,
.profile-actions,
.actions,
.risk-values {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mast,
.card-heading,
.profile-actions {
  justify-content: space-between;
}
.mast {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}
.mast .app-name {
  color: var(--ink);
  font-size: clamp(1.4rem, 2.6vw, 2.15rem);
  line-height: 1.15;
  text-decoration: none;
}
.app-name:hover {
  text-decoration: underline;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
}
a,
.text-button {
  color: var(--accent);
  text-underline-offset: 3px;
}
.home {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}
a:hover,
.text-button:hover {
  text-decoration: underline;
}
.intro {
  padding-block: clamp(18px, 2.4vw, 30px);
}
.intro p {
  max-width: 68ch;
  margin-top: 8px;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.5;
}
.intro nav {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 0.9rem;
}
.app-nav {
  display: flex;
  gap: clamp(16px, 3vw, 32px);
  flex-wrap: wrap;
  box-shadow: inset 0 -1px var(--line);
}
.app-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-bottom: 3px solid transparent;
  padding: 5px 2px 2px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}
.app-nav a:hover {
  text-decoration: underline;
}
.app-nav [aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.47fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.profile,
.result,
.methods {
  border: 1px solid var(--line);
  border-radius: 14px;
}
.result {
  grid-column: 2;
  grid-row: 1;
  background: var(--panel);
  padding: clamp(16px, 2.7vw, 34px);
}
.profile {
  grid-column: 1;
  grid-row: 1;
  background: #f1f3eb;
  padding: clamp(16px, 2vw, 26px);
}
.methods {
  grid-column: 1/-1;
  padding: 17px 24px;
  background: transparent;
}
h2 {
  font-size: clamp(1.7rem, 3vw, 2.65rem);
  line-height: 1.1;
}
.profile h2 {
  font-size: clamp(1.5rem, 2.3vw, 2rem);
}
h3 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
button,
.file-button {
  cursor: pointer;
  color: var(--ink);
  background: white;
  border: 1px solid #a7b4ad;
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.85rem;
}
:focus-visible {
  outline: 3px solid #307db5;
  outline-offset: 3px;
}
button:hover,
.file-button:hover {
  background: #eff4ee;
}
.text-button {
  font-size: 0.85rem;
  border: 0;
  background: none;
  font-weight: 600;
  padding: 6px 0;
  text-decoration: underline;
}
.text-button:hover {
  background: none;
}
.switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f4f5f1;
  padding: 3px;
  gap: 2px;
}
.switch button {
  white-space: nowrap;
  padding: 6px 9px;
  border: 0;
  background: none;
}
.switch button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
.ref-control {
  margin-top: 16px;
  gap: 8px;
  font-size: 0.84rem;
  flex-wrap: wrap;
}
select,
input:not([type="file"]) {
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #a7b4ad;
  border-radius: 6px;
  padding: 8px;
  min-height: 38px;
  min-width: 0;
}
.ref-control select {
  font-size: 0.85rem;
  min-height: 32px;
  padding: 4px 7px;
}
.legend {
  font-size: 0.8rem;
  color: var(--muted);
  gap: 22px;
  flex-wrap: wrap;
  margin: 22px 0 6px;
}
.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.legend i {
  width: 24px;
  border-top: 3px solid var(--accent);
}
.legend .dash {
  border-top: 2px dashed #65596d;
}
#chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-text {
  fill: var(--muted);
  font:
    12px system-ui,
    sans-serif;
}
.caption,
.hint,
.muted,
#storageNote,
.files p,
#notice,
.methods p,
.horizon p,
.explore p,
.methods td,
.methods th {
  font-size: 0.88rem;
  line-height: 1.5;
}
.caption,
.hint,
.muted,
#storageNote {
  color: var(--muted);
}
.caption {
  min-height: 2.8em;
  margin: 4px 0 16px;
}
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 17px 0;
}
.metrics strong {
  display: block;
  font-size: clamp(1.8rem, 3.4vw, 3.2rem);
  line-height: 1.15;
  font-variant-numeric: lining-nums tabular-nums;
}
.metrics h3,
.metrics span,
.risk-values span {
  font:
    500 0.8rem/1.4 system-ui,
    sans-serif;
  color: var(--muted);
}
.metrics h3 {
  color: var(--ink);
  font-weight: 650;
}
.horizon {
  padding: 16px 18px;
  background: var(--pale);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.risk-values {
  flex-wrap: wrap;
  gap: 25px;
  margin: 9px 0 5px;
}
.risk-values span,
.risk-values strong {
  display: block;
}
.risk-values strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.29rem;
}
.risk-values > div:first-child strong {
  color: var(--accent);
}
.explore,
.files {
  border-top: 1px solid var(--line);
  margin-top: 17px;
  padding-top: 13px;
}
.explore label {
  font-size: 0.9rem;
}
.explore input {
  width: 74px;
}
details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 4px 0;
}
details[open] > summary {
  margin-bottom: 10px;
}
.muted {
  margin: 9px 0 15px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 9px;
}
.fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}
.fields select,
.fields input {
  width: 100%;
  font-weight: 400;
}
.dates {
  margin: 10px 0 20px;
}
fieldset {
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 10px 0 0;
}
legend {
  padding: 0 8px 0 0;
  font-weight: 650;
}
fieldset .hint {
  margin: 0 0 10px;
}
fieldset:disabled select,
fieldset:disabled input {
  opacity: 0.68;
}
fieldset details {
  margin-top: 12px;
}
#moreFields {
  grid-template-columns: 1fr;
}
#primaryFields {
  grid-template-columns: 1fr;
}
.profile-actions {
  margin-top: 15px;
  font-size: 0.83rem;
}
.profile-feedback {
  font-size: 0.84rem;
  line-height: 1.5;
  border-top: 1px solid var(--line);
  margin-top: 17px;
  padding-top: 12px;
  color: var(--accent);
  font-weight: 600;
}
.actions {
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.file-button {
  position: relative;
  display: inline-block;
}
.file-button:focus-within {
  outline: 3px solid #307db5;
}
.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
#notice:not(:empty),
#error {
  margin: 12px 0;
  padding: 10px;
  background: #fff3d4;
  color: #503918;
  border-radius: 4px;
}
.methods h3 {
  margin: 16px 0 5px;
}
.methods p {
  max-width: 88ch;
  margin: 7px 0;
}
.methods table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  max-width: 760px;
}
.methods th,
.methods td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 5px;
}
.methods .workbench {
  display: inline-block;
  margin-top: 4px;
}
.skip {
  position: fixed;
  top: -100px;
  left: 10px;
  background: white;
  padding: 10px;
  z-index: 2;
}
.skip:focus {
  top: 8px;
}
@media (max-width: 800px) {
  .workspace {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  .workspace > section,
  .workspace > .methods {
    width: 100%;
  }
  .profile,
  .result {
    padding: 18px;
  }
  #primaryFields,
  #moreFields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 500px) {
  .app-header,
  main {
    padding-inline: 12px;
  }
  main {
    padding-bottom: 40px;
  }
  .home {
    font-size: 0.72rem;
    gap: 3px;
  }
  .home img {
    width: 14px;
    height: 14px;
  }
  .profile,
  .result,
  .methods {
    padding: 15px 12px;
  }
  .switch button {
    font-size: 0.74rem;
    padding: 6px;
  }
  .legend {
    margin-top: 16px;
    gap: 12px;
  }
  #moreFields {
    grid-template-columns: 1fr;
  }
  .methods td,
  .methods th {
    font-size: 0.72rem;
    padding: 4px 2px;
  }
}
#weeks {
  display: block;
  width: min(100%, 370px);
  margin: 12px auto 0;
}
#mobileExample {
  display: none;
}
@media (max-width: 800px) {
  #mobileExample {
    display: inline;
    padding: 0;
    font: inherit;
  }
  .fields select,
  .fields input {
    font-size: 16px;
  }
}

.methods math[display="block"] {
  margin: 0.9rem 0 1.1rem;
  font-size: 1.18rem;
  text-align: left;
}
.methods h4 {
  margin: 1.2rem 0 0.45rem;
}
.methods details {
  margin: 0.6rem 0 1.1rem;
}
#workedOdds {
  border-left: 3px solid var(--accent);
  padding-left: 0.7rem;
}
#longRisk {
  margin-top: 0.6rem;
}
