/* ===== Base Variables (Light Mode Defaults) ===== */
:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --header-bg: #e7e9ed;
  --header-text: #ffffff;
  --yellow-banner-bg: #ffff4d;
  --yellow-banner-text: red;
  --bluebox-bg: #7c97e8;
  --bluebox-border: blue;
  --infobar-bg: #c3e1f0;
  --infobar-text: #2b2b2b;
  --date-bg: #111311;
  --date-header-bg: #388e3c;
  --table-bg: #ffffff;
  --table-text: #000000;
  --table-alt-bg: #f9fcf9;
  --table-header-bg: #fff95d;
  --table-header-text: #222;
  --border-color: #b8b8b8;
}

/* ===== Dark Mode Variables (More Vibrant) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0d0d0d;
    --text-color: #f5f5f5;
    --header-bg: #1a1f2e; /* Deep navy */
    --header-text: #ffffff;

    --yellow-banner-bg: #ffd900; /* Strong golden yellow */
    --yellow-banner-text: #ff3030; /* Vivid warm red */

    --bluebox-bg: #2979ff; /* Bright blue */
    --bluebox-border: #004cff; /* Stronger blue border */

    --infobar-bg: #003c5f; /* Rich teal-blue */
    --infobar-text: #ffffff;

    --date-bg: #151515;
    --date-header-bg: #00b34a; /* Bright emerald green */

    --table-bg: #1c1c1c;
    --table-text: #f0f0f0;
    --table-alt-bg: #262626;

    --table-header-bg: #ffeb3b; /* Vibrant yellow */
    --table-header-text: #000000;

    --border-color: #666666;
  }
}

/* ===== Base Styles ===== */
body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: 'Open Sans', Arial, sans-serif;
  margin: 0;
  padding: 0;
}

html, body {
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ===== Logo Header ===== */
.logo-header {
  text-align: center;
  background: var(--header-bg);
  color: var(--header-text);
  font-style: italic;
  font-weight: bold;
  font-size: 1.5em;
  padding: 10px 0;
  border: 3px solid rgb(240, 240, 250);
  border-radius: 10px;
  margin: 5px auto;
  max-width: 480px;
}

.custom-logo-main {
  width: 80%;
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto 5px;
}

.logo-text {
  color: var(--header-text);
  font-weight: bold;
  font-size: 1.5em;
  margin: 0;
  padding: 0;
}

.subtext {
  color: var(--header-text);
  font-weight: 700;
  font-size: 14px;
  font-family: "Arial Black", Arial, sans-serif;
  margin-top: 4px;
}

/* ===== Yellow Banner (Scrolling) ===== */
.yellow-banner {
  background: var(--yellow-banner-bg);
  border: 3px double red;
  border-radius: 10px;
  margin: 5px 8px;
  padding: 6px 0;
  overflow: hidden;
  white-space: nowrap;
}

.scroll-text {
  display: inline-block;
  font-size: 1.3em;
  font-style: italic;
  color: var(--yellow-banner-text);
  font-weight: bold;
  padding-left: 100%;
  animation: scroll-left 8s linear infinite;
}

@keyframes scroll-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ===== Live Result Box ===== */
.bluebox {
  background: var(--bluebox-bg);
  color: #ffffff;
  text-align: center;
  font-size: 1.5em;
  font-weight: bold;
  padding: 10px 0;
  font-style: italic;
  border: 3px solid var(--bluebox-border);
  border-radius: 10px;
  margin: 5px 8px;
}

/* ===== Live Clock Styles ===== */
.live-clock {
  text-align: center;
  margin: 10px 8px;
  font-weight: bold;
  font-size: 1.2em;
  background: var(--date-header-bg);
  color: #fff;
  padding: 8px 0;
  border-radius: 10px;
}

#current-time {
  margin-bottom: 5px;
}

#countdown {
  font-size: 0.9em;
  font-style: italic;
}

/* ===== Info Bar ===== */
.infobar {
  background: var(--infobar-bg);
  color: var(--infobar-text);
  text-align: center;
  padding: 8px 0;
  font-size: 1.2em;
  font-weight: bold;
  border: 3px solid red;
  border-radius: 10px;
  margin: 5px 8px;
}

/* ===== Search Section Styles ===== */
.search-section {
  text-align: center;
  margin: 10px 8px;
}

#search-input {
  width: 90%;
  max-width: 330px;
  padding: 10px;
  font-size: 1em;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  background-color: var(--table-bg);
  color: var(--text-color);
}

/* ===== How-to-Play Section Styles ===== */
.info-section {
  margin: 10px 8px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.collapsible-button {
  background-color: var(--bluebox-bg);
  color: #fff;
  cursor: pointer;
  padding: 12px;
  width: 100%;
  border: 3px solid var(--bluebox-border);
  border-radius: 10px;
  text-align: center;
  outline: none;
  font-size: 1.2em;
  font-weight: bold;
}

.content {
  padding: 0 18px;
  background-color: var(--table-bg);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.content p, .content ul {
  color: var(--text-color);
}

/* ===== Results Table ===== */
.date-section {
  background: var(--date-bg);
  color: var(--text-color);
  margin-top: 13px;
  border-radius: 2px;
  box-shadow: 0 2px 6px #00000044;
  overflow: hidden;
  max-width: 350px;
  margin-left: auto;
  margin-right: auto;
}

.date-header {
  font-size: 1.3em;
  text-align: center;
  padding: 10px 0;
  margin: 0;
  background: var(--date-header-bg);
  color: #fff;
  font-weight: bold;
  letter-spacing: 1px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
  color: var(--table-text);
  font-size: 1.05em;
  margin-bottom: 7px;
}

.timerow th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-weight: bold;
  font-size: 1em;
  padding: 5px 0;
  border: 1px solid var(--border-color);
}

.number-row td {
  background: var(--table-bg);
  color: var(--table-text);
  font-size: 1.15em;
  font-weight: bold;
}

.digit-row td {
  background: var(--table-alt-bg);
  color: var(--table-text);
  font-size: 1em;
  font-weight: bold;
}

.result-table th,
.result-table td {
  border: 1px solid var(--border-color);
  padding: 8px 6px;
  text-align: center;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 480px) {
  .date-section {
    max-width: 100%;
  }
  .result-table {
    font-size: 0.85em;
  }
  .timerow th,
  .result-table td {
    padding: 4px 2px;
    font-size: 0.7em;
  }
  .number-row td {
    font-size: 0.9em;
  }
}

@media (max-width: 768px) {
  .custom-logo-main {
    width: 85%;
    max-width: 400px;
  }
  .yellow-banner,
  .bluebox,
  .infobar {
    font-size: 1em;
    padding: 6px;
    margin: 4px 6px;
  }
  .scroll-text {
    font-size: 1em;
  }
  .date-header {
    font-size: 1em;
    padding: 6px 0;
  }
  .result-table {
    font-size: 0.75em;
  }
  .timerow th,
  .result-table td {
    padding: 3px 2px;
    font-size: 0.75em;
  }
  .number-row td {
    font-size: 0.85em;
  }
  .digit-row td {
    font-size: 0.75em;
  }
}

@media (max-width: 420px) {
  .custom-logo-main {
    max-width: 280px;
  }
}

/* ===== Loading Logo ===== */
.loading-logo-container {
  text-align: center;
  margin: 10px 0;
}

.loading-logo {
  max-width: 150px;
  height: auto;
}

/* ===== New Result Highlight Animation ===== */
@keyframes fadeInHighlight {
  0% { background-color: transparent; }
  50% { background-color: var(--table-header-bg); } /* Use a CSS variable for the highlight color */
  100% { background-color: transparent; }
}

.new-result {
  animation: fadeInHighlight 3s ease-out;
}