:root {
  --bg:#fff;
  --ink-subtle:#dddddd;
  --accent:#000;

  /* MOBILE defaults */
  --scale: 1;
    --tile-w: calc(95px * var(--scale));
    --tile-h: calc(95px * var(--scale));
    --letter-gap: calc(-14px * var(--scale));
    --row-gap: calc(7px * var(--scale));
    --row-indent: 35px;

  --game-max: 650px;
  --game-side: 0px;

  --hint-accent: #ffff;
  --progress-offset: -10px;
}


/* DESKTOP overrides */
@media (min-width: 915px) {
  :root {
    --scale: 1;
    --tile-w: calc(95px * var(--scale));
    --tile-h: calc(95px * var(--scale));
    --letter-gap: calc(-14px * var(--scale));
    --row-gap: calc(7px * var(--scale));
    --row-indent: 35px;
  }
}


.logo {
  max-width: 300px;   /* tweak as needed */
  width: 100%;
  /*height: auto;*/
  margin: 0 auto 12px;
  display: block;
}

/* Base / shared layout */
html, body {
  /*height: 100%;*/
  margin: 0;
  background: var(--bg);
  padding-top: 7px;

  overscroll-behavior: auto;
  height: auto !important;
  min-height: 100%;
  overflow-y: auto !important;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system,  Arial;
  color: #fff;
  -webkit-overflow-scrolling: auto;
}

@media only screen and (max-width: 768px) {
   *, html, body, .row {
     
   }
}

#gameBoard {
  transform-origin: top left; /* anchor scaling to the top-left corner */
  margin-left: 0;
  margin-right: auto;         /* push everything to the left */
  display: flex;             /* ensure block flow layout */
  max-width: var(--game-max);
  width: 100%;
  position: relative;
  align-items: flex-start;
  justify-content: left;
}

#gameBoardInner {
  margin-left: 10;
  transform-origin: top center;
  transition: transform 0.0s ease;
  will-change: transform;
}

.container {
  max-width: var(--game-max);
  width: 100%;
  margin: 0 auto;
  position: relative; /* anchor positioned children inside */
  padding: 0 var(--game-side) 120px;
  text-align: left;
}


/* -------- Top bar: title (left) + gear (right) -------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0px;
  position: relative;
  height: 48px;
}

/* Each section takes equal horizontal space */
.topbar-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left and right content align inward */
.topbar-section.left {
  justify-content: flex-start;
}
.topbar-section.right {
  justify-content: flex-end;
}

/* Title link (left) */
.title-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.back-symbol {
  font-size: 30px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
}
.titlepage-text {
  font-size: 50px;
  font-weight: 700;
  color: #000;
}
.title-text {
  font-size: 25px;
  font-weight: 700;
  text-align: center;
  color: #000;
}
.title-link:hover .back-symbol,
.title-link:hover .title-text { opacity: .85; }

/* Gear button (right) */
.gear-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px;
  width: 45px;
  height: 45px;
  border:none;
  background:transparent;
  cursor:pointer;
  border-radius:10px;
  outline:none;
}
.gear-btn img{
  display:block;
  width:30px;
  height:30px;
}
.gear-btn:hover{ background: rgba(255,255,255,.08); }
.gear-btn:active{ background: rgba(255,255,255,.12); }
.gear-btn:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

/* Headings & text */
h1 { /* kept for index.html usage; puzzle title uses .title-text now */
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
}

.subtitle {
  margin: 0 0 -14px;
  font-size: 15px;
  font-weight: 400;
  color: #000;
}

h2 {
  margin: 0 0 20px;
  font-size: 12px;
  font-weight: 500;
  color: #000;
  text-transform: uppercase;
}

.phrase {
  font-size: 17px;
  font-weight: 900;
  margin: -20px 0 25px;
  color: #fff;
  background: #5b1371;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.phrase b { color: var(--accent); font-weight: 500; }

.subtitle,
h2,
.phrase {
  text-align: center;
}

.logo-subtitle {
  margin: 0 0 0px;
  font-size: 17px;
  font-weight: 500;
  color: var(--accent);
}

.archives-header {
  margin: 0 0 0px;
  font-size: 21px;
  font-weight: 500;
  color: var(--accent);
}

/* ===== Puzzle rows ===== */

/* Full-row guideline (repeating background) */
.word-row {
  margin: 0 0 var(--row-gap) 0;
  padding: 0;
  line-height: 0;
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto var(--tile-h);
  text-align: center;
}

.word-row {
  padding-left: var(--row-indent);
}

.letter-tile {
  width: var(--tile-w);
  height: var(--tile-h);
}

ul.word {
  gap: var(--letter-gap);
  margin-left: var(--row-indent);
}

.word-row {
  margin-bottom: var(--row-gap);
}

.row-badge {
  font-size: calc(22px * var(--scale));
  top: calc(var(--tile-h) / 2);
  width: calc(20px * var(--scale));
  height: calc(20px * var(--scale));
}

.row-badge-ep {
  color: #cccccc;            /* deep blue */
  font-size: calc(22px * var(--scale));
  top: calc(var(--tile-h) / 2);
  width: calc(20px * var(--scale));
  height: calc(20px * var(--scale));
}

/* UL that holds the letters (indented from the left) */
ul.word {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;                /* use flex, not inline-block */
  justify-content: left;
  align-items: left;
  gap: var(--letter-gap);
  flex-wrap: nowrap;            /* ⛔ prevent wrapping */
  margin-left: var(--row-indent);
}


/* LI letter tiles: allow “lift” during drag */
ul.word > li {
  flex: 0 0 auto;
  position: relative;
  margin: 0;
  padding: 0;
  overflow: visible;
  line-height: 0;
  background: transparent;
  transition: transform .08s ease, filter .08s ease;
}


/* Lifted state */
ul.word > li.lifted {
  transform: translateY(0px);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
  z-index: 10;
}

.letter-tile {
  display: block;
  width: var(--tile-w);
  height: var(--tile-h);
  background: transparent;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
}

/* Apply reddish tint overlay to 4th+ rows */
.letter-tile.fourth-row-tint {
  filter: invert(23%) sepia(100%) saturate(250%) hue-rotate(200deg) brightness(0.9) contrast(4.0);
  opacity: 0.9;
}

 /* Reuse the deep blue tint for special modal images */
  .tinted-bonus-img {
    filter: invert(23%) sepia(100%) saturate(250%) hue-rotate(200deg) brightness(1) contrast(4.0);
    opacity: 0.9;
  }


ul.word::after { content: ""; display: table; clear: both; }

/* Placeholder (jQuery.dragsort) — avoid odd default styles */
.placeHolder div {
  background-color: transparent !important;
  border: 1px dashed #888 !important;
}

/* --- Row number badge --- */
.row-wrap { 
  position: relative; 
}


/* size scales with your --scale var */
:root { --badge-size: calc(20px * var(--scale)); }

.row-badge{
  position: absolute;
  left: 5px;                          /* keep it inside the container padding */
  top: calc(var(--tile-h) / 2);       /* vertically center to the guideline */
  transform: translateY(-50%);
  width: var(--badge-size);
  height: var(--badge-size);
  border-radius: 999px;
  background: var(--bg);
  color: #000;   
  font-weight: 700;
  font-size: calc(20px * var(--scale));
  line-height: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;                         /* above the guideline */
  pointer-events: none;               /* never steals drag/tap */
}

@keyframes ftue-slideIn {
  0% {
    opacity: 0;
    transform: translateX(-60px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

#ftue-instructions {
  animation: ftue-slideIn 0.8s ease-out forwards;
}

.submit-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  height: 54px;
  padding: 0 28px;
  border-radius: 9999px;
  border: none;
  background: #000;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .4px;
  cursor: pointer;
  
  transition: transform .06s ease, box-shadow .12s ease, opacity .12s ease, background-color .12s ease, color .12s ease;
}
.submit-btn:hover   { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.2); }
.submit-btn:active  { transform: translateY(0);    box-shadow: 0 8px 18px rgba(0,0,0,.32); background:#ffffff; color:#1b1230; }
.submit-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* === NEW: feedback text above submit button === */
.submit-feedback{
  margin: 0px 0 6px;
  text-align: center;
  color: #fff;
  font-size: 17px;
  min-height: 1.2em; /* keeps space reserved even when empty */
  opacity: 0;
  transition: opacity .15s ease;
}
.submit-feedback.show { opacity: 1; }

/* === NEW: button shake animation === */
@keyframes btn-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
.submit-btn.shake { animation: btn-shake .35s ease; }

.checkmark-wrap {
  position: fixed;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 200; /* ✅ below modal backdrop */
}

.checkmark-icon {
  width: 28px;
  height: 28px;
}


/* === SUCCESS HEADLINE (“Well done!”) === */
.well-done{
  margin: -53px 0 10px;
  text-align: center;
  color: #008000;
  font-size: 25px; 
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-16px);
  animation: slide-in-left 2s ease forwards;
}

@keyframes slide-in-left{
  to{
    opacity: 1;
    transform: translateX(0);
  }
}

.submit-wrap {
  margin-top: 22px;
  display: flex;
  justify-content: center; /* horizontally center the button */
}

/* Make small feedback sit closer to the button (puzzle page only) */
.container:not(.landing) .submit-wrap{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px; /* exact spacing between feedback and button */
}
.submit-feedback{ margin: -10; }  /* gap now controls spacing */


/* ===== Landing page centering ===== */
.landing-shell{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.container.landing{
  text-align: center;
}
.credit{
  margin-top: 14px;
  color: #000;
  font-size: 14px;
}

.alphabet-btn {
  position: absolute;
  top: 8px;              /* aligns with gear’s natural baseline */
  right: 40px;           /* stays left of gear */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 200;
}

.alphabet-btn img {
  width: 100%;
  height: auto;          /* prevent squashing */
  aspect-ratio: 1 / 1;   /* force square proportion */
}


/* Modal */
.alphabet-modal {
  max-width: 160px;
  background: #2a1753;
  color: #fff;
  border-radius: 16px;
  padding: 10px;
  text-align: center;
}

.alphabet-modal h2 {
  margin-top: 0;
  font-size: 1.6em;
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 15px;
  justify-items: center;
}

.alphabet-grid img {
  width: 50px;
  height: auto;
  transition: transform 0.2s;
}

/* Generic modal overlay — hidden by default */
/* Dimmed backdrop behind modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55); /* semi-transparent black */
  /* the backstage disappears */
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.modal.open {
  display: flex;
}


/* The visible modal card */
.alphabet-modal {
  background: #ffffff; /* SOLID white card */
  border-radius: 16px;
  padding: 24px;
  width: 250px;
  max-width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  text-align: center;
}


/* Close button */
.alphabet-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 26px;
  color: #fff;
  cursor: pointer;
}



/* ===== Modal (Settings) ===== */
/* Settings modal — backdrop layer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55); /* Dark scrim like alphabet modal */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }

/* Settings modal — solid card */
.modal-panel {
  background: #ffffff; /* Solid white */
  color: #1b1230;      /* Dark text */
  border-radius: 16px;
  width: 250px;
  height: 500px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  position: relative;
}


.modal-title { margin: 0; font-size: 25px; font-weight: 700; text-align: center; color:#1b1230; }

.modal-close{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #1b1230;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover{ background: rgba(0,0,0,.06); }
.modal-close:active{ background: rgba(0,0,0,.1); }
.modal-close:focus-visible{ outline: 2px solid #1b1230; outline-offset: 2px; }

.modal-body  { margin-top: 14px; font-size: 16px; color: #1b1230; overflow: auto; }

/* Settings theming tweaks */
.setting-row label { color:#1b1230; }
.font-select-wrap { background:#fff; }
.font-select-wrap:focus { outline:2px solid #1b1230; outline-offset:2px; }
.font-select-wrap label { color: #000; }

/* === Archives (landing page) === */
.archive-section{
  text-align: center;
}

.archive-title{
  margin: 0 0 0px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

/* horizontally scrollable, snap-to-center strip */
.archive-strip{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 9px 33px;
  margin: -30 auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 calc(50% - 150px); /* helps centering cards */
  -webkit-overflow-scrolling: touch;
}

/* hide ugly scrollbars where possible */
.archive-strip::-webkit-scrollbar { height: 0; }
.archive-strip { scrollbar-width: none; }

.archive-item{
  flex: 0 0 auto;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* pill-style archive buttons */
.archive-btn{
  min-width: 150px;
  height: 74px;
  padding: 0 22px;
  border-radius: 22px;
  background: transparent;
  color: #000;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .4px;
  border: 3px solid rgba(0,0,0,.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 6px 18px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background-color .12s ease, color .12s ease, border-color .12s ease;
}
.archive-btn:hover   { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12); }
.archive-btn:active  { transform: translateY(0);    background: #ccc; color:#1b1230; border-color: #000; }
.archive-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* keep layout tidy on very small screens */
@media (max-width: 360px){
  .archive-btn{ min-width: 130px; height: 66px; font-size: 24px; }
}

.archive-btn.is-today {
  color: var(--accent);
  font-weight: 500;
  text-shadow: 0 0 6px rgba(255,255,255,0.25);
  border: 2px solid var(--accent);
  border-radius: 10px;
}


/* --- Allow vertical scrolling on the landing page only --- */
html.landing-html,
body.landing-page{
  max-width: var(--game-max);
  margin: 0 auto;
  padding: 0 var(--game-side) 120px;
  text-align: center;
}

/* Make the hero not consume the *entire* viewport height,
   so content below (Archives) is reachable immediately */
.landing-shell{
  min-height: 62vh;               /* was height:100% */
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Optional: a bit of breathing room before Archives */
.archive-section{
  margin-top: -60px;
}

/* Make the archive strip draggable with the mouse on desktop */
.archive-scroller { cursor: grab; }
.archive-scroller.dragging { cursor: grabbing; user-select: none; }

/* Make the archive strip feel draggable on desktop */
.archive-strip { cursor: grab; }
.archive-strip.dragging { cursor: grabbing; user-select: none; }

/* Bring Archives higher on small screens */
@media (max-width: 480px){
  .landing-shell{           /* was min-height: 62vh */
    min-height: 48vh;
  }
  .container.landing{       /* reduce bottom padding so Archives rises */
    padding-bottom: 40px;
  }
  .container.landing .submit-wrap{ /* less space under Play */
    margin-top: 18px;
  }
  .archive-section{         /* less top margin before Archives */
    margin-top: 12px;
  }
}

img.letter-tile.hinted-outline {
  outline: 3px solid #bd28eb;
  border-radius: 6px;
  display: inline-block; /* ensures the outline wraps around the image box */
  box-sizing: border-box; /* keeps outline outside image bounds */
}

.hint-btn{
  width:34px; height:34px; border:none;
  background:transparent; cursor:pointer;
  z-index: 1; /* layer is already high; this is within the layer */
  padding:0;
  transform: translateX(7px); 
}
.hint-btn img { width:20px; height:26px; display:block; }
.hint-btn:hover{ filter:brightness(1.05); }
.hint-btn:active{ filter:brightness(.97); }
.hint-btn:focus-visible{ outline:2px solid #fff; outline-offset:2px; }



/* Disable interactions on locked hints */
li.hint-locked {
  pointer-events: none;
  opacity: 0.95;
}

#progressText{
  position: relative;              /* allows light nudging with top if needed */
  top: 0;                          /* usually leave at 0; prefer margin via --progress-offset */
  margin: var(--progress-offset) 0 0px; /* vertical placement control */
  text-align: center;
  color: #cbaef5;            /* lavender tone to match brand */
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1.1;
  user-select: none;
}

/* helper class if you want JS to hide/show it */
#progressText.hidden{ display:none; }

.checkmark-icon {
  width:34px; height:34px; border:none;
}

/* === Musical notes animation === */
@keyframes note-rise {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-30px) scale(1.3); opacity: 0; }
}

.music-note {
  position: absolute;
  width: 30px;   /* tweak for size */
  height: 30px;
  pointer-events: none;
  animation: note-rise 1s linear forwards;
}

.back-arrow {
  display: block;
  width: 28px;        /* adjust to fit your layout */
  height: auto;
  transition: transform 0.15s ease;
}

.back-btn:hover .back-arrow {
  transform: translateX(-2px);
  opacity: 0.9;
}

.streak-strip {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #ff77ff;  
  background: #5b1371;      
  padding: 10px 0 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin: 12px 0 10px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 rgba(0,0,0,0.2);
}

#streakCount {
  color: #fff;                /* lighter pink highlight for the number */
  margin-left: 4px;
}

.music-confetti-container {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  pointer-events: none;
  z-index: 9999;
}

.music-confetti-note {
  position: absolute;
  bottom: 0;
  width: 28px;
  height: 28px;
  opacity: 0;
  animation-name: musicConfettiFly;
  animation-timing-function: cubic-bezier(0.25, 0.5, 0.5, 1);
  animation-fill-mode: forwards;
}

@keyframes musicConfettiFly {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  60% {
    transform: translateY(calc(-1 * var(--peak, 60vh))) rotate(540deg);
    opacity: 1;
  }
  100% {
    transform: translateY(0) rotate(720deg);
    opacity: 0;
  }
}

/* Continuous rotation for Mix Master winner image */
#mixMasterWinnerImg {
  animation: spin-slow 16s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Countdown timer styling */
#bonusCountdown {
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: #000;
  margin-top: 20px;
  letter-spacing: 0.5px;
  white-space: pre-line;
}

#solveTimeLine {
  text-align: center;
  color: #000;
  font-size: 15px;
  margin-top: 20px;   /* tweak this value freely */
  margin-bottom: 0;
}
