/* Force desktop-width layout on all viewports.
   The <meta viewport width=1280> handles real mobile browsers;
   min-width prevents CSS reflow below 1280px as a fallback. */
html, body {
  min-width: 1280px;
}

/* Remove default body margin and padding */
body {
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove top margin/padding from navbar container */
#navbar-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Language flag images inside the Fomantic menu */
.ui.menu .lang-flag {
  height: 18px;
  width: auto;
  display: inline-block;
  border-radius: 2px;
  vertical-align: middle;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.ui.menu .lang-dropdown:hover .lang-flag {
  opacity: 1;
}

/* ── Language dropdown trigger ── */
.lang-dropdown.ui.dropdown.item {
  padding: 0.45em 0.6em !important;
  display: flex !important;
  align-items: center !important;
}

/* Dropdown caret arrow */
.lang-dropdown .dropdown.icon {
  margin-left: 0.35em !important;
  font-size: 0.75em;
}

/* ── Dropdown menu panel ── */
.lang-dropdown > .menu {
  min-width: 100px !important;
  right: 0 !important;
  left: auto !important;
  border-radius: 0 0 5px 5px !important;
  background: #fff !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  margin-top: 0 !important;
  padding: 4px 0 !important;
}

/* Individual items inside the dropdown */
.lang-dropdown .menu > .lang-dropdown-item.item {
  display: flex !important;
  align-items: center !important;
  padding: 0.55em 0.9em !important;
  font-size: 0.8em !important;
  color: #333 !important;
  line-height: 1.3 !important;
}
.lang-dropdown .menu > .lang-dropdown-item.item:hover {
  background: rgba(33, 133, 208, 0.09) !important;
  color: #1a1a1a !important;
}
.lang-dropdown .menu > .lang-dropdown-item.item.active {
  background: rgba(33, 133, 208, 0.14) !important;
  font-weight: 700 !important;
}

/* Flags inside dropdown items */
.lang-dropdown .menu .lang-flag {
  height: 16px !important;
  opacity: 1 !important;
}

body :not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
  font-size: 16px !important;
}

/* Override the blanket 16px rule for Fomantic UI menus so size classes work */
body .ui.massive.menu .item,
body .ui.massive.menu {
  font-size: 1.71428571rem !important;
}
body .ui.huge.menu .item,
body .ui.huge.menu {
  font-size: 1.42857143rem !important;
}
body .ui.large.menu .item,
body .ui.large.menu {
  font-size: 1.14285714rem !important;
}

/* Tabular inverted menu: active tab stands out, items evenly spaced */
.ui.tabular.inverted.menu .item {
  border-bottom: 3px solid transparent;
}
.ui.tabular.inverted.menu .active.item {
  border-bottom: 3px solid white;
  background: rgba(255, 255, 255, 0.12);
}

/* Custom green color for primary action buttons */
.ui.button.green {
  background-color: #4CBB17 !important;
}

.ui.button.green:hover {
  background-color: #3A9B12 !important;
}

/* Custom blue color for test/secondary buttons */
.ui.button.blue-action {
  background-color: #1976D2 !important;
}

.ui.button.blue-action:hover {
  background-color: #1565C0 !important;
}


/* Make checkboxes outlined in black and larger on the landing page */
#landing-page .form-check-input {
  border-color: black;
  width: 1.4em;
  height: 1.4em;
  margin-top: 0.15em;
  cursor: pointer;
}

#landing-page .form-check-label {
  font-size: 15px;
  padding-left: 0.4em;
  cursor: pointer;
}

/* Ending page foldable "Click here for details" button.
   Must beat `body :not(h1..h6) { font-size: 16px !important }`. */
.ending-fold {
  text-align: center;
}
.ending-fold > summary.ending-fold-button {
  display: inline-block;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #fff !important;
  background: #2185d0;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  margin: 0 auto;
  line-height: 1.3;
}
.ending-fold > summary.ending-fold-button::-webkit-details-marker {
  display: none;
}
.ending-fold > summary.ending-fold-button::marker {
  content: "";
}
.ending-fold > summary.ending-fold-button:hover {
  background: #1678c2;
}
.ending-fold[open] > summary.ending-fold-button {
  background: #1b6ea8;
  margin-bottom: 4px;
}

/* Final-page leaderboard — two columns as sketched:
   left = your result card (previous look) + format chips; right = others table. */
.final-leaderboard {
  margin: 0 auto 20px auto;
  max-width: 1000px;
  width: 100%;
  padding: clamp(14px, 2.4vw, 22px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
}
.final-leaderboard-title {
  text-align: center;
  margin: 0 0 16px 0;
  font-size: clamp(20px, 3vw, 26px) !important;
  color: #1e3a5f;
}
.final-leaderboard-split {
  display: flex !important;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
  justify-content: center;
}
.final-leaderboard-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 1 380px;
  min-width: 240px;
  max-width: 420px;
}
.final-leaderboard-right {
  flex: 1 1 320px;
  min-width: 260px;
}
.final-leaderboard-hero {
  text-align: center;
  padding: 14px 12px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef5ff 0%, #f8fbff 100%);
  border: 1px solid rgba(33, 133, 208, 0.18);
}
.final-leaderboard-hero-label {
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4a5568;
  margin-bottom: 4px;
}
.final-leaderboard-hero-rank {
  font-size: clamp(28px, 5vw, 40px) !important;
  font-weight: 800 !important;
  color: #1d4ed8;
  line-height: 1.1;
  margin-bottom: 6px;
}
.final-leaderboard-hero-pct {
  display: inline-block;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 6px;
}
.final-leaderboard-hero-mae {
  font-size: 14px !important;
  color: #4a5568;
  margin-top: 4px;
}
.final-leaderboard-empty {
  text-align: center;
  color: #64748b;
  font-style: italic;
  margin-bottom: 8px;
}
.final-leaderboard-formats {
  width: 100%;
}
.final-leaderboard-format-label {
  text-align: center;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #475569;
  margin-bottom: 8px;
}
.final-leaderboard-format-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.final-leaderboard-format-chip {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1e3a5f;
  background: #f1f5f9;
  border: 1px solid rgba(75, 95, 130, 0.18);
  border-radius: 999px;
  padding: 6px 12px;
}
.final-leaderboard-board-title {
  text-align: center;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #1e3a5f;
  margin: 0 0 10px 0;
}
.final-leaderboard-row {
  display: grid;
  grid-template-columns: 48px 1fr 110px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px !important;
}
.final-leaderboard-row.head {
  font-weight: 700 !important;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12px !important;
  padding-bottom: 4px;
}
.final-leaderboard-row.you {
  background: #e8f1fb;
  border: 1px solid rgba(33, 133, 208, 0.28);
  font-weight: 700 !important;
}
.final-leaderboard-row.you .you-label {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #1d4ed8;
}
.final-leaderboard-cell.rank {
  font-variant-numeric: tabular-nums;
  font-weight: 800 !important;
  color: #1d4ed8;
}
.final-leaderboard-cell.mae {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #334155;
}
.final-leaderboard-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 720px) {
  .final-leaderboard-left,
  .final-leaderboard-right {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
}

/* Games-played counter: beat `body :not(h1..h6) { font-size: 16px !important }`. */
#landing-page .games-played-title {
  font-size: 38px !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  margin: 0 0 12px 0 !important;
  color: #334155 !important;
}

#landing-page .games-played-count {
  font-size: 70px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  margin: 0 !important;
  color: #1565c0 !important;
  font-variant-numeric: tabular-nums;
}

/* Info page styling (About, Contact, Demo pages) */
.info-page {
  min-height: 100vh;
  padding: 40px clamp(24px, 5vw, 60px) 60px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 35%, #fff7ed 100%);
  margin: 0 auto;
  max-width: clamp(320px, 85vw, 1400px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* H1 title styling for info pages */
.info-page h1 {
  font-family: inherit !important;
  font-size: 36px !important;
  font-weight: 800 !important;
  color: #0f172a;
  margin-bottom: 16px;
  margin-top: 0;
  letter-spacing: -0.01em;
}

/* H2 subtitle styling for info pages */
.info-page h2 {
  font-family: inherit !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #1565c0;
  margin-bottom: 8px;
  margin-top: 18px;
}

/* FAQ / info page question headings */
.info-page h3,
.info-page .ui.segment h3 {
  font-family: inherit !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  letter-spacing: 0.01em !important;
  margin-bottom: 6px !important;
  margin-top: 0 !important;
}

/* FAQ / info page body text */
.info-page p,
.info-page .ui.segment p {
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  line-height: 1.65 !important;
  color: #374151 !important;
  margin-bottom: 0 !important;
}

.info-page a {
  color: #1565c0;
  text-decoration: underline;
  word-break: break-all;
}
.info-page a:hover {
  color: #0d47a1;
}

.demo-fullscreen-button.ui.button {
  margin-top: 16px;
}

#demo-video-shell:fullscreen,
#demo-video-shell:-webkit-full-screen,
#demo-video-shell.demo-video-immersive {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  padding-bottom: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
}

#demo-video-shell:fullscreen iframe,
#demo-video-shell:-webkit-full-screen iframe,
#demo-video-shell.demo-video-immersive iframe {
  width: 100% !important;
  height: 100% !important;
}

/* Study design content styling */
.study-design-content h1,
.study-design-content h2,
.study-design-content h3,
.study-design-content h4 {
  font-family: inherit !important;
}

.study-design-content h1 {
  font-size: 24px !important;
  font-weight: 700;
  color: #0f172a;
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.study-design-content h2 {
  font-size: 20px !important;
  font-weight: 700;
  color: #1565c0;
  margin-top: 20px;
  margin-bottom: 10px;
  line-height: 1.3;
}

.study-design-content h3 {
  font-size: 18px !important;
  font-weight: 600;
  color: #334155;
  margin-top: 16px;
  margin-bottom: 8px;
}

.study-design-content p {
  line-height: 1.7;
  margin-bottom: 10px;
  color: #1e293b;
}

.study-design-content ul,
.study-design-content ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.study-design-content li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.study-design-content img {
  max-width: 100%;
  width: auto;
  min-width: 300px;
  height: auto;
  display: block;
  margin: 16px auto;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.10);
}

/* Suppress Dash's default "Loading..." text and white flash during callback
   updates to page-content / navbar-container.  Dash inserts a ._dash-loading
   element that replaces the previous children while the new callback response
   is in flight — hiding it keeps the old content visible for a seamless feel. */
._dash-loading {
  display: none !important;
}

/* H3 subtitle styling for consent notice (match required consent title style) */
#consent-notice-scroll h3 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  margin-top: 18px;
}

/* Prediction chart: slim y-axis unit strip.
   One horizontal row (label + mg/dL + mmol/L) rotated -90° so it reads
   up the axis as a single thin line — not a bulky side panel. */
#prediction-glucose-chart-container {
  position: relative;
}

#prediction-units-row.chart-yaxis-units {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 50%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(75, 95, 130, 0.28);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  white-space: nowrap;
  transform: translate(-42%, -50%) rotate(-90deg);
  transform-origin: center center;
}

#prediction-units-row .chart-yaxis-units-label {
  display: inline-block;
  margin: 0;
  padding: 0 2px 0 0;
  writing-mode: horizontal-tb;
  transform: none;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #2c5282;
  white-space: nowrap;
}

#prediction-units-row #glucose-unit-selector.chart-unit-toggle,
#prediction-units-row .chart-unit-toggle {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin: 0;
  width: auto;
}

#prediction-units-row .chart-unit-toggle .form-check {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 !important;
  padding: 4px 8px;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid rgba(75, 95, 130, 0.22);
  background: #f8fafc;
  cursor: pointer;
}

#prediction-units-row .chart-unit-toggle .form-check:has(input:checked) {
  background: #e8f1fb;
  border-color: #2185d0;
  box-shadow: inset 0 0 0 1px rgba(33, 133, 208, 0.25);
}

#prediction-units-row .chart-unit-toggle .form-check-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

#prediction-units-row .chart-unit-toggle .form-check-label {
  position: relative;
  z-index: 0;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #1a365d;
  cursor: pointer;
  white-space: nowrap;
}


