:root {
  --bg: #f7f7fb;
  
  --text: #111;
  --panel: #f7f7fb;
  
  --border: rgb(208, 217, 226);

  --tile-bg: antiquewhite;
  --hover_secondary: rgb(240, 225, 205);
  --tile-selected: rgb(255, 225, 185);
  --tile-text: #313131;
  --tile-border: silver;

  --correct: rgb(75, 201, 75);
  --hover_primary: rgb(65, 185, 65);
  --focus: rgb(208, 217, 226);
  --dlg-shadow: 0 0 16px 6px rgba(0, 0, 0, 0.20);
  --row-correct: rgb(41, 178, 236); /* blue */
  --col-correct: #E2B33C;  /* yellow */
  --both-correct: #8476ff; /* purple */
  --leaderboard-divider: rgba(0, 0, 0, 0.15);
  --leaderboard-input-bg: #f3f3f3;
  --leaderboard-input-text: #111111;
  --leaderboard-input-border: rgba(0, 0, 0, 0.2);

}

html.dark {
  --bg: #0f1115;
  --text: #f2f2f2;
  --panel: #151922;
  --border: rgba(255, 255, 255, 0.2);

  --tile-bg: #333a4e;
  --tile-selected: #2f3647;  /* lighter than #232836 */
  --hover_primary: rgb(75, 183, 75);
  --hover_secondary: #4f5974;
  --tile-text: #f2f2f2;
  --tile-border: rgba(255, 255, 255, 0.2);

  --focus: rgba(255, 255, 255, 0.08);
  --leaderboard-divider: rgba(255, 255, 255, 0.15);
  --leaderboard-input-bg: #1a2233;
  --leaderboard-input-text: #ffffff;
  --leaderboard-input-border: rgba(255, 255, 255, 0.2);
}

html.dark-preload {
  background: #0f1115;
  color: #f2f2f2;
}

html.dark-preload body {
  background: #0f1115;
}

body.hicontrast {
  --correct: #00d17a;
  --tile-bg: #fff7d6;
  --tile-border: #000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: 'Cabin', sans-serif;
}

/* Make the HTML hidden attribute always win */
[hidden] {
  display: none !important;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--border);
  height: 3.75rem;
  gap: 10px;
  background: var(--panel);
}

.flex-item {
  flex: 1;
  width: 33.33%;
}

.app-title {
  margin: 0;
  text-align: center;
  font-family: 'Orelega One', cursive;
  user-select: none;
  font-weight: bold;
}

#two-buttons,
#three-buttons {
  display: flex;
  gap: 0rem;
}

#three-buttons {
  justify-content: flex-end;
}

.btn {
  border: none;
  padding: 9px 10px;
  transition: 0.15s ease;
  background: transparent;
  cursor: pointer;
  height: 3.75rem;
  width: 3.75rem;
}

.btn:hover {
  background: var(--focus);
}

/* ---------- Intro ---------- */
#intro-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  user-select: none;
}

.intro {
  margin: 0 auto;
  display: flex;
  justify-content: center;
  padding: 14px 64px;
  border: none;
  border-radius: 30px;
}

#title {
  padding: 0;
  font-size: 46px;
  font-family: 'Orelega One', cursive;
}

.desc {
  
  font-weight: 400;
  font-size: 1.4rem;
  padding: 0;
  margin: 0.5rem 0;
}

#slogan-container {
  margin-bottom: 1.5rem;
}

.intro-btn {
  font-weight: 700;
  font-size: 20px;
  font-family: 'Cabin', sans-serif;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Intro buttons — white border in dark mode */
body.dark .intro-btn {
  border: none;
}

.intro-primary {
  background: var(--correct);
  color: white;
  border: none;
  transition: background-color 0.2s ease; /* smooth effect */
}
.intro-primary:hover {
  background: var(--hover_primary);
}

.intro-secondary {
  background: var(--tile-bg);
  color: var(--tile-text);
  transition: background-color 0.2s ease;
}
.intro-secondary:hover {
  background: var(--hover_secondary);
}

/* ---------- Game area ---------- */
.display-section {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  max-width: 500px;
  height: calc(100vh - 60px);
}

.board-module {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  padding-top: 10px;
}

.grid {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.puzzle-number {
  text-align: center;
  
  font-size: 1.2rem;
  margin-top: 10px;
  margin-bottom: -6px;
  opacity: 0.85;
}

.tile-module {
  border: 2px solid var(--tile-border);
  background: var(--tile-bg);
  color: var(--tile-text);
  width: 4.5rem;
  height: 4.5rem;
  
  font-size: 2.9rem;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  border-radius: 2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

/* ===== Clue numbers (top-left) ===== */
.tile-module::before {
  content: attr(data-clue);
  position: absolute;
  
  top: 3px;
  left: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
}

.tile-module[data-clue=""]::before {
  content: "";
}

.tile-module:hover {
  box-shadow: 0 0 10px 5px rgba(161, 155, 155, 0.30);
}

.tile-module.selected {
  transform: scale(1.03);
  box-shadow: 0 0 10px 5px rgba(161, 155, 155, 0.35);
  background: var(--tile-selected);
}

.tile-module.correct {
  background: var(--correct);
  border-color: var(--correct);
  color: white;
}

.tile-module.row-correct {
  background: var(--row-correct);
  border-color: var(--row-correct);
  color: white;
}

.tile-module.col-correct {
  background: var(--col-correct);
  border-color: var(--col-correct);
  color: white;
}

.tile-module.both-correct {
  background: var(--both-correct);
  border-color: var(--both-correct);
  color: white;
}

.status-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 10px 16px 20px;
  color: rgba(0, 0, 0, 0.6);
  padding-bottom: 2.5rem;
}

body.dark .status-bar {
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- Dialogs ---------- */
.dlg {
  width: 520px;
  max-width: calc(100vw - 24px);
  border: none;
  border-radius: 12px;
  font-family: 'Cabin', sans-serif;
  box-shadow: var(--dlg-shadow);
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

.dlg::backdrop {
  background: rgba(0,0,0,0.35);
}

.container {
  padding: 2.25rem;
  position: relative;
}

ul { padding-left: 18px; }

.close-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  position: absolute;
  top: 14px;
  right: 14px;
  user-select: none;
  cursor: pointer;
  font-size: 18px;
  border-radius: 8px;
}

.close-btn:hover {
  background: var(--focus);
}

.border {
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
}

a { color: inherit; }

/* ---------- Finish dialog ---------- */
.finish-dlg {
  width: 220px;
  border: none;
  border-radius: 12px;
  box-shadow: var(--dlg-shadow);
  text-align: center;
  font-family: 'Cabin', sans-serif;
  background: var(--panel);
  color: var(--text);
  padding: 10px 18px;
}

#textOne { font-size: 20px; margin: 10px 0 0; }
#textTwo { font-size: 16px; margin: 6px 0 10px; }

/* ---------- Settings ---------- */
.settings-module-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  gap: 10px;
}

.settings-module-text { padding-right: 8px; }
.settings-module-title { font-size: 20px; }
.settings-module-description { font-size: 14px; opacity: 0.7; }
.settings-module-info { opacity: 0.7; }

.settings-module-footnote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 0;
  opacity: 0.7;
  font-size: 14px;
}

/* Toggle switch */
.switch-module-container {
  height: 20px;
  width: 32px;
  background-color: rgba(133, 131, 131, 0.8);
  border-radius: 999px;
  display: block;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

.switch-module-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  transition: 0.25s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
}

.switch-module-container input:checked + .slider {
  background-color: #2196F3;
}

.switch-module-container input:checked + .slider:before {
  transform: translateX(12px);
}

/* ---------- Statistics ---------- */
.statistics-module {
  display: flex;
  justify-content: space-around;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.statistics-mod {
  
  padding: 1.25rem 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.stats { text-align: center; }
.num { font-size: 40px; }
.stats-text { opacity: 0.7; font-size: 14px; }

#share-btn, #puzzle-three-btn, #puzzle-four-btn {
  padding: 15px 35px;
  border: none;
  border-radius: 26px;
  background-color: var(--correct);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

#puzzle-three-btn {
  background-color: #4285f4;
  
}

#puzzle-four-btn {
  background-color: rgb(255, 78, 78);
}

.stat-header {
  margin: 1rem 0;
  margin-bottom: 0;
}

#stat-header-last {
  text-align: center;
}

#button-other {
  display: flex;
  justify-content: center;
  gap: 2rem;
  border-bottom: none;
  padding: 2.5rem 0;
}

.stat-btn:active { transform: scale(0.98); }
#button-s { border-bottom: none; }

/* ---------- Login ---------- */
#email-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 10px;
}

#email-header { margin: 6px 0; }

#email-input {
  padding: 11px 0;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.4);
  text-indent: 14px;
  font-size: 16px;
  background: transparent;
  color: inherit;
}

#email-btn {
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  background-color: black;
  color: white;
  cursor: pointer;
}

body.dark #email-btn {
  background: #f2f2f2;
  color: #111;
}

#brdr {
  width: 100%;
  text-align: center;
  border-bottom: 1px solid var(--border);
  line-height: 0.1em;
  margin: 18px 0;
}

#or-txt {
  background: var(--panel);
  padding: 0 10px;
}

.social-btn {
  font-size: 18px;
  padding: 10px 0;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.4);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  color: inherit;
}

body.dark .social-btn {
  border-color: rgba(255,255,255,0.25);
}

#social-links {
  margin-bottom: 12px;
  text-align: center;
  font-size: 14px;
  opacity: 0.9;
}

.email-img { padding-right: 6px; }

/* ---------- Side menu ---------- */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 22rem;
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 5px 5px 16px -4px rgba(0,0,0,0.35);
  transform: translateX(-110%);
  transition: transform 0.25s ease;
  padding: 16px 0;
  z-index: 50;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 1.5rem;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
  width: 34px;
  height: 34px;
}

.icon-btn:hover { background: var(--focus); }

.nav-menu-heading {
  font-weight: 600;
  margin: 0;
  padding: 0;
}

#nav-menu-brdr {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin: 16px 16px 16px;
}

.nav-btn {
  display: block;
  padding: 12px 16px;
  padding-left: 2rem;
  transition: 0.15s;
  color: inherit;
  width: 100%;
  background: transparent;
  border: none;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

.nav-btn:hover {
  background: var(--focus);
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 40;
}

/* ===== Wordle-style flip animation (left-to-right) ===== */

.tile-module {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

@keyframes tileFlipLR {
  0%   { transform: perspective(700px) rotateY(0deg); }
  49%  { transform: perspective(700px) rotateY(90deg); }
  51%  { transform: perspective(700px) rotateY(90deg); }
  100% { transform: perspective(700px) rotateY(0deg); }
}

/* apply to a tile to trigger the flip */
.tile-module.flip {
  animation: tileFlipLR 0.45s ease-in-out;
}
.status-bar .status-bar-text {
  font-size: 1.25rem;
}

body.dark .header .btn img { filter: invert(1); }

/* ===== Instructions example grids ===== */
.help-grid {
  display: grid;
  gap: 6px;
  margin: 1.2rem 0;
  
}

.help-row {
  display: grid;
  grid-template-columns: repeat(5, 2.5rem);
  gap: 6px;
}

.help-tile {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  font-family: 'Cabin', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  user-select: none;
}

.help-tile.correct {
  background: rgb(75, 201, 75);
  border-color: rgb(75, 201, 75);
  color: #fff;
}

.help-tile.yllw {
  background: #E2B33C;
  border-color: #E2B33C;
  color: #fff;
}

.help-tile.blue{
  background: #00A5E7;
  border-color: #00A5E7;
  color: #fff;
}

.help-tile.purple{
  background: #8476ff;
  border-color: #8476ff;
  color: #fff;
}

.help-tile.tbd {
  background: var(--panel);
  border-color: var(--border);
  color: rgba(0,0,0,0.85);
}

body.dark .help-tile.tbd {
  color: rgba(255,255,255,0.9);
}

.help-notes {
  
  margin: 1.5rem 0;
  padding-left: 18px;
}

.help-tip {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
#example-title {
  margin-top: 0
}
#instructions-dialog {
  height: 70vh;
}

.title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: -0.25rem;
}
.logo {
  margin-top: 4rem;
  height: 6.5rem;  /* similar scale to Wordle style */
  width: auto;
}
#title {
  font-size: 48px;
  margin: 0;
  margin-top: 0.6rem;
}
#slogan-one {
  margin-top: 0;
  text-align:center;
}

.icon-btn, .close-btn{
  color: var(--text);
}

#hints-dialog{
  height: 55vh;
}

.sign-up-container{
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.both-correct {
  background: var(--both-correct);
  border-color: var(--both-correct);
  color: white;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Make icon white */
.share-icon {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

/* Slide up animation */
@keyframes slideUp {
  from {
    transform: translateY(3rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Start dialog off-screen */
.dlg {
  transform: translateY(100%);
  opacity: 0;
}

/* When dialog opens */
.dlg[open] {
  animation: slideUp 0.15s ease-out forwards;
}

.swap-message {
  border-bottom: none;
  margin: 0.5rem 0;
}

.today-stats{
  display: flex;
  justify-content: space-around;
  gap: 1rem;
}

.num {
  font-size: 2rem;
}

#free-account {
  padding: 0.5rem 0;
}

.bullet-break {
  margin-bottom: 16px; /* adjust spacing as needed */
}

/* Invert any header-style icons used outside the header (e.g., in instructions) */
body.dark img.header-img {
  filter: invert(1);
}

#instructions-dialog .header-img {
  margin-left: 5px;
  margin-right: 5px;
}

.limelight-regular {
  font-family: "Limelight", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.stat-header-container {
  display: flex;
  justify-content: center;
}

#button-s2{
  border-bottom: 1px solid var(--border);
}

.help-notes {
  margin-top: 12px;
  padding-left: 20px;
}

.help-notes li {
  margin-bottom: 0.25rem;   /* Controls vertical spacing between items */
  line-height: 1.5;      /* Makes multi-line items more readable */
}

.google-only {
  background: white;
  color: #111;
  border: 1px solid rgba(0,0,0,0.15);
}

html.dark .google-only {
  background: #fff;
  color: #111;
}

/* Login (Google-only) */
#login-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-subtext {
  margin: 0;
  opacity: 0.8;
  line-height: 1.35;
}

.login-legal {
  margin: 0;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}

.google-only {
  background: white;
  color: #111;
  border: 1px solid rgba(0,0,0,0.15);
}

html.dark .google-only {
  background: #fff;
  color: #111;
}

.stat-login-btn {
  padding: 15.5px 22px;
  border-radius: 26px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  background: rgb(69, 116, 255);
  color: white;
  font-size: 15px;
  transition: transform 0.1s ease, opacity 0.2s ease;
}

.stat-login-btn:hover {
  opacity: 0.9;
}

.stat-login-btn:active {
  transform: scale(0.98);
}

.stats-synced {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.85;
}

#stats-synced-text, #instructions-synced-msg {
  margin-bottom: 1.35rem;
  margin-top: 0;
}

.stats-cta-text {
  font-size: 14px;
  opacity: 0.8;
  margin: 0 0 1.25rem 0;
}

#stats-login-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.instructions-login-cta {
  text-align: center;
}

#stats-logout-btn, #instructions-logout-btn {
  padding: 15px 44.5px;
}

.icon-button {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
}

#leaderboardList {
  text-align: left;
  margin-top: 15px;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  gap: 12px;
  font-weight: bold;
}

/* Make long names not break layout */
.leaderboard-entry span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

/* Top 3 emphasis (medal rows) */
.leaderboard-entry.lb-top1,
.leaderboard-entry.lb-top2,
.leaderboard-entry.lb-top3 {
  font-weight: 800;
}

/* Highlight the current user row */
.leaderboard-entry.lb-you {
  text-decoration: none;
  font-weight: 800;
}

/* -------------------------
   Leaderboard dialog sizing
   ------------------------- */
.leaderboard-container{
  /* Grow with content, but stop at same “tall dialog” size */
  max-height: 65vh;
  overflow: hidden; /* scrolling happens inside the list */
  display: flex;
  flex-direction: column;
}

.leaderboard-controls{
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  margin-bottom: 6px;
}

.leaderboard-toggle-btn{
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.leaderboard-toggle-btn:hover{
  background: var(--focus);
}

/* List scrolls once it gets tall */
.leaderboard-list{
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px; /* avoids scrollbar overlapping text */
}

/* -------------------------
   Leaderboard row alignment
   ------------------------- */
.leaderboard-entry{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  gap: 12px;
  border-left: 4px solid transparent;
  padding-left: 10px;
}

/* Keep left side from pushing right side */
.leaderboard-left{
  display: inline-flex;
  align-items: center;   /* vertically aligns medal, rank and name */
  gap: 4px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

/* Right side stays aligned and numbers line up */
.leaderboard-right{
  font-weight: 700; /* bold and bright */
  color: var(--text);
  opacity: 1;       /* ensure not dim */
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Make ALL numbers bold + bright */
.leaderboard-rank-num,
.leaderboard-num{
  font-weight: 800;
  color: var(--text);
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

/* Top 3 medal borders */
.leaderboard-entry.lb-top1 { border-left-color: #d4af37; }
.leaderboard-entry.lb-top2 { border-left-color: #c0c0c0; }
.leaderboard-entry.lb-top3 { border-left-color: #cd7f32; }

/* Current user highlight stays bold */
#leaderboard-date {
  margin: 0.75rem 0;
}

.leaderboard-date {
  margin-top: -6px;
  margin-bottom: 16px;
  font-weight: 500;
  opacity: 0.75;
}

/* ============================= */
/* Leaderboard Entry Section UI  */
/* ============================= */

.leaderboard-entry-section {
  text-align: center;
  margin: 10px auto 10px auto;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--leaderboard-divider);
  
}

.leaderboard-entry-title {
  
  margin-bottom: 1rem 0;
}

.leaderboard-input {
  max-width: 220px;
  width: 100%;
  padding: 16px 12px;
  border-radius: 26px;
  border: 1px solid var(--leaderboard-input-border);
  background: var(--leaderboard-input-bg);
  color: var(--leaderboard-input-text);
  
  font-size: 14px;
  margin: 1.5rem auto 1rem auto;  /* <-- centers it */
  display: block;            /* <-- required for auto margins */
  box-sizing: border-box;
}

.leaderboard-input:focus {
  outline: none;
  border-color: #4285f4;
}

.leaderboard-submit-btn {
  max-width: 220px;
  width: 100%;
  padding: 16px;
  border-radius: 26px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background-color: #af50f7;
  
  
  color: white;
  transition: background-color 0.2s ease;
  margin: 0 auto;      /* <-- centers it */
  display: block;      /* <-- required */
}

.leaderboard-submit-btn:hover {
  background-color: #a836ff;
  
}

.leaderboard-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.leaderboard-error {
  margin-top: 10px;
  color: #ff4d4d;
  font-size: 13px;
  min-height: 18px;
}

.leaderboard-input::placeholder {
  text-align: center;
}

.leaderboard-input {
  text-align: center;
}

/* Ensure rank numbers line up even when medals exist (fixed medal column) */
.leaderboard-medal{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2ch;
  padding-bottom:3px;
}

.leaderboard-rank-num{
  display: inline-block;
  width: 1.4ch;            /* aligns 1..100 nicely */
  text-align: right;
  font-weight: 800;
  color: var(--text);
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

/* ---------- Calendar reminder (instructions dialog) ---------- */

.reminder-actions {
  margin: 1.75rem 0 1rem;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.reminder-calendar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 15.5px 22px;
  border-radius: 26px;
  border: none;

  font-weight: 700;
  font-size: 15px;
  cursor: pointer;

  background: rgb(69, 116, 255);
  color: white;
  text-decoration: none;

  transition: transform 0.1s ease, opacity 0.2s ease;
}

.reminder-calendar-btn:hover {
  opacity: 0.9;
}

.reminder-subtext {
  margin: 10px 0 0;
  font-size: 14px;
  opacity: 0.75;
  text-align:center;
}

/* ---------- Intro footer (Privacy Policy) ---------- */
#intro-footer {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 5;
}

.intro-footer-link {
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  font-family: 'Cabin', sans-serif;
  font-size: 1rem;
  text-decoration: underline;
  color: rgba(0, 0, 0, 0.55);
}

 html.dark .intro-footer-link {
  color: rgba(255, 255, 255, 0.85);
}

.intro-footer-link:hover {
  opacity: 0.85;
}

/* ---------- Privacy policy body scroll ---------- */
.policy-body {
  max-height: 70vh;
  padding-right: 6px;
}

.policy-body h3 { margin-top: 1.25rem; }
.policy-body h4 { margin-top: 0.85rem; opacity: 0.95; }
.policy-body p, .policy-body li { line-height: 1.45; }

.footer-separator {
  font-size: 12px;
  opacity: 0.5;
  margin: 0 4px;
}

.ad-slot {
  max-width: 500px;
  margin: 8px auto 14px;
  padding: 0 10px;
}

.legal-link {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  color: inherit;
}

#intro-footer {
  position: absolute;
  bottom: 18px;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  font-family: 'Cabin', sans-serif;
  opacity: 0.75;
}

.intro-footer-links {
  margin-bottom: 0.5rem;
}

.intro-footer-link {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
}

.intro-footer-link:hover {
  text-decoration: underline;
}

.footer-separator {
  margin: 0 8px;
  opacity: 0.5;
}

.intro-copyright {
  font-size: 0.8rem;
  color: inherit;   /* Uses same colour as footer links */
}

#hints-rows li,
#hints-cols li {
  margin-left: 1rem;
}

@media (max-width: 449px) {
  #hints-rows li,
  #hints-cols li {
    display: grid;
    grid-template-columns: 1.5rem 1fr;
    column-gap: 0rem;
    align-items: start;
  }

  .hint-number {
    font-weight: 700;
    white-space: nowrap;
  }

  .hint-text {
    min-width: 0;
  }
}

/* Reduce success dialog heading on very small screens */
@media (max-width: 449px) {
  #success-dialog h1 {
    font-size: 1.5rem; /* adjust if needed */
  }
}

/* MEDIA QUERIES */
@media (max-width: 1100px) {
  .btn {
    width: 3rem;
    height: 3rem;
    padding: 8px 8px;
  }

  .app-title { font-size: 1.6rem; }
  .puzzle-number { font-size: 1.1rem; }
  .status-bar .status-bar-text { font-size: 1.1rem;}
  .header {
    height: 3rem;
  }

  #leaderboard-img{
    width: 16px;
    height: 16px;
  }

  .header-img {
    width: 18px;
    height: 18px;
  }

}

@media (max-width: 760px) {
    .btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 8px 8px;
  }

  .app-title { font-size: 1.4rem; }
  .puzzle-number { font-size: 1rem; }
  .status-bar .status-bar-text { font-size: 1rem;}
  

  #leaderboard-img{
    width: 15px;
    height: 15px;
  }

  .header-img {
    width: 16px;
    height: 16px;
  }

}

@media (max-width: 600px) {
  .app-title {
    display: none;
  }
  .tile-module {
    width: 4rem;
    height: 4rem;
    font-size: 2.7rem;
  }
  .tile-module::before {
    top: 3.5px;
    left: 3.5px;
    font-size: 0.6rem;
  }
  #button-other{
    flex-direction: column;
    gap: 1.5rem;
  }
  #slogan-one {
    font-size: 1.3rem;
  }

}

@media (max-width: 500px) {
  .dlg {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }

  .container {
    padding: 2.25rem;
  }

  #inst-btn {
    padding: 14px 48px;
  }

  #slogan-one {
    font-size: 1.2rem;
  }

}

@media (max-height: 750px) {
  #hints-dialog {
    height: 65vh;
  }
}

/* -------------------------
   Swap Frequency / Distribution charts (horizontal bars)
   ------------------------- */
.dist-chart{
  width: 100%;
  margin-top: 0.35rem;
}

.dist-row{
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
}

.dist-label{
  width: 2.6rem;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums; /* <-- keeps digits aligned */
}

.dist-bar-wrap{
  /* Width is set inline by JS (percent). Zero rows override to full width. */
  flex: 0 0 auto;
  height: 1.25rem;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 2px;
  overflow: hidden;

  display: flex;
  align-items: center;
  
}

/* Green fill (for non-zero rows) */
.dist-bar{
  height: 100%;
  width: 100%;
  background: var(--correct);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.4rem;
  font-weight: 700;
  color: #fff;
}

.dist-bar-wrap.zero{
  justify-content: center;  /* center the 0 inside the short stub */
}

.dist-zero{
  font-weight: 700;
}

.dist-zero { color: var(--text); }

/* A little tighter on very small screens */
@media (max-width: 380px){
  .dist-label{ width: 2.3rem; }
  .dist-bar{ font-size: 0.85rem; }
}

@media (max-width: 400px) {
  /* Only shrink tiles when playing 5x5 */
  #grid[data-size="5"] .tile-module {
    width: calc(4rem - 3px);
    height: calc(4rem - 3px);
    font-size: 2.4rem;
  }
}

/* Default layout (normal screens) */
.intro-copyright {
  text-align: center;
}

.intro-copyright .creator {
  display: inline;
}

/* Small screens */
@media (max-width: 450px) {
  #side-menu {
    width: 100vw;
  }
}

/* Small screens */
@media (max-width: 421px) {
  .intro-copyright .creator {
    display: block;
    margin-top: 0.45rem;
  }
}
