/* The page stays neutral white and grey around the plates. Blue is for controls only. */
:root { --white: #fff; --ink: #1c2530; --soft: #55606d; --hair: #d5dae0; --scale: #858f9a; --blue: #1a55a8; --blue-deep: #143f7f; --blue-tint: #edf3fb;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; font: 17px/1.5 var(--sans); color: var(--ink); background: var(--white); font-variant-numeric: tabular-nums; }
h1, h2, h3, p, ul, ol { margin: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
#masthead { display: flex; align-items: center; justify-content: center; gap: 10px; height: 60px; border-bottom: 1px solid var(--hair); }
.mark { width: 32px; height: 32px; display: block; }
#masthead h1 { font-size: 1.2rem; font-weight: 400; letter-spacing: -.01em; }
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
button { font: inherit; cursor: pointer; }
.solid, .line { display: block; width: 100%; min-height: 54px; padding: 10px 20px; border-radius: 8px; font-weight: 500; }
.solid { background: var(--blue); color: #fff; border: 1px solid var(--blue); }
.line { background: #fff; color: var(--blue-deep); border: 1px solid var(--blue); }
.text { display: block; min-height: 44px; padding: 8px 12px; margin: 0 auto; background: none; border: 0; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) { .solid:hover { background: var(--blue-deep); } .line:hover { background: var(--blue-tint); } }

/* Start */
#screen-start { padding: 24px 0 32px; }
.instrument { display: block; width: 132px; height: 132px; margin: 0 auto 18px; fill: none; stroke: var(--scale); stroke-width: 1; }
.instrument .pupil { fill: var(--blue); stroke: none; }
.lede { font-size: 1.5rem; line-height: 1.3; letter-spacing: -.01em; margin-bottom: 22px; }
.actions { display: grid; gap: 10px; }
#start-disclaimer { margin-top: 26px; padding-left: 14px; border-left: 3px solid var(--blue); }
#brightness-note { margin-top: 14px; color: var(--soft); }

/* Play */
#screen-play { padding: 12px 0 16px; display: flex; flex-direction: column; align-items: center; }
#round-label { font-size: 1.05rem; font-weight: 400; color: var(--soft); }
.ruler { width: 100%; max-width: 480px; height: 7px; margin: 8px 0 12px; border-bottom: 1px solid var(--scale); position: relative; }
.ruler i { position: absolute; left: 0; bottom: -2px; height: 3px; width: calc(var(--progress, 0) * 100%); background: var(--blue); }
.stage { position: relative; }
#plate-canvas { display: block; width: clamp(220px, min(100vw - 40px, 100dvh - 410px), 460px); height: auto; aspect-ratio: 1 / 1; }
#options { width: 100%; max-width: 480px; margin-top: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#options button { min-height: 54px; padding: 4px; background: #fff; color: var(--ink); border: 1px solid var(--scale); border-radius: 8px; font-size: 1.1rem; }
#options button:last-child { grid-column: 1 / -1; font-size: 1.05rem; color: var(--soft); min-height: 48px; }
@media (hover: hover) { #options button:hover { border-color: var(--blue); color: var(--blue-deep); } }
#btn-quit { margin-top: 2px; }
.play-note { font-size: .88rem; color: var(--soft); }

/* Results */
#screen-results { padding: 26px 0 32px; }
#results-title { font-size: 1.7rem; font-weight: 400; line-height: 1.2; letter-spacing: -.01em; }
#results-disclaimer { margin-top: 14px; padding-left: 14px; border-left: 3px solid var(--blue); }
#results-body { margin-top: 14px; }
#results-breakdown { margin-top: 14px; padding: 0; list-style: none; }
#results-breakdown li, #history-list li { padding: 9px 0; border-top: 1px solid var(--hair); }
.res-side { margin-top: 24px; }
.res-side h3 { font-size: .8rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin: 22px 0 8px; }
.res-side h3:first-child { margin-top: 0; }
textarea { display: block; width: 100%; font: .95rem/1.4 ui-monospace, Menlo, monospace; color: var(--ink); padding: 10px; margin-bottom: 8px; border: 1px solid var(--scale); border-radius: 8px; resize: vertical; }
#share-status { display: block; min-height: 1.5em; margin-top: 4px; color: var(--soft); }
#history-empty { color: var(--soft); }
#history-list { padding: 0; list-style: none; font-size: .95rem; }
#btn-clear-history { margin: 6px 0 12px; padding-left: 0; }

@media (min-width: 840px) {
  #masthead { height: 72px; } #masthead h1 { font-size: 1.5rem; } .mark { width: 40px; height: 40px; }
  #screen-start { display: grid; grid-template-columns: 300px 1fr; gap: 64px; align-items: center; padding-top: 72px; }
  .instrument { width: 300px; height: 300px; margin: 0; }
  .lede { font-size: 2rem; }
  .actions { grid-template-columns: 1fr 1fr; }
  #screen-play { padding-top: 16px; }
  #plate-canvas { width: clamp(280px, 100dvh - 350px, 500px); }
  /* Graduated scales either side of the plate, neutral grey only. */
  .stage::before, .stage::after { content: ""; position: absolute; top: 0; bottom: 0; width: 14px;
    background: repeating-linear-gradient(0deg, var(--scale) 0 1px, transparent 1px 12.5%) ; border-block: 1px solid var(--scale); }
  .stage::before { left: -90px; border-left: 1px solid var(--scale); }
  .stage::after { right: -90px; border-right: 1px solid var(--scale); }
  #options { max-width: 640px; grid-template-columns: repeat(4, 1fr) 1.4fr; }
  #options button:last-child { grid-column: auto; min-height: 54px; }
  #screen-results { display: grid; grid-template-columns: 1fr 380px; column-gap: 64px; padding-top: 48px; }
  #screen-results > :not(.res-side) { grid-column: 1; }
  .res-side { grid-column: 2; grid-row: 1 / span 8; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 840px) { #options button { font-size: 1.3rem; } }
