/* Factions. Content only; the shell owns the bar, the signpost and the theme.
 * Cobalt revision 2026-10-05: grey accent, bold lede over a quiet subline, compact on a mouse and 44px on touch,
 * the detail card is a glass panel (right side on a desktop, a bottom sheet that swipes down on a phone).
 * Tokens: /cobalt/cobalt-tokens.css, then /ui/jslc-ui.css. */
:root { color-scheme: light; --paper: #f6f7fa; --card: #fff; --ink: #111a2d; --muted: #4b5563; --rule: #9ca3af; --accent: #374151; --link: #374151; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; --paper: #0b1324; --card: #0f1d37; --ink: #f3f6ff; --muted: #b6bfcf; --rule: #6b7280; --accent: #d1d5db; --link: #d1d5db; } }
:root[data-theme="dark"] { color-scheme: dark; --paper: #0b1324; --card: #0f1d37; --ink: #f3f6ff; --muted: #b6bfcf; --rule: #6b7280; --accent: #d1d5db; --link: #d1d5db; }
* { box-sizing: border-box; }
html { touch-action: manipulation; }
body { margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink); font: 13px/1.5 Arial, Helvetica, sans-serif; -webkit-text-size-adjust: 100%; }
body.drawer-open { overflow: hidden; }
main { width: min(1120px, 100%); margin: auto; padding: calc(env(safe-area-inset-top, 0px) + 16px) calc(env(safe-area-inset-right, 0px) + 16px) calc(env(safe-area-inset-bottom, 0px) + 24px) calc(env(safe-area-inset-left, 0px) + 16px); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { margin: 0; font-size: 20px; line-height: 1.3; }
h2 { margin: 0; font-size: 15px; }
section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line, rgba(17,26,45,.12)); }
p { margin: 6px 0; }
.lede { font-weight: 700; }
.quiet, .sub { color: var(--muted); }
.quiet { font-size: 11.5px; }
a { color: var(--link); }
.actions, .jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.button, .card { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.button { display: inline-flex; align-items: center; justify-content: center; height: var(--g-ctl, 28px); padding: 0 12px; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; color: var(--ink); }
.button:hover, .card:hover { background: var(--accent-subtle); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
section > .button { margin: 4px 0 8px; }
/* Cards: one boundary per unit or structure; a bold name over a quiet role. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto 1fr; column-gap: 8px; align-items: start; padding: 8px; text-align: left; cursor: pointer; min-width: 0; border-color: var(--line, rgba(17,26,45,.12)); }
.card > img, .card > .pending { grid-row: span 2; }
.card strong { font-size: 12.5px; line-height: 1.3; overflow-wrap: anywhere; }
.card .sub { font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.card img, .cameo { width: 48px; height: 48px; object-fit: contain; background: var(--paper); border-radius: 4px; }
.card .pending { min-height: 48px; width: 48px; font-size: 11px; line-height: 1.2; }
.pending { min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: 11.5px; }
.scale { width: 100%; height: auto; border-radius: 8px; background: var(--card); margin: 6px 0; }
.sheet-caption { overflow-wrap: anywhere; }
/* Scrim: phone only. */
.scrim { position: fixed; inset: 0; z-index: 2; border: 0; padding: 0; background: var(--scrim); color: transparent; font-size: 0; }
.scrim[hidden], .drawer[hidden] { display: none; }
@media (min-width: 760px) { .scrim { background: transparent; } }
/* Detail card: glass, sized to its content, never wider than it needs. */
.drawer { position: fixed; z-index: 3; left: 6px; right: 6px; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); max-height: 86dvh; overflow: auto; overscroll-behavior: contain; background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--ink); border: 1px solid var(--glass-line); border-radius: var(--r-sheet, 12px); box-shadow: var(--shadow); padding: 0 14px 14px; }
.drawer .c-grab-zone { position: sticky; top: 0; padding: 0 0 2px; }
.detail-head { position: sticky; top: 13px; z-index: 1; display: flex; align-items: center; gap: 4px; margin: 0 -14px 6px; padding: 2px 14px 6px; background: inherit; border-bottom: 1px solid var(--line, rgba(17,26,45,.12)); }
.detail-head h2 { flex: 1; min-width: 0; font-size: 15px; }
.detail-head .g-x { margin: 0 -10px 0 0; }
.sheet, .angles { width: 100%; height: auto; background: var(--card); border-radius: 8px; }
.angles-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.angles-row figure { margin: 0; }
figcaption { font-size: 11px; color: var(--muted); }
dl { display: grid; grid-template-columns: 7.5em 1fr; gap: 4px 8px; margin: 10px 0; font-size: 12px; }
dt { color: var(--muted); font-size: 11px; padding-top: 1px; }
dd { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-transparency: reduce) { .drawer { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .drawer { left: auto; right: 8px; top: 8px; bottom: auto; width: min(400px, 40vw); max-height: calc(100dvh - 16px); }
  .drawer .c-grab-zone { display: none; }
  .detail-head { top: 0; padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Phone readers get full names and roles, rather than a miniaturized poster. */
.reference-sheets { margin-top: 16px; }
.reference-sheets summary, .sheet-link { display: flex; align-items: center; min-height: 44px; font-size: 12px; }
.reference-sheets summary { cursor: pointer; }
@media (max-width: 759px) {
  .grid { grid-template-columns: 1fr; }
  .card { grid-template-columns: 56px minmax(0, 1fr); min-height: 76px; padding: 10px; }
  .card strong { font-size: 14px; }
  .card .sub, .card .pending, .pending, .quiet, .sub, figcaption, dt, dd { font-size: 12px; line-height: 1.5; }
  .button, .g-share, .g-x { min-width: 44px; min-height: 44px; }
}
@media (min-width: 480px) and (max-width: 759px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Compact cards (Cobalt, kit rev 2026-10-05b): name and role first, a 40px thumbnail on the right; 11px game floor holds. */
.grid { gap: 6px; }
.card { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 2px; padding: 7px 8px 7px 10px; }
.card > img, .card > .pending { grid-column: 2; grid-row: 1 / span 2; }
.card > strong, .card > .sub { grid-column: 1; }
.card strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.card .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card img, .card .cameo { width: 40px; height: 40px; }
.card .pending { width: 40px; min-height: 40px; font-size: 11px; }
.detail-head .c-ct-acts { margin-left: 0; }
.card { grid-template-rows: auto auto; align-content: start; }

/* Preserve the current phone readability rules alongside the compact right-hand thumbnail. */
@media (max-width: 759px) {
  .card { min-height: 76px; }
  .card strong { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
  .card .sub { white-space: normal; overflow: visible; }
}
