/* ============================================================================
 * JQRG Study theme foundation.
 * Theme IDs and palette variations live in jqrg-theme.js and
 * jqrg-theme-presets.css. This file applies the Study family to the whole
 * first-party shell: readable ink, calm surfaces, clear controls, and a
 * resource-library layout. Presets add the selected palette and details.
 * ==========================================================================*/

html[data-theme="study"]{
  --study-ink:#111827;
  --study-ink-dim:#4b5563;
  --study-line:#b9bfc7;
  --study-line-soft:#d8dce1;
  --study-surface:#ffffff;
  --study-page:#ffffff;
  --study-band:#f4f5f6;
  --study-link:#0b4f9e;
  --study-primary:#153a63;
  --study-primary-ink:#dbe3ec;
  --study-ok:#15803d;

  /* the site's own tokens, so anything driven by them follows along */
  --bg-deep:#ffffff;
  --bg-card:#ffffff;
  --border:#b9bfc7;
  --border-light:#d8dce1;
  --text:#111827;
  --text-dim:#4b5563;
  --pill-bg:#f4f5f6;
  --dropdown-bg:#ffffff;
  --search-pill-bg:#ffffff;
  --accent-purple:#0b4f9e;
}

/* --- 1/2. calm surfaces without flattening the whole interface ------------ */
html[data-theme="study"] *{
  border-radius:8px !important;
  text-shadow:none !important;
  filter:none !important;
  /* Keep short transitions and entry effects; only remove exaggerated motion. */
  animation-delay:0s !important;
  animation-duration:0.18s !important;
  animation-iteration-count:1 !important;
  transition-duration:0.18s !important;
  transition-delay:0s !important;
}
html[data-theme="study"] .bg,
html[data-theme="study"] .bg::after{display:none !important}
html[data-theme="study"] #bg-scrim,
html[data-theme="study"] #bg-particles,
html[data-theme="study"] #particle-canvas,
html[data-theme="study"] .particles{display:none !important}

html[data-theme="study"],
html[data-theme="study"] body{
  background:var(--study-page) !important;
  color:var(--study-ink) !important;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif !important;
}

/* --- 3. one ink colour for all text -------------------------------------- */
html[data-theme="study"] #app,
html[data-theme="study"] #app div,
html[data-theme="study"] #app span,
html[data-theme="study"] #app p,
html[data-theme="study"] #app li,
html[data-theme="study"] #app label,
html[data-theme="study"] #app h1,
html[data-theme="study"] #app h2,
html[data-theme="study"] #app h3,
html[data-theme="study"] #app h4,
html[data-theme="study"] #app strong,
html[data-theme="study"] #app em,
html[data-theme="study"] #app button,
html[data-theme="study"] #app input,
html[data-theme="study"] #app select,
html[data-theme="study"] #app textarea,
html[data-theme="study"] #app td,
html[data-theme="study"] #app th{
  color:var(--study-ink) !important;
}
/* NOTE: no blanket `opacity:1` here. Several components show/hide with opacity
   (.dropdown-menu is opacity:0 until .dropdown.open, .modal-overlay, page
   transitions), and a blanket rule on #app div broke the games "All Demos"
   dropdown so it opened but never collapsed. Dimmed *text* is instead reset
   per element further down (.home-hero-subtitle, .home-quick-desc,
   .home-chat-banner-desc, .tile-label). */
html[data-theme="study"] #app a,
html[data-theme="study"] #app a *{color:var(--study-link) !important;text-decoration:underline}

/* --- 4. UI icons: monochrome, never white -------------------------------- */
html[data-theme="study"] #app svg,
html[data-theme="study"] #app svg *{
  fill:var(--study-ink-dim) !important;
  stroke:var(--study-ink-dim) !important;
  color:var(--study-ink-dim) !important;
}
html[data-theme="study"] #app svg[fill="none"],
html[data-theme="study"] #app svg[fill="none"] *{fill:none !important;stroke:var(--study-ink-dim) !important}
html[data-theme="study"] .sidebar .logo svg,
html[data-theme="study"] .sidebar .logo svg *{fill:#6b7280 !important;stroke:#6b7280 !important}
html[data-theme="study"] .logo-shape{background:#6b7280 !important}

/* --- 5. home-only promotion art and motion ------------------------------- */
html[data-theme="study"] .home-banner,
html[data-theme="study"] .home-spotlight,
html[data-theme="study"] .home-spotlight-play{display:none !important}
html[data-theme="study"] .t-g img,
html[data-theme="study"] .t-a img,
html[data-theme="study"] .learning-module img,
html[data-theme="study"] .interactive-module img,
html[data-theme="study"] .educational-card img,
html[data-theme="study"] .t-g .skeleton,
html[data-theme="study"] .t-a .skeleton,
html[data-theme="study"] .t-g .tile-shadow,
html[data-theme="study"] .t-a .tile-shadow{display:none !important}

/* --- 6. chrome: a plain document frame ---------------------------------- */
html[data-theme="study"] .top-bar{
  background:var(--study-surface) !important;
  border-bottom:1px solid var(--study-line) !important;
}
html[data-theme="study"] .sidebar{
  background:var(--study-band) !important;
  border-right:1px solid var(--study-line) !important;
}
html[data-theme="study"] .main{
  background:var(--study-page) !important;
  border:0 !important;
}
html[data-theme="study"] .page{background:transparent !important}
html[data-theme="study"] .sidebar nav button,
html[data-theme="study"] .tb-section .nav-btns button{background:transparent !important;border:0 !important}
html[data-theme="study"] .sidebar nav button.active{
  background:var(--study-band) !important;
  border-left:3px solid var(--study-link) !important;
}

/* --- 7. the home page, reshaped ----------------------------------------- */
html[data-theme="study"] .home-hero-greeting{
  background:none !important;
  -webkit-text-fill-color:var(--study-ink) !important;
  font-size:22px !important;
  font-weight:600 !important;
  letter-spacing:0 !important;
}
html[data-theme="study"] .home-hero-subtitle{color:var(--study-ink-dim) !important;opacity:1 !important}
html[data-theme="study"] .home-quick-card,
html[data-theme="study"] .home-chat-banner,
html[data-theme="study"] .partner-card{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  padding:12px 14px !important;
}
html[data-theme="study"] .home-quick-card:hover,
html[data-theme="study"] .home-chat-banner:hover,
html[data-theme="study"] .partner-card:hover{background:var(--study-band) !important;border-color:var(--study-line) !important}
html[data-theme="study"] .home-quick-card::before{display:none !important}
html[data-theme="study"] .home-quick-icon,
html[data-theme="study"] .home-chat-banner-icon{
  background:var(--study-band) !important;
  border:1px solid var(--study-line-soft) !important;
}
html[data-theme="study"] .home-quick-icon svg,
html[data-theme="study"] .home-chat-banner-icon svg{color:var(--study-ink-dim) !important}
html[data-theme="study"] .home-chat-banner-live{display:none !important}
html[data-theme="study"] .partner-name,
html[data-theme="study"] .partner-desc,
html[data-theme="study"] .home-quick-title,
html[data-theme="study"] .home-quick-desc,
html[data-theme="study"] .home-chat-banner-desc{color:var(--study-ink) !important;opacity:1 !important}

/* --- 8. catalogue tiles use compact resource rows ------------------------ */
html[data-theme="study"] .grid-1,
html[data-theme="study"] .grid-2{gap:6px !important;grid-template-columns:repeat(auto-fill,minmax(200px,1fr)) !important}
html[data-theme="study"] .t-g,
html[data-theme="study"] .t-a,
html[data-theme="study"] .learning-module,
html[data-theme="study"] .interactive-module,
html[data-theme="study"] .educational-card{
  aspect-ratio:auto !important;
  overflow:visible !important;
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  min-height:40px;
  padding:10px 12px;
  display:flex;align-items:center;justify-content:flex-start;text-align:left;
}
html[data-theme="study"] .t-g:hover,
html[data-theme="study"] .t-a:hover{background:var(--study-band) !important;border-color:var(--study-ink-dim) !important}
html[data-theme="study"] .tile-label,
html[data-theme="study"] .t-g .tile-label,
html[data-theme="study"] .t-a .tile-label{
  position:static !important;inset:auto !important;bottom:auto !important;padding:0 !important;
  font-size:13.5px !important;font-weight:400 !important;letter-spacing:0 !important;line-height:1.35;
  color:var(--study-ink) !important;white-space:normal !important;overflow:visible !important;
  text-overflow:clip !important;transform:none !important;opacity:1 !important;background:none !important;
}
html[data-theme="study"] .tile-label .hl{color:var(--study-link) !important;font-weight:600 !important}
html[data-theme="study"] .t-g.tile-noimg,
html[data-theme="study"] .t-a.tile-noimg{background:var(--study-surface) !important}

/* --- 9. controls: flat, square, bordered -------------------------------- */
html[data-theme="study"] #app button,
html[data-theme="study"] #app .setting-btn,
html[data-theme="study"] #app input,
html[data-theme="study"] #app select,
html[data-theme="study"] #app textarea{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] #app button:hover,
html[data-theme="study"] #app .setting-btn:hover{background:var(--study-band) !important}
html[data-theme="study"] ::-webkit-scrollbar{width:12px;height:12px}
html[data-theme="study"] ::-webkit-scrollbar-thumb{background:#c1c5cb !important;border:0 !important}
html[data-theme="study"] ::-webkit-scrollbar-track{background:var(--study-band) !important}

/* --- 10. overlays: modals, settings, sign-in, first-run chooser ---------- */
html[data-theme="study"] .modal-overlay,
html[data-theme="study"] .jqrg-auth-overlay{background:rgba(17,24,39,.35) !important}
html[data-theme="study"] .modal,
html[data-theme="study"] .jqrg-auth-modal{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .modal-header{border-bottom:1px solid var(--study-line-soft) !important}
html[data-theme="study"] .settings-nav{background:var(--study-band) !important;border-right:1px solid var(--study-line) !important}
html[data-theme="study"] .settings-nav-btn:hover{background:var(--study-surface) !important;padding-left:16px !important}
html[data-theme="study"] .settings-nav-btn.active{background:var(--study-surface) !important;border-right:3px solid var(--study-link) !important}
html[data-theme="study"] .setting-divider{border-color:var(--study-line-soft) !important}
html[data-theme="study"] .jqrg-gate-intro{
  background:var(--study-band) !important;
  border:1px solid var(--study-line-soft) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-auth-submit,
html[data-theme="study"] .jqrg-auth-btn{
  background:var(--study-link) !important;
  color:#ffffff !important;
  border:1px solid var(--study-link) !important;
}
html[data-theme="study"] .jqrg-auth-submit *,
html[data-theme="study"] .jqrg-auth-btn *{color:#ffffff !important}
html[data-theme="study"] .jqrg-verify-resend,
html[data-theme="study"] .jqrg-send-code-btn{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}

/* First-run chooser: always the light palette (it is answered before the
   theme is known) and boxy like everything else here. */
#jqrg-theme-chooser{
  position:fixed;inset:0;z-index:2147483647;
  display:flex;align-items:center;justify-content:center;padding:24px;
  background:#ffffff;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
.jqrg-theme-choose-card{
  background:#ffffff;border:1px solid #b9bfc7;
  padding:24px;max-width:660px;width:100%;text-align:left;
  border-radius:0;
}
.jqrg-theme-choose-card h2{margin:0 0 8px;font-size:20px;font-weight:600;color:#111827}
.jqrg-theme-choose-card p{margin:0 0 20px;font-size:14px;line-height:1.5;color:#4b5563}
.jqrg-theme-choose-row{display:flex;gap:10px;flex-wrap:wrap}
.jqrg-theme-choose-btn{
  flex:1 1 240px;display:flex;flex-direction:column;gap:6px;text-align:left;
  padding:14px;border:1px solid #b9bfc7;border-left:4px solid #b9bfc7;
  background:#ffffff;cursor:pointer;font-family:inherit;border-radius:0;
}
.jqrg-theme-choose-btn:hover{background:#f4f5f6}
.jqrg-theme-choose-btn[data-pick="study"]{border-left-color:#0b4f9e}
.jqrg-theme-choose-btn[data-pick="jimmyqrg"]{border-left-color:#6b7280}
.jqrg-theme-choose-btn strong{font-size:15px;font-weight:600;color:#111827}
.jqrg-theme-choose-btn span{font-size:13px;line-height:1.45;color:#4b5563}

/* The settings panel is a SIBLING of #app (index.html: #app closes at 3477,
 * #settings-modal opens at 3523), so every `#app …` control rule above misses
 * it entirely. In Study that left the whole panel with the dark-theme chrome:
 * `.setting-btn` keeps `border:1px solid rgba(255,255,255,.16)`, which is a
 * white 16% border on a white panel — no visible button at all. The theme row
 * showed it worst: the UNSELECTED option ("JimmyQrg") was a bare word with an
 * invisible border, so the option looked like it was missing. Cover the panel
 * explicitly, and give the theme options real chrome in every theme. */
html[data-theme="study"] #settings-modal input,
html[data-theme="study"] #settings-modal select,
html[data-theme="study"] #settings-modal textarea,
html[data-theme="study"] #settings-modal .setting-btn,
html[data-theme="study"] #settings-modal .setting-select{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] #settings-modal .setting-btn:hover,
html[data-theme="study"] #settings-modal .setting-select:hover{background:var(--study-band) !important}

/* Theme options: always a visible control, selected or not. The dark default
   stays close to the app's own .setting-btn so the row does not look foreign. */
.jqrg-theme-pick .setting-btn{
  border:1px solid #6b7280 !important;
  background:rgba(255,255,255,.08) !important;
  color:#ffffff !important;
}
.jqrg-theme-pick .setting-btn[aria-pressed="true"]{
  border-color:#1a73e8 !important;
  background:#e8f0fe !important;
  color:#1a73e8 !important;
  font-weight:600 !important;
}
html[data-theme="study"] #settings-modal .jqrg-theme-pick .setting-btn{
  border:1px solid var(--study-line) !important;
  background:var(--study-surface) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] #settings-modal .jqrg-theme-pick .setting-btn[aria-pressed="true"]{
  border-color:#0b4f9e !important;
  background:#e8f0fe !important;
  color:#0b4f9e !important;
  font-weight:600 !important;
}

/* --- 11. chrome that lives OUTSIDE #app -----------------------------------
 * The pre-app cover (#learn-cover) is a sibling of #app, so the ink rules above
 * never reached it — that is exactly how "Unlimited Learning" stayed white on
 * white. Cover it explicitly. */
html[data-theme="study"] #learn-cover{background:var(--study-page) !important}
html[data-theme="study"] #learn-cover,
html[data-theme="study"] #learn-cover *{
  color:var(--study-ink) !important;
  background-image:none !important;
  text-shadow:none !important;
  box-shadow:none !important;
  border-radius:0 !important;
  filter:none !important;
}
html[data-theme="study"] #learn-cover button,
html[data-theme="study"] #learn-cover a{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-link) !important;
  text-decoration:none !important;
}

/* --- 12. pseudo-elements --------------------------------------------------
 * A rule on `*` does not match ::before/::after, which is where the last
 * shimmer animation (and a few decorative rings/shadows) lived. */
html[data-theme="study"] *::before,
html[data-theme="study"] *::after{
  border-radius:0 !important;
  box-shadow:none !important;
  text-shadow:none !important;
  filter:none !important;
  background-image:none !important;
  animation-delay:0s !important;
  animation-duration:0.001s !important;
  animation-iteration-count:1 !important;
}

/* --- 13. everything OUTSIDE #app ------------------------------------------
 * Sections 3/4 scoped the ink to `#app`, but several surfaces are siblings of
 * it and kept hard-coded white text: #anniversary-modal (.anniv-title/.anniv-sub
 * /.anniv-hint are #fff / rgba(255,255,255,…)), the auth wall, and #learn-cover.
 * Repairing those one class at a time is how we ended up with invisible text,
 * so the ink rule is restated over the whole document and the deliberate
 * exceptions (links, primary buttons) are re-applied with higher specificity.
 *
 * The trap worth remembering: `.anniv-prize` sets
 * `-webkit-text-fill-color:transparent` together with a gradient clip. Killing
 * the gradient (section 1) left the fill transparent — text present in the DOM
 * but invisible on white. So text-fill is reset globally here too. */
html[data-theme="study"] body,
html[data-theme="study"] body *{
  color:var(--study-ink) !important;
  -webkit-text-fill-color:currentColor !important;
}
html[data-theme="study"] a,
html[data-theme="study"] a *{color:var(--study-link) !important}

/* The anniversary experience is not part of Study. Hiding the modal here is the
   reliable half (it cannot be defeated by a stray .open class);
   js/jqrg-theme.js disables the entry points as well. Every part is styled
   explicitly rather than leaning on the generic document pass, so nothing here
   depends on a fallback. */
html[data-theme="study"] #anniversary-modal{display:none !important}

/* The announcement list links straight into the anniversary; drop that line
   rather than leave a dead button behind. */
html[data-theme="study"] #announcement-body li:has(button[onclick*="openAnniversary"]){display:none !important}

html[data-theme="study"] #anniversary-modal .modal{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] #anniversary-modal .modal-close{color:var(--study-ink-dim) !important}
html[data-theme="study"] #anniversary-modal .anniv-title{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif !important;
  font-size:17px !important;
  font-weight:700 !important;
  color:var(--study-ink) !important;
  text-shadow:none !important;
}
html[data-theme="study"] #anniversary-modal .anniv-sub,
html[data-theme="study"] #anniversary-modal .anniv-hint{
  color:var(--study-ink-dim) !important;
  -webkit-text-fill-color:var(--study-ink-dim) !important;
}
/* .anniv-prize paints its text with a gradient clip and a transparent fill, so
   killing the gradient (section 1) left it invisible until the fill was reset. */
html[data-theme="study"] #anniversary-modal .anniv-prize{
  background:none !important;
  color:var(--study-ink) !important;
  -webkit-text-fill-color:var(--study-ink) !important;
  font-weight:700 !important;
}
html[data-theme="study"] #anniversary-modal .anniv-play-btn,
html[data-theme="study"] #anniversary-modal .anniv-play-btn *{
  background:var(--study-link) !important;
  border:1px solid var(--study-link) !important;
  color:#ffffff !important;
  -webkit-text-fill-color:#ffffff !important;
}
html[data-theme="study"] #anniversary-modal .anniv-confetti,
html[data-theme="study"] #anniversary-modal .anniv-cake{display:none !important}

/* --- 14. dark panels that sit outside #app --------------------------------
 * Forcing dark ink (section 13) is only half the job: any panel that hard-codes
 * a dark surface then reads as dark-on-dark. These are the remaining ones.
 * Measured before the fix: #ac-modal labels at 1.18:1 (near-invisible). */

/* Auto-clicker panel: background:rgba(14,5,20,.95) with rgba(255,255,255,.5)
   labels, and inputs/selects at rgba(0,0,0,.3). */
html[data-theme="study"] #ac-modal .ac-panel{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] #ac-modal input[type="number"],
html[data-theme="study"] #ac-modal select,
html[data-theme="study"] #ac-modal .ac-keybtn{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] #ac-modal .ac-status.off,
html[data-theme="study"] #ac-modal .ac-status.on{
  background:var(--study-band) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] #ac-modal .ac-section{border-top-color:var(--study-line-soft) !important}
html[data-theme="study"] #ac-modal .ac-keybtn.recording{border-color:var(--study-link) !important}

/* Announcement modal: `#announcement-modal .modal-body a{color:#fff !important}`
   is specificity (1,1,1) and beat the plain `a` rule, leaving the "here" link
   white on a white modal. Match its specificity and win. */
html[data-theme="study"] #announcement-modal .modal-body a{
  color:var(--study-link) !important;
  -webkit-text-fill-color:var(--study-link) !important;
}

/* Collection tiles still hard-code background:#1a1024. */
html[data-theme="study"] .collection-tile{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
}

/* --- 15. auth modal controls ---------------------------------------------
 * `.jqrg-auth-form input` is styled for a dark modal: background
 * rgba(255,255,255,.06) and border rgba(255,255,255,.1). On the white Study
 * modal both are invisible, so the fields looked like empty space with no
 * field to click. Same story for `.jqrg-profile-action` (color:#fff) and the
 * `.jqrg-profile-row` shell. */
html[data-theme="study"] .jqrg-auth-form input,
html[data-theme="study"] .jqrg-email-form input,
html[data-theme="study"] .jqrg-confirm-input{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
  -webkit-text-fill-color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-auth-form input::placeholder,
html[data-theme="study"] .jqrg-email-form input::placeholder,
html[data-theme="study"] .jqrg-confirm-input::placeholder{
  color:var(--study-ink-dim) !important;
  -webkit-text-fill-color:var(--study-ink-dim) !important;
}
html[data-theme="study"] .jqrg-profile-row{
  background:var(--study-band) !important;
  border:1px solid var(--study-line) !important;
}
html[data-theme="study"] .jqrg-profile-action{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-verify-info{
  background:var(--study-band) !important;
  border:1px solid var(--study-line) !important;
  border-left:3px solid var(--study-link) !important;
}

/* --- 16. generic page shell (any first-party page that is NOT the main app) --
 * /html/, /tools/*, /info/*, /strategies/*, error pages and so on are separate
 * little apps, each with its own inline dark styling (.wrap, .toolbar,
 * .editor-pane …). None of them contain #app, so the rules above never reached
 * their surfaces and they stayed dark-on-dark.
 *
 * Rather than patch each one's palette, they opt in with
 * <html data-jqrg-shell="1"> and get a complete plain-document design here:
 * white page, one ink colour, hairline rules, square corners, no decoration.
 * This is deliberately a full re-skin — an unthemed page is treated as a new
 * page to design, not as something to recolour.
 *
 * Third-party game builds (q/g/**, q/e/r1-*.html) and the anniversary archive
 * snapshots (anniversary/versions/**) are NOT opted in: flattening a game's own
 * UI would break it, and the archive is meant to look like the old site. */

html[data-theme="study"][data-jqrg-shell="1"],
html[data-theme="study"][data-jqrg-shell="1"] body{
  background:var(--study-page) !important;
  color:var(--study-ink) !important;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif !important;
}
/* Strip every decorative surface, then rebuild the few that carry meaning. */
html[data-theme="study"][data-jqrg-shell="1"] body *{
  background-color:transparent !important;
  background-image:none !important;
  color:var(--study-ink) !important;
  -webkit-text-fill-color:currentColor !important;
  border-color:var(--study-line-soft) !important;
  border-radius:0 !important;
  box-shadow:none !important;
  text-shadow:none !important;
  filter:none !important;
  animation-delay:0s !important;
  animation-duration:0.001s !important;
  animation-iteration-count:1 !important;
  transition-duration:0.001s !important;
  transition-delay:0s !important;
}
/* Card-style anchors: the tools page wraps a title + description in an <a>.
   Colouring and underlining everything inside it made body copy look like a
   link, so only anchors whose content is inline text keep the link cue. */
html[data-theme="study"][data-jqrg-shell="1"] a{
  color:var(--study-ink) !important;
  text-decoration:none !important;
}
html[data-theme="study"][data-jqrg-shell="1"] a:not(:has(*)){
  color:var(--study-link) !important;
  text-decoration:underline !important;
}
html[data-theme="study"][data-jqrg-shell="1"] a:hover{text-decoration:underline !important}

/* Controls stay obvious: a bordered white box on the page. */
html[data-theme="study"][data-jqrg-shell="1"] button,
html[data-theme="study"][data-jqrg-shell="1"] input,
html[data-theme="study"][data-jqrg-shell="1"] select,
html[data-theme="study"][data-jqrg-shell="1"] textarea,
html[data-theme="study"][data-jqrg-shell="1"] label.btn,
html[data-theme="study"][data-jqrg-shell="1"] [role="button"]{
  background-color:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"][data-jqrg-shell="1"] button:hover,
html[data-theme="study"][data-jqrg-shell="1"] label.btn:hover,
html[data-theme="study"][data-jqrg-shell="1"] [role="button"]:hover{background-color:var(--study-band) !important}
html[data-theme="study"][data-jqrg-shell="1"] input::placeholder,
html[data-theme="study"][data-jqrg-shell="1"] textarea::placeholder{color:var(--study-ink-dim) !important}

/* Code, editors and logs read as plain inset blocks. */
html[data-theme="study"][data-jqrg-shell="1"] pre,
html[data-theme="study"][data-jqrg-shell="1"] code,
html[data-theme="study"][data-jqrg-shell="1"] textarea{
  background-color:var(--study-band) !important;
  border:1px solid var(--study-line-soft) !important;
  color:var(--study-ink) !important;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Courier New",monospace !important;
}

/* Panels/cards that framed themselves with a border keep a hairline. */
html[data-theme="study"][data-jqrg-shell="1"] .toolbar,
html[data-theme="study"][data-jqrg-shell="1"] .editor-pane,
html[data-theme="study"][data-jqrg-shell="1"] .preview-pane,
html[data-theme="study"][data-jqrg-shell="1"] .card,
html[data-theme="study"][data-jqrg-shell="1"] .panel,
html[data-theme="study"][data-jqrg-shell="1"] .wrap{
  border:1px solid var(--study-line-soft) !important;
}

/* The required first-run chooser renders on these pages too and must stay a
   readable light card, so re-assert it after the strip above. */
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser{background:#ffffff !important}
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser .jqrg-theme-choose-card{
  background:#ffffff !important;border:1px solid #b9bfc7 !important;
}
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser .jqrg-theme-choose-btn{
  background:#ffffff !important;border:1px solid #b9bfc7 !important;
}
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser h2,
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser strong{color:#111827 !important}
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser p,
html[data-theme="study"][data-jqrg-shell="1"] #jqrg-theme-chooser span{color:#4b5563 !important}

/* --- 17. email verification step (light) ---------------------------------
 * The auth UI styles the verification step for the dark modal: a translucent
 * purple status box, a dark tracked code field, a ghosty resend link. On the
 * white Study modal those become unreadable, so restate each piece as a plain
 * light control while keeping the OTP treatment (monospace, tracked, centred). */
html[data-theme="study"] .jqrg-verify-info{
  background:var(--study-band) !important;
  border:1px solid var(--study-line) !important;
  border-left:3px solid var(--study-link) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-verify-info strong{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-verify-info.ok{
  background:var(--study-band) !important;
  border-color:var(--study-line) !important;
  border-left-color:var(--study-ok) !important;
  color:var(--study-ink) !important;
}
html[data-theme="study"] .jqrg-verify-info.ok strong{color:var(--study-ink) !important}
html[data-theme="study"] .jqrg-verify-row label{
  color:var(--study-ink-dim) !important;
  letter-spacing:.06em !important;
  text-transform:uppercase !important;
}
html[data-theme="study"] input.jqrg-code-input{
  background:var(--study-surface) !important;
  border:1.5px solid var(--study-line) !important;
  color:var(--study-ink) !important;
  -webkit-text-fill-color:var(--study-ink) !important;
  caret-color:var(--study-ink) !important;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Courier New",monospace !important;
  font-size:24px !important;
  font-weight:700 !important;
  letter-spacing:.42em !important;
  text-indent:.42em !important;
  text-align:center !important;
}
html[data-theme="study"] input.jqrg-code-input::placeholder{
  color:var(--study-line) !important;
  -webkit-text-fill-color:var(--study-line) !important;
  letter-spacing:.42em !important;
}
html[data-theme="study"] input.jqrg-code-input:focus{
  outline:none !important;
  border-color:var(--study-link) !important;
  box-shadow:0 0 0 3px rgba(11,79,158,.15) !important;
}
html[data-theme="study"] .jqrg-verify-hint{color:var(--study-ink-dim) !important}
html[data-theme="study"] .jqrg-verify-resend{
  background:var(--study-surface) !important;
  border:1px solid var(--study-line) !important;
  color:var(--study-link) !important;
}
/* "Send verification code" is the primary action of this step. Leaving it as an
   outline button next to the outlined resend pill removed the hierarchy, so in
   Study it stays filled like the other primary buttons. */
html[data-theme="study"] .jqrg-send-code-btn{
  background:var(--study-link) !important;
  border:1px solid var(--study-link) !important;
  color:#ffffff !important;
}
html[data-theme="study"] .jqrg-verify-resend:disabled,
html[data-theme="study"] .jqrg-send-code-btn:disabled{
  color:var(--study-ink-dim) !important;
  background:var(--study-band) !important;
  border-color:var(--study-line-soft) !important;
}

/* --- 18. no purple, and one main colour -----------------------------------
 * The purple that survived section 1 was never in a gradient or a glow — the
 * flatten rules already kill those. It was hiding in BORDERS, OUTLINES, FOCUS
 * RINGS and ACTIVE states, which the flatten pass does not touch:
 *   - button.nav-discover::before/::after drew a 2px rgba(176,122,255,.6) ring
 *     around the Partners button (this is what the rendered-page scan caught);
 *   - .rnd-1-toast ("Playing: <game>") carried a rgba(176,122,255,.30) border;
 *   - .home-section-clear:focus-visible outlined in #b07aff, and the settings
 *     inputs/selects plus the auto-clicker fields glowed rgba(136,65,214,.15)
 *     on :focus, so any keyboard use still surfaced purple;
 *   - the active sidebar button was tinted rgba(136,65,214,.12) with a purple
 *     drop-shadow on its icon.
 * Those are covered below. The focus rings are recoloured rather than removed —
 * a Study page still needs a visible focus indicator.
 */
html[data-theme="study"] button.nav-discover::before,
html[data-theme="study"] button.nav-discover::after{border-color:var(--study-primary) !important}
html[data-theme="study"] button.nav-discover{box-shadow:none !important}

html[data-theme="study"] .rnd-1-toast,
html[data-theme="study"] .rnd-1-toast:hover{border-color:var(--study-line) !important;box-shadow:none !important}
html[data-theme="study"] .rnd-1-toast .rgt-icon{
  background:var(--study-primary) !important;background-image:none !important;box-shadow:none !important;
}

html[data-theme="study"] .home-section-clear:focus-visible{outline:2px solid var(--study-primary) !important}
html[data-theme="study"] .setting-input:focus,
html[data-theme="study"] .setting-select:focus,
html[data-theme="study"] #ac-modal input[type="number"]:focus,
html[data-theme="study"] #ac-modal select:focus{
  box-shadow:none !important;outline:2px solid var(--study-primary) !important;outline-offset:1px !important;
}
html[data-theme="study"] input[type="checkbox"]:checked::after,
html[data-theme="study"] input[type="range"]:hover::-webkit-slider-thumb,
html[data-theme="study"] .toggle-switch.active,
html[data-theme="study"] .toggle-switch.active:hover,
html[data-theme="study"] .filter-toggle.active:hover,
html[data-theme="study"] .cloak-icon-opt.active{box-shadow:none !important}

html[data-theme="study"] .sidebar nav button.active svg,
html[data-theme="study"] .sidebar nav button.active svg *{filter:none !important}
html[data-theme="study"] .top-bar .brand-wrap,
html[data-theme="study"] .top-bar .brand-wrap:hover,
html[data-theme="study"] .sidebar .logo:hover{filter:none !important}
html[data-theme="study"] .url-bar:focus-within,
html[data-theme="study"] .search-bar:focus-within{box-shadow:none !important;border-color:var(--study-primary) !important}

/* --- one main colour ------------------------------------------------------
 * A plain white page reads as a missing stylesheet, not as a study site. The
 * rail (the primary navigation) carries --study-primary, and the same colour
 * repeats on section rules, primary buttons, highlights and focus rings, so the
 * page has a recognisable dominant hue instead of white-on-white. */
html[data-theme="study"] .sidebar{
  background:var(--study-primary) !important;
  border-right:1px solid var(--study-primary) !important;
}
html[data-theme="study"] #app .sidebar svg,
html[data-theme="study"] #app .sidebar svg *{
  fill:var(--study-primary-ink) !important;
  stroke:var(--study-primary-ink) !important;
  color:var(--study-primary-ink) !important;
}
html[data-theme="study"] #app .sidebar .logo svg,
html[data-theme="study"] #app .sidebar .logo svg *{fill:#ffffff !important;stroke:#ffffff !important}
html[data-theme="study"] .logo-shape{background:#ffffff !important}
/* The rail's buttons must stay ON the rail. `html[data-theme="study"] #app button`
   (1,1,2) outranks a plain `.sidebar nav button` (0,2,2) and was painting each nav
   button as a white surface chip on the navy rail; it also beat the active-tint and
   left the active icon light-on-white, i.e. invisible (measured). Scoping with #app
   puts the rail back and lets the active tint win. */
html[data-theme="study"] #app .sidebar nav button,
html[data-theme="study"] #app .sidebar .tb-section .nav-btns button,
html[data-theme="study"] #app .sidebar nav button *{
  background:transparent !important;
  border:0 !important;
  color:var(--study-primary-ink) !important;
}
html[data-theme="study"] #app .sidebar nav button:hover{background:#24507f !important}
html[data-theme="study"] #app .sidebar nav button.active{
  background:#24507f !important;
  border-left:3px solid #ffffff !important;
}
html[data-theme="study"] #app .sidebar nav button.active svg,
html[data-theme="study"] #app .sidebar nav button.active svg *{fill:#ffffff !important;stroke:#ffffff !important}

/* the same colour on the rest of the chrome */
html[data-theme="study"] .home-section-title::before{
  background:var(--study-primary) !important;
  background-image:none !important;
  box-shadow:none !important;
}
html[data-theme="study"] .tile-label .hl{color:var(--study-primary) !important;text-shadow:none !important}
html[data-theme="study"] .home-section-link{color:var(--study-primary) !important}

/* the same colour carries into the grid: every game/app tile gets a main-colour
   edge, so the catalogue reads as part of the study site rather than as a wall
   of white boxes. Tiles stay plain name buttons otherwise. */
html[data-theme="study"] .t-g,
html[data-theme="study"] .t-a,
html[data-theme="study"] .learning-module,
html[data-theme="study"] .interactive-module,
html[data-theme="study"] .educational-card{border-left:3px solid var(--study-primary) !important}

html[data-theme="study"] .filter-confirm-btn,
html[data-theme="study"] #ac-modal .ac-btn-save,
html[data-theme="study"] .home-empty .home-empty-cta,
html[data-theme="study"] .home-banner-empty .home-empty-cta,
html[data-theme="study"] .empty-1-cta-ghost,
html[data-theme="study"] .rnd-1-btn,
html[data-theme="study"] .jqrg-auth-submit,
html[data-theme="study"] .jqrg-auth-btn,
html[data-theme="study"] .jqrg-send-code-btn{
  background:var(--study-primary) !important;
  background-image:none !important;
  border:1px solid var(--study-primary) !important;
  color:#ffffff !important;
  box-shadow:none !important;
}
html[data-theme="study"] .filter-confirm-btn *,
html[data-theme="study"] .home-empty .home-empty-cta *,
html[data-theme="study"] .rnd-1-btn *,
html[data-theme="study"] .jqrg-auth-submit *,
html[data-theme="study"] .jqrg-send-code-btn *{color:#ffffff !important;-webkit-text-fill-color:#ffffff !important}
/* Keep the game surface clipped to the rounded JimmyQrg player viewport.
   The iframe's own document can paint an opaque background at its corners;
   clipping the iframe element prevents that content from escaping the shell. */
#ov-1 > iframe {
  border-radius: 24px;
  overflow: hidden;
  clip-path: inset(0 round 24px);
}
