:root {
  --bg:          #FAF7F5;
  --primary:     #7B1D2E;
  --primary-mid: #9B3545;
  --muted:       #9B7070;
  --line:        #D4B8B8;
  --border:      rgba(123, 29, 46, 0.13);
  --surface:     rgba(123, 29, 46, 0.06);
  --green:       #2e7d32;
  --green-bg:    rgba(46, 125, 50, 0.09);
  --red:         #c62828;
  --card-bg:     #ffffff;
  --key-bg:      #F0E4E1;
}

/* ─── DARK MODE ─────────────────────────────── */
[data-theme="dark"] {
  --bg:          #1c1010;
  --primary:     #e8908a;
  --primary-mid: #c47070;
  --muted:       #9a7070;
  --line:        #4a2828;
  --border:      rgba(232, 144, 138, 0.15);
  --surface:     rgba(232, 144, 138, 0.07);
  --green:       #4caf50;
  --green-bg:    rgba(76, 175, 80, 0.12);
  --red:         #ef5350;
  --card-bg:     #2a1515;
  --key-bg:      #3d2525;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--primary);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ─── INTRO SCREEN ──────────────────────────── */
#intro-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#intro-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

#intro-logo {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  object-fit: cover;
  mix-blend-mode: multiply;
  opacity: 0;
}

#intro-logo.playing {
  animation: introSpin 1.2s ease-in-out forwards;
}

@keyframes introSpin {
  0%   { transform: perspective(600px) rotateY(0deg) scale(0.85); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: perspective(600px) rotateY(360deg) scale(1); opacity: 1; }
}

/* ─── SPLASH ────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.splash-content {
  text-align: center;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

#splash-player-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  margin: 0 0 2px;
  display: none;
}

#splash-player-name.visible {
  display: block;
}

.splash-welcome {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--muted);
  margin-bottom: 12px;
}

.splash-brand {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 56px;
}

.splash-letters {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
}

.sl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  animation: letterPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.sl-static {
  opacity: 1;
  animation: none;
}

.sl:nth-child(1) { animation-delay: 0.1s; }
.sl:nth-child(2) { animation-delay: 0.2s; }
.sl:nth-child(3) { animation-delay: 0.3s; }
.sl:nth-child(4) { animation-delay: 0.4s; }
.sl:nth-child(5) { animation-delay: 0.5s; }

@keyframes letterPop {
  from { opacity: 0; transform: translateY(18px) scale(0.7); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

.sl-letter {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
}

.sl-num {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 500;
}

@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 4px 18px rgba(123, 29, 46, 0.38); }
  50%       { box-shadow: 0 6px 28px rgba(123, 29, 46, 0.58); }
}

#splashBtn {
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 50px;
  width: 220px;
  height: 54px;
  padding: 0;
  font-size: 0.9rem;
  box-shadow: 0 4px 18px rgba(123, 29, 46, 0.38);
  animation: pulse-btn 2.4s ease-in-out infinite;
  font-weight: 800;
  letter-spacing: 2.5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.15s, transform 0.1s;
}

#splashBtn:active { transform: scale(0.96); opacity: 0.85; }

.splash-modes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}

.splash-modes button {
  width: 220px;
  height: 54px;
  padding: 0;
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 13px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, transform 0.08s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.splash-modes button:active  { transform: scale(0.95); }
.splash-modes button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.splash-lb-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 16px;
  margin-top: 4px;
  touch-action: manipulation;
  letter-spacing: 0.3px;
  transition: opacity 0.1s;
}

.splash-lb-btn:active { opacity: 0.6; transform: none; }

#splash-resources {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* ─── TIMER ─────────────────────────────────── */
#timer-wrap {
  position: relative;
  height: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

#timer-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: rgba(46, 125, 50, 0.18);
  transition: width 0.9s linear, background 0.5s;
  transform-origin: left;
}

#timer-text {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--primary);
}

/* ─── APP LAYOUT ────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
}

#app.fade-in {
  animation: appFadeIn 0.35s ease;
}

@keyframes appFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── TOP NAV ───────────────────────────────── */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.nav-home-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
  touch-action: manipulation;
  flex-shrink: 0;
}

.nav-home-btn:active { background: var(--surface); }

#level-info {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 4px;
}

#lives {
  display: flex;
  gap: 2px;
  align-items: center;
}

#lives .heart {
  font-size: 0.9rem;
  transition: transform 0.2s, opacity 0.3s;
}

#lives .heart.lost {
  opacity: 0.2;
  transform: scale(0.75);
}

#wrongs {
  display: none;
}

#keys-display {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
}

/* ─── LEVEL PROGRESS BAR ────────────────────── */
#level-progress {
  height: 4px;
  background: var(--surface);
  flex-shrink: 0;
}

#level-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

#game-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.game-info-mid {
  display: flex;
  gap: 10px;
}

/* ─── GAME AREA ─────────────────────────────── */
.game-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#status {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  min-height: 26px;
  margin-bottom: 6px;
  transition: font-size .2s, color .2s;
  text-align: center;
}

@keyframes win-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1);    opacity: 1; }
}

#status.win {
  font-size: 1.25rem;
  animation: win-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#score-detail {
  margin-bottom: 14px;
  text-align: center;
}

.score-breakdown {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  background: var(--surface);
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 0.78rem;
  color: var(--primary-mid);
  font-weight: 600;
}

.score-breakdown strong {
  color: var(--primary);
  font-weight: 800;
}

/* ─── DAILY BADGE ───────────────────────────── */
#daily-badge {
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  min-height: 20px;
}

/* ─── NAME MODAL ────────────────────────────── */
#name-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.name-modal-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 36px 28px 32px;
  text-align: center;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  animation: settingsPop 0.22s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.name-modal-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.name-modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 8px;
}

.name-modal-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.name-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 50px;
  padding: 13px 20px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg);
  text-align: center;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.name-input:focus { border-color: var(--primary); }

.name-confirm-btn {
  width: 100%;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 50px;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.15s, transform 0.1s;
}

.name-confirm-btn:active { transform: scale(0.97); opacity: 0.88; }

/* ─── NAME MODAL TABS ───────────────────────────── */
.nm-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}
.nm-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  font-family: inherit;
}
.nm-tab.active {
  background: var(--primary);
  color: #fff;
}
.nm-input-gap { margin-top: 8px; }
.pin-display {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.35em;
  color: var(--primary);
  background: var(--bg);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 12px 0 16px;
  text-align: center;
}
.restore-error {
  color: var(--red);
  font-size: 0.78rem;
  text-align: center;
  margin-top: -4px;
  margin-bottom: 8px;
}

/* ─── PROFILE PANEL ──────────────────────────── */
.nm-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.nm-info-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.nm-info-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.nm-pin-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nm-pin-val {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 6px;
}

.nm-eye-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  line-height: 1;
}

.nm-eye-btn:hover { background: var(--surface); }

.nm-profile-actions {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.nm-outline-btn {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.nm-outline-btn:hover { background: var(--surface); }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}
.shake { animation: shake 0.35s ease; border-color: var(--red) !important; }

/* ─── TUTORIAL ──────────────────────────────── */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.tut-content {
  background: var(--bg);
  border-radius: 24px;
  padding: 36px 28px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.tut-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.tut-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 12px;
}

.tut-text {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.tut-demo {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tut-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
  padding: 6px 4px 2px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--primary);
}

.tut-cell.active-demo { border-color: var(--green); background: var(--green-bg); }
.tut-cell.solved-demo { border-color: var(--primary); background: var(--surface); }

.tut-num {
  font-size: 0.55rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.tut-hearts {
  font-size: 1.4rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.tut-keys-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.tut-arrow {
  font-size: 1.2rem;
  color: var(--muted);
}

.tut-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.tut-dots {
  display: flex;
  gap: 6px;
}

.tut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}

.tut-dot.active { background: var(--primary); }

#tutNextBtn {
  padding: 10px 22px;
  font-size: 0.82rem;
}

/* ─── COMBO TOAST ───────────────────────────── */
#combo-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: linear-gradient(135deg, #e65100, #f9a825);
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  padding: 8px 20px;
  border-radius: 50px;
  z-index: 350;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

#combo-toast.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ─── CELL REVEAL STAGGER ───────────────────── */
@keyframes cellReveal {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); background: var(--green-bg); }
  100% { transform: scale(1); }
}

.cell.just-revealed {
  animation: cellReveal 0.35s ease both;
}

/* ─── SPLASH STATS ─────────────────────────── */
#splash-stats {
  margin-top: 22px;
  display: flex;
  gap: 20px;
  justify-content: center;
}

.splash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.splash-stat-val {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary);
}

.splash-stat-lbl {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ─── LEVEL PREVIEW ─────────────────────────── */
#level-preview {
  position: fixed;
  inset: 0;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  animation: lpFadeIn 0.3s ease;
}

#level-preview.fade-out {
  animation: lpFadeOut 0.3s ease forwards;
}

@keyframes lpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes lpFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.lp-content {
  text-align: center;
  color: var(--bg);
}

.lp-num {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 3px;
  opacity: 0.75;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.lp-letters {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
}

/* ─── WORD COMPLETE ANIMATION ───────────────── */
.word.word-done {
  animation: wordPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wordPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ─── MOTIVATIONAL TOAST ────────────────────── */
#motivational-toast {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

#motivational-toast.show {
  opacity: 1;
}

#motivational-toast .mot-text {
  background: var(--primary);
  color: var(--bg);
  font-size: 1.6rem;
  font-weight: 900;
  padding: 22px 36px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  letter-spacing: 0.5px;
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#motivational-toast.show .mot-text {
  transform: scale(1);
}

/* ─── PUZZLE ────────────────────────────────── */
#puzzle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 16px 16px;
  width: 100%;
}

/* Each word is a group */
.word {
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

/* Each cell: letter + underline + number */
.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  padding: 8px 5px 2px;   /* zona klikuese vertikale e zgjeruar pa ndikuar pamjen */
  cursor: pointer;
  border-radius: 5px;
  border: 2px solid transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none; /* parandalon menunë e long-press në iOS */
  transition: border-color 0.12s, background 0.12s;
}

.cell.active {
  border-color: var(--primary);
  background: var(--surface);
}


.cell.wrong {
  animation: shake 0.38s ease;
  border-color: var(--red);
  background: rgba(198, 40, 40, 0.1);
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.cell-letter {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  height: 34px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  line-height: 1;
}

.cell-letter.auto-revealed {
}

.cell-locked::before {
  content: '🔒';
  font-size: 0.85rem;
  opacity: 0.45;
  line-height: 1;
}

.level-author {
  margin-top:    10px;
  margin-bottom: 4px;
  margin-right:  16px;
  font-size:     0.85rem;
  font-style:    italic;
  color:         var(--muted);
  text-align:    right;
  letter-spacing: 0.03em;
}

.cell-apostrophe {
  display:     inline-flex;
  align-items: flex-start;
  font-size:   1.1rem;
  font-weight: 800;
  color:       var(--muted);
  padding-top: 2px;
  align-self:  flex-start;
  user-select: none;
}

.cell-line {
  width: 100%;
  height: 2px;
  background: var(--line);
  margin: 4px 0 3px;
  border-radius: 1px;
  transition: background 0.15s;
}

.cell.active .cell-line      { background: var(--primary); }

.cell-num {
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.cell.solvedNum {
  cursor: default;
}


.cell.solvedNum .cell-num {
  visibility: hidden;
}

/* ─── BOTTOM PANEL ──────────────────────────── */
.bottom-panel {
  border-top: 1px solid var(--border);
  /* env(safe-area-inset-bottom): mbron home indicator-in e iPhone X+ */
  padding: 10px 12px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg);
  flex-shrink: 0;
}

.bottom-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#nextBtn, #retryBtn {
  min-width: 140px;
  padding: 13px 24px;
  font-size: 0.95rem;
}

#shareBtn, #homeBtn {
  padding: 11px 18px;
  font-size: 0.85rem;
}

#buyHintBtn, #hintBtn {
  flex: 1;
  padding: 13px 10px;
  font-size: 0.85rem;
}

/* ─── KEYBOARD ──────────────────────────────── */
#keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

#keyboard button {
  min-width: 30px;
  width: calc((100vw - 80px) / 10);
  max-width: 42px;
  min-height: 44px; /* Apple HIG minimum touch target */
  padding: 0 2px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--key-bg);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none; /* parandalon menunë e long-press në iOS */
  transition: transform 0.08s, background 0.1s, opacity 0.1s;
  font-family: inherit;
}

#keyboard button:active:not(:disabled) { transform: scale(0.86); }

#keyboard button.key-solved {
  background: transparent;
  border-color: transparent;
  color: var(--line);
  cursor: default;
}

#keyboard button.key-wrong {
  background: rgba(198, 40, 40, 0.07);
  border-color: rgba(198, 40, 40, 0.25);
  color: var(--red);
}

/* ─── SHARED BUTTONS ────────────────────────── */
button {
  padding: 10px 18px;
  border: none;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  letter-spacing: 0.5px;
  font-family: inherit;
  transition: transform 0.08s, opacity 0.1s;
}

button:active { transform: scale(0.95); }

#hintBtn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

#buyHintBtn {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--border);
}

#buyHintBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

#hintBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

#retryBtn {
  background: rgba(198, 40, 40, 0.08);
  color: var(--red);
  border: 1px solid rgba(198, 40, 40, 0.2);
}

#nextBtn {
  background: var(--primary);
  color: var(--bg);
  padding: 11px 26px;
}

/* ─── LEADERBOARD OVERLAY ───────────────────── */
#leaderboard-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  overflow-y: auto;
}

.lb-content {
  padding: 40px 28px;
  text-align: center;
  width: 100%;
  max-width: 420px;
}

.lb-sub {
  font-size: 0.68rem;
  letter-spacing: 3px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.lb-trophy {
  font-size: 3rem;
  margin-bottom: 6px;
}

.lb-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 24px;
}

.lb-section {
  margin-bottom: 24px;
  text-align: left;
}

.lb-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

#lbStreakList,
#lbLevelList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#lbStreakList li,
#lbLevelList li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

#lbStreakList li:last-child,
#lbLevelList li:last-child { border-bottom: none; }

.lb-rank {
  min-width: 26px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.lb-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.lb-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-mid);
}

#playAgainBtn {
  background: var(--primary);
  color: var(--bg);
  padding: 15px 44px;
  font-size: 0.82rem;
  letter-spacing: 2px;
}

/* ─── ACHIEVEMENT TOAST ─────────────────────── */
#ach-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-140px);
  background: var(--primary);
  color: var(--bg);
  border-radius: 16px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 300;
  min-width: 260px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

#ach-toast.show {
  transform: translateX(-50%) translateY(0);
}

#ach-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.ach-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#ach-name {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

#ach-desc {
  font-size: 0.72rem;
  opacity: 0.7;
  font-weight: 500;
}

/* ─── ICON BUTTON ───────────────────────────── */
.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  padding: 5px 7px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--primary);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background 0.12s;
  line-height: 1;
}

.icon-btn:active { background: var(--surface); }

#splash-topbar {
  position: absolute;
  top: 20px;
  left: 16px;
  display: flex;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

#splash-keys, #splash-lives {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.splash-hearts {
  display: flex;
  gap: 1px;
  font-size: 1rem;
  line-height: 1;
}

.splash-regen-timer {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.splash-settings-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.4rem;
  color: var(--primary);
  z-index: 110;
  min-width: 44px;
  min-height: 44px;
}

/* ─── SHARE & HOME BUTTONS ──────────────────── */
#shareBtn {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(46, 125, 50, 0.25);
}

#homeBtn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ─── SETTINGS POPUP ─────────────────────────── */
#settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: transparent;
}

.settings-content {
  position: absolute;
  top: 64px;
  right: 12px;
  width: 230px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 14px 16px 16px;
  animation: settingsPop 0.18s cubic-bezier(0.34,1.56,0.64,1) forwards;
  border: 1px solid var(--border);
}

@keyframes settingsPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.settings-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.3px;
}

.settings-close-x {
  background: none;
  border: none;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  touch-action: manipulation;
}

.settings-close-x:hover { background: var(--surface); }

/* ─── STATS OVERLAY ──────────────────────────── */
#stats-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  overflow-y: auto;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.stats-content {
  padding: 40px 28px;
  text-align: center;
  width: 100%;
  max-width: 420px;
}

.overlay-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 28px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}

.setting-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.setting-row select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237B1D2E' fill-opacity='.45'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 28px 8px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.1s;
}

.setting-row select:active { opacity: 0.8; }

[data-theme="dark"] .setting-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23e8908a' fill-opacity='.55'/%3E%3C/svg%3E");
}

#themeToggleBtn, .settings-toggle-btn {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 0.78rem;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.import-label {
  display: block;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: opacity 0.1s;
  letter-spacing: 0.5px;
}

.import-label:active { opacity: 0.7; }
.import-label input[type="file"] { display: none; }

/* ─── STATS GRID ────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.stat-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.stat-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* ─── LANG TOGGLE ───────────────────────────── */
.lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 10px;
  padding: 3px;
}

.lang-btn {
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  transition: background 0.18s, color 0.18s;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

.lang-btn:not(.active):hover {
  background: var(--border);
  color: var(--primary);
}

/* ─── MOBILE ────────────────────────────────── */

/* Telefonat e zakonshëm: iPhone 14 (390px), Samsung S23 (393px) etj. */
@media (max-width: 430px) {
  #keyboard button { min-height: 46px; }
}

/* Telefonat e vegjël: iPhone SE, telefona Android të vjetër */
@media (max-width: 380px) {
  .splash-title    { font-size: 2.2rem; }
  .cell            { width: 24px; }
  .cell-letter     { font-size: 1rem; height: 26px; }
  .cell-num        { font-size: 0.52rem; }
  #keyboard button { min-height: 40px; font-size: 0.78rem; }
  .top-stats       { gap: 8px; font-size: 0.8rem; }
}
