/* PS5 / Xbox picker, cheat tables and controller-button chips.
   Loaded only by articles that use the 'platform' or 'table' layout. */

.platform-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0 8px; }
.platform-picker__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 120px; padding: 20px; border-radius: var(--radius-lg, 16px);
  border: 2px solid transparent; color: #fff; cursor: pointer; font: inherit;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.platform-picker__btn--ps5  { background: linear-gradient(135deg, #0070d1, #003791); }
.platform-picker__btn--xbox { background: linear-gradient(135deg, #1fa31f, #0e6b0e); }
.platform-picker__btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.platform-picker__btn:focus-visible { outline: 3px solid var(--talc-blue, #1f5eff); outline-offset: 3px; }
.platform-picker__btn[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px var(--fg, #111); }
html[data-platform] .platform-picker__btn[aria-pressed="false"] { opacity: .55; }
.platform-picker__name { font-size: clamp(20px, 3vw, 28px); font-weight: 800; letter-spacing: -.01em; }
.platform-picker__hint { font-size: 14px; opacity: .9; }
.platform-picker__status { font-size: 14px; color: var(--fg-muted, #666); min-height: 1.4em; margin-top: 8px; }

/* With JS, the tables wait for a choice. Without JS, everything shows. */
html.platform-js:not([data-platform]) .platform-content { display: none; }

/* Spreadsheet-style tables */
.cheat-table-wrap { margin: 20px 0 8px; background: #fff; border: 1px solid var(--border, #e3e3e3); border-radius: var(--radius-md, 12px); overflow: hidden; }
.cheat-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.cheat-table thead th {
  background: var(--accent, #1f5eff); color: #fff; text-align: left; font-weight: 700;
  font-size: 13px; letter-spacing: .04em; text-transform: uppercase; padding: 12px 14px;
}
html[data-platform="ps5"]  .cheat-table thead th { background: #003791; }
html[data-platform="xbox"] .cheat-table thead th { background: #107c10; }
.cheat-table tbody th, .cheat-table td { padding: 12px 14px; border-top: 1px solid var(--border, #e3e3e3); text-align: left; vertical-align: middle; }
.cheat-table tbody th { font-weight: 700; white-space: nowrap; }
.cheat-table tbody tr:nth-child(even) { background: var(--bg-alt, #f6f7f9); }
.cheat-table__code { white-space: nowrap; color: var(--fg-muted, #777); }

/* Controller chips */
.pad-seq { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pad {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 50%;
  font: 700 15px/1 var(--font-body, system-ui), sans-serif; color: #fff;
  background: #2b2d33; box-shadow: inset 0 -2px 0 rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.2);
}
.pad--dir { font-size: 17px; font-family: system-ui, "Segoe UI Symbol", sans-serif; }
.pad--shoulder { border-radius: 8px; min-width: 38px; font-size: 13px; }
.pad__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pad-join, .pad-then { font-size: 13px; font-weight: 600; color: var(--fg-muted, #777); padding: 0 2px; }

/* Shoulder labels: both until a console is chosen, then just that one. */
.pad-xb::before { content: "/"; opacity: .5; margin: 0 2px; }
html[data-platform="ps5"]  .pad-xb { display: none; }
html[data-platform="xbox"] .pad-ps { display: none; }
html[data-platform="xbox"] .pad-xb::before { content: none; }

/* PS5: dark DualSense buttons with a blue edge. Xbox: black buttons with a green edge. */
html[data-platform="ps5"]  .pad { background: #1b1f2a; box-shadow: inset 0 -2px 0 #0070d1, 0 1px 2px rgba(0,0,0,.25); }
html[data-platform="xbox"] .pad { background: #111; box-shadow: inset 0 -2px 0 #1fa31f, 0 1px 2px rgba(0,0,0,.25); }
html[data-platform="xbox"] .pad--dir { border-radius: 6px; }

/* Phones: each row becomes a stacked card. */
@media (max-width: 640px) {
  .platform-picker { grid-template-columns: 1fr; }
  .platform-picker__btn { min-height: 88px; }
  .cheat-table thead { display: none; }
  .cheat-table, .cheat-table tbody, .cheat-table tr, .cheat-table tbody th, .cheat-table td { display: block; width: 100%; }
  .cheat-table tr { padding: 10px 14px; border-top: 1px solid var(--border, #e3e3e3); }
  .cheat-table tr:first-child { border-top: 0; }
  .cheat-table tbody th, .cheat-table td { border: 0; padding: 3px 0; white-space: normal; }
  .cheat-table tbody th { font-size: 17px; }
  .cheat-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--fg-muted, #777); }
  .cheat-table td.cheat-table__code::before { display: block; margin-bottom: 4px; }
}

/* Desktop: let the tables break out of the 740px reading column. */
@media (min-width: 900px) {
  .cheat-table-wrap { width: min(1080px, calc(100vw - 64px)); margin-left: calc(50% - min(540px, 50vw - 32px)); }
  .cheat-table tbody th { width: 22%; }
  .cheat-table__code { min-width: 400px; }
}
