/* ========== The adventure's MJ tab (8E): the sub-bar and the Maîtrise page ==========
   Mockups AdvGmMaster (1440), AdvGmMasterLandscapeConfirm (1180), AdvGmMasterPortrait (820): a
   52 px sub-bar (Maîtrise | Ambiance, « Jets secrets » on the right), then on Maîtrise the
   active effects in a column of 440 px (>= 1280) / 380 px (1024-1279.98) with the danger zone at
   its foot, and the accidents card in the rest; at <= 1023.98 the two stack (effects 0.8fr,
   accidents 1fr). */

/* The MJ tab draws no title above the tab bar (8D recipe): the main content has no top padding,
   the sub-bar sits 12 px under the tab bar, and on Maîtrise the page fills the screen to 12 px
   above its bottom, so nothing scrolls but the columns. */
.anima-main-content:has(.gm-subbar) {
  padding-top: 0;
}
.anima-main-content:has(.gm-page) {
  padding-bottom: 12px;
}
.anima-subtab-bar:has(~ .gm-subbar) {
  margin-bottom: 0;
}
.gm-subbar {
  box-sizing: border-box;
  min-height: 52px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.gm-page {
  --gm-aside-w: 440px;
  box-sizing: border-box;
  height: calc(100dvh - var(--chrome-h) - var(--subtab-bar-h) - 1px - 12px - 52px - 12px - 12px);
  min-height: 20rem;
  display: grid;
  grid-template-columns: var(--gm-aside-w) minmax(0, 1fr);
  gap: 16px;
}
.gm-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gm-col--accidents {
  overflow-y: auto;
}
.gm-col-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.anima-main-content:has(.gm-page) .anima-ambient-fab {
  right: auto;
  left: 24px;
}

/* ── The sub-bar ── */
.gm-segmented {
  display: inline-flex;
  margin-right: auto;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.gm-segment {
  min-height: var(--touch-min);
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.gm-segment[aria-current='page'] {
  background: var(--selected);
  color: var(--accent);
  font-weight: 700;
}
.gm-secret-rolls {
  min-height: var(--touch-min);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--selected);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.gm-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.gm-secret-count {
  min-width: 22px;
  height: 22px;
  box-sizing: border-box;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* ── The danger zone, at the foot of the effects column ── */
.gm-danger {
  flex: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: var(--surface);
}
.gm-danger-text {
  flex: 1;
  min-width: 0;
}
.gm-danger-text strong {
  color: var(--danger);
  font-size: 0.85rem;
}
.gm-danger-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Buttons and the confirmation window ── */
.gm-btn {
  min-height: var(--touch-min);
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.gm-btn--outline {
  border-color: var(--border-strong);
}
.gm-btn--danger-outline {
  flex: none;
  border-color: var(--danger);
  color: var(--danger);
}
.gm-btn--danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-accent);
  font-weight: 700;
}
.gm-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.gm-dialog-title {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: 1.1rem;
}
.gm-dialog-error {
  color: var(--danger);
  font-size: 0.85rem;
}

/* ── The active effects: one card per participant ── */
.gm-card-title {
  margin: 0 0 10px;
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--ink);
}
.gm-effects-empty {
  margin: 0;
  padding: 16px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.gm-effects-list,
.gm-effect-pills {
  margin: 0;
  padding: 0;
  list-style: none;
}
.gm-effects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gm-effect-card {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.gm-effect-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gm-effect-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
}
.gm-effect-kind {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.gm-effect-kind--npc {
  color: var(--accent);
  border-color: var(--accent);
}
.gm-effect-add {
  flex: none;
  margin-left: auto;
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.gm-effect-none {
  display: block;
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.gm-effect-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.gm-effect-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 15%, transparent);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}
.gm-effect-pill--penalty {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}
.gm-effect-detail {
  font-weight: 500;
  opacity: 0.85;
}
.gm-effect-remove {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
}
.gm-effect-remove::after {
  content: '';
  position: absolute;
  inset: -10px; /* a 44 px hit area around the 24 px mark */
}
.gm-effect-remove:hover {
  opacity: 1;
}

/* ── The Accidents card: a heading and its tablist on one row, the calculator under it ── */
.accidents-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.accidents-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.accidents-title {
  margin: 0;
  font-family: var(--font-title);
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.accidents-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.accidents-tab {
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.accidents-tab[aria-selected='true'] {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.accidents-body {
  padding: 16px;
}

/* ── The falls calculator: « Le jet » | « Le résultat » ── */
.fall-calc {
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}
.fall-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fall-col-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.fall-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fall-field .form-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.fall-field .form-control,
.fall-field .form-select {
  min-height: 48px;
}
.fall-roll-row {
  display: flex;
  gap: 8px;
}
.fall-roll-row .form-control {
  flex: 1;
  min-width: 0;
}
.fall-d100 {
  flex: none;
  width: 52px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.fall-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fall-actions {
  display: flex;
  gap: 8px;
}
.fall-actions .btn {
  min-height: 52px;
}
.fall-apply {
  flex: 1;
}
.fall-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 1279.98px) {
  .gm-page {
    --gm-aside-w: 380px;
  }
}
@media (max-width: 1023.98px) {
  .gm-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 0.8fr) minmax(0, 1fr);
  }
  .fall-calc {
    grid-template-columns: minmax(0, 1fr);
  }
  .gm-effects-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}
