/* Loaded for a dark device preference or an explicit visitor choice. */

/* Moved from readability.css so manual light mode disables every dark rule. */
:root {
    color-scheme: dark;
    --ink: #e7eef6;
    --text: #e7eef6;
    --muted: #bccbdb;
    --steel: #bdd1e4;
    --sky: #16283b;
    --mist: #162638;
    --light: #142334;
    --border: #3a4d63;
    --rule: #3a4d63;
    --green-pale: #17323b;
    --blue-pale: #322638;
    --red-pale: #322638;
    --pink-pale: #322638;
    --orange-pale: #352e22;
  }
  body { color: #e7eef6; background: #0c1725; }
  h2, h3, h4, h5, h6 { color: #e7eef6; }
  a { color: #ffc1d4; }
  .kicker { color: #ffb3cd; }
  .home-publication,
  .publication-panel,
  .welcome-card,
  .news-card,
  .program-panel,
  .program-concept,
  .tutorial-card,
  .speaker-card,
  .travel-card,
  .committee-group,
  .md-explorer,
  .md-diagram-dialog-panel,
  .sponsor-card,
  .competition-partner-card { background: #162638; border-color: #3a4d63; }
  .publication-panel h2,
  .welcome-card h2,
  .welcome-signature strong,
  .venue-copy h2,
  .partner-group-secondary h3,
  .deadline-milestones .symposium-date dd,
  .scoring-layout h3,
  .autonomy-scale b,
  .md-explorer-copy h3,
  .competition-partner-copy h3,
  .betafpv-copy h3,
  .partner-benefit { color: #e7eef6; }
  .role-label { background: #23364b; color: #bdd1e4; }
  .md-explorer-copy .kicker { background: transparent; color: #bdd1e4; }
  .md-mode-tabs { background: #0f1e30; }
  .md-mode-tab { color: #bccbdb; }
  .md-mode-tab[aria-selected="true"] { background: #30465f; color: #ffffff; }
  .md-mode-tab[aria-selected="true"] span { background: #09182d; }
  .md-choice { background: #23364b; color: #e7eef6; border-color: #60758b; }
  .md-choice[aria-pressed="true"] { background: #e7eef6; color: #102847; }
  .md-diagram-link { color: #ffc1d4; }
  .md-scene-status { background: #eaf2f7; color: #3e6180; }
  .registration-inclusions i { color: #ffb3cd; }
  .deadline-milestones dd,
  .scope-link,
  .news-card > a { color: #ffb3cd; }
  .home-dates,
  .home-partners,
  .side-toc,
  .chair,
  .travel-visual,
  .program-panel-head,
  .legacy-domain,
  .comeback-motion { background: #162638; }
  .side-toc > p { background: #09182d; color: #e7eef6; }
  .side-toc .anchor-links a { color: #bccbdb; }
  .side-toc .anchor-links a.is-active,
  .side-toc .anchor-links a:hover { color: #ffc1d4; background: #30465f; }
  .chair strong,
  .committee-list strong,
  .committee-roster strong,
  .agenda-body strong,
  .legacy-domain-copy h3,
  .comeback-motion-head h2 { color: #e7eef6; }
  .text-link,
  .speaker-link,
  .timeline-label,
  .legacy-step .timeline-label,
  .legacy-facts dt,
  .legacy-domain-copy span,
  .timeline-day { color: #ffc1d4; }
  .sponsor-card-copy > p { color: #bccbdb; }
  .button-outline { color: #e7eef6; border-color: #8297ad; }
  .button-outline:hover { color: #ffffff; background: #30465f; }
  .autonomy-scale span:nth-child(2) strong { color: #102847; }
  .course-spec-grid article,
  .autonomy-grid article,
  .rule-grid article,
  .safety-grid article,
  .award-grid article,
  .mission-step,
  .design-direction,
  .comeback-planning-note,
  .comeback-field-figure figcaption { background: #162638; color: #e7eef6; }
  .comeback-principle { background: #352e22; }
  .comeback-principle p,
  .comeback-planning-note p { color: #bccbdb; }
  .comeback-section-head h2,
  .comeback-intro-copy h2,
  .comeback-planning-note h2,
  .rule-grid h3,
  .safety-grid h3,
  .course-spec-grid h3,
  .autonomy-grid h3,
  .award-grid h3 { color: #e7eef6; }
  .comeback-principle i,
  .comeback-planning-note > i { color: #f0c66d; }
  .site-header,
  .mobile-nav-panel { background: #101e2e; color: #e7eef6; border-color: #3a4d63; }
  .site-header .desktop-nav a,
  .site-header .header-actions a,
  .site-header .brand,
  .site-header .menu-toggle { color: #e7eef6; }
  .page-flow > .section-alt,
  .competition-fold.is-collapsed { background: #162638; border-color: #3a4d63; }
  .content-card,
  .platform-card,
  .rule-card,
  .safety-card,
  .autonomy-card,
  .document-card,
  .single-card,
  .competition-category,
  .data-table,
  .hotel,
  .stay-card { background: #162638; border-color: #3a4d63; color: #e7eef6; }
  .section-head h2,
  .content-card h3,
  .platform-card h3,
  .rule-card h3,
  .safety-card h3,
  .document-card strong,
  .registration-section h2,
  .registration-section h3,
  .registration-price,
  .registration-inclusions li,
  .registration-contact span,
  .competition-timeline h3 { color: #e7eef6; }
  .section-head p,
  .entry-policy,
  .requirements-footnote,
  .document-card span,
  .role-label,
  .competition-timeline p { color: #bccbdb; }
  .registration-section a,
  .entry-policy a,
  .content-card > a { color: #ffc1d4; }
  .competition-fold-toggle { background: #23364b; border-color: #60758b; color: #ffffff; }
  .competition-fold-toggle:hover { background: #30465f; }
  .competition-fold-toggle i { background: #0b1b2f; }
  .contact-email-image:not(.contact-email-footer) { filter: brightness(0) invert(1); }
  .competition-update,
  .competition-callout-dark,
  .site-footer { background: #09182d; color: #ffffff; }
  .competition-update h2,
  .site-footer h2 { color: #ffffff; }
  .competition-update p,
  .site-footer p,
  .site-footer a { color: #dbe5ef; }
  /* Logos and field illustrations keep their intended light canvas. */
  .partner-logo-link,
  .partner,
  .betafpv-visual,
  .md-stage,
  .comeback-hero-art { background-color: #ffffff; }

  :root {
    color-scheme: dark;
    --ink: #e9f0f8;
    --text: #e9f0f8;
    --muted: #b8c8d9;
    --border: #344b63;
    --rule: #344b63;
    --mist: #12263c;
    --light: #12263c;
    --sky: #203a54;
    --green-pale: #153542;
    --orange-pale: #392e1d;
    --blue-pale: #392230;
    --red-pale: #392230;
    --pink-pale: #392230;
    --shadow: 0 18px 42px rgba(0, 7, 19, .24);
  }

  body { color: var(--ink); background: #0b192b; }
  main, .page-flow > .section { background-color: #0b192b; }
  .section-alt, .page-flow > .section-alt { background: #12263c; }
  .home-dates, .home-welcome, .home-partners, .home-publication {
    background: linear-gradient(115deg, rgba(216, 108, 145, .07), transparent 45%), #0b192b;
  }
  .home-news {
    background: linear-gradient(115deg, rgba(216, 108, 145, .06), transparent 42%), #12263c;
  }

  :is(h1, h2, h3, h4, .committee-list strong, .committee-roster strong,
    .welcome-signature strong, .agenda-body strong, .partner-group-secondary h3,
    .competition-switcher-head h2, .competition-option h3) { color: #f0f5fb; }
  a, .kicker, .tutorial-card span, .agenda time,
  .speaker-link, .role-label { color: #f3a4c0; }
  a:hover, .speaker-link:hover { color: #ffd0df; }
  .section-head p, .venue-copy, .travel-copy p { color: var(--muted); }
  .deadline-milestones dd { color: #f3a4c0; }
  .deadline-milestones .symposium-date dd { color: #e9f0f8; }

  body .side-toc { background: #192e45; }
  .side-toc .anchor-links a, .anchor-links a { color: #d9e8f8; }
  .side-toc .anchor-links a:hover, .side-toc .anchor-links a:focus-visible,
  .anchor-links a:hover, .anchor-links a:focus-visible {
    color: #fff; background: #29435c;
  }
  .side-toc .anchor-links a.is-active,
  .side-toc .anchor-links a[aria-current="location"] {
    color: #ffd5e3; background: #39283c;
  }
  .anchor-links a.is-active, .anchor-links a[aria-current="location"] {
    color: #fff; background: #982744;
  }

  :is(.content-card, .publication-panel, .topic-column, .data-table,
    .program-tab, .program-panel, .travel-visual, .hotel, .stay-card,
    .competition-concept, .system-node, .competition-timeline li,
    .legacy-facts, .legacy-card, .legacy-feature, .legacy-highlight,
    .competition-option, .mission-step, .design-direction) {
    color: var(--ink); background: #192e45;
  }
  :is(.welcome-card, .news-card, .speaker-card, .tutorial-card, .program-concept,
    .program-panel-head, .chair, .committee-group) {
    color: var(--ink);
    background: linear-gradient(135deg, rgba(216, 108, 145, .075), transparent 52%), #192e45;
  }
  .news-card time, .role-label { color: #ffc0d5; background: #3b293c; }
  .shared-task, .compact-challenge {
    color: var(--ink); background: #352d25;
  }
  .shared-task { border-color: #806944; }
  .program-tab { color: var(--ink); }
  .program-tab span { color: #f3a4c0; }
  .program-tab.is-active { color: #fff; background: #982744; }
  .program-tab.is-active span { color: #fff; }
  .data-table th { background: #203c59; }
  .data-table td:last-child { color: #ffc0d5; }
  .speaker-photo, .welcome-card img, .chair img {
    background: linear-gradient(#192e45, #192e45) padding-box,
      linear-gradient(120deg, var(--sakura), #4db8d4 38%, var(--burgundy) 68%, var(--sakura)) border-box;
    background-size: 100% 100%, 260% 260%;
  }
  .partner {
    position: relative;
    isolation: isolate;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  .partner img {
    filter: drop-shadow(0 0 1px rgba(244, 249, 255, .95))
      drop-shadow(0 0 4px rgba(222, 236, 250, .66));
  }
  .partner:focus-within, .partner:hover { background: transparent; }
  .partner:focus-within img, .partner:hover img {
    filter: drop-shadow(0 0 2px rgba(244, 249, 255, 1))
      drop-shadow(0 0 7px rgba(222, 236, 250, .8));
  }
  .partner img[src*="TokyoMetropolitanUniLogo"],
  .partner img[src*="Springer.svg.png"],
  .partner img[src*="odrive-robotics"] {
    filter: brightness(0) invert(1) drop-shadow(0 0 5px rgba(223, 237, 251, .32));
  }
  .partner img[src*="suzuki-foundation"] {
    filter: brightness(1.9) drop-shadow(0 0 4px rgba(223, 237, 251, .35));
  }
  .hero-brand-logos a:nth-child(2) img,
  .hero-brand-logos a:nth-child(4) img { background: transparent; }
  .hero-brand-logos a:nth-child(2)::before,
  .hero-brand-logos a:nth-child(4)::before {
    inset: -12% -4%;
    background: radial-gradient(ellipse, rgba(235, 243, 251, .76), rgba(235, 243, 251, .34) 50%, transparent 78%);
    filter: blur(7px);
    opacity: .9;
  }

  /* The competition pages have their own late-loaded, light-only styles. */
  .competition-quick-switch { background: rgba(25, 46, 69, .97); }
  .competition-quick-link,
  .competition-quick-link.is-current,
  .competition-option.is-current,
  .competition-fold-toggle,
  .competition-fold[open] .competition-fold-toggle {
    color: var(--ink);
    background: linear-gradient(135deg, rgba(77, 184, 212, .11), transparent 75%), #192e45;
  }
  .competition-quick-link :where(strong, span, small),
  .competition-option :where(h3, p),
  .competition-option:hover, .competition-option:focus-visible { color: var(--ink); }
  /* Outrank the light-mode invitation style, including its sibling selector. */
  .competition-quick-switch .competition-quick-link,
  .competition-quick-switch .competition-quick-link-main.is-current + .competition-quick-link-comeback {
    color: #eef5fc;
    background: #192e45;
    border-color: #68839b;
  }
  .competition-quick-switch .competition-quick-link .competition-quick-copy small { color: #c3d2e1; }
  .competition-quick-switch .competition-quick-index {
    color: #eef5fc;
    background: #30485f;
    box-shadow: inset 0 0 0 1px #68839b;
  }
  .competition-quick-switch .competition-quick-link.is-current {
    background: #29435c;
    border-color: var(--quick-accent);
  }
  .competition-quick-switch .competition-quick-link.is-current .competition-quick-index {
    color: #102847;
    background: var(--quick-accent);
  }
  .competition-quick-switch .competition-quick-link:hover,
  .competition-quick-switch .competition-quick-link:focus-visible,
  .competition-quick-switch .competition-quick-link-main.is-current + .competition-quick-link-comeback:hover,
  .competition-quick-switch .competition-quick-link-main.is-current + .competition-quick-link-comeback:focus-visible {
    color: #ffffff;
    background: #304b65;
    border-color: #c0d9e9;
  }
  .competition-option-label, .competition-option-action { color: #8cdbed; }
  .competition-option-comeback .competition-option-label,
  .competition-option-comeback .competition-option-action { color: #f2ca7a; }
  .competition-option.is-current .competition-option-action {
    color: #f5f8fc; background: #29435c;
  }
  .competition-fold.is-collapsed,
  .page-flow > .section-alt.competition-fold.is-collapsed {
    background: linear-gradient(105deg, #192e45, #203b52);
  }
  .competition-fold-toggle:hover { color: #fff; background: #29435c; }
  .domain-choice, .journey-mission, .competition-partner-card {
    color: var(--ink); background: #192e45;
  }
  .domain-choice strong, .journey-mission h3 { color: #f0f5fb; }
  .domain-choice-media, .journey-mission-visual { background: #e9f0f8; }
  .domain-choice-action { color: #f3a4c0; }
  .journey-bridge span { color: var(--ink); background: #203a54; }
  .journey-bridge { color: #b8c8d9; }
  .partner-benefit { color: #dff5fb; background: #153542; }
  .partner-logo-link { background: #f4f6f8; }
  .competition-partner-copy > p, .partner-access-note { color: var(--muted); }
  .comeback-principle { border-color: #82683a; background: #352d25; }
  .comeback-principle i { color: #f0c66d; }
  .comeback-principle h3 { color: #fff0d0; }
  .comeback-principle p { color: #d6c6ad; }
  .legacy-domain { background: #192e45; }
  .legacy-domain-copy span { color: #f3a4c0; }
  .legacy-photo { background: #192e45; }
  .comeback-simple-figure, .comeback-field-figure,
  .comeback-field-figure > a { background: #192e45; }
  .comeback-sequence-figure > a,
  .comeback-sequence-figure figcaption {
    color: var(--ink);
    background: #192e45;
    border-color: var(--border);
  }
  .comeback-field-figure figcaption { color: var(--muted); background: #192e45; }
  .comeback-planning-note { border-color: #31566b; background: #153542; }
  .comeback-planning-note > i { color: #8cdbed; }
  .comeback-planning-note p { color: var(--muted); }

  /* Interactive CanSat block: keep the illustration bright, but theme every
     surrounding control surface so it belongs to the selected page mode. */
  .comeback-motion-player {
    color: var(--ink);
    background: #192e45;
    border-color: var(--border);
    box-shadow: 0 22px 55px rgba(0, 7, 19, .3);
  }
  .comeback-category-tabs button {
    color: var(--ink);
    background: #192e45;
    border-color: #68839b;
  }
  .comeback-category-tabs button span { color: var(--muted); }
  .comeback-category-tabs button:hover {
    color: #fff;
    background: #304b65;
    border-color: #91aec4;
  }
  .comeback-category-tabs button[aria-selected="true"] {
    color: #fff;
    background: #29435c;
    border-color: #f0c66d;
    box-shadow: inset 0 -3px 0 #f0c66d;
  }
  .comeback-category-tabs button[aria-selected="true"] span { color: #e7eef6; }
  .comeback-motion-canvas { background: #13263a; }
  .comeback-motion-status {
    color: var(--ink);
    background: #192e45;
    border-color: var(--border);
  }
  .comeback-motion-status strong { color: #f0f5fb; }
  .comeback-motion-status small { color: var(--muted); }
  .comeback-motion-controls { border-color: var(--border); }
  .comeback-motion-controls button {
    color: var(--muted);
    background: #192e45;
    border-color: var(--border);
  }
  .comeback-motion-controls button:hover {
    color: #fff;
    background: #29435c;
  }
  .comeback-motion-controls button.is-active {
    color: #fff0d0;
    background: #352d25;
  }
  .comeback-motion-controls span {
    color: #eef5fc;
    background: #30485f;
  }
  .comeback-motion-controls button.is-active span {
    color: #102847;
    background: #f0c66d;
  }
  .design-direction i { color: #fff; background: #304b65; }

  /* Form controls must follow the page instead of rendering bright white. */
  :is(input, select, textarea) {
    color: var(--ink); background-color: #192e45; border-color: var(--border);
  }
  :is(input, select, textarea)::placeholder { color: #9caec2; }
  :is(a, button, input, select, textarea):focus-visible {
    outline-color: #f2c76e;
  }
