
    /* ---------- Theme Variables ---------- */
    :root {
      --primary-color: #000;
      --bg-color: #fff;
      --page-bg: var(--bg-color);
      --text-color: #000;
      --accent-color: #222;

      --panel-bg: #f8f8f8;
      --panel-border: #e5e5e5;

      --card-bg: #fff;
      --card-border: #e8e8e8;

      --current: #e8f3ff;
      --next: #f4ffdb;

      --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.06);
      --radius-lg: 14px;
      --radius-md: 10px;
    }

    html, body {
      height: 100%;
      min-width: 320px;
    }
    body {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background: var(--bg-color);
      color: var(--text-color);
      margin: 0;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      transition: background 0.3s ease, color 0.3s ease;
    }

    .shell {
  width: min(95%, 1280px);
  margin: 0 auto;
  /* allow the page/root background to show through (gradient applied on html/body) */
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* push footer to bottom */
  padding: clamp(8px, 2vw, 16px);
  min-height: 100vh; /* ensure it fills the viewport */
  box-sizing: border-box;
}

/* When present, prevent background transitions (used for instant theme swaps) */
html.no-bg-transition,
body.no-bg-transition {
  transition: none !important;
}

/* position shell so we can place an overlay above the background but below content */
.shell { position: relative; }

/* Ensure direct children of shell render above the overlay */
.shell > * { position: relative; z-index: 1; }

/* If viewport height is small, tighten paddings and font sizes so everything fits on one screen */
@media (max-height: 820px) {
  .shell { padding: 8px; }
  #headerRow { margin: 6px 0; }
  #schoolLogo { height: 44px; }
  .card .card-body { padding: 8px; }
  #countdown { font-size: clamp(24px, 6vw, 48px); }
}

@media (max-height: 680px) {
  .shell { padding: 6px; }
  #headerRow { margin: 4px 0; }
  #schoolLogo { height: 36px; }
  .grid { gap: 10px; }
  .splash-image { max-height: 58vh; }
  #countdown { font-size: clamp(20px, 5.5vw, 40px); }
}

    /* ---------- Header ---------- */
    #headerRow {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: clamp(8px, 2vw, 14px);
      margin: clamp(8px, 2vw, 12px) 0;
      padding: 0 clamp(6px, 1.5vw, 12px);
    }
    .logo-wrapper {
      display: flex;
      justify-content: center;
      align-items: center;
    }
    #schoolLogo {
      height: clamp(48px, 8vw, 64px);
      width: auto;
      display: block; 
      object-fit: contain;
    }
    h1 {
      margin: 0;
      text-align: center;
      color: inherit;
      font-size: clamp(24px, 5vw, 40px);
      line-height: 1.2;
      letter-spacing: 0.2px;
      word-wrap: break-word;
      hyphens: auto;
    }
    @media (min-width: 768px) {
      #headerRow {
        flex-direction: row;
        justify-content: center;
        gap: clamp(16px, 3vw, 24px);
      }
      h1 {
        font-size: clamp(28px, 4vw, 40px);
      }
      #schoolLogo {
        height: clamp(60px, 8vw, 70px);
      }
    }

    /* ---------- Global Message ---------- */
    #globalMessageBox {
      display: none;
      margin: 14px auto 18px;
      padding: 14px 16px;
      max-width: 980px;
      background: #ffcc00;
      color: #000;
      font-weight: 700;
      font-size: 1.05rem;
      text-align: center;
      border-radius: var(--radius-md);
      box-shadow: var(--shadow);
    }

    /* ---------- Controls Row (Color Picker) ---------- */
    #controlsRow {
      max-width: 980px;
      margin: 0 auto 18px;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      gap: 10px 14px;
      font-size: 0.98rem;
    }
    select.theme {
      padding: 8px 10px;
      border: 1px solid #ccc;
      border-radius: 8px;
      background: #fff;
      min-width: 180px;
    }
    input[type="color"] {
      width: 42px;
      height: 36px;
      border: none;
      background: none;
      padding: 0;
      cursor: pointer;
    }
    .fullscreen-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 8px 14px;
      font-size: 0.98rem;
      color: #000;
      background-color: #fff;
      border: 1px solid #e8e8e8;
      border-radius: 8px;
      text-decoration: none;
      cursor: pointer;
      transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
      font-weight: 600;
      white-space: nowrap;
    }
    .fullscreen-button:hover,
    .fullscreen-button:focus {
      background-color: #f5f5f5;
      border-color: #ddd;
      opacity: 1;
      color: #000;
      text-decoration: none;
    }
    .fullscreen-button:active {
      opacity: 0.9;
      transform: translateY(1px);
    }

    /* ---------- Grid Layout ---------- */
    .grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: clamp(10px, 2.5vw, 18px);
      align-items: start;
      width: 100%;
      flex: 1 1 auto; /* allow grid to use available space */
    }
    @media (min-width: 768px) {
      .grid {
        grid-template-columns: minmax(auto, 1fr) minmax(300px, 380px);
      }
    }

    /* ---------- Cards ---------- */
    .card {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
      width: 100%;
      min-width: 0; 
    }
    .card .card-body {
      padding: clamp(8px, 2vw, 14px);
    }
    .card h2,
    .card h3 {
      margin: 0 0 clamp(8px, 2vw, 12px);
      font-weight: 800;
      letter-spacing: 0.2px;
    }
    .card h2 {
      font-size: clamp(18px, 4vw, 26px);
    }
    .card h3 {
      font-size: clamp(16px, 3.5vw, 20px);
      text-align: center;
    }

    /* ---------- Countdown Card ---------- */
    #status {
      font-size: clamp(18px, 4vw, 26px);
      font-weight: 800;
      margin: clamp(6px, 2vw, 12px) 0;
      word-wrap: break-word;
    }
    #countdown {
      font-size: clamp(32px, 8vw, 68px);
      font-weight: 900;
      color: var(--accent-color);
      letter-spacing: 0.6px;
      margin: clamp(6px, 2vw, 8px) 0;
      word-wrap: break-word;
    }
    #tomorrowLabel {
      margin-top: clamp(8px, 2vw, 10px);
      font-size: clamp(14px, 3.5vw, 16px);
      font-weight: 800;
      white-space: pre-line; 
    }
    #allClearMessage { display: none; }

    /* ---------- Today’s Schedule Card ---------- */
    #schedulePanel .card-body {
      padding-top: 18px;
    }
    #scheduleList {
      padding: 0;
      margin: 12px 0 0;
      list-style: none;
      font-size: 1.05rem;
    }
    #scheduleList li {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: baseline;

      margin-bottom: 8px;
      padding: 10px 12px;
      border: 1px solid var(--panel-border);
      border-radius: 10px;
      background: #fff;
      color: inherit;
    }
    #scheduleList li .period-name { font-weight: 800; }
    #scheduleList li .period-time {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      letter-spacing: 0.2px;
    }
    #scheduleList li.current {
      background: var(--current);
      border-color: #b7dfff;
    }
    #scheduleList li.next {
      background: var(--next);
      border-color: #e5f3a5;
    }
    #scheduleNote {
      display: block;
      margin-top: 8px;
      color: #666;
      text-align: center;
    }

    /* ---------- Quote + Weather Card ---------- */
    #quoteBox {
      font-style: italic;
      font-size: clamp(14px, 3.5vw, 16px);
      line-height: 1.4;
      word-wrap: break-word;
    }
    #weather {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: clamp(8px, 2vw, 12px);
      flex-wrap: wrap;
      margin-top: clamp(8px, 2vw, 10px);
      font-size: clamp(14px, 3.5vw, 16px);
      color: #333;
      padding: 0 clamp(4px, 1vw, 8px);
    }
    #weather .bar {
      width: min(100%, 200px);
      height: clamp(10px, 2vw, 12px);
      background: #eee;
      border: 1px solid #ddd;
      border-radius: 8px;
      overflow: hidden;
      flex-grow: 1;
    }
    #weather .fill {
      width: 0%;
      height: 100%;
      background: linear-gradient(90deg, #4fc3f7, #ff7043);
      transition: width 0.6s ease;
    }

    /* ---------- Feedback ---------- */
    .feedback {
      text-align: center;
      margin-top: clamp(12px, 3vw, 16px);
    }
    .feedback-description {
      margin: 0 0 clamp(8px, 2vw, 10px);
      font-size: clamp(14px, 3.5vw, 16px);
      padding: 0 clamp(4px, 1vw, 8px);
    }
    .feedback-button {
      display: inline-block;
      padding: clamp(10px, 2.5vw, 12px) clamp(14px, 3vw, 18px);
      font-size: clamp(14px, 3.5vw, 16px);
      color: white;
      background-color: #0047ab;
      border: none;
      border-radius: 10px;
      cursor: pointer;
      text-decoration: none;
      width: min(100%, 300px);
    }

    /* ---------- Overlays ---------- */
    #maintenanceOverlay,
    #lockdownOverlay,
    #allClearOverlay {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: none;
      justify-content: center;
      align-items: center;
      text-align: center;
      padding: 24px;
      color: #fff;
      font-size: clamp(22px, 3vw, 32px);
      font-weight: 900;
    }
    #maintenanceOverlay { background-color: #4C00B0; }
    #lockdownOverlay    { background-color: #FF0033; }
    #allClearOverlay    { background-color: #00BF5F; }

    /* ---------- RM Theme: High Contrast ---------- */
    body[data-theme="rm"] {
      --text-color: #fff;
      --accent-color: #fff;
      --card-bg: rgba(0,0,0,0.18);
      --card-border: rgba(255,255,255,0.28);
      --panel-border: rgba(255,255,255,0.28);
      --panel-bg: rgba(255,255,255,0.08);
      /* keep page background variable for completeness */
      --page-bg: linear-gradient(180deg, #5a0f11 0%, #8b1c1f 100%);
    }
    body[data-theme="rm"] h1,
    body[data-theme="rm"] #status,
    body[data-theme="rm"] #tomorrowLabel,
    body[data-theme="rm"] #globalMessageBox { color: #fff; }
    body[data-theme="rm"] #globalMessageBox {
      background: rgba(0,0,0,0.35);
      border: 1px solid rgba(255,255,255,0.25);
    }
    body[data-theme="rm"] .card { background: var(--card-bg); border-color: var(--card-border); }
    body[data-theme="rm"] #scheduleList li {
      background: rgba(0,0,0,0.25);
      border-color: var(--panel-border);
      color: #fff;
    }
    body[data-theme="rm"] #scheduleList li.current {
      background: rgba(255, 255, 255, 0.18);
      border-color: rgba(255, 255, 255, 0.5);
    }
    body[data-theme="rm"] #scheduleList li.next {
      background: rgba(255, 255, 255, 0.14);
      border-color: rgba(255, 255, 255, 0.45);
    }
    body[data-theme="rm"] #quoteBox { color: #fff; }
    body[data-theme="rm"] #weather { color: #fff; }
    body[data-theme="rm"] #weather .bar {
      background: rgba(255,255,255,0.15);
      border-color: rgba(255,255,255,0.35);
    }
    body[data-theme="rm"] #weather .fill {
      background: linear-gradient(90deg, #ffe066, #ffd166);
    }
    body[data-theme="rm"] .feedback-button {
      background: #ffd166;
      color: #000;
    }
    body[data-theme="rm"] .fullscreen-button {
      background: rgba(255, 255, 255, 0.2);
      border-color: rgba(255, 255, 255, 0.4);
      color: #fff;
    }
    body[data-theme="rm"] .fullscreen-button:hover,
    body[data-theme="rm"] .fullscreen-button:focus {
      background: rgba(255, 255, 255, 0.3);
      border-color: rgba(255, 255, 255, 0.5);
      opacity: 1;
    }

    body[data-theme="ryan"] {
      --text-color: #ffffff;
      --accent-color: #ffffff;
      --card-bg: rgb(255, 153, 80);
      --card-border: rgba(255, 0, 0, 0.22);
      --panel-border: rgba(255,140,0,0.22);
      --panel-bg: rgb(255, 0, 0);
      --page-bg: linear-gradient(180deg, #ff9a2e 0%, #ff6a00 100%);
    }
    body[data-theme="ryan"] h1 {color: #000e75;}
    body[data-theme="ryan"] #status,
    body[data-theme="ryan"] #tomorrowLabel,
    body[data-theme="ryan"] #globalMessageBox { color: #fff; }
    body[data-theme="ryan"] #globalMessageBox {
      background: rgba(87, 78, 78, 0.14);
      border: 1px solid rgba(255,165,0,0.28);
    }

    body[data-theme="custom"] h1 {
      color: inherit;
    }
        /* ---------- Holiday Themes: Christmas & Hanukkah ---------- */
        body[data-theme="christmas"] {
          --page-bg: none; /* fallback */
          background-image: url('images/christmas-tile.jpg');
          background-repeat: repeat;
          background-position: top left;
          background-size: auto;
          color: #111;
        }
          /* Mixed Holiday theme: blends Christmas and Hanukkah tiles for an inclusive festive look */
          body[data-theme="holiday"] {
            /* combine the two tiles via layered backgrounds */
            background-image: url('images/holiday-tile.png');
            background-repeat: repeat, repeat;
            background-position: center, center;
            background-size: auto, auto;
            --card-bg: rgba(255,255,255,0.6);
            --card-border: rgba(255,255,255,0.6);
            color: var(--text-color);
          }
        body[data-theme="christmas"] .card { background: rgba(255,255,255,0.88); border-color: rgba(0,0,0,0.06); }

        body[data-theme="hanukkah"] {
          --page-bg: none;
          background-image: url('images/hanukkah-tile.jpg');
          background-repeat: repeat;
          background-position: top left;
          background-size: auto;
          color: #111;
        }
        body[data-theme="hanukkah"] .card { background: rgba(255,255,255,0.9); border-color: rgba(0,0,0,0.06); }

    /* Add a subtle black overlay over holiday tiled backgrounds to improve contrast */
    /* Full-page dark overlay for holiday themes (covers entire viewport) */
    body[data-theme="christmas"]::before,
    body[data-theme="hanukkah"]::before {
      content: "";
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.22); /* tweak opacity as needed */
      pointer-events: none;
      z-index: 0; /* sits below most content; page content should use z-index > 0 */
    }

      /* apply same overlay for mixed holiday theme */
      body[data-theme="holiday"]::before {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        z-index: 0;
        background: rgba(0,0,0,0.24);
      }

      /* Make header text white for holiday theme for better contrast */
      body[data-theme="holiday"] #headerRow h1 { color: #fff; }

    /* Falling dreidels container (placed under panels but above background) */
    .falling-dreidels {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 0; /* under .shell children which have z-index:1 */
      overflow: visible;
    }

    .dreidel {
      position: absolute;
      top: -10vh;
      left: 0;
      width: var(--size, 40px);
      height: auto;
      transform-origin: center center;
      will-change: transform, opacity;
      opacity: 0.95;
      animation: dreidel-fall var(--duration, 6s) linear var(--delay, 0s) forwards;
    }

    @keyframes dreidel-fall {
      from {
        transform: translate3d(0, -10vh, 0) rotate(0deg);
        opacity: 0.95;
      }
      to {
        transform: translate3d(var(--drift, 30px), 110vh, 0) rotate(calc(var(--spin, 2) * 360deg));
        opacity: 0.85;
      }
    }
    body[data-theme="custom"] .card {
      background: var(--custom-card-bg);
      border-color: var(--custom-card-border);
    }
    body[data-theme="custom"] #scheduleList li {
      background: var(--custom-schedule-bg);
      border-color: var(--custom-panel-border);
      transition: all 0.3s ease;
    }
    body[data-theme="custom"] #scheduleList li.current {
      background: var(--custom-schedule-current);
      border-color: var(--custom-schedule-current);
      border-width: 2px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    body[data-theme="custom"] #scheduleList li.next {
      background: var(--custom-schedule-next);
      border-color: var(--custom-schedule-next);
      border-width: 2px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
    body[data-theme="custom"] #weather .bar {
      background: var(--custom-card-bg);
      border-color: var(--custom-panel-border);
    }
    body[data-theme="custom"] .feedback-button {
      background: var(--custom-card-bg);
      border: 1px solid var(--custom-card-border);
      color: inherit;
    }
    body[data-theme="custom"] .fullscreen-button {
      background: var(--custom-card-bg);
      border: 1px solid var(--custom-card-border);
      color: inherit;
    }
    body[data-theme="custom"] .fullscreen-button:hover,
    body[data-theme="custom"] .fullscreen-button:focus {
      background: var(--custom-card-bg);
      border-color: var(--custom-card-border);
      opacity: 0.9;
      color: inherit;
    }
    body[data-theme="custom"] #countdown {
      color: inherit;
    }
    body[data-theme="ryan"] .card { background: var(--card-bg); border-color: var(--card-border); }
    body[data-theme="ryan"] #scheduleList li {
      background: rgba(255, 85, 0, 0.639);
      border-color: var(--panel-border);
      color: #fff;
    }
    body[data-theme="ryan"] #scheduleList li.current {
      background: rgba(0, 119, 247, 0.721);
      border-color: rgba(255,165,0,0.4);
    }
    body[data-theme="ryan"] #scheduleList li.next {
      background: rgba(83, 162, 245, 0.732);
      border-color: rgba(255,165,0,0.35);
    }
    body[data-theme="ryan"] #quoteBox { color: #fff; }
    body[data-theme="ryan"] #weather { color: #fff; }
    body[data-theme="ryan"] #weather .bar {
      background: rgba(255,255,255,0.12);
      border-color: rgba(255,165,0,0.28);
    }
    body[data-theme="ryan"] #weather .fill {
      background: linear-gradient(90deg, #57aeff, #0051ff);
    }
    body[data-theme="ryan"] .feedback-button {
      background: rgba(255, 85, 0, 0.639);
      color: #fff;
    }
    body[data-theme="ryan"] .fullscreen-button {
      background: rgba(0, 119, 247, 0.8);
      border-color: rgba(0, 119, 247, 1);
      color: #fff;
    }
    body[data-theme="ryan"] .fullscreen-button:hover,
    body[data-theme="ryan"] .fullscreen-button:focus {
      background: rgba(0, 119, 247, 1);
      border-color: rgba(83, 162, 245, 1);
      opacity: 1;
    }
#siteFooter {
  margin: 12px auto 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  width: 100%;
  max-width: 980px;
  flex-shrink: 0; /* keep footer visible at bottom */
}

/* Christmas-specific text colors: make header and footer text white for contrast */
body[data-theme="christmas"] #headerRow h1,
body[data-theme="christmas"] #siteFooter,
body[data-theme="christmas"] #siteFooter a {
  color: #ffffff !important;
}
#siteFooter div {
  padding: 10px 12px;
  text-align: center;
  font-size: 0.95rem;
  color: inherit;
  background: none;
}
    #siteFooter a#ryanLink {
      color: inherit; 
      text-decoration: underline;
      text-decoration-thickness: 1px;
    }
    #siteFooter a#ryanLink:hover,
    #siteFooter a#ryanLink:focus,
    #siteFooter a#ryanLink:visited {
      color: inherit;
      text-decoration: underline;
    }

/* ---------- Splash Overlay ---------- */
#splashOverlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.splash-content {
  text-align: center;
  max-width: 720px;
  padding: 24px;
}
.splash-image {
  display: block;
  margin: 0 auto 12px;
  width: min(760px, 84vw);
  height: auto;
  max-height: 72vh; /* keep it within viewport height */
  object-fit: contain;
}

.splash-sub {
  margin: 8px 0 16px; /* tighter spacing to sit closer to the logo */
  color: #3b82f6; /* fallback */
  background-image: linear-gradient(90deg, #3b82f6 0%, #7c3aed 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 18px;
  font-weight: 600;
}

/* Make title + subtitle pick up the gradient from the splash logo image */
.splash-title,
.splash-sub {
  /* fallback color */
  color: #3b82f6;
  /* use a CSS gradient that matches the splash logo colors (maroon -> orange) */
  background-image: linear-gradient(90deg, #3b82f6 0%, #7c3aed 100%);
  background-size: 200% auto; /* help the gradient look smooth on larger text */
  background-position: center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent; /* for WebKit */
}

/* Slightly smaller subtitle on narrow screens */
@media (max-width: 420px) {
  .splash-title { font-size: 28px; }
  .splash-sub { font-size: 13px; }
}
.splash-bar {
  width: min(68%, 520px);
  height: 12px;
  background: #f0f0f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.splash-fill {
  width: 0%;
  height: 100%;
  /* blue -> purple gradient to match logo colors */
  background: linear-gradient(90deg, #3b82f6 0%, #7c3aed 100%);
  transition: width 1.5s cubic-bezier(.22,.9,.28,1);
}

/* hide splash when dismissed (avoid removing from DOM so accessibility tools can detect)
   the attribute aria-hidden will also be toggled via JS */
#splashOverlay[aria-hidden="true"] { display: none; }

/* Fade-out helper */
.splash-fade {
  animation: splashFadeOut 540ms ease-in-out forwards;
}

@keyframes splashFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* Make sure splash content scales nicely on small screens */
@media (max-width: 420px) {
  .splash-title { font-size: 28px; }
  .splash-sub { font-size: 14px; }
  .splash-bar { width: 84%; height: 10px; }
}
