/*
======================================================================
  5150 TABLE ROLLER  -  LOOK OF THE TABLES  (tables.css)
======================================================================
  The colours, fonts, page, buttons and hazard strip come from
  ../shared/console.css (loaded first). This file only has this tool's
  own parts:

    1. SECTION BAR   the group and section buttons, and the search box
    2. TABLE CARDS   one fold-open box per table
    3. ROLLING       the dice, the result, and the lit-up row
======================================================================
*/


/* ------------------------------------------------------------------
   1. SECTION BAR
------------------------------------------------------------------ */
.section-bar { display: grid; gap: 8px; }
.group-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px; }
/* The four big group buttons. */
.group-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.group-buttons button { font-size: 15px; padding: 9px 16px; letter-spacing: 0.08em; }
.group-about { margin: 0; color: var(--ui-soft); font-size: 14px; }
.group-about:empty { display: none; }
/* The smaller section buttons under the chosen group, set off by a line. */
.section-buttons { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px dashed #555a61; }
.section-buttons button { font-size: 13px; padding: 5px 10px; }
.section-buttons .count { opacity: 0.65; font-size: 11px; }
/* The chosen button stays lit; the others are outlined. */
.group-buttons button:not([aria-pressed="true"]),
.section-buttons button:not([aria-pressed="true"]) { background: transparent; color: var(--ink); }
.group-buttons button:not([aria-pressed="true"]):hover,
.section-buttons button:not([aria-pressed="true"]):hover { background: var(--ink); color: var(--paper); }
.search { display: grid; gap: 4px; color: var(--ui-soft); font-size: 14px; }
.search input { min-width: 240px; }


/* ------------------------------------------------------------------
   2. TABLE CARDS
------------------------------------------------------------------ */
.tables-area { padding: 0 16px 24px; }
.section-intro { margin: 0 0 12px; color: var(--ui-text); max-width: 60rem; }
.section-intro h2 {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}
.section-intro p { margin: 0; color: var(--ui-soft); }
.empty-note { color: var(--ui-soft); }

.table-list { display: grid; gap: 10px; }
.table-card {
  background: rgba(12, 14, 17, 0.9);
  border: 1px solid #555a61;
  border-left: 3px solid var(--ink);
}
.table-card > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}
.table-card > summary::-webkit-details-marker { display: none; }
.table-card > summary::before { content: "▸"; color: var(--ink); }
.table-card[open] > summary::before { content: "▾"; }
.table-card .t-title {
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-text);
}
.table-card .t-source { font-size: 13px; color: var(--accent); border: 1px solid var(--accent); padding: 0 6px; }
.table-card .t-section { font-size: 12px; color: var(--ui-soft); }
.table-card .t-body { padding: 0 12px 12px; }
.t-how { margin: 0 0 8px; color: var(--ui-soft); font-size: 14px; }
.t-how b { color: var(--ink); font-weight: normal; }
.t-mods { margin: 0 0 8px; padding-left: 1.2em; font-size: 14px; color: var(--ui-hint); }
.t-notes { margin: 8px 0 0; font-size: 14px; color: var(--ui-soft); }

/* The table itself. On a phone, a wide table scrolls inside its box. */
.t-scroll { overflow-x: auto; }
.t-rows { width: 100%; border-collapse: collapse; font-size: 15px; }
.t-rows th {
  text-align: left;
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 4px 8px;
  border-bottom: 1px solid #555a61;
  white-space: nowrap;
}
.t-rows td { padding: 5px 8px; border-bottom: 1px dashed #3c4148; vertical-align: top; color: var(--ui-text); }
.t-rows td.t-roll { white-space: nowrap; color: var(--ink); width: 1%; }
.t-rows tr.is-rolled td { background: color-mix(in srgb, var(--ink) 18%, transparent); color: #fff; }
.t-rows tr.is-rolled td.t-roll { color: var(--accent); }


/* ------------------------------------------------------------------
   3. ROLLING
------------------------------------------------------------------ */
.t-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.t-controls label { display: flex; align-items: center; gap: 6px; color: var(--ui-soft); font-size: 14px; }
.t-controls input[type="number"] { width: 4.2em; }
.t-controls select { max-width: 16rem; }
.t-result {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ui-text);
}
.t-result:empty { display: none; }
.t-result .t-answer { color: var(--ink); }
/* One die face. A die that passed glows; one that failed is grey (never red). */
.die {
  display: inline-grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  margin-right: 4px;
  font-weight: bold;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.die.passed { background: var(--ink); color: var(--paper); }
.die.failed { color: var(--ui-soft); border-color: #5d636b; }

@media (max-width: 600px) {
  .search input { min-width: 0; width: 100%; }
  .search { width: 100%; }
  .tables-area { padding: 0 8px 20px; }
}
