/* static/styles/setup.css */

/* Author-level display rules below would otherwise override the browser's
   default [hidden] behavior for .setup-form. */
[hidden] {
  display: none !important;
}

/* ---------- Shared container ---------- */
.setup {
  max-width: 900px;
  margin: 28px auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--box-overlay);
  backdrop-filter: blur(2px);
}

.setup h2 {
  margin-top: 0;
}

/* ---------- Setup form ---------- */
.setup-form {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 12px 14px;
  align-items: center;
  max-width: 520px;
  margin: 28px auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--box-overlay);
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

html.light .setup,
html.light .setup-form {
  background: var(--box-overlay);
}

/* The entanglement-probe setting is wrapped in a div so the deployment switch
   can hide the whole row at once. That wrapper was itself a grid item, sitting
   in the label column, and a grid column sized to max-content takes the widest
   thing in it -- here the longest option text of the select inside the
   wrapper, around 380px. It pushed the value column down to what was left of a
   484px form, collapsing every input and select in Advanced Setup to about
   30px. display: contents removes the wrapper from the layout so its label and
   select sit in the two columns like every other row. The [hidden] rule at the
   top of this file still hides it: display:none !important outranks this. */
#probe-regions-advanced {
  display: contents;
}

/* Sits above the setup card and outside both panels, so it is the first thing
   under the header and cannot be hidden by the Advanced toggle. Accent-tinted
   rather than the neutral card used elsewhere on this page: the research ask is
   deliberately the one thing on Setup that is not part of starting a game. */
.setup-survey {
  max-width: 900px;
  margin: 18px auto 0;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--accent), transparent 88%);
  border: 1px solid color-mix(in oklab, var(--accent), transparent 55%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
}

.setup-survey__text {
  margin: 0;
  color: var(--fg);
  font-size: 0.95rem;
  text-align: center;
  /* Keeps the sentence and the button on one row when there is space, and lets
     the button drop underneath rather than squeezing when there is not. */
  flex: 1 1 320px;
}

/* Deliberately not `.btn`: that class is owned by the game's controls, and this
   is the one accent-filled call to action on the page. */
.setup-survey__cta {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.setup-survey__cta:hover {
  background: var(--accent-hover);
}

.setup-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

.setup-form label {
  justify-self: end;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Full column, not 80%. The widest option text ("2 - two areas, shared
   information") did not fit in four fifths of it and was truncated mid-word,
   and the narrow-screen rules below already give these fields the full width. */
.setup-form input[type="number"],
.setup-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--fg);
  font-size: 0.95rem;
}

.setup-form input[type="number"]:focus,
.setup-form select:focus {
  outline: none;
  border-color: var(--accent);
}

.setup-form input[type="number"]:focus-visible,
.setup-form select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


html.light .setup-form input[type="number"],
html.light .setup-form select {
  background: var(--btn-bg);
}

/* ---------- Boot/loading card (browser build only) ----------
   Only the static Pyodide build renders #loading: starting a game there has to
   download the Python runtime first. Styled like .setup-form so the wait looks
   like part of the same first screen. */
.loading-card {
  max-width: 520px;
  margin: 28px auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--box-overlay);
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.loading-card__message {
  margin: 0;
  font-size: 0.95rem;
}

/* Track: only present while there is progress to report, so it carries its own
   top margin rather than the message carrying a bottom one. */
.loading-card__track {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--fg), transparent 85%);
  overflow: hidden;
}

.loading-card__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  /* Smooths the ~5/s steps browser-main.js applies into continuous motion. */
  transition: width 0.25s linear;
}

.loading-card__hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .setup {
    margin: 16px auto;
    padding: 12px;
  }

  .setup-form {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 18px auto;
    padding: 14px;
  }

  .setup-form label {
    justify-self: start;
  }

  .setup-actions {
    flex-direction: column;
  }

  .setup-actions .btn {
    width: 100%;
  }

}
