/* Terrarium tab styles — all scoped under #terrariumResult (.ts-scope) so they
   never touch the rest of tx-checker. Dark theme consistent with the app.
   Refinement pass: vertical rhythm, clearer label↔value separation, section
   hierarchy, and table legibility. Single-column; Tancel dark/monospace system. */

.ts-scope {
  --ts-bg: #14141f;
  --ts-bg-2: #0f0f18;
  --ts-rule: #262633;
  --ts-rule-soft: #1e1e29;
  --ts-fg: #e8e4df;
  --ts-fg-bright: #f5f1ec;
  --ts-muted: #8a8a99;
  --ts-accent: #d4642a;
  font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace;
  color: var(--ts-fg);
  margin-top: 16px;
  font-variant-numeric: tabular-nums;
}

/* ── Summary blocks (Overview, General Pool) — pre-wrap key:value text ── */
.ts-scope .summary {
  background: linear-gradient(180deg, #16161f, #131320);
  border: 1px solid var(--ts-rule);
  border-left: 2px solid var(--ts-accent);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  white-space: pre-wrap;
  line-height: 1.85;
}
.ts-scope .summary b { color: var(--ts-fg-bright); font-weight: 700; letter-spacing: 0.2px; }
.ts-scope .summary.warn { border-left-color: #c79a5a; }
.ts-scope .summary.bad { border-color: #5a2a2a; border-left-color: #e05050; color: #e88; }

.ts-scope .warn { color: #e0a030; }
.ts-scope .ok { color: #5ab06a; }
.ts-scope .bad { color: #e05050; }
.ts-scope .hint { color: var(--ts-muted); font-size: 12px; line-height: 1.6; margin: 7px 0; }
.ts-scope .ts-muted { color: var(--ts-muted); }
.ts-scope a { color: #6ab0c7; text-underline-offset: 2px; }
.ts-scope a:hover { color: #8fcfe2; }

/* ── Section headers ── */
.ts-scope .ts-h3 {
  margin: 26px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--ts-rule);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ts-muted);
}

/* ── Pills & badges ── */
.ts-scope .pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--ts-rule); font-size: 11px; color: var(--ts-muted);
  background: rgba(255, 255, 255, 0.015);
}
.ts-scope .pill-rns { background: #16282f; color: #6ab0c7; border-color: #2a5a6b; }
.ts-scope .badge { display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.ts-scope .badge.run { background: #14361f; color: #6cc47e; border: 1px solid #2a6b3f; }
.ts-scope .badge.rest { background: #2a2118; color: #d0a868; border: 1px solid #5a4a2a; }
.ts-scope .badge.free { background: #1c1c28; color: var(--ts-muted); border: 1px solid var(--ts-rule); }
.ts-scope .badge-collectible { background: #271a31; color: #c79aff; border: 1px solid #5a3a6b; }
.ts-scope .badge-system { background: #16282f; color: #6ab0c7; border: 1px solid #2a5a6b; }

/* ── Tables ── */
.ts-scope table { border-collapse: collapse; width: 100%; margin: 10px 0 4px; }
.ts-scope th, .ts-scope td {
  text-align: left; padding: 7px 12px; font-size: 12px; vertical-align: middle;
  border-bottom: 1px solid var(--ts-rule-soft);
}
.ts-scope thead th {
  position: sticky; top: 0;
  color: var(--ts-muted); font-weight: 700; font-size: 10.5px;
  letter-spacing: 0.8px; text-transform: uppercase;
  border-bottom: 1px solid var(--ts-rule);
  background: var(--ts-bg-2);
  white-space: nowrap;
}
.ts-scope tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
.ts-scope tbody tr:hover { background: rgba(212, 100, 42, 0.07); }
.ts-scope tbody tr:last-child td { border-bottom: none; }
.ts-scope mark { background: var(--ts-accent); color: #0c0c16; border-radius: 2px; padding: 0 1px; }

/* ── Collapsibles ── */
.ts-scope details { margin-top: 12px; }
.ts-scope summary {
  cursor: pointer; color: #c4c4d0; padding: 6px 0; font-weight: 600;
  list-style: none; user-select: none;
}
.ts-scope summary::-webkit-details-marker { display: none; }
.ts-scope summary::before { content: '▸'; color: var(--ts-muted); display: inline-block; width: 1.1em; transition: transform 0.15s ease; }
.ts-scope details[open] > summary::before { transform: rotate(90deg); }
.ts-scope details.ts-card {
  background: var(--ts-bg); border: 1px solid var(--ts-rule);
  border-radius: 10px; padding: 12px 16px; margin-top: 14px;
}
.ts-scope details.ts-card[open] { border-color: #34343f; }
.ts-scope pre {
  background: #0a0a12; border: 1px solid var(--ts-rule);
  border-radius: 8px; padding: 14px; overflow: auto; font-size: 12px;
  max-height: 60vh; line-height: 1.55;
}

/* ── Search / filter bar ── */
.ts-scope .searchbar { margin: 12px 0 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ts-scope .searchbar input, .ts-scope .searchbar select {
  font: inherit; background: #1b1b27; color: var(--ts-fg);
  border: 1px solid var(--ts-rule); border-radius: 6px; padding: 7px 10px;
}
.ts-scope .searchbar input { min-width: 240px; }
.ts-scope .searchbar input:focus, .ts-scope .searchbar select:focus {
  outline: none; border-color: var(--ts-accent); box-shadow: 0 0 0 3px rgba(212, 100, 42, 0.12);
}

/* ── Per-plot dropdowns ── */
.ts-scope .plot {
  background: var(--ts-bg); border: 1px solid var(--ts-rule);
  border-radius: 8px; margin-bottom: 10px; transition: border-color 0.15s ease;
}
.ts-scope .plot:hover { border-color: #3a3a47; }
.ts-scope .plot[open] { border-color: #3a3a47; }
.ts-scope .plot > summary { padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; list-style: none; font-weight: 400; }
.ts-scope .plot > summary::-webkit-details-marker { display: none; }
.ts-scope .plot > summary::before { content: '▸'; color: var(--ts-muted); width: 1em; transition: transform 0.15s ease; }
.ts-scope .plot[open] > summary::before { transform: rotate(90deg); }
.ts-scope .plot .body { padding: 6px 16px 16px 34px; border-top: 1px solid var(--ts-rule-soft); }
.ts-scope .grow { flex: 1; }

/* ── Shrine key/value stats ── */
.ts-scope .kv {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 7px 18px; margin: 12px 0; align-items: baseline;
}
.ts-scope .kv dt { color: var(--ts-muted); }
.ts-scope .kv dd { margin: 0; color: var(--ts-fg-bright); }

/* current-tick highlight in the pool-regen projection */
.ts-scope tr.row-now { background: rgba(212, 100, 42, 0.10) !important; box-shadow: inset 2px 0 0 var(--ts-accent); }
.ts-scope .ts-now { color: var(--ts-fg-bright); }

/* ── Scrollable table wrapper (axie list + other standalone tables) ── */
.ts-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 720px) {
  /* Tables inside collapsible cards scroll horizontally */
  .ts-scope details.ts-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Tick consumption and pool regen tables */
  .ts-scope .tickwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Per-plot shrine detail tables */
  .ts-scope .plot .body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Searchbar input: don't force a min-width larger than the viewport */
  .ts-scope .searchbar input { min-width: 0; width: 100%; }
  /* Shrine kv grid: allow value column to wrap */
  .ts-scope .kv { grid-template-columns: max-content 1fr; word-break: break-all; }
}
