/*
 * Phase 8R -- THE CHAOS DIRECTOR AND THE BONUS EVENTS.
 *
 *   .acd-*      ARSENAL -> ADMIN CHAOS, regrouped (admin-chaos-director.js):
 *               the four sections, the CREATE A BONUS EVENT forms, the WHY /
 *               SAFE ALTERNATIVE blocks, live & recent bonus events. Its
 *               cards reuse the .acx-* card, picker and confirmation styles of
 *               phase8q3-chaos.css.
 *   .cix-*      the players' BONUS EVENTS card on Home and Games
 *               (chaos-instances.js)
 *
 * Mobile first (320 px): one column, every row wraps, nothing has a fixed
 * width, every control is at least the tap height, inputs are 16 px so iOS
 * does not zoom, state is always in words (a chip never relies on colour).
 * Only tokens defined in app.css :root are used. Linked before phase8k.css,
 * which stays LAST.
 */

/* ---------------------------- the Director ---------------------------- */

.acd-panel {
  min-width: 0;
}

.acd-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.acd-section {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.acd-section__title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--metal);
  overflow-wrap: anywhere;
}

.acd-section__help,
.acd-section__empty {
  margin: 4px 0 10px;
  color: var(--text-dim);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.acd-cards {
  min-width: 0;
}

.acd-form {
  border-color: var(--accent-dim);
}

.acd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
  min-width: 0;
}

@media (min-width: 600px) {
  .acd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.acd-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.acd-field[hidden],
.acd-players[hidden] {
  display: none;
}

.acd-field__label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.acd-field__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.acd-input,
.acd-select {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  font-size: 16px;
}

.acd-players {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.acd-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-check input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.acd-alt {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--warn);
  border-radius: var(--radius-sm);
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-alt__why {
  margin: 0 0 6px;
  color: var(--warn);
  font-size: 0.85rem;
}

.acd-alt__label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.acd-alt__button {
  min-height: var(--tap);
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.acd-instance-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.acd-instance {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  padding: 10px;
  margin: 0 0 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-instance__line {
  margin: 0;
  font-weight: 700;
}

.acd-instance__when {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.acd-instance__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.acd-instance__controls .acx-input {
  flex: 1 1 180px;
}

.acd-instance__controls .btn {
  min-height: var(--tap);
}

/*
 * The "Result & audit" / "Players & audit" toggles (8Q.3's .acx-recent__details,
 * reused by the Director) measured 32 px tall in the 8R responsive pass; every
 * Director tap target is at least --tap. Kept a list-item (no flex) so the
 * disclosure triangle stays; the padding centres the one line in the height.
 */
.acx-recent__details > summary {
  cursor: pointer;
  min-height: var(--tap);
  box-sizing: border-box;
  padding-block: 12px;
}

.acd-notyet summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/*
 * Phase 8R.1 -- CHAOS CHOICE (the area chips and what can launch now), the
 * FAST BOUNTY sentence, and the per-event RESULT / AUDIT report. Same rules:
 * wraps at 320 px, no fixed width, every button the tap height, the chosen
 * area told by aria-pressed AND a heavier border (never colour alone -- the
 * panel title names the area in words too).
 */
.acd-choice__chips,
.acd-choice__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.acd-choice__chip,
.acd-choice__launch {
  min-height: var(--tap);
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.acd-choice__chip[aria-pressed="true"] {
  border: 2px solid var(--metal);
  font-weight: 700;
}

.acd-choice__panel {
  margin-top: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-choice__title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.acd-choice__empty {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--warn);
}

.acd-choice__blocked {
  margin: 0 0 10px;
  min-width: 0;
}

.acd-choice__label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.acd-bounty-line {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.acd-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px 12px;
  margin: 8px 0 0;
  font-size: 0.85rem;
  min-width: 0;
}

@media (min-width: 600px) {
  .acd-report {
    grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  }
}

.acd-report__term {
  color: var(--text-dim);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.acd-report__value {
  margin: 0 0 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --------------------------- the players' card --------------------------- */

.cix-host {
  min-width: 0;
  margin: 0 0 12px;
}

.cix-panel {
  min-width: 0;
}

.cix-panel__title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--warn);
}

.cix-card {
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 12px;
  margin: 0 0 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cix-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cix-card__kind {
  color: var(--warn);
}

.cix-card__timer {
  color: var(--text-dim);
}

.cix-card__title {
  margin: 6px 0 4px;
  font-size: 1.05rem;
  color: var(--text);
}

.cix-card__todo,
.cix-card__reward,
.cix-card__note,
.cix-card__message {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.cix-card__reward,
.cix-card__earned {
  color: var(--accent);
  font-weight: 700;
}

.cix-card__done,
.cix-card__earned {
  margin: 6px 0 0;
}

.cix-card__prompt {
  margin: 10px 0 6px;
  font-weight: 700;
  color: var(--text);
}

.cix-card__choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 600px) {
  .cix-card__choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cix-card__choice {
  min-height: var(--tap);
  width: 100%;
  white-space: normal;
  text-align: center;
}

.cix-card__write {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.cix-card__label {
  flex: 1 1 100%;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.cix-card__input {
  flex: 1 1 180px;
  min-width: 0;
  min-height: var(--tap);
  font: inherit;
  font-size: 16px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 10px;
}

.cix-card__send {
  min-height: var(--tap);
}

/*
 * Phase 8R.1 RESULTS & AUDIT: ONE disclosure per bonus event (the summary
 * keeps .acx-recent__details' tap-height rule above), its report, ordered
 * player lists and identifiers. Long lists simply grow; long ids wrap.
 */
.acd-results__summary {
  font-weight: 700;
  letter-spacing: 0.05em;
  list-style: none;
}

.acd-results__summary::-webkit-details-marker {
  display: none;
}

.acd-report-wrap {
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-report__heading {
  margin: 12px 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.acd-report__list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.acd-report__line {
  margin: 0 0 4px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.acd-history__more {
  min-height: var(--tap);
  max-width: 100%;
  white-space: normal;
}

/*
 * Phase 8R.2 (directive 7-8, 27-31): the RESULTS & AUDIT report's collapsed
 * TECHNICAL AUDIT (a native <details>, the tap height on its summary; ids
 * wrap, never a scroll box), and a SAFE ALTERNATIVE that is not available:
 * plain words, deliberately NOT styled as a control.
 */
.acd-technical {
  margin-top: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.acd-technical__summary {
  cursor: pointer;
  min-height: var(--tap);
  box-sizing: border-box;
  padding-block: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.acd-alt__unavailable {
  font-weight: 400;
  letter-spacing: normal;
}
