* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px;
  background-image: url("assets/background.png");
  background-repeat: no-repeat;
  background-position: center 60% !important;
  background-attachment: fixed;
  background-size: cover;
  overflow: hidden;
  transition: background 0.2s ease;
}

/* Utility hidden (used for Back button, timer, etc.) */
.hidden {
  display: none !important;
}

/* Initial Modal Styles */
.initial-modal {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.initial-modal-content {
  padding: 2rem 1rem;
}

.modal-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Enlarge & absolutely-center the logo ─── */
.modal-header .modal-logo {
  height: 100%;
  width: 43vw;
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-btn {
  transition: all 0.3s ease !important;
  transform: translateY(0);
}

.modal-btn:hover {
  transform: translateY(-2px);
  /* box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); */
}

.modal-btn small {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ------------------------------------------------------------------

------------------------------------------------------------------ */
.image-btn {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  display: inline-block;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-btn img {
  display: block;
  width: 48%;
  height: auto;
}

/* ─── Layout the two icons side-by-side ─── */
.icon-button-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28%;
  margin-top: 1rem;
}

/* ─── Icon-only buttons ─── */
.icon-btn {
  margin: 0 1rem;
  cursor: pointer;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
}

.icon-btn .settings-icon,
.icon-btn img /* catches the "?" if you use an <img> variant later */ {
  width: 4rem;
  height: 4rem;
  background: transparent !important;
}

/* ─── Strip all button chrome from icon-only buttons ─── */
.icon-btn,
.icon-btn:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
}

/* Main Game Container */
.main-container {
  width: 100%;
  height: 100%;
  padding: 1rem;
}

.home-icon,
.settings-icon {
  display: block;
  width: 4rem;
  height: 4rem;
  object-fit: contain;
}

@keyframes gameSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.level-info {
  font-size: 1.1rem; /* slightly smaller */
  background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
  padding: 10px 16px; /* reduced */
  border-radius: 10px; /* smaller */
  border: 1px solid #ddeeff;
  box-shadow: 0 2px 8px rgba(30, 144, 255, 0.1);
  display: flex;
  align-items: center;
  margin-right: 16px;
}

.level-info .label {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-right: 8px;
}

.level-info .number {
  display: inline-block;
  background: #ffffff;
  color: #000000;
  font-size: 1.15rem !important;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  min-width: 24px;
  text-align: center;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 10px; /* reduced from 15px */
  font-size: 0.9rem; /* slightly smaller */
}

.mode-toggle label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px; /* reduced */
}

.timer-display {
  background: #ff6b6b;
  color: white;
  padding: 6px 10px; /* reduced */
  border-radius: 6px; /* smaller */
  font-weight: 600;
  font-size: 0.9rem; /* smaller */
  animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.stats-container {
  margin: 15px 0; /* reduced from 20px */
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(130px, 1fr)
  ); /* slightly smaller min */
  gap: 10px; /* reduced from 15px */
}

.stat-card {
  background: linear-gradient(135deg, #f9f9f9, #f0f8ff);
  padding: 10px; /* reduced from 15px 12px */
  border-radius: 10px; /* smaller */
  text-align: center;
  border: 1px solid #e0e8f0;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.8rem; /* smaller */
  color: #666;
  margin-bottom: 4px; /* reduced */
}

.stat-value {
  font-size: 1.4rem; /* slightly smaller */
  font-weight: 700;
  color: #333;
}

@keyframes progressShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.game-content {
  width: 100%;
  height: 100%;
}

.game-section {
  flex: 0 0 auto !important;
  grid-column: 2;
  justify-self: center !important;
  margin: 1rem auto;
}

.grid-frame {
  position: relative;
  margin: 0 auto 15px;
  width: 550px;
  aspect-ratio: 848 / 916;
  background: url("assets/slotMachine.svg") no-repeat center center;
  background-size: contain;
}

.grid-frame .grid-container {
  position: absolute;
  inset: 0;
  display: block;
}

.grid-frame .grid {
  position: absolute;
  top: 20%;
  left: 14%;
  width: 68%;
  height: 64%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
}

.grid-frame .grid .tile {
  width: 100%;
  height: 100%;
}

.cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f0f8ff);
  border-radius: 10px; /* smaller */
  font-size: 1.6rem; /* reduced from 1.8rem */
  font-weight: 700;
  color: #222;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

.cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(30, 144, 255, 0.2);
  border-color: #1e90ff;
}

.cell.selected {
  background: linear-gradient(135deg, #90ee90, #98fb98);
  border-color: #32cd32;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(50, 205, 50, 0.3);
}

.cell.frozen {
  background: linear-gradient(135deg, #add8e6, #b8e6ff);
  border-color: #4682b4;
}

.cell .point {
  position: absolute;
  font-size: 0.9rem;
  color: #666;
  bottom: 2px; /* slight shift */
  right: 4px; /* slight shift */
  font-weight: 600;
  background: rgba(255, 255, 255, 0.8);
  padding: 1px 3px; /* smaller */
  border-radius: 4px;
  background: none;
  background-color: transparent;
  border-radius: 0;
  padding: 0;
  bottom: auto;
  top: 0rem; /* adjust up/down until it exactly hugs the corner */
  right: 0.4rem; /* same horizontal alignment as before */
  color: #000;
  font-weight: bold;
}

.current-word {
  text-align: center;
  margin-bottom: 10px; /* reduced from 15px */
  font-size: 1.2rem; /* slightly smaller */
  font-weight: 600;
  min-height: 28px; /* slightly reduced */
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.controls {
  display: flex;
  gap: 10px; /* reduced from 12px */
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px; /* reduced from 15px */
}

.btn {
  padding: 10px 16px; /* reduced from 12px 20px */
  font-size: 0.95rem; /* slightly smaller */
  border-radius: 8px; /* smaller */
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  transform: translateY(0);
  font-family: inherit;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, #1e90ff, #4169e1);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1c86ee, #3a5fcd);
}

.btn-success {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049, #3d8b40);
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6268, #495057);
}

.sidebar {
  grid-column: 3;
  justify-self: start;
  min-width: 280px; /* slightly smaller */
  background: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.sidebar .powerup-grid .btn-powerup .powerup-icon {
  width: 6rem !important; /* ≈96px */
  height: 6rem !important;
  display: block;
  margin: 0 auto 0.25rem;
}

.powerups h3,
.word-history h3 {
  margin-bottom: 12px; /* reduced from 15px */
  font-size: 1.1rem; /* slightly smaller */
  font-weight: 700;
  color: #333;
}

.powerup-grid {
  position: fixed;
  top: 16px; /* 16px down from top */
  bottom: 16px; /* 16px up from bottom */
  right: 16px; /* 16px in from right edge */
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8px; /* a little inner breathing room */
  background: transparent;
  z-index: 1000;
  gap: 32px; /* equal space between each power-up */
  margin-bottom: 20px; /* keep your bottom spacing */
}

.btn-powerup {
  font-size: 0.9rem; /* slightly smaller */
  border-radius: 8px; /* smaller */
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column; /* icon over label */
  align-items: center; /* center them */
  gap: 8px; /* small gap between icon & label */
  text-align: center;
  transition: all 0.3s ease;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
  position: relative;
}

.btn-powerup:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #1e90ff;
}

.btn-powerup:disabled {
  opacity: 1 !important; /* override the 0.6 fade in your disabled rule :contentReference[oaicite:0]{index=0} */
  cursor: not-allowed; /* keep the "disabled" cursor state */
}

.powerup-name {
  display: inline-block;
  background: #083a6f; /* deep-blue pill */
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
  line-height: 1;
}

.word-history {
  background: rgba(255, 255, 255, 0.8);
  padding: 12px; /* reduced from 15px */
  border-radius: 8px; /* smaller */
  border: 1px solid #dee2e6;
}

.history-list {
  max-height: 130px; /* slightly reduced */
  overflow-y: auto;
  background: #fff;
  padding: 10px; /* reduced from 12px */
  border-radius: 6px; /* smaller */
  border: 1px solid #e0e0e0;
  margin-bottom: 10px; /* reduced from 12px */
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.history-list ul {
  list-style: none;
}

.history-list li {
  margin-bottom: 4px; /* reduced from 6px */
  font-size: 0.9rem; /* slightly smaller */
  padding: 4px 6px; /* reduced */
  background: #f8f9fa;
  border-radius: 6px;
  font-weight: 500;
}

.history-stats {
  font-size: 0.9rem; /* slightly smaller */
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.notification {
  position: fixed;
  top: 16px; /* slightly up */
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: white;
  padding: 10px 20px; /* reduced */
  border-radius: 10px; /* smaller */
  z-index: 1000;
  font-weight: 600;
  font-size: 0.9rem; /* slightly smaller */
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  padding: 25px; /* reduced from 35px */
  border-radius: 14px; /* smaller */
  text-align: center;
  max-width: 400px; /* reduced */
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-content h2 {
  margin-bottom: 12px; /* reduced */
  font-size: 1.6rem; /* slightly smaller */
  color: #333;
}

.modal-content p {
  margin: 6px 0; /* reduced */
  font-size: 0.95rem; /* slightly smaller */
  color: #fff;
}

.modal-stats {
  background: rgba(30, 144, 255, 0.1);
  padding: 12px; /* reduced */
  border-radius: 8px; /* smaller */
  margin: 12px 0; /* reduced */
}

.modal-stats p {
  color: #333;
  font-weight: 600;
  margin: 4px 0; /* reduced */
}

.footer {
  text-align: center;
  padding-top: 15px; /* reduced */
  font-size: 0.85rem; /* smaller */
  color: #666;
  border-top: 1px solid #e0e0e0;
  margin-top: 15px; /* reduced */
}

.level-bar {
  position: relative;
  width: 100%;
  max-width: 577px; /* Figma spec */
  height: 48px; /* Figma spec */
  background: #0e4a93; /* base container blue */
  border-radius: 12px; /* full pill ends */
  box-shadow: inset 0 4px 0 #6699ff, /* top highlight */ inset 0 -4px 0 #083a6f; /* bottom shadow */
  display: flex;
  align-items: center;
  padding: 0 12px;
  box-sizing: border-box;
}

.track {
  position: relative;
  flex: 1;
  height: 24px; /* track height = half of container */
  background: #081c56; /* dark-navy track background */
  border-radius: 8px; /* pill ends for empty track */
  overflow: hidden;
  margin-right: 16px;
}

.fill {
  height: 100%;
  width: 0; /* JS will set this to `${pct}%` */
  background: linear-gradient(90deg, #febc0d 0%, #fd9009 100%);
  box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.2); /* yellow→orange fill */
  border-radius: 10px; /* only left end rounded as it grows */
  transition: width 0.5s ease;
}

.level-bar > .level-info {
  background: none; /* remove the gradient box */
  padding: 0; /* drop its internal padding */
  border: none; /* no border */
  box-shadow: none; /* no shadow */
  margin-right: 8px; /* snug it against the progress track */
}

.level-bar > .level-info .label {
  color: #ffffff; /* white text */
  font-size: 1rem; /* match your number's size if needed */
  margin-right: 4px; /* small gap before the number pill */
}

.level-bar .track {
  margin-right: 0; /* no gap—score is now inside */
  position: relative; /* for absolutely-positioning the text */
}

.level-bar .track .progress-text {
  position: absolute;
  right: 12px; /* adjust inset from the right edge */
  top: 50%;
  transform: translateY(-50%);
  background: none; /* no separate pill */
  padding: 0; /* drop the old padding */
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  border-radius: 0;
}

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

.level-bar > .level-info {
  /* strip out the old pill-background and gap */
  background: none;
  padding: 0;
  border: none;
  box-shadow: none;
  margin-right: 0; /* no gap before the track */
}

.level-bar > .level-info .label {
  /* keep your "Level" text styled however you like */
  color: #fff;
  margin-right: 8px; /* small gap to the number */
}

.level-bar > .level-info .number {
  /* square, sharp corners */
  width: 24px; /* same as the track height */
  height: 24px;
  padding: 2px 8px; /* let width/height drive size */
  border-radius: 0; /* no rounding */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff; /* white box */
  color: #000000; /* black text */
  font-size: 1rem; /* tweak to taste */
  font-weight: 700;
}

.level-bar .track {
  border-radius: 8px; /* was 16px, now subtler */
  overflow: hidden; /* keep fill clipped */
  margin-right: 16px; /* restore spacing before score */
}

.level-bar .track .fill {
  border-radius: 24px; /* straight on the left */
  transition: width 0.5s ease;
}

.level-bar .track {
  border-radius: 8px; /* same as fill's rounding */
  overflow: hidden; /* keep children clipped */
}

.level-bar .track .fill {
  /* sharp flush on the left, gentle on the right */
  border-radius: 10px;
}

.level-bar > .level-info .number {
  border-radius: 4px; /* small rounding, not a pill or sharp square */
}

.level-bar > .level-info {
  position: relative;
  z-index: 2; /* sit above the fill */
  margin-right: -12px; /* pull it 8px into the track */
}

.btn-powerup .powerup-name {
  display: inline-block;
  background: #083a6f; /* deep-blue pill */
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
  line-height: 1;
}

.current-word {
  background: none !important; /* kills the old gradient :contentReference[oaicite:0]{index=0} */
  padding: 0 !important; /* removes the inner spacing */
  border-radius: 0 !important;
  /* makes it square/flush */
}

.grid-frame .current-word {
  position: absolute;
  top: 85%;
  left: 14.3%; /* match your .grid's left */
  width: 68%; /* match your .grid's width */
  position: absolute;
  bottom: 15%; /* lifts it above the spin button, inside the front panel */
  left: 50%; /* center horizontally */
  transform: translateX(-50%);
  width: auto; /* shrink to content */
  margin: 0;
}

.grid-frame .current-word .remaining-spin {
  display: inline-flex; /* so contents center nicely */
  justify-content: center;
  align-items: center;
  background: #083a6f;
  border-radius: 8px;
  color: #fff;
  padding: 0.5rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 2rem;
  margin-right: 0.5rem;
  box-sizing: border-box;
}

.grid-frame .current-word .remaining-spin #spins-left {
  font-family: monospace, sans-serif;
  min-width: 5ch; /* "00:00" is 5 chars */
  text-align: center;
  display: inline-block;
}

.grid-frame .progress-container {
  position: absolute;
  top: 1%;
  left: 48.5%;
  transform: translateX(-50%);
  width: 70%;
  margin: 0;
}

.grid-frame .progress-container .level-bar {
  width: 100%;
  max-width: none;
  height: 2.8rem !important;
}

.btn-powerup small {
  position: absolute;
  top: 0.5rem;
  right: 0.3rem;
  color: #ff0000;
  font-size: 0.9rem;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
  opacity: 1;
}

/* ─────────────────────────────────────────────────
   Home & Settings buttons (stacked, inset from corner)
───────────────────────────────────────────────── */
#back-btn,
#settings-btn {
  position: absolute;
  left: 2rem; /* inset from the left edge */
  /* bottom: 2rem; */
  margin: 0;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1000;
}

/* Home button stays 16px from top */
#back-btn {
  top: 2rem;
}

/* Settings sits 16px below the Home button */
#settings-btn {
  bottom: 2rem;
}

/* spin-button: show only the image, remove default button chrome */
.spin-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.spin-button img {
  display: block;
  width: 120px; /* or max-width: 60px; */
  height: auto;
}

/* Re-order for Score Boost, Extra Spin, Freeze */
#booster-btn {
  order: -1;
}

#extra-spin-btn {
  order: 0;
}

#freeze-btn {
  order: 1;
}

/* Zero out any auto-margins on the buttons */
.powerup-grid .btn-powerup {
  margin: 0;
}

#grid,
.grid,
.cell {
  user-select: none; /* standard browsers */
  -webkit-user-select: none; /* Chrome, Safari */
  -ms-user-select: none; /* IE10+ */
}

.cell {
  -webkit-tap-highlight-color: transparent; /* Android/iOS tap flash */
}

.grid-frame .controls {
  position: absolute;
  bottom: -6%; /* just above the base of the machine */
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0; /* override the default spacing */
}

.slider-container {
  margin: 16px 0;
  text-align: left;
}

.slider-container label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1e90ff;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1e90ff;
  cursor: pointer;
}

/* ── SETTINGS MODAL CUSTOM STYLING ───────────────────────────────────────── */

/* card background, rounding, and "lip" shadow */
.settings-modal-content {
  background-color: #4076b7 !important;
  border-radius: 2rem;
  padding: 2rem;
  position: relative;
  box-shadow: 0 8px 0 #345e7f;
  max-width: 380px;
  width: 90%;
}

/* corner "×" close button */
.settings-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 3.25rem;
  height: 3.25rem;
  background-color: #e74c3c;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-close-btn img {
  width: 100%;
  height: 100%;
}

/* "SETTINGS" title */
.settings-title {
  margin: 0 0 1rem;
  font-size: 2.5rem;
  color: #ffffff;
  text-align: center;
  text-shadow: 2px 2px 6px #23496b;
}

/* each option row: icon + slider */
.settings-option {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

/* square icon background */
.settings-icon {
  width: 4rem;
  height: 4rem;
  background-color: #335c99;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  background: transparent !important;
  border-radius: 0 !important;
}

.settings-icon img {
  width: 100%;
  height: 100%;
}

/* base slider styling */
#settings-modal input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 1rem;
  border-radius: 0.5rem;
  background: #ddd; /* overwritten dynamically */
  outline: none;
  transition: background 0.3s ease;
}

/* slider thumb */
#settings-modal input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #335c99;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

#settings-modal input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #335c99;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

#settings-modal .settings-icon {
  background: transparent !important; /* no more blue box */
  border-radius: 0 !important; /* square corners */
}

/* 3. Disable the global .btn:hover transform/box-shadow on those two buttons */
#back-btn:hover,
#settings-btn:hover {
  transform: none !important;
  box-shadow: none !important;
}

#settings-btn .settings-icon {
  background-color: transparent !important;
  border-radius: 0 !important;
}

#settings-btn:hover {
  transform: none !important; /* disable the wide-button hover */
  box-shadow: none !important;
}

#settings-btn .settings-icon:hover {
  /* your desired icon-only hover, e.g.: */
  transform: scale(1.1);
}

#back-btn:hover {
  transform: none !important;
  box-shadow: none !important;
}

#back-btn .home-icon,
#settings-btn .settings-icon {
  width: 5rem;
  height: 5rem;
}

#back-btn .home-icon:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

#timer {
  display: none !important;
}

/* ── TILE BASE ── */
.grid-frame .grid .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;

  /* your new flat background, no gradient */
  background: #ffefc6;
  background-image: none;

  /* match your asset's corner radius & subtle shadow */
  border-radius: 10px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1),
    /* inner shadow at top */ 0 2px 6px rgba(0, 0, 0, 0.15); /* drop shadow */

  /* keep the same sizing/typography you had */
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* from your assets: */
.letter-e {
  color: #ec3c7b;
} /* pink */
.letter-x {
  color: #984cc2;
} /* purple */
.letter-j {
  color: #00afdf;
} /* sky-blue */
.letter-n {
  color: #57b834;
} /* green */

/* make the tile letters pop a little more */
.grid-frame .grid .cell .letter {
  font-size: 3.5rem; /* bump this up until it visually "fills" the tile */
  font-weight: 1000; /* extra-bold for maximum impact */
  line-height: 1; /* keeps it vertically centered */
  display: block; /* so the box-shadow shows evenly */
  line-height: 1;
}

/* ── COLUMN SHUFFLE KEYFRAMES ── */
@keyframes shuffle-down {
  0% {
    transform: translateY(-100%);
  }
  50% {
    transform: translateY(10%);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes shuffle-up {
  0% {
    transform: translateY(100%);
  }
  50% {
    transform: translateY(-10%);
  }
  100% {
    transform: translateY(0);
  }
}

/* when .animating is set, trigger per-column shuffles */
.grid-frame .grid.animating .cell {
  animation-duration: 0.6s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

/* 1st & 3rd columns: top→bottom */
.grid-frame .grid.animating .cell:nth-child(4n + 1),
.grid-frame .grid.animating .cell:nth-child(4n + 3) {
  animation-name: shuffle-down;
}

/* 2nd & 4th columns: bottom→top */
.grid-frame .grid.animating .cell:nth-child(4n + 2),
.grid-frame .grid.animating .cell:nth-child(4n + 4) {
  animation-name: shuffle-up;
}

@keyframes shuffle-down {
  0% {
    transform: translateY(-100%);
  }
  50% {
    transform: translateY(20%);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes shuffle-up {
  0% {
    transform: translateY(100%);
  }
  50% {
    transform: translateY(-20%);
  }
  100% {
    transform: translateY(0);
  }
}

/* trigger on spin */
.grid-frame .grid.animating .cell {
  animation-duration: 0.8s; /* slightly longer for smoothness */
  animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
  animation-fill-mode: both; /* hold final state */
  transform-origin: center center; /* rotate around center */
}

/* 1st & 3rd columns → down & rotate forward */
.grid-frame .grid.animating .cell:nth-child(4n + 1),
.grid-frame .grid.animating .cell:nth-child(4n + 3) {
  animation-name: shuffle-down;
}

/* 2nd & 4th columns → up & rotate backward */
.grid-frame .grid.animating .cell:nth-child(4n + 2),
.grid-frame .grid.animating .cell:nth-child(4n + 4) {
  animation-name: shuffle-up;
}

/* ── HOW TO PLAY MODAL CUSTOMIZATION ── */

/* Ensure our new modal sits above the initial screen */
#how-to-play-modal {
  z-index: 4000; /* above the initial-modal's 3000 */
}

/* Strip away the default "white-card" look */
#how-to-play-modal .how-to-play-content {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: none !important;
  position: relative !important;
  display: inline-block !important;
  width: auto !important;
}

/* Center the play_modal graphic, scale to viewport */
#how-to-play-modal .play-modal-image {
  display: block;
  max-width: 85vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  margin: auto;
}

/* Style the close (cross) button */
#how-to-play-modal .how-to-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 3rem;
  height: 3rem;
  z-index: 2;
  transform: translate(50%, -50%);
}

#how-to-play-modal .how-to-close-btn img {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── FLOAT HALF-OUTSIDE CLOSE BUTTON ── */
#how-to-play-modal .how-to-close-btn {
  /* anchor at the container's top-right */
  top: 12px;
  right: 12px;
  /* push half of its width to the right, and half its height upward */
  transform: translate(50%, -50%);
}

#settings-modal {
  z-index: 3500 !important;
}

/* ── GAME-OVER / LEVEL-COMPLETE MODAL ── */
#game-modal .game-over-content {
  position: relative;
  background: #3f6cb3; /* match your blue art */
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 480px;
  width: 90%;
  box-sizing: border-box;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
  text-align: center;
}

/* Title styling */
#game-modal #modal-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  margin-bottom: 24px;
}

/* Score pill */
#game-modal .modal-stats {
  display: inline-block;
  background: #0e4a93;
  padding: 12px 24px;
  border-radius: 12px;
  margin-bottom: 24px;
}

#game-modal .modal-stats p {
  margin: 0;
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
}

/* Close (X) button */
#close-game-modal-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  padding: 0;
  width: 2.75rem;
  height: 2.75rem;
  cursor: pointer;
  transform: translate(50%, -50%);
}

#close-game-modal-btn img {
  width: 100%;
  height: auto;
}

/* Continue / Retry action button */
#modal-btn.modal-action-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 auto;
  cursor: pointer;
  display: block;
}

#modal-btn.modal-action-btn img {
  max-width: 140px; /* down from 180px */
  width: 100%; /* keep responsive if you adjust container */
  height: auto;
}
#daily-challenges-btn.blurred {
  filter: blur(2px);
}

/* highlight any tile you’re clicking/dragging over */
.grid-frame .grid .cell.interacting {
  background: #99e7b1;
}

/* Reel overlay sits on top of your real grid during the spin */
.reel-overlay {
  z-index: 100; /* above the grid */
  pointer-events: none; /* so clicks pass through */
}

/* Make the overlay grid match your real grid’s layout exactly */
.reel-overlay {
  position: absolute;
  top: 20%;
  left: 14%;
  width: 68%;
  height: 64%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  overflow: hidden;
}

/* Each column’s “tube” */
.reel-col {
  grid-row: 1 / span 4; /* span all 4 rows */
  position: relative;
}

.reel-col-down {
  margin-top: -5rem;
}

/* The moving stack of letters */
.strip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.strip .cell {
  margin: 0;
  padding: 0;
  border: none;
}

.reel-overlay .cell .letter {
  display: block; /* same as .grid-frame .grid .cell .letter */
  font-size: 3.5rem; /* matches your in-grid letter size */
  line-height: 1; /* vertically centered */
}

/* ─── Make reel-overlay cells look exactly like real grid tiles ─── */
.reel-overlay .cell {
  /* match the flat cream background of your real tiles */
  background: #ffefc6; /* real grid tiles use this color */
  background-image: none; /* remove any gradient */
  /* same rounded corners + inset/drop shadow */
  border-radius: 1rem;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.15);
  /* preserve the same interaction look (even though pointer-events:none on the overlay) */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-frame .grid .cell.frozen {
  background: #add8e6;
  border: 2px solid #4682b4;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.grid-frame .grid {
  touch-action: none;
}
/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .main-container {
    padding: 1rem;
  }

  #back-btn,
  #settings-btn {
    position: absolute;
    left: 1rem;
    top: 1.5rem;
  }

  /* Settings sits 16px below the Home button */
  #settings-btn {
    bottom: 0;
    left: 87vw;
    width: 4rem;
    height: 4rem;
  }

  #back-btn .home-icon,
  #settings-btn .settings-icon {
    width: 3rem;
    height: 3rem;
  }

  .icon-btn .settings-icon,
  .icon-btn img {
    width: 3rem !important;
    height: 3rem !important;
  }

  .grid-frame {
    width: 420px;
    margin-top: 1rem;
    aspect-ratio: 700 / 900;
  }

  .level-bar {
    margin-top: 1vh;
  }

  .grid-frame .grid {
    width: 68%;
    height: 54%;
    top: 25%;
  }

  .grid-frame .grid .cell .letter {
    font-size: 2.5rem;
  }

  .grid-frame .current-word .remaining-spin {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    margin-top: -2.5rem;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-frame .controls {
    bottom: -1%;
  }

  .cell .point {
    font-size: 0.7rem;
  }

  .powerup-grid {
    top: auto;
    bottom: -0.4rem;
    left: 1rem;
    right: 1rem;
    flex-direction: row !important;
    justify-content: space-evenly !important;
    padding: 1rem 0 !important;
  }

  .sidebar .powerup-grid .btn-powerup .powerup-icon {
    width: 4.5rem !important; /* ≈64px */
    height: 4.5rem !important;
  }

  /* ─── Enlarge & absolutely-center the logo ─── */
  .modal-header .modal-logo {
    width: 75vw;
  }

  .image-btn img {
    width: 60%;
  }

  .reel-overlay {
    top: 26%;
    left: 15%;
    width: 67%;
    height: 54%;
    gap: 2px;
    padding: 2px;
  }

  .reel-overlay .cell .letter {
    font-size: 2.5rem;
  }

  .grid-frame {
    width: 90vw;
    max-width: 420px;
    margin-top: 0.5rem;
  }

  .btn-powerup small {
    top: 0.4rem;
    right: 0.15rem;
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  #back-btn .home-icon,
  #settings-btn .settings-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  #settings-btn {
    left: 85vw;
  }

  .icon-btn .settings-icon,
  .icon-btn img {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }

  .grid-frame {
    width: 380px;
    margin-top: 4rem;
  }

  .grid-frame .grid {
    width: 67%;
    height: 53%;
    top: 25%;
  }

  .grid-frame .grid .cell .letter {
    font-size: 2rem;
  }

  .reel-overlay {
    top: 25%;
    width: 67%;
    height: 53%;
  }

  .reel-overlay .cell .letter {
    font-size: 2rem;
  }

  .grid-frame .current-word .remaining-spin {
    padding: 0.5rem;
    font-size: 0.7rem;
    margin-top: -2.5rem;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .spin-button img {
    width: 6rem;
  }

  #how-to-play-modal .how-to-close-btn {
    width: 2rem;
    height: 2rem;
  }

  #how-to-play-modal .play-modal-image {
    max-width: 95vw;
    max-height: 95vh;
  }
  .reel-overlay {
    top: 26.5%;
    left: 15%;
    width: 66%;
    height: 50%;
    gap: 2px;
    padding: 2px;
  }

  .grid-frame {
    width: 90vw;
    max-width: 420px;
    /* margin-top: 3rem; */
    margin-top: 8rem;
  }
}
