/* PuffinParse playground (/playground/). Layered on tokens.css + style.css: no new base tokens,
   light and dark come from tokens.css. docs/DESIGN.md: one accent (the Run button), hairlines over
   shadows, system fonts, tabular numbers, focus rings on everything interactive. */

/* Components below set `display`, which would otherwise beat the `hidden` attribute. */
.pg-main [hidden] { display: none !important; }

.pg-skip { position: absolute; left: -9999px; top: .5rem; z-index: 50; padding: .4rem .7rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-2); }
.pg-skip:focus { left: .75rem; }
.pg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top a.pg-here { color: var(--ink); font-weight: 540; }

.pg-main { display: block; max-width: 84rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.pg-main:focus { outline: none; }
.pg-intro h1 { font-size: var(--t-xl); line-height: 1.2; letter-spacing: -.025em; margin: 0 0 .4rem; font-weight: 660; }
.pg-lede { color: var(--ink-2); max-width: var(--measure); margin: 0 0 1.5rem; }
.pg-hint { color: var(--ink-3); font-size: var(--t-sm); }
.pg-note { border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper-2);
  padding: .6rem .8rem; font-size: var(--t-sm); color: var(--ink-2); }
.pg-error { color: var(--poor); font-size: var(--t-sm); margin: .5rem 0 0; }
.pg-error:empty { display: none; }

.pg-form { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem 2rem;
  align-items: start; }
.pg-step { min-width: 0; }
.pg-step:nth-child(3) { grid-column: 1 / -1; }
.pg-step h2 { display: flex; align-items: center; gap: .5rem; font-size: var(--t-lg); margin: 0 0 .8rem;
  font-weight: 620; letter-spacing: -.015em; }
.pg-num { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pg-count { margin-left: auto; font-size: var(--t-sm); font-weight: 400; color: var(--ink-3); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pg-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin-bottom: .9rem;
  border: 1px solid var(--rule); border-radius: var(--r-pill); background: var(--paper-2); }
.pg-seg label { position: relative; padding: .3rem .85rem; border-radius: var(--r-pill); font-size: var(--t-md);
  color: var(--ink-2); cursor: pointer; }
.pg-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pg-seg label:has(input:checked) { background: var(--paper); color: var(--ink); font-weight: 540;
  box-shadow: inset 0 0 0 1px var(--rule); }
.pg-seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.pg-seg label:has(input:focus-visible) { outline: 2px solid var(--scan-ink); outline-offset: 2px; }

.pg-samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .6rem; }
.pg-sample { position: relative; display: flex; gap: .6rem; align-items: center; padding: .5rem;
  border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper); cursor: pointer; }
.pg-sample:hover { border-color: var(--ink-3); }
.pg-sample input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pg-sample:has(input:checked) { border-color: var(--scan-edge); background: var(--scan-wash); }
.pg-sample:has(input:focus-visible) { outline: 2px solid var(--scan-ink); outline-offset: 2px; }
.pg-thumb { flex: none; width: 3rem; height: 3.9rem; border: 1px solid var(--rule-2); border-radius: var(--r-1);
  overflow: hidden; background: #fff; display: grid; place-items: center; }
.pg-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pg-thumb-empty { font-size: var(--t-xs); color: var(--ink-3); }
.pg-sample-text { display: grid; gap: .1rem; min-width: 0; line-height: 1.35; }
.pg-sample-title { font-size: var(--t-md); font-weight: 540; }

.pg-drop { display: grid; gap: .25rem; justify-items: start; padding: 1.2rem; border: 1.5px dashed var(--rule);
  border-radius: var(--r-2); background: var(--paper-2); cursor: pointer; }
.pg-drop.over, .pg-drop:hover { border-color: var(--scan-edge); background: var(--scan-wash); }
.pg-drop:focus-within { outline: 2px solid var(--scan-ink); outline-offset: 2px; }
.pg-drop-title { font-weight: 540; }
.pg-drop input { font: inherit; font-size: var(--t-sm); margin-top: .4rem; max-width: 100%; }
.pg-file-status { font-size: var(--t-sm); margin: .5rem 0 0; overflow-wrap: anywhere; }

.pg-models { display: grid; gap: .8rem; }
.pg-provider legend { font-size: var(--t-sm); color: var(--ink-3); margin-bottom: .25rem; padding: 0; }
.pg-model { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; padding: .25rem 0;
  cursor: pointer; line-height: 1.45; }
.pg-model input { margin: 0; accent-color: var(--scan-ink); align-self: center; }
.pg-model.off { color: var(--ink-3); cursor: not-allowed; }
.pg-model-id { font-family: var(--font-mono); font-size: var(--t-sm); }

.pg-panel { display: grid; gap: .6rem; max-width: 40rem; }
.pg-panel p { margin: 0; color: var(--ink-2); font-size: var(--t-md); }
.pg-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pg-who { justify-content: space-between; }
.pg-email { display: grid; gap: .35rem; margin-top: .4rem; }
.pg-email label, .pg-key label { font-size: var(--t-sm); color: var(--ink-2); }
.pg-panel input[type="email"], .pg-key input { font: inherit; font-size: var(--t-md); color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-1); padding: .38rem .55rem;
  min-width: 0; flex: 1 1 14rem; }
.pg-key { display: grid; gap: .25rem; }
.pg-key input { font-family: var(--font-mono); font-size: var(--t-sm); width: 100%; }
.pg-keys { display: grid; gap: .6rem; }
.pg-check { display: flex; gap: .45rem; align-items: center; font-size: var(--t-md); color: var(--ink-2); cursor: pointer; }
.pg-check input { margin: 0; accent-color: var(--scan-ink); }
.pg-link { font: inherit; font-size: var(--t-sm); background: none; border: 0; padding: 0; color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: 2px; cursor: pointer; }
.pg-link:hover { color: var(--scan-ink); }
.pg-turnstile:empty { display: none; }
.pg-turnstile { margin: .6rem 0; }
.pg-sample-run p { margin: 0 0 .5rem; color: var(--ink-2); font-size: var(--t-md); }

.pg-privacy { margin: 1rem 0; max-width: 52rem; font-size: var(--t-sm); color: var(--ink-2); }
.pg-privacy summary { cursor: pointer; color: var(--ink-2); }
.pg-privacy ul { padding-left: 1.2rem; margin: .5rem 0; }
.pg-privacy li { margin: .3rem 0; line-height: 1.55; }
.pg-privacy a { text-decoration: underline; text-decoration-color: var(--link-underline); }

.pg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.pg-actions .btn { font: inherit; font-size: var(--t-md); padding: .45rem 1.1rem; cursor: pointer; }
.pg .btn { font: inherit; font-size: var(--t-sm); cursor: pointer; }
.pg .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ---- results ---- */
.pg-results { margin-top: 2.5rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.pg-results-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; }
.pg-results-head h2 { margin: 0; font-size: var(--t-lg); font-weight: 620; scroll-margin-top: 4.5rem; }
.pg-results-head p { margin: 0; }
.pg-docline { font-size: var(--t-sm); color: var(--ink-2); margin: .5rem 0 1rem; overflow-wrap: anywhere; }
.pg-docline a { text-decoration: underline; text-decoration-color: var(--link-underline); }
.pg-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 1rem; }
.pg-card { min-width: 0; border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper);
  display: flex; flex-direction: column; }
.pg-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem;
  padding: .6rem .8rem; border-bottom: 1px solid var(--rule-2); }
.pg-card-head h3 { margin: 0; font-size: var(--t-md); font-weight: 540; display: flex; gap: .4rem; align-items: baseline;
  flex-wrap: wrap; }
.pg-view { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-1); overflow: hidden; }
.pg-view button { font: inherit; font-size: var(--t-xs); background: var(--paper); color: var(--ink-2); border: 0;
  padding: .2rem .55rem; cursor: pointer; }
.pg-view button[aria-pressed="true"] { background: var(--paper-3); color: var(--ink); font-weight: 540; }
.pg-metrics { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: 0; padding: .5rem .8rem;
  border-bottom: 1px solid var(--rule-2); font-size: var(--t-sm); }
.pg-metrics div { display: flex; gap: .35rem; }
.pg-metrics dt { color: var(--ink-3); }
.pg-metrics dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pg-out { margin: 0; padding: .7rem .8rem; max-height: 70vh; overflow: auto; flex: 1; min-height: 8rem; }
.pg-out:focus-visible { outline-offset: -2px; }
.pg-raw { background: var(--paper-2); border: 0; border-radius: 0; font-size: var(--t-sm); white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.55; }
.pg-md { font-size: var(--t-md); line-height: 1.6; overflow-wrap: anywhere; }
.pg-md > :first-child { margin-top: 0; }
.pg-md h3, .pg-md h4, .pg-md h5, .pg-md h6 { font-size: var(--t-md); margin: 1rem 0 .4rem; font-weight: 640; }
.pg-md h3 { font-size: var(--t-base); }
.pg-md p, .pg-md ul, .pg-md ol { margin: .45rem 0; }
.pg-md ul, .pg-md ol { padding-left: 1.2rem; }
.pg-md table { font-size: var(--t-sm); width: auto; min-width: 100%; }
.pg-md th, .pg-md td { padding: .3rem .5rem; border: 1px solid var(--rule-2); white-space: normal; }
.pg-md pre { font-size: var(--t-sm); white-space: pre-wrap; }
.pg-md a { text-decoration: underline; text-decoration-color: var(--link-underline); }
.pg-tablewrap { overflow-x: auto; margin: .6rem 0; }
.pg-img { color: var(--ink-3); font-style: italic; }
.pg-card-foot { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .5rem .8rem; border-top: 1px solid var(--rule-2);
  font-size: var(--t-sm); }
.pg-card-foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--link-underline); }
.pg-pending { display: flex; gap: .5rem; align-items: center; padding: 1rem .8rem; margin: 0; color: var(--ink-2);
  font-size: var(--t-md); }
.pg-spinner { width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--scan);
  animation: pg-spin .9s linear infinite; }
@keyframes pg-spin { to { transform: rotate(360deg); } }
.pg-fail { padding: .7rem .8rem; font-size: var(--t-md); }
.pg-fail p { margin: .2rem 0; }
.pg-fail strong { color: var(--poor); }

.pg-footer { border-top: 1px solid var(--rule); }
.pg-footer-in { max-width: 84rem; margin: 0 auto; padding: 1.25rem; font-size: var(--t-sm); color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: .55rem; }
.pg-footer a { color: var(--ink-2); }

@media (max-width: 900px) {
  .pg-form { grid-template-columns: minmax(0, 1fr); }
  .pg-grid { grid-template-columns: minmax(0, 1fr); }
  .pg-out { max-height: 60vh; }
}
@media (max-width: 560px) {
  .pg-main { padding: 1.25rem 1rem 3rem; }
  .pg-samples { grid-template-columns: minmax(0, 1fr); }
  .pg-seg { display: flex; }
  .pg-seg label { flex: 1; text-align: center; }
  .pg-footer-in { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .pg-spinner { animation: none; } }
