/* /fantasy-theater/simulator. theater_sim.py copies this to /sim.css. In a file because the site's
   Content-Security-Policy refuses a <style> block. */
.sim { --left: #8ab4f8; --right: #f2cb2e; }
.spends, .controls { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0; align-items: center; }
.sim button, .sim select { font: inherit; color: var(--fg); background: var(--card); border: 1px solid #3a3a40;
                           border-radius: 6px; padding: 0.3rem 0.7rem; cursor: pointer; }
.sim button[aria-pressed=true] { border-color: var(--link); color: var(--link); }
.towers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1rem 0; }
.tower { background: var(--card); border-radius: var(--r); padding: 10px; border-top: 3px solid var(--left); min-width: 0; }
.tower + .tower { border-top-color: var(--right); }
.tower ol { list-style: none; margin: 10px 0; padding: 0; }
.tower li { display: grid; grid-template-columns: 2.3rem 4.2rem 3rem; gap: 6px; align-items: center; padding: 3px 8px;
            border-radius: 6px; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.tower li .n { color: var(--mute); }
.tower li .cost { color: var(--mute); font-size: 0.875rem; }
.tower li.here { border-color: var(--edge-hi); background: var(--card-hi); }
.tower li.here .n { color: var(--fg); font-weight: 700; }
.tower li.ascend { border-color: var(--d1); }
.tower li.fail { border-color: var(--d3); }
.tower li.claim, .tower li.top { border-color: var(--d2); background: rgba(242, 203, 46, 0.14); }
/* Floor 8 is only there in the Fortress. */
.tower:not(.fortress) li[data-floor="8"] { opacity: 0.35; }
.tower .head { color: var(--mute); font-size: 0.8125rem; }
.tower dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 0; padding: 0 8px; }
.tower dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tower .last { min-height: 3.1em; margin: 8px 8px 0; color: var(--mute); font-size: 0.875rem; }
.tower .place { display: none; color: var(--d2); font-weight: 600; }
.tower.fortress .place { display: inline; }
#chart { display: block; width: 100%; height: 180px; background: var(--card); border-radius: var(--r); }
.controls .count { margin-left: auto; color: var(--mute); font-variant-numeric: tabular-nums; }
.sim button#play { min-width: 4.6rem; }
.tower dl.avg { margin: 10px 0 0; }
.tower dl.avg .now { font-size: 1.25rem; font-weight: 700; color: var(--left); }
.tower + .tower dl.avg .now { color: var(--right); }
.tower dl.avg dt:first-of-type { align-self: center; }
.tower dl.avg dt + dd + dt, .tower dl.avg .exact { color: var(--mute); font-size: 0.875rem; }
.speeds { gap: 0; }
.speeds span { color: var(--mute); margin-right: 0.6rem; }
.speeds button { border-radius: 0; margin-left: -1px; }
.speeds button:first-of-type { border-radius: 6px 0 0 6px; margin-left: 0; }
.speeds button:last-of-type { border-radius: 0 6px 6px 0; }
.speeds button[aria-pressed=true] { position: relative; background: var(--card-hi); }
.key { color: var(--mute); font-size: 0.875rem; margin: 0 0 8px; }
.key span { display: inline-block; width: 26px; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--fg); }
.key span.dashed { border-top: 1px dashed var(--fg); margin-left: 14px; }
#chart { height: 200px; }
/* The packs are the set-up for both towers, kept apart from the simulator under them by a line (Fred, 15 Nov). */
.spends { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
/* At phone width a tower is about 165 px, and "Claim on floor 2" was cut off in its picker (Fred, 15 Nov). */
@media (max-width: 480px) {
  .towers { gap: 8px; }
  /* The four speeds stay on one row. */
  .speeds { flex-wrap: nowrap; }
  .speeds button { padding: 0.3rem 0.45rem; font-size: 0.9375rem; white-space: nowrap; }
  .speeds span { margin-right: 0.4rem; }
  .tower { padding: 8px 6px; }
  .tower li { padding: 3px 6px; }
  /* Six-figure averages (Epic and Mythic) don't fit beside their labels in a 142 px tower: each sits under its label. */
  .tower dl.avg { display: block; }
  .tower dl.avg dt { color: var(--mute); font-size: 0.75rem; }
  .tower dl.avg dd { text-align: left; }
  .tower dl.avg .exact { font-size: 0.875rem; margin-bottom: 2px; }
  .tower dl, .tower .last { padding-left: 6px; padding-right: 6px; margin-left: 0; margin-right: 0; }
}
/* The floor a tower claims on is picked on the tower (Fred, 15 Nov): floors 2 to 7 are buttons, and the one picked
   has a wash of the tower's colour and its claim in that colour. The tower's heading names the strategy: a
   "Claim here" label on the floor took half a wide tower (Fred, 15 Nov). */
.tower { --mine: var(--left); }
.tower + .tower { --mine: var(--right); }
.tower h3.plan { margin: 2px 8px 0; color: var(--mine); }
.tower li .cost { text-align: right; }
.tower li[role=button] { cursor: pointer; }
.tower li[role=button]:hover { background: var(--card-hi); }
.tower li.pick, .tower li.pick:hover { background: color-mix(in srgb, var(--mine) 16%, transparent); }
.tower li.pick > span:nth-child(2) { color: var(--mine); font-weight: 700; }
.sim p.sub { margin: 0 0 4px; color: var(--mute); }
@media (min-width: 481px) {
  .tower dl { grid-template-columns: 8.4rem auto; justify-content: start; }
}
@media (max-width: 480px) {
  .tower li { grid-template-columns: 1.1rem 1fr auto; }
  .tower li.head { grid-template-columns: auto 1fr auto; }
  .tower dl:not(.avg) { font-size: 0.875rem; white-space: nowrap; }
}
/* A wide tower has its floors on the left and its figures stacked on the right, each under its label, so the
   floors' columns stay together and the right half isn't empty (Fred, 15 Nov). */
@media (min-width: 600px) {
  .tower { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr auto; column-gap: 18px;
           grid-template-areas: "plan plan" "floors avg" "floors stats" "last last"; }
  .tower h3.plan { grid-area: plan; }
  .tower ol { grid-area: floors; margin-bottom: 0; }
  .tower dl.avg { grid-area: avg; margin-top: 10px; }
  .tower dl:not(.avg) { grid-area: stats; }
  /* The last move has a line of its own across the tower: in the narrow right column it wrapped to two or three
     lines for some moves, and the tower changed height as it played (Fred, 15 Nov). */
  .tower .last { grid-area: last; margin: 6px 8px 0; min-height: 1.55em; white-space: nowrap; }
  .tower dl { display: block; padding: 0; }
  .tower dl dt, .tower dl.avg dt { color: var(--mute); font-size: 0.8125rem; }
  .tower dl dd { text-align: left; margin-bottom: 6px; }
}
.sim ol.steps { margin: 8px 0; padding-left: 1.4rem; }
.towers { margin-top: 0; }
.sim p.intro { margin: 16px 0 8px; }
.key span.dot { width: 7px; height: 7px; border: 0; border-radius: 50%; background: var(--fg); opacity: 0.5; margin-left: 14px; }
.sim button:disabled { opacity: 0.45; cursor: default; }
/* The climb rail (Fred, 15 Nov: picked from drawn options, without the castle picture drawn over the floors). A rail
   runs up the floors' left: it is filled with the tower's colour up to a dot on the floor the tower is at, and the
   dot's ring says what happened, as the floor's outline did. */
.tower { --rail: #3f3f47; --node: #5a5a63; }
.tower ol { position: relative; }
.tower li[data-floor] { position: relative; padding-left: 22px; }
.tower li[data-floor]::before { content: ""; position: absolute; left: 9px; top: -1px; bottom: -1px; width: 2px;
                                background: var(--rail); }
.tower li[data-floor="8"]::before { top: 50%; }
.tower li[data-floor="1"]::before { bottom: 50%; }
.tower li[data-floor]::after { content: ""; position: absolute; left: 7px; top: calc(50% - 3px); width: 6px; height: 6px;
                               border-radius: 50%; background: var(--node); }
.tower li.below::after { background: var(--mine); }
/* The rail to floor 8 is dotted until the Fortress builds it. */
.tower:not(.fortress) li[data-floor="8"]::before { width: 0; background: none; border-left: 2px dotted var(--rail); }
.tower li.here { border-color: transparent; }
.tower li.fill, .tower li.mk, .tower li.plus { position: absolute; display: block; padding: 0; border: 0; pointer-events: none; }
.tower li.fill { left: 10px; width: 2px; border-radius: 1px; background: var(--mine); transform-origin: bottom;
                 transition: transform 200ms ease-out; }
.tower li.mk { left: 5px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--mine); z-index: 1;
               box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--edge-hi); transition: transform 200ms ease-out; }
.tower li.mk.ascend { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--d1); }
.tower li.mk.fail { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--d3); }
.tower li.mk.claim, .tower li.mk.top { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--d2), 0 0 12px 4px rgba(242, 203, 46, 0.5); }
/* A claim on floor 7 or 8: the floor flashes and its tokens rise off its right end, where the Explore column is
   empty for it and for the floor above. */
.tower li.plus { left: 0; right: 8px; z-index: 2; text-align: right; color: var(--d2); font-weight: 700; opacity: 0; }
.tower li.plus.go { animation: sim-plus 900ms ease-out; }
.tower li.big { animation: sim-flash 450ms ease-out; }
@keyframes sim-plus {
  0% { opacity: 0; transform: translateY(4px); }
  25% { opacity: 1; transform: translateY(0); }
  60% { opacity: 1; transform: translateY(-10px); }
  100% { opacity: 0; transform: translateY(-24px); }
}
@keyframes sim-flash {
  0% { background-color: rgba(242, 203, 46, 0.6); }
}
.towers.still li.fill, .towers.still li.mk { transition: none; }
/* A phone's floor has no room for the rising figure beside its claim: the floor flashes, and the line under the
   tower gives the tokens. */
@media (max-width: 480px) {
  .tower li.plus { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tower li.fill, .tower li.mk { transition: none; }
  .tower li.plus.go, .tower li.big { animation: none; }
}
/* A wide tower's floors have fixed columns, so their headings move in with them. A phone's headings stay where they
   were: there is no room to move them. */
@media (min-width: 481px) {
  .tower li { grid-template-columns: 2.3rem 4.2rem 3rem; }
  .tower li.head { padding-left: 22px; }
}
/* The Fortress (Fred, 15 Nov: picked from drawn options): the tower warms from the top, and a star takes floor 8's
   place on the rail. Neither changes a tower's height. */
.tower.fortress { background: linear-gradient(rgba(242, 203, 46, 0.16), transparent 150px) var(--card); }
.tower.fortress li[data-floor="8"]::after { content: "★"; background: none; color: var(--d2); width: auto; height: auto;
                                            left: 3px; top: calc(50% - 11px); font-size: 14px; line-height: 22px; }
/* The summary under the chart (Fred, 15 Nov: picked from drawn options). Each tower has a bar on one scale: a thin
   line from its worst event to its best, a band that holds 8 in 10 of its events, and a tick at its median. */
.summary { background: var(--card); border-radius: var(--r); padding: 10px 12px; }
.summary .s0 { color: var(--left); }
.summary .s1 { color: var(--right); }
.summary .cap { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 2px; font-size: 0.8125rem; }
.summary .cap:first-child { margin-top: 0; }
.summary .cap small { color: var(--mute); font-size: inherit; }
.summary .cap b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.summary .bar { position: relative; height: 16px; }
.summary .bar i { position: absolute; background: currentColor; }
.summary .bar .thin { top: 7px; height: 2px; min-width: 2px; opacity: 0.5; }
.summary .bar .thick { top: 3px; height: 10px; min-width: 2px; border-radius: 3px; opacity: 0.8; }
.summary .bar .mid { top: 0; height: 16px; width: 2px; margin-left: -1px; background: var(--fg); }
.summary .bar.none i, .summary .bar.few .thick { display: none; }
.summary .axis { display: flex; justify-content: space-between; color: var(--mute); font-size: 0.75rem; margin: 3px 0 8px;
                 min-height: 1.55em; font-variant-numeric: tabular-nums; }
.summary .key { color: var(--mute); font-size: 0.75rem; margin: 0 0 8px; }
.summary .key i { display: inline-block; vertical-align: middle; margin: 0 4px 0 8px; background: var(--mute); }
.summary .key i:first-child { margin-left: 0; }
.summary .key .thin { width: 16px; height: 2px; }
.summary .key .thick { width: 16px; height: 8px; border-radius: 2px; }
.summary .key .mid { width: 2px; height: 12px; background: var(--fg); }
.summary table { width: 100%; margin: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.summary table th, .summary table td { border: 0; background: none; }
.summary thead th { font-size: 0.8125rem; font-weight: 600; text-align: right; padding: 2px 0 4px 12px; white-space: nowrap; }
.summary tbody th, .summary tbody td { padding: 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
.summary tbody th { text-align: left; font-weight: 400; color: var(--mute); font-size: 0.875rem; }
.summary tbody td { text-align: right; font-weight: 600; padding-left: 12px; white-space: nowrap; width: 1%; }
.summary tbody td small { color: var(--mute); font-weight: 400; }
.summary .gap { margin: 0 0 10px; }
.summary .gap span { font-weight: 600; }
/* A claim on the floor a tower claims on: the floor's wash of the tower's colour hid the claim's own, and on the
   yellow tower the two were the same colour. The claim's wash is stronger there, and its figure is white. */
.tower li.pick.claim, .tower li.pick.top { background: rgba(242, 203, 46, 0.32); }
.tower li.pick.claim > span:nth-child(2), .tower li.pick.top > span:nth-child(2) { color: var(--fg); }
