body {
      font-family: Arial, sans-serif;
      background-color: #f4f8ff;
      color: #222;
      text-align: center;
      padding: 2em;
      transition: background-color 2s ease-in-out;
    }

    h1 {
      font-size: 2.5em;
      margin-bottom: 0.2em;
    }

    h2 {
      font-size: 1.5em;
      margin-top: 0;
      color: #444;
    }

    .info-box {
      background-color: #fff;
      border: 2px solid #000;
      border-radius: 10px;
      box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
      padding: 20px;
      margin: 1em auto;
      max-width: 500px;
      text-align: left;
    }

    .info-box p {
      font-size: 1.1em;
      margin: 0.5em 0;
    }

    #last-updated {
      margin-top: 1em;
      font-size: 0.9em;
      color: #555;
    }

    body.dark-mode {
      background-color: #000;
    }

    body.dark-mode .info-box {
      background-color: #111;
    }

    .back-button {
      margin-top: 30px;
      display: inline-block;
      padding: 10px 20px;
      background-color: #fff;
      color: #000;
      border: 2px solid #000;
      border-radius: 8px;
      text-decoration: none;
      font-weight: bold;
    }

    .back-button:hover {
      background-color: #eeeeee;
    }

    .main-row {
      display: flex;
      justify-content: center;
      align-items: flex-start;
      gap: 1em;
      margin: 1em auto;
      max-width: 1100px;
    }

    .relative-wrapper {
      position: relative;
      max-width: 500px;
      width: 100%;
      margin: 0 auto;
    }

    .history-box {
      right: 100%;
      margin-right: 1em;
      top: 0;
      width: 300px;
      background-color: #fff8dc;
      border: 2px solid #000;
      border-radius: 10px;
      padding: 15px;
      box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
      text-align: left;
    }

    body.dark-mode .history-box {
      background-color: #222;
    }

    .box-wide {
      width: 100%;
    }

    .flex-row {
      display: flex;
      justify-content: center;
      align-items: flex-start;
      gap: 2em; /* spacing between boxes */
      margin: 1.5em auto;
      flex-wrap: nowrap;
      max-width: 1300px;
    }

    .sun-weather-box {
      width: 100%;
      max-width: 500px;
      box-sizing: border-box;
    }

    .history-box {
      width: 300px;
      background-color: #fff8dc;
      border: 2px solid #000;
      border-radius: 10px;
      padding: 15px;
      box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
      text-align: left;
      flex-shrink: 0;
    }

    #seasonBox {
      text-align: center;
      font-family: Arial, sans-serif;
      transition: background-color 1s ease-in-out, color 1s ease-in-out;
      width: 100%;
      max-width: 500px;
    }

    #seasonBox h3 {
      font-size: 2.5em;
      margin: 0.2em 0;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 0.5em;
    }

    #seasonBox h3 span {
      font-weight: bold;
    }

    #seasonBox p {
      margin: 0.4em 0;
    }

    #seasonBox .season-year {
      font-size: 1.5em;
      font-weight: bold;
    }

    #seasonBox .season-subtext {
      font-size: 0.75em;
      color: inherit;
    }

    #moonBox {
      text-align: center;
      padding-top: 1.2em;
      transition: background-color 1s ease-in-out, color 1s ease-in-out;
    }

    #moonBox .moon-percent {
      font-size: 2.2em;
      font-weight: bold;
      margin: 0;
    }

    #moonBox .moon-emoji {
      font-size: 2.5em;
      margin: 0.2em 0;
    }

    #moonBox .moon-phase {
      font-size: 1em;
      margin-bottom: 0.6em;
    }

    #timeProgressBox {
      text-align: center;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 0.5em;
      font-weight: bold;
    }

    #timeProgressBox .time-block {
      padding: 0.5em;
      border: 2px solid black;
      border-radius: 6px;
    }

    #timeProgressBox .label {
      font-size: 1.4em;
    }

    #timeProgressBox .subtext {
      font-size: 0.8em;
      margin-top: 0.2em;
    }

    /* full-width cards that won't break the evenness of the grid above */
    #timeProgressBox .span-all {
      grid-column: 1 / -1;
    }

    body {
      font-family: 'IBM Plex Sans', sans-serif;
    }

    h1, h2, h3 {
      font-family: 'Merriweather', serif;
    }

    h1 {
      font-size: 3em; /* previously 2.5em */
    }

    h2 {
      font-size: 2em; /* previously 1.5em */
    }

    h3 {
      font-size: 1.5em; /* previously inherited default, or ~1.17em */
    }

    .calendar-section {
      margin: 2em auto;
      padding: 0;
      border-radius: 12px;
      box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.15);
      background-color: var(--calendar-bg);
      border: 2px solid var(--calendar-accent);
      max-width: 900px;
      overflow: hidden;
    }

    .calendar-header {
      background-color: var(--calendar-accent);
      padding: 1em;
      text-align: center;
    }

    .calendar-header h3 {
      margin: 0;
      font-size: 1.8em;
      color: #808080; /* Pure grey */
    }

    .calendar-content {
      padding: 1.5em;
      color: var(--calendar-text);
    }

    .calendar-content p,
    .calendar-content small {
      margin-bottom: 1em;
      color: var(--calendar-text);
    }

    .calendar-content small {
      color: var(--calendar-subtext);
      font-style: italic;
    }

    .holiday {
      background-color: rgba(255, 0, 0, 0.18); /* translucent red overlay */
      font-weight: bold;                       /* emphasize holiday text */
    }

    .holiday-table {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 1em;
    }

    .holiday-table th,
    .holiday-table td {
      border: 1px solid var(--calendar-accent);
      padding: 0.6em;
      text-align: left;
    }

    .holiday-table thead {
      background-color: var(--calendar-accent);
      color: #000; /* black text */
      font-weight: bold;
    }

    .holiday-table tbody tr:nth-child(even) {
      background-color: rgba(255, 255, 255, 0.2);
    }

    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 0.5em;
      text-align: center;
      margin-bottom: 1em;
    }

    .calendar-grid div {
      padding: 0.7em;
      border-radius: 6px;
      background-color: var(--calendar-bg);
      border: 1px solid var(--calendar-accent);
      color: var(--calendar-text);
    }

    .calendar-grid .header {
      background-color: var(--calendar-accent);
      color: var(--calendar-text);
    }
    
    .calendar-grid .today {
      background-color: yellow;
      color: black;
      font-weight: bold;
    }

    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0; top: 0;
      width: 100%; height: 100%;
      overflow: auto;
      background-color: rgba(0,0,0,0.5);
    }

    .modal-content {
      background-color: #fefefe;
      margin: 15% auto;
      padding: 1em 2em;
      border: 1px solid #888;
      width: 300px;
      max-width: 90%;
      border-radius: 10px;
      text-align: center;
      position: relative;
    }

    .close {
      color: #aaa;
      float: right;
      font-size: 24px;
      font-weight: bold;
      position: absolute;
      right: 10px;
      top: 5px;
      cursor: pointer;
    }

    .close:hover {
      color: #000;
    }

    .calendar-grid .interdimus {
      opacity: 0.7;
      font-style: italic;
    }
    .calendar-grid .principus {
      font-weight: bold;
      text-decoration: underline;
    }

    #northuCalendarGrid div {
      padding: 0.7em;
      border-radius: 6px;
      background-color: var(--calendar-bg);
      border: 1px solid var(--calendar-accent);
      color: var(--calendar-text);
    }
    #northuCalendarGrid .header {
      background-color: var(--calendar-accent);
      color: var(--calendar-text);
      font-weight: bold;
    }

    .northu-calendar-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5em;
      margin-bottom: 1em;
    }
    
    .calendar-wrapper {
      background-color: var(--calendar-bg, #fdf6c2);
      padding: 2em;
      border-radius: 1em;
      max-width: 1100px;
      margin: 2em auto;
      box-shadow: 0 0 10px rgba(0,0,0,0.1);
    }

    .calendar-columns {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      gap: 2em;
      justify-content: center;
    }

    .calendar-section {
      flex: 1 1 400px;
    }

    .time-progress {
      margin-top: 0.35em;
      height: 8px;
      background: #e6e6e6;
      border-radius: 6px;
      overflow: hidden;
      border: 1px solid #000;
      position: relative;
    }
    .time-progress > div {
      height: 100%;
      width: 0%;
      background: hsl(200, 100%, 45%);
      transition: width 0.4s linear;
    }
    /* vertical marker line for special thresholds */
    .time-progress .marker {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 0;
      border-left: 2px solid #000; /* simple black line */
      pointer-events: none;
      display: flex;
      justify-content: center;
    }

    .time-progress .marker.sunrise::after,
    .time-progress .marker.sunset::after {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      font-size: 12px;
      line-height: 1;
      top: -14px; /* place the arrow just above the bar */
      font-size: 12px;
      line-height: 1;
      margin-top: -14px;
    }
    .time-progress .marker.sunrise::after { content: "▲"; }
    .time-progress .marker.sunset::after  { content: "▼"; }

    .northu-calendar-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5em;
      margin-bottom: 1em;
    }

    #northuCalendarGrid .today {
      background-color: yellow;
      color: black;
      font-weight: bold;
    }

    /* Countdown box styling */
    #countdownsBox {
      background: linear-gradient(145deg, #1e1e2f, #2a2a3d);
      border: 1px solid #444;
      border-radius: 12px;
      padding: 12px;
      color: #eee;
      box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    }

    #countdownsBox h3 {
      margin-top: 0;
      font-size: 1.1rem;
      text-align: center;
      color: #ffcc66;
    }

    #countdownsContent {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    #countdownsContent .time-block {
      display: flex;
      justify-content: space-between;
      background: rgba(255,255,255,0.05);
      padding: 6px 10px;
      border-radius: 6px;
      transition: background 0.3s;
    }

    #countdownsContent .time-block:hover {
      background: rgba(255,255,255,0.12);
    }

    #countdownsContent .label {
      font-weight: 600;
      color: #99ddff;
    }

    #countdownsContent .time-block div:last-child {
      font-family: monospace;
      color: #ff9966;
    }

    .forecast-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 0.6em;
    }
    .forecast-card {
      border: 2px solid #000;
      border-radius: 8px;
      padding: 0.6em;
      background: #fff;
      text-align: center;
    }
    body.dark-mode .forecast-card {
      background: #111;
    }
    .forecast-card .dow { font-weight: 700; }
    .forecast-card .hi   { font-weight: 700; }
    .forecast-card .lo   { opacity: 0.9; }

    .projections-grid{
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 1em;
      max-width: 1100px;   /* match your page width */
      margin: 0 auto;
    }

    /* === HOLIDAY SEASON YEAR TIMELINE === */
    .liturgical-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.9rem;
      margin-bottom: 1rem;
    }

    .liturgical-controls button {
      min-width: 44px;
      min-height: 44px;
      padding: 0.5rem 0.8rem;
      border: 2px solid var(--calendar-accent, #000);
      border-radius: 8px;
      background: var(--calendar-bg, #fff);
      color: var(--calendar-text, #000);
      font-weight: 700;
      cursor: pointer;
    }

    .liturgical-controls button:hover {
      filter: brightness(0.96);
    }

    .liturgical-controls button:focus-visible {
      outline: 3px solid currentColor;
      outline-offset: 2px;
    }

    #liturgicalTitle {
      min-width: 8ch;
      font-family: 'Merriweather', serif;
      font-size: 1.25rem;
    }

    .liturgical-timeline {
      position: relative;
      border: 2px solid var(--calendar-accent, #000);
      border-radius: 10px;
      background: var(--calendar-bg, #fff);
      overflow-x: auto;
      padding: 0;
      margin-top: 0.5rem;
    }

    .liturgical-timeline-inner {
      position: relative;
      min-width: 820px;
    }

    .liturgical-month-grid {
      display: grid;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      border-bottom: 2px solid var(--calendar-accent, #000);
      background: rgba(127, 127, 127, 0.08);
    }

    .liturgical-month {
      position: relative;
      text-align: center;
      font-weight: 700;
      padding: 0.65rem 0.15rem;
      color: var(--calendar-text, #000);
      border-right: 1px solid rgba(127, 127, 127, 0.35);
      font-size: 0.82rem;
    }

    .liturgical-month:last-child {
      border-right: 0;
    }

    .liturgical-holiday-lane {
      position: relative;
      height: 72px;
      border-bottom: 2px solid var(--calendar-accent, #000);
      background:
        repeating-linear-gradient(
          to right,
          transparent 0,
          transparent calc(8.333333% - 1px),
          rgba(127,127,127,0.18) calc(8.333333% - 1px),
          rgba(127,127,127,0.18) 8.333333%
        );
    }

    .liturgical-holiday-lane-label {
      position: absolute;
      left: 8px;
      top: 6px;
      z-index: 2;
      padding: 2px 5px;
      border-radius: 4px;
      background: rgba(255,255,255,0.82);
      color: #111;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      pointer-events: none;
    }

    body.dark-mode .liturgical-holiday-lane-label {
      background: rgba(0,0,0,0.78);
    }

    .liturgical-holiday-marker {
      position: absolute;
      bottom: 13px;
      width: 13px;
      height: 13px;
      padding: 0;
      border: 2px solid #111;
      transform: translateX(-50%);
      z-index: 4;
      cursor: pointer;
      appearance: none;
    }

    .liturgical-holiday-marker:focus-visible {
      outline: 3px solid #111;
      outline-offset: 3px;
    }

    .liturgical-holiday-marker.national-holiday {
      background: #d32f2f;
      transform: translateX(-50%) rotate(45deg);
      border-radius: 2px;
    }

    .liturgical-holiday-marker.observance {
      background: #1976d2;
      border-radius: 50%;
    }

    .liturgical-holiday-marker.seasonal {
      background: #f9a825;
      clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
      border-radius: 0;
    }

    .liturgical-holiday-marker.other {
      background: #616161;
      border-radius: 2px;
    }

    .liturgical-holiday-details {
      min-height: 2.2em;
      padding: 0.45rem 0.7rem;
      border-bottom: 1px solid rgba(127,127,127,0.25);
      font-size: 0.78rem;
      text-align: left;
    }

    .liturgical-holiday-key {
      display: flex;
      flex-wrap: wrap;
      gap: 0.55rem 1rem;
      padding: 0.45rem 0.7rem;
      border-bottom: 1px solid rgba(127,127,127,0.25);
      font-size: 0.72rem;
    }

    .liturgical-holiday-key-item {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .liturgical-holiday-key-symbol {
      display: inline-block;
      width: 11px;
      height: 11px;
      border: 1px solid #111;
      flex: 0 0 auto;
    }

    .liturgical-holiday-key-symbol.national-holiday {
      background: #d32f2f;
      transform: rotate(45deg);
      border-radius: 1px;
    }

    .liturgical-holiday-key-symbol.observance {
      background: #1976d2;
      border-radius: 50%;
    }

    .liturgical-holiday-key-symbol.seasonal {
      background: #f9a825;
      clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
      border-radius: 0;
    }

    .liturgical-track {
      position: relative;
      min-height: 90px;
      background:
        repeating-linear-gradient(
          to right,
          transparent 0,
          transparent calc(8.333333% - 1px),
          rgba(127,127,127,0.24) calc(8.333333% - 1px),
          rgba(127,127,127,0.24) 8.333333%
        );
    }

    .liturgical-bar-layer {
      position: relative;
      width: 100%;
      min-height: 90px;
    }

    .liturgical-bar {
      position: absolute;
      height: 26px;
      border-radius: 6px;
      border: 1px solid rgba(0,0,0,0.65);
      display: flex;
      align-items: center;
      padding: 0 7px;
      box-sizing: border-box;
      white-space: nowrap;
      font-size: 12px;
      line-height: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      box-shadow: 0 1px 2px rgba(0,0,0,0.18);
      cursor: default;
    }

    .liturgical-bar.is-active {
      outline: 3px solid currentColor;
      outline-offset: 1px;
      font-weight: 800;
    }

    .liturgical-today-marker {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 2px;
      background: #d40000;
      z-index: 5;
      pointer-events: none;
    }

    .liturgical-today-marker::before {
      content: "Today";
      position: absolute;
      top: 3px;
      left: 5px;
      padding: 2px 5px;
      border-radius: 4px;
      background: #d40000;
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      white-space: nowrap;
    }

    .liturgical-axis-note {
      padding: 0.45rem 0.7rem 0.55rem;
      border-top: 1px solid rgba(127,127,127,0.25);
      font-size: 0.72rem;
      opacity: 0.78;
      text-align: left;
    }

    .liturgical-legend {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 8px;
      margin-top: 12px;
    }

    .liturgical-legend-item {
      display: flex;
      gap: 8px;
      align-items: center;
      border: 1px solid var(--calendar-accent, #000);
      border-radius: 8px;
      padding: 7px 9px;
      background: #fff;
      color: #111;
      text-align: left;
    }

    body.dark-mode .liturgical-legend-item {
      background: #111;
    }

    .legend-swatch {
      width: 20px;
      height: 20px;
      flex: 0 0 20px;
      border-radius: 4px;
      border: 1px solid rgba(0,0,0,0.65);
    }

    @media (max-width: 700px) {
      .liturgical-timeline-inner {
        min-width: 720px;
      }

      .liturgical-legend {
        grid-template-columns: 1fr;
      }
    }


    /* Countdown Details (non-invasive add-on) */
    #countdownDetailsToggle {
      width: 100%;
      margin-top: 8px;
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid #444;
      background: rgba(255,255,255,0.06);
      color: #ffcc66;
      font-weight: 700;
      cursor: pointer;
    }
    #countdownDetailsPanel {
      display: none;
      margin-top: 8px;
      border: 1px solid #444;
      border-radius: 10px;
      padding: 10px;
      background: rgba(255,255,255,0.04);
    }
    #countdownDetailsPanel.open { display: block; }

    #countdownDetailsPanel .detail-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      padding: 6px 8px;
      border-radius: 6px;
      margin: 4px 0;
      background: rgba(255,255,255,0.05);
    }
    #countdownDetailsPanel .detail-row .label {
      color: #99ddff;
      font-weight: 600;
    }
    #countdownDetailsPanel .detail-row .exact {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
      color: #ff9966;
      white-space: nowrap;
    }
    #countdownDetailsPanel .detail-row .exact {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
      color: #ff9966;
      white-space: normal;     /* allow wrapping */
      word-break: break-word;  /* force breaks if necessary */
      overflow-wrap: anywhere; /* modern browsers, ensures wrapping */
    }

    #monthBox {
      text-align: center;
      transition: background-color 1s ease-in-out, color 1s ease-in-out;
      width: 100%;
      max-width: 500px;
    }

    #monthBox h3 {
      /* Slightly bigger than the Season box title */
      font-size: 2.7em; /* Season is 2.5em; bump just a bit */
      margin: 0.2em 0;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 0.5em;
    }

    #monthBox h3 span {
      font-weight: bold;
    }

    #monthBox .month-year {
      font-size: 1.3em;
      font-weight: bold;
    }

    #monthBox .month-subtext {
      font-size: 0.75em;
      color: inherit;
    }

    .forecast-footnote {
      margin-top: 8px;
      font-size: 0.75rem;
      color: #666;
      text-align: center;
      opacity: 0.85;
    }

    #councilSessionBox {
      text-align: center;
      transition: background-color 1s ease-in-out, color 1s ease-in-out;
    }

    #councilSessionBox h3 {
      font-size: 1.5em;
      margin-top: 0;
    }

    #councilSessionBox .session-title {
      font-size: 1.4em;
      font-weight: bold;
      margin: 0.2em 0;
    }

    #councilSessionBox .session-subtext {
      font-size: 0.8em;
      opacity: 0.85;
      margin-bottom: 0.4em;
    }

    #councilSessionBox .session-dates {
      font-size: 0.9em;
      margin-top: 0.4em;
    }

    #councilSessionBox a {
      color: inherit;
      text-decoration: none;
      display: block;
    }

    #councilSessionBox a:hover .time-progress {
      filter: brightness(1.1);
    }

    /* === FOUNDER AGE PANEL === */

    #founderAgeBox {
      text-align: center;
      transition: background-color 1s ease-in-out, color 1s ease-in-out;
    }

    #founderAgeBox h3 {
      margin-top: 0;
      margin-bottom: 0.35em;
      font-size: 1.5em;
    }

    #founderExactAge {
      margin: 0.15em 0;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
                  "Liberation Mono", monospace;
      font-size: 1.9em;
      font-weight: bold;
      overflow-wrap: anywhere;
    }

    #founderWholeAge {
      margin: 0.25em 0 0.65em;
      font-size: 1.1em;
      font-weight: bold;
    }

    #founderLegalAge {
      display: inline-block;
      margin-bottom: 0.9em;
      padding: 0.45em 0.8em;
      border: 1px solid currentColor;
      border-radius: 7px;
      font-size: 0.95em;
    }

    #founderLegalAgeValue {
      font-size: 1.1em;
      font-weight: bold;
    }

    #founderLegalAgeNote {
      margin-top: 0.15em;
      font-size: 0.72em;
      opacity: 0.75;
    }

    #founderAgeRange {
      display: flex;
      justify-content: space-between;
      gap: 1em;
      margin-top: 0.4em;
      font-size: 0.9em;
      font-weight: bold;
    }

    #founderAgePercent {
      margin-top: 0.5em;
      font-size: 0.9em;
      font-weight: bold;
    }

    #founderBirthDetails {
      margin-top: 0.8em;
      font-size: 0.75em;
      opacity: 0.8;
    }

    #founderAgeProgressFill {
      transition: none;
    }

    /* Compact-by-default founder age card */
    #founderAgeBox {
      padding: 14px 16px;
    }

    #founderAgeCompact {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      text-align: left;
    }

    #founderAgeCompactText {
      min-width: 0;
    }

    #founderAgeCompactTitle {
      margin: 0 0 0.15em;
      font-family: 'Merriweather', serif;
      font-size: 1.05em;
      font-weight: 700;
    }

    #founderAgeCompactValue {
      font-size: 1.35em;
      font-weight: 700;
      line-height: 1.15;
    }

    #founderAgeCompactProgress {
      margin-top: 0.18em;
      font-size: 0.72em;
      opacity: 0.72;
    }

    #founderAgeToggle {
      flex-shrink: 0;
      padding: 7px 10px;
      border: 1px solid currentColor;
      border-radius: 7px;
      background: transparent;
      color: inherit;
      font-weight: 700;
      cursor: pointer;
    }

    #founderAgeToggle:hover {
      background: rgba(127,127,127,0.12);
    }

    #founderAgeExpanded {
      display: none;
      margin-top: 0.9em;
      padding-top: 0.9em;
      border-top: 1px solid rgba(127,127,127,0.35);
    }

    #founderAgeBox.expanded #founderAgeExpanded {
      display: block;
    }

    #founderAgeBox.expanded #founderAgeCompactProgress {
      display: none;
    }


    /* === TERRARIA OST CONTROL === */
    #terrariaOstControl {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 0.35em;
      margin-top: 1.5em;
      width: 100%;
    }

    #terrariaOstButton {
      padding: 10px 16px;
      border: 2px solid #000;
      border-radius: 8px;
      background: #fff;
      color: #000;
      font-weight: bold;
      cursor: pointer;
    }

    #terrariaOstButton:hover {
      background: #eee;
    }

    body.dark-mode #terrariaOstButton {
      background: #111;
    }

    body.dark-mode #terrariaOstButton:hover {
      background: #222;
    }

    #terrariaOstStatus {
      font-size: 0.8em;
      opacity: 0.8;
      max-width: 320px;
      text-align: right;
    }


    /* === AUTOMATIC PER-SURFACE TEXT CONTRAST ===
       contrast.js assigns --surface-text independently to each major area.
       Deliberately colored timeline bars keep their own foreground colors. */

    body,
    .info-box,
    .history-box,
    .calendar-wrapper,
    .calendar-section,
    .calendar-header,
    .calendar-content,
    .forecast-card,
    #countdownsBox,
    #countdownDetailsPanel,
    #countdownDetailsPanel .detail-row,
    .liturgical-timeline,
    .liturgical-month-grid,
    .liturgical-holiday-lane,
    .liturgical-holiday-details,
    .liturgical-holiday-key,
    .liturgical-axis-note,
    .liturgical-legend-item,
    .modal-content,
    .back-button,
    #terrariaOstButton {
      color: var(--surface-text, inherit);
    }

    /* Text that previously had fixed colors should follow its own surface. */
    .calendar-header h3,
    .calendar-content p,
    .calendar-content small,
    .calendar-grid div,
    .calendar-grid .header,
    #northuCalendarGrid div,
    #northuCalendarGrid .header,
    .liturgical-month,
    .forecast-footnote,
    #last-updated,
    #terrariaOstStatus,
    #countdownDetailsToggle {
      color: inherit;
    }

    /* Inputs / controls should remain readable on their immediate surface. */
    .liturgical-controls button,
    #founderAgeToggle,
    #countdownDetailsToggle {
      color: var(--surface-text, inherit);
      border-color: currentColor;
    }

    /* Preserve intentionally encoded colors. */
    .liturgical-bar {
      color: inherit;
    }

    .holiday-table thead,
    .holiday-table th,
    .holiday-table td {
      color: inherit;
    }

    /* Today remains intentionally high-contrast regardless of its parent. */
    .calendar-grid .today,
    #northuCalendarGrid .today {
      color: #000;
    }

    /* The holiday marker detail label follows the marker lane surface. */
    .liturgical-holiday-lane-label {
      color: var(--surface-text, inherit);
    }



    /* === RICH CONTEXT TOOLTIPS === */
    [data-almanac-context="true"] {
      cursor: help;
      border-radius: 4px;
    }

    [data-almanac-context="true"]:focus-visible {
      outline: 2px dashed currentColor;
      outline-offset: 3px;
    }

    #almanacContextTooltip {
      position: fixed;
      z-index: 10000;
      display: none;
      width: min(340px, calc(100vw - 24px));
      max-width: 340px;
      padding: 10px 12px;
      border: 1px solid rgba(127,127,127,0.55);
      border-radius: 9px;
      background: rgba(20,20,24,0.97);
      color: #fff;
      box-shadow: 0 8px 26px rgba(0,0,0,0.35);
      font-size: 0.82rem;
      line-height: 1.38;
      text-align: left;
      pointer-events: none;
    }

    #almanacContextTooltip.open {
      display: block;
    }

    #almanacContextTooltip .context-title {
      margin: 0 0 5px;
      font-weight: 800;
      font-size: 0.92rem;
    }

    #almanacContextTooltip .context-value {
      margin-bottom: 7px;
      opacity: 0.92;
    }

    #almanacContextTooltip .context-grid {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 3px 8px;
      margin-top: 6px;
    }

    #almanacContextTooltip .context-grid strong {
      font-weight: 700;
    }

    #almanacContextTooltip .context-note {
      margin-top: 7px;
      opacity: 0.8;
      font-size: 0.76rem;
    }

    @media (hover: none), (pointer: coarse) {
      [data-almanac-context="true"] {
        cursor: pointer;
      }
    }


/* ======================= Time-of-Day Wheel ======================= */
.time-of-day-wheel-box {
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
}

.time-of-day-wheel-box h3 {
  margin: 0 0 0.25em;
}

.time-of-day-wheel-wrap {
  position: relative;
  width: min(100%, 310px);
  margin: 0 auto;
  padding-top: 20px;
  box-sizing: border-box;
}

.time-of-day-wheel {
  display: block;
  width: 100%;
  max-width: 310px;
  height: auto;
  margin: 0 auto;
  overflow: hidden;
  color: var(--surface-text, currentColor);
}

/* Rotation is applied with the SVG transform attribute in timewheel.js. */
#timeOfDayWheelRotor {
  transition: none;
}

.time-of-day-now-arrow {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  line-height: 1;
  color: #e11d48;
  text-shadow: 0 1px 1px rgba(255,255,255,0.8), 0 1px 3px rgba(0,0,0,0.35);
  pointer-events: none;
}

.time-of-day-wheel-center {
  fill: rgba(255,255,255,0.94);
  stroke: rgba(0,0,0,0.5);
  stroke-width: 2;
}

body.dark-mode .time-of-day-wheel-center {
  fill: rgba(17,17,17,0.96);
  stroke: rgba(255,255,255,0.52);
}

.time-of-day-wheel-current {
  fill: var(--surface-text, #111);
  font: 700 12.5px Arial, sans-serif;
}

.time-of-day-wheel-time {
  fill: var(--surface-text, #111);
  font: 700 11.5px Arial, sans-serif;
}

.time-of-day-wheel-range {
  fill: var(--surface-text, #111);
  opacity: 0.78;
  font: 9.5px Arial, sans-serif;
}

.time-of-day-wheel-note {
  margin-top: 0.15em;
  font-size: 0.72em;
  line-height: 1.25;
  opacity: 0.72;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 520px) {
  .time-of-day-wheel-wrap {
    width: min(100%, 280px);
  }

  .time-of-day-wheel {
    max-width: 280px;
  }
}


/* Time-of-day wheel fullscreen control */
.time-of-day-wheel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  margin-bottom: 0.25em;
}

.time-of-day-wheel-heading h3 {
  margin: 0;
  min-width: 0;
}

.time-of-day-wheel-fullscreen {
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 7px;
  padding: 6px 9px;
  background: transparent;
  color: inherit;
  font: 700 0.76em Arial, sans-serif;
  cursor: pointer;
}

.time-of-day-wheel-fullscreen:hover,
.time-of-day-wheel-fullscreen:focus-visible {
  background: rgba(127,127,127,0.18);
}

#timeOfDayWheelBox:fullscreen,
#timeOfDayWheelBox:-webkit-full-screen {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: #f4f8ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.dark-mode #timeOfDayWheelBox:fullscreen,
body.dark-mode #timeOfDayWheelBox:-webkit-full-screen {
  background: #111;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel-heading,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-heading {
  width: min(92vw, 900px);
  margin-bottom: 8px;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel-wrap,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-wrap {
  width: min(78vw, 78vh, 820px);
  max-width: none;
  padding-top: 28px;
  margin: 0 auto;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel {
  width: 100%;
  max-width: none;
}

#timeOfDayWheelBox:fullscreen .time-of-day-now-arrow,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-now-arrow {
  font-size: 34px;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel-note,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-note {
  font-size: 0.9em;
  margin-top: 6px;
}

/* Fallback for browsers that refuse the Fullscreen API on local file:// pages. */
#timeOfDayWheelBox.wheel-fullscreen-fallback {
  position: fixed;
  z-index: 100000;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: #f4f8ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

body.dark-mode #timeOfDayWheelBox.wheel-fullscreen-fallback { background: #111; }
body.wheel-fullscreen-fallback-open { overflow: hidden; }
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-heading { width: min(92vw, 900px); }
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-wrap { width: min(78vw, 78vh, 820px); max-width: none; padding-top: 28px; }
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel { width: 100%; max-width: none; }
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-now-arrow { font-size: 34px; }

/* =========================================================
   FULLSCREEN-ONLY CURRENT-DAY PERIOD LIST
   ========================================================= */

/* Normal Almanac view: keep the period list completely hidden. */
.time-of-day-period-list {
  display: none;
}

.time-of-day-fullscreen-layout {
  display: block;
}

.time-of-day-wheel-stage {
  display: block;
}

/* =========================================================
   TRUE FULLSCREEN + FALLBACK FULLSCREEN
   ========================================================= */

#timeOfDayWheelBox:fullscreen,
#timeOfDayWheelBox:-webkit-full-screen,
#timeOfDayWheelBox.wheel-fullscreen-fallback {
  box-sizing: border-box;
  width: 100vw;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: 24px 32px;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* Header spans the fullscreen width. */
#timeOfDayWheelBox:fullscreen .time-of-day-wheel-heading,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-heading,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-heading {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto 12px;
  flex: 0 0 auto;
}

/* =========================================================
   MAIN FULLSCREEN LAYOUT
   LEFT = PERIOD LIST
   RIGHT = WHEEL
   ========================================================= */

#timeOfDayWheelBox:fullscreen .time-of-day-fullscreen-layout,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-fullscreen-layout,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-fullscreen-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: clamp(30px, 5vw, 90px);
  width: 100%;
  max-width: 1500px;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  align-items: center;
}

/* =========================================================
   LEFT PERIOD LIST
   ========================================================= */

#timeOfDayWheelBox:fullscreen .time-of-day-period-list,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-period-list,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-period-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid rgba(127, 127, 127, 0.38);
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.08);
  text-align: left;
  align-self: center;
}

.time-of-day-period-list-heading {
  flex: 0 0 auto;
  margin: 0 0 5px;
  padding: 2px 6px 10px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.35);
  font-size: 1.05rem;
  font-weight: 800;
}

.time-of-day-period-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 0.82rem;
  line-height: 1.15;
}

.time-of-day-period-row.is-current {
  background: rgba(127, 127, 127, 0.22);
  font-weight: 800;
  outline: 1px solid currentColor;
  outline-offset: -1px;
}

.time-of-day-period-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.time-of-day-period-name {
  min-width: 0;
}

.time-of-day-period-range {
  white-space: nowrap;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   RIGHT WHEEL AREA
   ========================================================= */

#timeOfDayWheelBox:fullscreen .time-of-day-wheel-stage,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-stage,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

/* Size mainly from viewport height so the list cannot push the wheel downward. */
#timeOfDayWheelBox:fullscreen .time-of-day-wheel-wrap,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-wrap,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-wrap {
  width: min(72vh, 720px);
  max-width: 100%;
  margin: 0 auto;
  padding-top: 32px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0 auto;
}

#timeOfDayWheelBox:fullscreen .time-of-day-now-arrow,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-now-arrow,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-now-arrow {
  font-size: 34px;
}

#timeOfDayWheelBox:fullscreen .time-of-day-wheel-note,
#timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-note,
#timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-note {
  margin-top: 6px;
  font-size: 0.9em;
  flex: 0 0 auto;
}

/* =========================================================
   DARK MODE
   ========================================================= */

body.dark-mode #timeOfDayWheelBox:fullscreen,
body.dark-mode #timeOfDayWheelBox:-webkit-full-screen,
body.dark-mode #timeOfDayWheelBox.wheel-fullscreen-fallback {
  background: #111;
}

/* =========================================================
   SMALLER SCREENS
   ========================================================= */

@media (max-width: 1000px) {
  #timeOfDayWheelBox:fullscreen .time-of-day-fullscreen-layout,
  #timeOfDayWheelBox:-webkit-full-screen .time-of-day-fullscreen-layout,
  #timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-fullscreen-layout {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 22px;
  }

  #timeOfDayWheelBox:fullscreen .time-of-day-wheel-wrap,
  #timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-wrap,
  #timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-wrap {
    width: min(65vh, 600px);
  }

  .time-of-day-period-row {
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 7px;
  }

  .time-of-day-period-range {
    grid-column: 2;
    font-size: 0.76rem;
  }
}

/* Very narrow fullscreen windows: keep the period panel on the left. */
@media (max-width: 720px) {
  #timeOfDayWheelBox:fullscreen,
  #timeOfDayWheelBox:-webkit-full-screen,
  #timeOfDayWheelBox.wheel-fullscreen-fallback {
    padding: 14px;
  }

  #timeOfDayWheelBox:fullscreen .time-of-day-fullscreen-layout,
  #timeOfDayWheelBox:-webkit-full-screen .time-of-day-fullscreen-layout,
  #timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-fullscreen-layout {
    grid-template-columns: minmax(180px, 36vw) minmax(0, 1fr);
    gap: 12px;
  }

  #timeOfDayWheelBox:fullscreen .time-of-day-period-list,
  #timeOfDayWheelBox:-webkit-full-screen .time-of-day-period-list,
  #timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-period-list {
    padding: 8px;
  }

  .time-of-day-period-row {
    font-size: 0.72rem;
    padding: 4px;
  }

  .time-of-day-period-list-heading {
    font-size: 0.88rem;
  }

  #timeOfDayWheelBox:fullscreen .time-of-day-wheel-wrap,
  #timeOfDayWheelBox:-webkit-full-screen .time-of-day-wheel-wrap,
  #timeOfDayWheelBox.wheel-fullscreen-fallback .time-of-day-wheel-wrap {
    width: min(58vh, 58vw);
  }
}

/* =========================================================
   FULLSCREEN WHEEL GALLERY (fullscreen only)
   ========================================================= */
.wheel-gallery-page:not(.time-of-day-fullscreen-layout),
.wheel-gallery-chrome { display: none; }

#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-page { display: none; }
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-page.is-active { display: grid; }
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-chrome {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
  width: min(100%, 1500px);
  margin: 10px auto 0;
  flex: 0 0 auto;
  z-index: 20;
}
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-arrow {
  width: 44px; height: 36px; border-radius: 999px;
  border: 1px solid rgba(127,127,127,.55); background: rgba(127,127,127,.10);
  color: inherit; font: 800 28px/1 Arial, sans-serif; cursor: pointer;
}
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-arrow:hover,
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-arrow:focus-visible { background: rgba(127,127,127,.24); }
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-prev { justify-self: start; }
#timeOfDayWheelBox.wheel-gallery-open .wheel-gallery-next { justify-self: end; }
.wheel-gallery-position { text-align: center; line-height: 1.15; }
.wheel-gallery-position strong { display: block; font-size: .88rem; }
.wheel-gallery-position span { display: block; margin-top: 3px; font-size: .72rem; letter-spacing: .25em; opacity: .65; }

/* Hide the normal Time-of-Day heading only while viewing another fullscreen page. */
#timeOfDayWheelBox.wheel-gallery-open[data-gallery-page="1"] > .time-of-day-wheel-heading,
#timeOfDayWheelBox.wheel-gallery-open[data-gallery-page="2"] > .time-of-day-wheel-heading { visibility: hidden; }

/* Season page */
#timeOfDayWheelBox.wheel-gallery-open .season-wheel-page {
  grid-template-columns: 1fr;
  width: 100%; max-width: 1500px; flex: 1 1 auto; min-height: 0; margin: 0 auto;
}
.season-wheel-layout {
  display: grid; grid-template-columns: minmax(300px,380px) minmax(0,1fr);
  gap: clamp(30px,5vw,90px); align-items: center; min-height: 0;
}
.season-period-list {
  max-height: calc(100vh - 160px); overflow: auto; padding: 14px 16px;
  border: 1px solid rgba(127,127,127,.38); border-radius: 12px;
  background: rgba(127,127,127,.08); text-align: left;
}
.season-period-row {
  display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 10px;
  align-items: center; padding: 10px 6px; border-radius: 8px; font-size: .8rem;
}
.season-period-row.is-current { background: rgba(127,127,127,.22); outline: 1px solid currentColor; outline-offset: -1px; }
.season-period-swatch { width: 10px; height: 10px; border-radius: 50%; }
.season-period-row small { display:block; opacity:.7; margin-top:2px; }
.season-period-dates { text-align:right; font-variant-numeric:tabular-nums; opacity:.78; white-space:nowrap; }
.season-wheel-stage { display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:0; min-height:0; }
.season-wheel-wrap { position:relative; width:min(72vh,720px); max-width:100%; padding-top:32px; }
.season-wheel { display:block; width:100%; height:auto; }
.season-now-arrow { position:absolute; z-index:3; top:0; left:50%; transform:translateX(-50%); font-size:34px; line-height:1; }
.season-wheel-current { font-size:17px; font-weight:800; fill:currentColor; }
.season-wheel-year { font-size:11px; font-weight:700; fill:currentColor; opacity:.8; }
.season-wheel-progress { font-size:8px; fill:currentColor; opacity:.72; }

/* Calendar page */
#timeOfDayWheelBox.wheel-gallery-open .daylight-calendar-page {
  width:100%; max-width:1500px; flex:1 1 auto; min-height:0; margin:0 auto;
}
.daylight-calendar-shell { display:flex; flex-direction:column; min-height:0; width:100%; }
.daylight-calendar-toolbar {
  display:grid; grid-template-columns:48px 1fr 48px; align-items:center; gap:12px;
  margin:0 0 8px; flex:0 0 auto;
}
.daylight-calendar-toolbar h3 { margin:0 0 2px; font-size:1.25rem; }
.daylight-calendar-toolbar > div > div { font-size:.78rem; opacity:.72; }
.daylight-calendar-toolbar button {
  border:1px solid rgba(127,127,127,.45); background:rgba(127,127,127,.10); color:inherit;
  border-radius:9px; height:38px; font-size:28px; cursor:pointer;
}
.daylight-calendar-weekdays, .daylight-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.daylight-calendar-weekdays { flex:0 0 auto; font-weight:800; font-size:.78rem; opacity:.72; }
.daylight-calendar-weekdays span { padding:5px; }
.daylight-calendar-grid {
  flex:1 1 auto; min-height:0; grid-auto-rows:minmax(56px,1fr);
  border-left:1px solid rgba(127,127,127,.35); border-top:1px solid rgba(127,127,127,.35);
}
.daylight-calendar-cell {
  position:relative; min-width:0; min-height:0; padding:5px;
  border-right:1px solid rgba(127,127,127,.35); border-bottom:1px solid rgba(127,127,127,.35);
  background:rgba(127,127,127,.035); overflow:hidden;
}
.daylight-calendar-cell.is-empty { background:rgba(127,127,127,.08); }
.daylight-calendar-cell.is-today { box-shadow:inset 0 0 0 2px currentColor; }
.daylight-calendar-date { position:relative; z-index:2; display:block; width:max-content; padding:1px 5px; border-radius:999px; background:rgba(0,0,0,.45); color:#fff; font-size:.78rem; font-weight:800; }
.daylight-calendar-gradient {
  position:absolute; left:5px; right:5px; bottom:7px; height:clamp(18px,4.2vh,36px);
  border-radius:5px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.28), 0 1px 3px rgba(0,0,0,.18);
}
.daylight-calendar-gradient::before, .daylight-calendar-gradient::after {
  position:absolute; bottom:100%; margin-bottom:2px; font-size:.48rem; opacity:.62; color:currentColor;
}
.daylight-calendar-gradient::before { content:"00"; left:0; }
.daylight-calendar-gradient::after { content:"24"; right:0; }
.daylight-calendar-legend {
  display:flex; flex-wrap:wrap; justify-content:center; gap:4px 9px; margin-top:7px; flex:0 0 auto;
  font-size:.62rem; max-height:40px; overflow:auto;
}
.daylight-calendar-legend span { display:inline-flex; align-items:center; gap:3px; }
.daylight-calendar-legend i { width:7px; height:7px; border-radius:2px; display:inline-block; }

@media (max-width: 900px) {
  .season-wheel-layout { grid-template-columns:minmax(210px,32vw) minmax(0,1fr); gap:16px; }
  .season-period-row { grid-template-columns:10px 1fr; }
  .season-period-dates { grid-column:2; text-align:left; white-space:normal; font-size:.7rem; }
  .season-wheel-wrap { width:min(62vh,58vw); }
  .daylight-calendar-grid { grid-auto-rows:minmax(48px,1fr); }
  .daylight-calendar-gradient { left:3px; right:3px; bottom:5px; }
}

/* ===== Eclipse ambience =====
   Keeps the existing sun-position background color underneath and adds a soft,
   uneven blood-red gradient only while a locally visible lunar eclipse is active. */
body {
  background-image: none;
}

body.lunar-eclipse-active {
  background-image:
    radial-gradient(circle at 18% 28%, rgb(150 0 12 / var(--lunar-eclipse-strength, 0.35)), transparent 42%),
    radial-gradient(circle at 82% 72%, rgb(92 0 8 / var(--lunar-eclipse-strength, 0.35)), transparent 48%),
    linear-gradient(135deg, rgb(110 0 8 / var(--lunar-eclipse-strength, 0.35)), rgb(30 0 0 / calc(var(--lunar-eclipse-strength, 0.35) * 0.55)));
  background-attachment: fixed;
}

.eclipse-countdown-row {
  position: relative;
}

.eclipse-countdown-row .label::before {
  content: "🌘 ";
}

/* ===== Active eclipse infobox =====
   Created dynamically at the top of the middle Real-Time Data column and
   removed completely as soon as no locally visible eclipse is active. */
.active-eclipse-box {
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.active-eclipse-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.active-eclipse-heading h3 {
  margin: 2px 0 0;
}

.active-eclipse-kicker {
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .12em;
  opacity: .76;
}

.active-eclipse-phase {
  max-width: 48%;
  padding: 5px 8px;
  border: 1px solid rgba(127,127,127,.42);
  border-radius: 999px;
  background: rgba(127,127,127,.10);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}

.eclipse-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
  margin: 10px 0;
}

.eclipse-summary-grid > div {
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(127,127,127,.09);
}

.eclipse-summary-grid span,
.eclipse-summary-grid strong {
  display: block;
}

.eclipse-summary-grid span {
  margin-bottom: 2px;
  font-size: .65rem;
  opacity: .68;
}

.eclipse-summary-grid strong {
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.eclipse-event-progress {
  width: 100%;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(127,127,127,.20);
}

.eclipse-event-progress > div {
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: .76;
  transition: width .8s linear;
}

.eclipse-event-progress-label {
  margin-top: 4px;
  font-size: .63rem;
  opacity: .62;
  text-align: right;
}

.eclipse-next-milestone {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin: 12px 0 7px;
  padding: 8px 9px;
  border: 1px solid rgba(127,127,127,.34);
  border-radius: 8px;
  background: rgba(127,127,127,.08);
  font-size: .74rem;
}

.eclipse-next-milestone strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.eclipse-milestones {
  display: grid;
  gap: 2px;
}

.eclipse-milestone {
  display: grid;
  grid-template-columns: 18px minmax(0,1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 5px 3px;
  border-radius: 6px;
  font-size: .7rem;
}

.eclipse-milestone time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.eclipse-milestone.is-past {
  opacity: .5;
}

.eclipse-milestone.is-next {
  background: rgba(127,127,127,.16);
  font-weight: 800;
}

.eclipse-milestone-status {
  text-align: center;
}

@media (max-width: 600px) {
  .active-eclipse-heading { display: block; }
  .active-eclipse-phase { max-width: none; width: fit-content; margin-top: 7px; text-align: left; }
  .eclipse-summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ===================== Annual Astronomical Almanac ===================== */
.annual-almanac-section {
  width: min(1380px, 100%);
  margin: 1.5em auto 2em;
}

.annual-almanac-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1em;
  flex-wrap: wrap;
  margin: 0 auto 1em;
  text-align: left;
}

.annual-almanac-heading h3 {
  margin: 0 0 .35em;
}

.annual-almanac-heading p {
  margin: 0;
  opacity: .78;
}

.annual-almanac-controls {
  display: flex;
  align-items: center;
  gap: .45em;
  flex-wrap: wrap;
}

.annual-almanac-controls button,
.annual-almanac-controls input,
#almanacMoonMonthSelect {
  font: inherit;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: rgba(127,127,127,.08);
  color: inherit;
  padding: .42em .65em;
}

.annual-almanac-controls button {
  cursor: pointer;
  font-weight: 700;
}

.annual-almanac-controls input {
  width: 7.2em;
  text-align: center;
}

.annual-almanac-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1em;
  align-items: start;
}

.annual-almanac-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 0;
  overflow: hidden;
}

.annual-almanac-wide {
  grid-column: 1 / -1;
}

.annual-almanac-card h3 {
  margin-top: 0;
}

.annual-almanac-card h4 {
  margin: 1.2em 0 .55em;
}

.almanac-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7em;
}

.almanac-metric-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1em;
}

.almanac-metric {
  padding: .8em;
  border: 1px solid rgba(127,127,127,.28);
  border-radius: 9px;
  background: rgba(127,127,127,.06);
  min-width: 0;
}

.almanac-metric-label {
  display: block;
  font-size: .78em;
  opacity: .68;
  margin-bottom: .28em;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.almanac-metric strong {
  display: block;
  font-size: 1.03em;
  overflow-wrap: anywhere;
}

.almanac-metric small {
  display: block;
  margin-top: .3em;
  opacity: .7;
  line-height: 1.3;
}

.almanac-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 7px;
}

.almanac-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88em;
  color: inherit;
}

.almanac-data-table th,
.almanac-data-table td {
  padding: .55em .65em;
  border-bottom: 1px solid rgba(127,127,127,.24);
  text-align: left;
  vertical-align: top;
}

.almanac-data-table th {
  font-size: .83em;
  text-transform: uppercase;
  letter-spacing: .03em;
  opacity: .72;
  white-space: nowrap;
}

.almanac-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.almanac-data-table tbody tr:nth-child(odd) {
  background: rgba(127,127,127,.035);
}

.almanac-note,
.annual-almanac-source-note {
  font-size: .82em !important;
  line-height: 1.45;
  opacity: .72;
}

.annual-almanac-source-note {
  text-align: center;
  margin: 1em auto 0;
}

.almanac-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1em;
}

.almanac-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
}

.almanac-card-head h3 {
  margin-bottom: 0;
}

.almanac-card-head label {
  font-size: .86em;
  font-weight: 700;
}

.moon-calendar-weekdays,
.moon-illumination-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .35em;
}

.moon-calendar-weekdays {
  margin: 1em 0 .35em;
  font-size: .76em;
  font-weight: 700;
  text-align: center;
  opacity: .68;
}

.moon-day {
  position: relative;
  min-height: 76px;
  border: 1px solid rgba(127,127,127,.24);
  border-radius: 8px;
  padding: .38em;
  background: rgba(127,127,127,.045);
  display: grid;
  grid-template-areas:
    "num pct"
    "emoji emoji";
  grid-template-columns: 1fr auto;
  align-items: center;
}

.moon-day.blank {
  visibility: hidden;
}

.moon-day-num {
  grid-area: num;
  align-self: start;
  font-weight: 700;
  font-size: .78em;
}

.moon-day-emoji {
  grid-area: emoji;
  font-size: 1.9em;
  text-align: center;
  line-height: 1;
}

.moon-day-pct {
  grid-area: pct;
  align-self: start;
  font-size: .72em;
  opacity: .7;
}

.almanac-details {
  margin-top: 1em;
  border-top: 1px solid rgba(127,127,127,.24);
  padding-top: .7em;
}

.almanac-details summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: .7em;
}

@media (max-width: 950px) {
  .annual-almanac-grid,
  .almanac-two-column {
    grid-template-columns: 1fr;
  }
  .annual-almanac-wide {
    grid-column: auto;
  }
  .almanac-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .annual-almanac-heading {
    align-items: stretch;
  }
  .annual-almanac-controls {
    width: 100%;
  }
  .annual-almanac-controls input {
    flex: 1;
    min-width: 5.5em;
  }
  .almanac-metric-grid,
  .almanac-metric-grid.compact {
    grid-template-columns: 1fr;
  }
  .moon-day {
    min-height: 62px;
    padding: .25em;
  }
  .moon-day-emoji {
    font-size: 1.45em;
  }
  .moon-day-pct {
    font-size: .62em;
  }
}
/* ===================== Current Moment qualitative summary ===================== */
.current-moment-card {
  --moment-accent: #d4a017;
  width: min(1300px, 100%);
  max-width: 1300px;
  box-sizing: border-box;
  margin: 1rem auto 0.35rem;
  padding: 18px 22px 19px;
  border-top: 5px solid var(--moment-accent);
  text-align: left;
}

.current-moment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.current-moment-kicker {
  margin-bottom: 5px;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.14em;
  opacity: 0.62;
}

.current-moment-headline {
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(1.25rem, 2.1vw, 1.85rem);
  line-height: 1.3;
  font-weight: 700;
}

.current-moment-icon {
  flex: 0 0 auto;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.12));
}

.current-moment-details {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.current-moment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 4px 9px;
  border: 1px solid rgba(0,0,0,0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.46);
  font-size: 0.84rem;
  line-height: 1.2;
}

body.dark-mode .current-moment-chip {
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.08);
}

@media (max-width: 720px) {
  .current-moment-card {
    padding: 15px 16px 16px;
  }

  .current-moment-heading {
    align-items: flex-start;
  }

  .current-moment-icon {
    font-size: 2rem;
  }

  .current-moment-details {
    gap: 6px;
  }

  .current-moment-chip {
    font-size: 0.78rem;
  }
}
