/* ===============================================
   PORTER-TOOLS.CSS - Porter tool pages
   Cover Generator, JSON Generator, README Generator

   Sizing note: this site sets a 125% root font (so 1rem = 20px), which
   every other stylesheet here accounts for. This file originally did not -
   it used desktop-app scale values (0.95rem inputs, 0.875rem padding,
   2.5rem headings) that rendered ~25% larger than everything around them,
   which is what made these pages read as oversized and detached from the
   rest of the site. Control sizes below are matched to the Browse filter
   panel in games-filters.css: 0.78rem text, 0.45rem/0.6rem padding, 8px
   radius. Keep them in step with that file.
   =============================================== */

/* ===== CONTAINER =====
   No max-width or side padding of its own - the theme's .md-content__inner
   already caps and gutters every page, so anything extra here just made
   these pages narrower than their neighbours. */
.porter-tool {
  margin: 1.25rem 0 2rem;
}

/* Bordered card wrapping a stack of .filter-accordion sections, so a long
   form reads as one collapsible panel rather than a run of loose fields -
   same component and colours as the Browse filter panel. Padding is 0
   because each accordion row carries its own, letting the divider borders
   span the full width edge to edge. */
.porter-tool-panel {
  border-radius: 12px;
  border: 1px solid rgba(128, 128, 128, 0.3);
  overflow: hidden;
}

[data-md-color-scheme="light"] .porter-tool-panel {
  background-color: #ececec;
  color: #111111;
}

[data-md-color-scheme="dark"] .porter-tool-panel {
  background-color: #2b2b2b;
  color: #eeeeee;
}

/* h1/subtitle/numbered-section-card styling used to live here, for markup
   like <h1>/<p class="subtitle">/<div class="section"><div
   class="section-number">1</div>... All three tool pages use real Markdown
   (#, ##) for their titles now, which already carries its own typographic
   weight via the theme's .md-typeset rules and earns a TOC entry for free.
   The numbered circles said nothing the heading didn't, so they're gone
   rather than reimplemented. */

/* ===== FORM ELEMENTS ===== */
.porter-tool textarea,
.porter-tool input[type="text"],
.porter-tool input[type="url"],
.porter-tool input[type="email"],
.porter-tool input[type="number"],
.porter-tool input[type="date"],
.porter-tool select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  /* Alpha grey rather than --card-border (#e0e0e0), which sits ~1:1 against
     the light-mode page and disappears entirely. */
  border: 1px solid rgba(128, 128, 128, 0.45);
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  font-size: 0.78rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.porter-tool textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.55;
}

.porter-tool textarea:focus,
.porter-tool input[type="text"]:focus,
.porter-tool input[type="url"]:focus,
.porter-tool input[type="email"]:focus,
.porter-tool input[type="number"]:focus,
.porter-tool input[type="date"]:focus,
.porter-tool select:focus {
  outline: none;
  border-color: #F49519;
  box-shadow: 0 0 0 3px rgba(244, 149, 25, 0.12);
}

/* input[type="date"] was missing from the shared rule above until now, so
   it fell back to the browser's bare native control - a white box with a
   black calendar glyph, regardless of theme, sitting next to fields that
   all otherwise match the page. color-scheme tells the browser which
   palette to render ITS OWN chrome in (the picker icon and the calendar
   popup it opens - neither is reachable via ordinary CSS properties),
   matched to this site's manual light/dark toggle rather than the OS's. */
[data-md-color-scheme="dark"] .porter-tool input[type="date"] {
  color-scheme: dark;
}

[data-md-color-scheme="light"] .porter-tool input[type="date"] {
  color-scheme: light;
}

.porter-tool input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
  margin-right: -2px;
  transition: background-color 0.2s ease;
}

.porter-tool input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background-color: rgba(244, 149, 25, 0.15);
}

/* Scoped to .form-group/.im-slot rather than every label inside the tool:
   .filter-subgroup label (Resolution / Ram / Other) comes from
   games-filters.css with its own uppercase small-caps treatment, and this
   file loads later, so an unscoped .porter-tool label would silently
   override half of it and leave those headers in a hybrid style. */
.porter-tool .form-group > label,
.porter-tool .im-slot-body label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  font-size: 0.78rem;
}

.porter-tool .form-group {
  margin-bottom: 0.9rem;
}

.porter-tool .form-group:last-child {
  margin-bottom: 0;
}

.porter-tool .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.porter-tool .help-text {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--md-default-fg-color--light);
  margin: 0.25rem 0 0;
}

/* ===== TABLES ===== */
.porter-tool .controls-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(128, 128, 128, 0.3);
  font-size: 0.78rem;
}

.porter-tool .controls-table thead {
  background: rgba(128, 128, 128, 0.12);
}

.porter-tool .controls-table th {
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--md-default-fg-color);
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.porter-tool .controls-table td {
  padding: 0.4rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.porter-tool .controls-table tr:last-child td {
  border-bottom: none;
}

.porter-tool .controls-table input {
  margin: 0;
}

.porter-tool .table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ===== BUTTONS =====
   38px tall at 0.75rem, matching the Connect button in the Browse filter
   panel - but coloured like .hero-btn-primary/.hero-btn-secondary from
   homepage.css (an inverted near-white/near-black solid paired with a
   transparent outline) rather than solid orange, so these match the same
   button family as the homepage CTAs and the { .md-button } links used
   elsewhere in the docs (see extra.css). Orange is kept only as an accent
   (focus rings, the destructive .row-delete-btn hover, filter-panel
   pieces reused from games-filters.css) rather than a button fill. */
.porter-tool .primary-btn,
.porter-tool .add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.8rem;
  height: 1.9rem;
  background: #f0f0f2;
  color: #15151a;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.porter-tool .primary-btn:hover,
.porter-tool .add-row-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

[data-md-color-scheme="light"] .porter-tool .primary-btn,
[data-md-color-scheme="light"] .porter-tool .add-row-btn {
  background: #1a1a1e;
  color: #f5f5f7;
}

[data-md-color-scheme="light"] .porter-tool .primary-btn:hover,
[data-md-color-scheme="light"] .porter-tool .add-row-btn:hover {
  background: #000000;
}

.porter-tool .secondary-btn,
.porter-tool .clear-btn,
.porter-tool .remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.8rem;
  height: 1.9rem;
  background: transparent;
  color: var(--md-default-fg-color);
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.porter-tool .secondary-btn:hover,
.porter-tool .clear-btn:hover,
.porter-tool .remove-btn:hover {
  border-color: rgba(128, 128, 128, 0.9);
  color: var(--md-default-fg-color);
  background: transparent;
}

.porter-tool .action-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

/* ===== OUTPUT AREAS ===== */
.porter-tool .output-container {
  position: relative;
}

.porter-tool pre {
  margin: 0;
  padding: 0.9rem;
  background: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.7rem;
  line-height: 1.6;
  font-family: 'Roboto Mono', monospace;
  border: 1px solid rgba(128, 128, 128, 0.3);
  max-height: 22rem;
  overflow-y: auto;
}

/* Markdown / Preview switch above the README generator's output. */
.porter-tool .readme-view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
  padding: 0.2rem;
  border-radius: 8px;
  background: var(--md-code-bg-color);
  border: 1px solid rgba(128, 128, 128, 0.3);
}

.porter-tool .readme-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--md-default-fg-color--light);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.porter-tool .readme-view-btn.active {
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

/* Same box as the markdown <pre>, but rendered content inside. */
.porter-tool .readme-preview {
  padding: 0.4rem 1.1rem;
  border-radius: 8px;
  border: 1px solid rgba(128, 128, 128, 0.3);
  max-height: 22rem;
  overflow-y: auto;
}

.porter-tool .readme-preview table {
  display: table;
  font-size: 0.7rem;
}

.porter-tool .output-placeholder {
  color: var(--md-default-fg-color--light);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.75rem;
}

/* ===== ALERTS ===== */
.porter-tool .alert {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.9rem;
  border: 1px solid;
  font-size: 0.75rem;
  line-height: 1.5;
}

.porter-tool .alert-info {
  background: rgba(77, 190, 238, 0.1);
  border-color: rgba(77, 190, 238, 0.3);
  color: var(--md-default-fg-color);
}

.porter-tool .alert-warning {
  background: rgba(255, 152, 0, 0.1);
  border-color: rgba(255, 152, 0, 0.3);
  color: var(--md-default-fg-color);
}

.porter-tool .alert-success {
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
  color: var(--md-default-fg-color);
}

/* Section divider: a hairline above every ## heading that follows one of
   these tool blocks. General-sibling selector, so it needs no wrapper
   markup and self-scopes to pages that use .porter-tool. */
.md-typeset .porter-tool ~ h2 {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(128, 128, 128, 0.25);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .porter-tool .action-buttons {
    flex-direction: column;
  }

  .porter-tool .primary-btn,
  .porter-tool .secondary-btn {
    width: 100%;
    justify-content: center;
  }

  .porter-tool .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .porter-tool .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===============================================
   COVER GENERATOR (tools/cover-generator.md)
   Three image slots + a 640x480 preview canvas.
   =============================================== */
.porter-tool .im-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 720px) {
  .porter-tool .im-slots {
    grid-template-columns: 1fr;
  }
}

.porter-tool .im-slot {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1px dashed rgba(128, 128, 128, 0.4);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.porter-tool .im-slot.is-filled {
  border-style: solid;
  border-color: #F49519;
}

/* Whole-card drop target - matches Chrome/Firefox's native drag feedback
   language (dashed border, tinted fill) rather than inventing a new one. */
.porter-tool .im-slot.is-dragover {
  border-style: solid;
  border-color: #F49519;
  background-color: rgba(244, 149, 25, 0.08);
}

/* 16:9 so the box doesn't jump height when an image lands in it. */
.porter-tool .im-slot-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background-color: rgba(128, 128, 128, 0.12);
  overflow: hidden;
  color: var(--card-stat-color, #888888);
  font-size: 1.6rem;
}

.porter-tool .im-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.porter-tool .im-slot input[type="file"] {
  width: 100%;
  font-size: 0.7rem;
  color: var(--card-text);
}

.porter-tool .im-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 1rem;
  border-radius: 10px;
  /* Checkerboard: the cover is transparent outside the bezel and floppy,
     so a flat fill would hide what is and isn't actually opaque. */
  background-image:
    linear-gradient(45deg, rgba(128,128,128,0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(128,128,128,0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(128,128,128,0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(128,128,128,0.18) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.porter-tool .im-stage canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.porter-tool .im-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--card-stat-color, #888888);
}

/* ===============================================
   SCREENSHOT RESIZER (tools/screenshot-resizer.md)
   One drop slot beside the fit-mode picker, then
   the cover generator's stage underneath.
   =============================================== */
.porter-tool .rs-setup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  /* The slot is shorter than the radio list on most viewports - without
     this it stretches to match and the 16:9 preview box grows with it. */
  align-items: start;
}

@media (max-width: 720px) {
  .porter-tool .rs-setup {
    grid-template-columns: 1fr;
  }
}

/* What the current mode did to the source, in .im-empty's muted treatment.
   Sits outside .im-stage so the checkerboard doesn't run behind the text. */
.porter-tool .rs-meta {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--card-stat-color, #888888);
}

/* ===============================================
   PNG COMPRESSOR (tools/png-compressor.md)
   Drop slot + quality controls, then a
   before/after wipe over the two renderings.
   =============================================== */
.porter-tool .pq-setup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 720px) {
  .porter-tool .pq-setup {
    grid-template-columns: 1fr;
  }
}

.porter-tool .pq-controls {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.porter-tool input[type="range"] {
  width: 100%;
  margin: 0.2rem 0 0;
  /* accent-color hands the track and thumb to the browser's own control
     in brand orange - no vendor-prefixed thumb rules to keep in sync. */
  accent-color: #F49519;
  cursor: pointer;
}

.porter-tool .pq-value {
  float: right;
  font-weight: 400;
  color: var(--card-stat-color, #888888);
}

/* The checkbox row is a .filter-checkbox-item so it matches the filter
   panel, but on its own it sits too tight under the group label. */
.porter-tool .pq-dither {
  padding-left: 0;
}

.porter-tool .pq-compare {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  margin: 0 auto;
  max-width: 100%;
  /* The wipe is driven by pointer events, so the browser must not claim
     a horizontal drag as a page scroll first. */
  touch-action: none;
  user-select: none;
  cursor: ew-resize;
  /* Checkerboard: a compressed PNG can keep transparency, and a flat fill
     would hide which parts are actually see-through. */
  background-image:
    linear-gradient(45deg, rgba(128,128,128,0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(128,128,128,0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(128,128,128,0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(128,128,128,0.18) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.porter-tool .pq-compare img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* clip-path rather than a width plus overflow: the two layers then share
   one coordinate system, so the halves line up exactly at the divider
   whatever the image's aspect ratio is. */
.porter-tool .pq-compare-overlay {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pq-pos, 50%)) 0 0);
}

.porter-tool .pq-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pq-pos, 50%);
  width: 2px;
  margin-left: -1px;
  background-color: #F49519;
  cursor: ew-resize;
}

.porter-tool .pq-compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid #F49519;
  background-color: rgba(0, 0, 0, 0.55);
}

.porter-tool .pq-compare-handle:focus-visible {
  outline: none;
}

.porter-tool .pq-compare-handle:focus-visible::after {
  box-shadow: 0 0 0 3px rgba(244, 149, 25, 0.45);
}

/* Held down, the labels and grip would otherwise sit in the way of the
   thing being compared. */
.porter-tool .pq-compare.is-dragging .pq-tag {
  opacity: 0;
}

.porter-tool .pq-tag {
  position: absolute;
  top: 0.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.porter-tool .pq-tag-left { left: 0.5rem; }
.porter-tool .pq-tag-right { right: 0.5rem; }

.porter-tool .pq-compare.is-busy {
  /* Quantising blocks the main thread, so the only honest feedback is to
     dim what is already on screen until the new render replaces it. */
  opacity: 0.55;
}

.porter-tool .pq-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--card-stat-color, #888888);
}

.porter-tool .pq-size strong {
  font-weight: 600;
  color: var(--card-text);
  margin-right: 0.3rem;
}

.porter-tool .pq-delta.is-smaller { color: #43a047; }
.porter-tool .pq-delta.is-bigger { color: #e53935; }

/* Breaks onto its own line rather than sitting in the figures row - it is
   an instruction, not another number. */
.porter-tool .pq-hint {
  flex-basis: 100%;
  color: var(--card-stat-color, #888888);
}

/* ===============================================
   PORT JSON GENERATOR - REQUIREMENTS (tools/json-generator.md)
   A tri-state tag picker and a device x firmware
   grid showing which devices would list the port.
   =============================================== */
.porter-tool .req-status,
.porter-tool .req-intro {
  font-size: 0.78rem;
  color: var(--card-stat-color, #888888);
}

.porter-tool .req-tags {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}

.porter-tool .req-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.25rem 0;
  border: 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.25);
  background: none;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--card-stat-color, #888888);
  cursor: pointer;
}

.porter-tool .req-group-title small {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.porter-tool .req-group-title i {
  transition: transform 0.2s ease;
}

.porter-tool .req-group.is-collapsed .req-group-title i {
  transform: rotate(-90deg);
}

/* Firmware and device lists run to dozens of tags, so they start closed. */
.porter-tool .req-group.is-collapsed .req-taglist {
  display: none;
}

.porter-tool .req-taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.55rem;
}

.porter-tool .req-tag {
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  color: var(--card-text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.porter-tool .req-tag:hover {
  border-color: #F49519;
}

.porter-tool .req-tag:focus-visible {
  outline: 2px solid #F49519;
  outline-offset: 2px;
}

.porter-tool .req-tag.is-required {
  background: #F49519;
  border-color: #F49519;
  color: #111111;
  font-weight: 600;
}

.porter-tool .req-tag.is-excluded {
  border-color: #e53935;
  color: #e53935;
  text-decoration: line-through;
}

.porter-tool .req-tag.is-excluded::before {
  content: "!";
  display: inline-block;
  margin-right: 0.1rem;
  text-decoration: none;
}

.porter-tool .req-summary {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.82rem;
}

.porter-tool .req-warn {
  color: #e53935;
}

.porter-tool .req-grid-scroll {
  max-height: 26rem;
  overflow: auto;
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 8px;
}

/* The scrollbar the theme gives code blocks and the sidebar: a thin bar in the
   faded text colour that turns the accent orange on hover. Chrome ignores the
   ::-webkit-scrollbar rules once the standard properties are set, so those only
   go to browsers that lack them (Firefox), as the theme itself does. */
.porter-tool .req-grid-scroll::-webkit-scrollbar {
  width: 0.2rem;
  height: 0.2rem;
}

.porter-tool .req-grid-scroll::-webkit-scrollbar-thumb {
  background-color: var(--md-default-fg-color--lighter);
}

.porter-tool .req-grid-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--md-accent-fg-color);
}

.porter-tool .req-grid-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

@supports not selector(::-webkit-scrollbar) {
  .porter-tool .req-grid-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--md-default-fg-color--lighter) transparent;
  }
}

/* A class on the table keeps mkdocs-material's own table styling off it. */
.porter-tool .req-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.porter-tool .req-grid th,
.porter-tool .req-grid td {
  padding: 0.3rem 0.55rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  text-align: center;
  white-space: nowrap;
}

/* Header row and device column stay put while the rest scrolls. */
.porter-tool .req-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card-bg, var(--md-default-bg-color));
}

.porter-tool .req-grid tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  font-weight: 500;
  background: var(--card-bg, var(--md-default-bg-color));
}

.porter-tool .req-grid thead th:first-child {
  left: 0;
  z-index: 3;
  text-align: left;
}

.porter-tool .req-grid td.is-pass {
  color: #43a047;
  font-weight: 700;
}

.porter-tool .req-grid td.is-fail {
  color: #e53935;
  background: rgba(229, 57, 53, 0.08);
  cursor: help;
}

.porter-tool .req-grid td.is-na {
  opacity: 0.35;
}

.porter-tool .req-note {
  margin-top: 0.6rem;
}

/* ===============================================
   JSON/README GENERATORS
   The accordion sections, checkbox rows and radio
   lists all reuse games-filters.css directly, so
   these pages share the Browse filter panel's look.
   Only the bits that don't exist there live here.
   =============================================== */

/* Genre/architecture picker - the filter panel's dense checkbox rows
   flowed into a wrapping grid instead of one tall column. */
.porter-tool .tool-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.1rem 0.75rem;
}

/* Requirements group headers ("Resolution", "Ram", "Other") reuse
   .filter-subgroup + .filter-subgroup label from games-filters.css; this
   only widens their spacing to form-group rhythm. */
.porter-tool .filter-subgroup {
  margin-bottom: 0.9rem;
}

.porter-tool .filter-subgroup:last-child {
  margin-bottom: 0;
}

/* games-filters.css styles `.filter-subgroup label` as an uppercase
   small-caps group header, but .filter-checkbox-item rows are themselves
   <label>s, so nested option rows inherit that treatment and win on
   specificity (0,1,1 over 0,1,0). On the games page that goes unnoticed -
   the values there are short tokens like "aarch64". Here they're full
   sentences ("Not Lowres: Exclude 480x320..."), which in all-caps is close
   to unreadable, so option rows are put back to sentence case. Scoped to
   .porter-tool so the games panel keeps the look it has today. */
.porter-tool .filter-subgroup .filter-checkbox-item {
  display: flex;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--card-text, var(--md-default-fg-color));
}

.porter-tool select[multiple] {
  min-height: 8rem;
  padding: 0.3rem;
}

.porter-tool select[multiple] option {
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
}

.porter-tool select[multiple] optgroup {
  font-weight: 700;
  color: var(--md-default-fg-color);
}

/* Input + button on one line ("Add Porter", SteamDB command). The input's
   flex-basis is a real floor rather than 0/auto: with a wide button beside
   it ("Add Steam Instructions" is ~277px) an auto basis let the input
   collapse to ~42px on a phone instead of wrapping the button onto its own
   line, which is what this basis + flex-wrap now forces. */
.porter-tool .tool-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.porter-tool .tool-inline-row input {
  flex: 1 1 11rem;
  min-width: 0;
}

.porter-tool .tool-inline-row .add-row-btn {
  flex-shrink: 0;
}

/* Ghost icon button that removes one row from the store-links/controls
   tables. */
.porter-tool .row-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(128, 128, 128, 0.45);
  color: var(--md-default-fg-color--light);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  font-size: 0.6rem;
}

.porter-tool .row-delete-btn:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
}

.porter-tool .controls-table th.row-actions,
.porter-tool .controls-table td.row-actions {
  width: 2.2rem;
  text-align: center;
}
