/* =========================================
   PINYIN GAME SPECIFIC STYLES
   ========================================= */

/* (Variables are now inherited from theme.css) */

/* =========================================
   1. BASE & LAYOUT
   ========================================= */
html {
  height: 100%;
  overflow: hidden; /* Strict scroll locking */
}

body {
  /* Margin/Dimensions handled in theme.css */
  display: flex;
  justify-content: center;
  align-items: center;

  /* Mobile Input Positioning Fixes */
  position: fixed;
  top: 0;
  left: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Generic Button Defaults (Specific to Pinyin's look) */
button {
  padding: 15px 40px;
  font-size: 1.5rem;
  background: var(--neon-pink);
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  box-shadow: 0 0 20px var(--neon-pink);
  transition: transform 0.2s;
}

button:not(.pause-btn):not(#pause-overlay button):not(.start-screen-btn):hover {
  transform: scale(1.1);
}

/* =========================================
   2. TOP UI LAYER (Score, Pause, Timer)
   ========================================= */
#ui-layer {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

#ui-layer > * {
  pointer-events: auto;
}

.score-box,
.timer-box {
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.score-box span,
.timer-box span {
  font-family: "Roboto Mono", monospace;
}

/* Round Icon Button (Pause) */
.icon-btn {
  background: transparent;
  border: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  font-family: "Roboto Mono", monospace;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-shadow: 0 4px 6px transparent;
  font-size: 1rem;
}
.icon-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
}
.icon-pause {
  letter-spacing: -1px;
  font-weight: 900;
}

/* =========================================
   3. STREAK BAR
   ========================================= */
#streak-wrapper {
  position: absolute;
  left: 50px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  z-index: 8;
}

#streak-container {
  width: 30px;
  height: 300px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 15px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  overflow: visible;
  position: relative;
  transition: border-color 0.3s ease;
}

#streak-inner {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background-color: #00000059;
  transition: background-color 0.3s;
}

#streak-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: white;
  transition: height 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    background 0.18s ease;
}

.multiplier-text {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  font-family: "Roboto Mono", monospace;
  margin-top: 5px;
}

#streak-count {
  font-family: "Roboto Mono", monospace;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: bold;
}

/* =========================================
   4. GAME AREA & TILES
   ========================================= */
#game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  z-index: 5;
  transform-style: preserve-3d;
  transition: transform 0.1s;
}

#tiles-wrapper {
  display: flex;
  gap: 15px;
  perspective: 800px;
}

.majong-tile {
  width: 100px;
  height: 130px;
  background: var(--tile-face);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Noto Sans SC", sans-serif;
  font-weight: 700;
  font-size: 4.5rem;
  color: #b00;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1), 1px 1px 0 #ccc, 2px 2px 0 #ccc,
    3px 3px 0 #ccc, 4px 4px 0 #ccc, 5px 5px 0 #ccc, 7px 7px 0 var(--felt-dark),
    12px 12px 20px rgba(0, 0, 0, 0.4);
  transform: rotateX(10deg);
  transition: transform 0.1s, opacity 0.3s;
  user-select: none;
}

/* Input Wrapper */
.input-wrapper {
  position: relative;
  width: 320px;
}

input#pinyin-input {
  width: 100%;
  padding: 15px;
  font-size: 1.5rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  color: white;
  font-family: "Roboto Mono", monospace;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

input#pinyin-input:focus {
  background: rgba(0, 0, 0, 0.7);
  border-color: var(--neon-gold);
  box-shadow: 0 0 15px var(--neon-gold);
}

/* Timer Bar (Bottom) */
#timer-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 15px;
  background: #1a1a1a;
  display: none;
}

#timer-bar {
  width: 100%;
  height: 100%;
  background: #006400;
  box-shadow: 0 0 10px #006400;
  transform-origin: left;
}

/* =========================================
   5. OVERLAYS (Start, Levels, Rules, About)
   ========================================= */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  pointer-events: auto;
}

/* Start Screen Styles */
#start-screen {
  /* Using theme variables for gradient */
  background: radial-gradient(
    circle at center,
    var(--felt-green),
    var(--felt-dark)
  );
  z-index: 2;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* Logo Animation */
.logo-wrapper {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
  justify-content: center;
}
.logo-tile {
  width: 80px;
  height: 110px;
  font-size: 3.5rem;
  transform: rotateX(10deg);
  animation: float 3s ease-in-out infinite;
  background: var(--tile-face);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Noto Sans SC", sans-serif;
  font-weight: 700;
  color: #b00;
  box-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 4px 4px 0 var(--felt-dark),
    10px 10px 20px rgba(0, 0, 0, 0.5);
}
.logo-tile:nth-child(2) {
  animation-delay: 1.5s;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotateX(10deg);
  }
  50% {
    transform: translateY(-10px) rotateX(10deg);
  }
}
.game-title {
  font-size: 1.5rem;
  letter-spacing: 8px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

/* Level Selection Grid */
.majong-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 10px 0 20px 0;
}
.majong-btn {
  width: 80px;
  height: 110px;
  background: var(--tile-face);
  border: none;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 3px 3px 0 #ccc,
    4px 4px 0 var(--felt-dark), 8px 8px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}
.majong-btn:active:not(.disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #ccc, 2px 2px 0 var(--felt-dark),
    inset 0 2px 5px rgba(0, 0, 0, 0.1);
}
.majong-btn:hover:not(.disabled) {
  filter: brightness(1.05);
}
.majong-btn.disabled {
  cursor: default;
  background: #e0e0e0;
  box-shadow: 1px 1px 0 #bbb, 2px 2px 0 #bbb, 3px 3px 0 #888;
}
.m-label {
  font-family: "Rubik", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--felt-green);
  text-transform: uppercase;
  margin-bottom: -5px;
}
.m-char {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--felt-green);
  line-height: 1;
}
.majong-btn.disabled .m-label,
.majong-btn.disabled .m-char {
  color: #999;
  opacity: 0.6;
}
.m-soon {
  position: absolute;
  bottom: 5px;
  font-size: 0.6rem;
  background: #666;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-family: sans-serif;
  letter-spacing: 1px;
}

/* Shared Modal/Overlay Content */
.tutorial-content {
  background: #1a1a1a;
  border: 2px solid var(--neon-gold);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  color: #eee;
}
.tutorial-content h2 {
  color: var(--neon-gold);
  margin-bottom: 20px;
  font-size: 2rem;
}
.tutorial-content h3 {
  color: var(--neon-blue);
  margin: 20px 0 10px;
  font-size: 1.2rem;
}
.tutorial-content p {
  color: #ccc;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 5px;
}
.close-x {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: #666;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}
.close-x:hover {
  color: white;
  transform: none;
}

/* Rules & About Specifics */
#rules-overlay,
#about-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 55;
  transition: opacity 0.3s;
}
#rules-overlay.hidden,
#about-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

/* About Text Alignment */
#about-overlay .tutorial-text {
  text-align: left;
  padding: 0 10px;
}
#about-overlay p {
  font-weight: 400;
  color: #e0e0e0;
  line-height: 1.6;
}

/* About Action Buttons */
.about-actions {
  display: flex;
  flex-direction: row;
  gap: 15px;
  width: 100%;
  margin-top: 20px;
}
.action-btn {
  flex: 1;
  padding: 10px 5px;
  border-radius: 8px;
  text-decoration: none;
  font-family: "Rubik", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  text-align: center;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  box-shadow: none;
}
.action-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}
.action-btn:active {
  transform: translateY(1px);
}
.action-btn.coffee {
  color: #ffd700;
  border-color: #ffd700;
}
.action-btn.coffee:hover {
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
}
.action-btn.feedback {
  color: #00f3ff;
  border-color: #00f3ff;
}
.action-btn.feedback:hover {
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.15);
}

/* Mockups for Help */
.mockup-container {
  background: radial-gradient(circle, var(--felt-green), var(--felt-dark));
  padding: 20px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.mockup-tiles-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.mockup-tile {
  width: 60px;
  height: 80px;
  background: var(--tile-face);
  color: #b00;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
  box-shadow: 2px 2px 0 #ccc, 4px 4px 0 rgba(0, 0, 0, 0.5);
  transform: rotateX(10deg);
}
.mockup-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--neon-gold);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-family: "Roboto Mono", monospace;
  font-size: 1.1rem;
}
.tone-grid {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0;
}
.tone-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
}
.tone-item span {
  color: var(--neon-pink);
  font-size: 1.2rem;
  margin-right: 5px;
}

/* =========================================
   6. PAUSE OVERLAY & BUTTONS
   ========================================= */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}
#pause-overlay.hidden {
  display: none;
}
.pause-menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* PAUSE BUTTON SPECIFICS */
/* By targeting #pause-overlay button, we stop the scale animation */
#pause-overlay button,
.pause-btn {
  /* Override the generic button animation */
  transform: none !important;
  transition: none !important;

  /* Flat, non-glowing look */
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5) !important;
  border: none;
  font-family: "Rubik", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 12px;
}

#pause-overlay button:hover,
.pause-btn:hover {
  /* Prevent growth */
  transform: none !important;
  filter: brightness(1.1); /* Subtle highlight only */
}

#pause-overlay button:active,
.pause-btn:active {
  /* Physical press down effect */
  box-shadow: none !important;
  transform: translateY(4px) !important;
}

/* Specific button colors in pause menu */
#pause-overlay #btn-resume {
  background: var(--neon-blue);
  color: #00444d;
  filter: brightness(0.9);
}
#pause-overlay #btn-exit {
  background: #ff4500;
  color: white;
  margin-top: 10px;
  filter: brightness(0.9);
}
/* Others (Sound, Help, Restart) inherit the generic pink or secondary gray 
   but get the flat button physics applied above. */

/* =========================================
   7. END SCREEN
   ========================================= */
#end-screen {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 2;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.end-header {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 10px;
}
.end-stats-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 10px;
}
.stat-badge {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.stat-label {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.stat-val {
  font-family: "Roboto Mono", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--neon-gold);
}

/* Results List */
.results-container {
  display: flex;
  gap: 15px;
  width: 90%;
  max-width: 600px;
  height: 50vh;
  margin-bottom: 15px;
}
.result-col {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.result-col h3 {
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 1rem;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.col-correct h3 {
  color: #00ff7f;
}
.col-missed h3 {
  color: #ff4500;
}
.word-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.word-list::-webkit-scrollbar {
  width: 6px;
}
.word-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.word-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 0.9rem;
}
.col-correct .word-item {
  border-left: 3px solid #00ff7f;
}
.col-missed .word-item {
  border-left: 3px solid #ff4500;
}
.ch {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 1.2rem;
  font-weight: bold;
}
.py {
  font-family: "Roboto Mono", monospace;
  opacity: 0.8;
}

/* =========================================
   8. MOBILE KEYBOARD & INPUT
   ========================================= */
.mobile-input-display,
.onscreen-keyboard {
  display: none;
}

@media (max-width: 800px) {
  body {
    align-items: flex-start;
  }
  h1 {
    font-size: 1.8rem;
  }

  /* Adjust header for mobile */
  #ui-layer {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  /* Streak vertical stack */
  #streak-wrapper {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    z-index: 20;
  }
  #streak-container {
    width: 100%;
    height: 16px;
    border-radius: 8px;
  }
  .multiplier-text {
    font-size: 1.2rem;
    width: auto;
    text-align: center;
    margin: 0;
    line-height: 1;
  }
  #streak-count {
    font-size: 0.9rem;
    line-height: 1;
  }

  /* Game Area Placement */
  #game-area {
    position: absolute;
    top: 75px;
    left: 0;
    width: 100%;
    height: calc(55% - 85px);
    margin: 0;
    padding: 0;
    justify-content: center;
  }
  #tiles-wrapper {
    margin-bottom: 5px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .majong-tile {
    width: 82px;
    height: 110px;
    font-size: 3.8rem;
    margin: 4px;
    box-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 3px 3px 0 var(--felt-dark);
  }
  .input-wrapper {
    width: 92%;
  }
  input#pinyin-input {
    display: none;
  }

  /* Mobile Display Box */
  .mobile-input-display {
    display: block;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 6px;
    border-radius: 8px;
    text-align: center;
    font-family: "Roboto Mono", monospace;
    font-size: 1.3rem;
    min-height: 1.5em;
    width: 100%;
    box-sizing: border-box;
  }

  #timer-container {
    position: fixed;
    bottom: 45%; /* Matches the keyboard height */
    left: 0;
    width: 100%;
    height: 12px; /* Thin bar */
    background: #111;
    z-index: 105; /* IMPORTANT: Must be higher than keyboard (100) */
    display: none; /* JS toggles this to block */
  }

  /* Keyboard */
  .onscreen-keyboard {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 45%;
    background: rgba(10, 20, 15, 0.98);
    padding: 4px;
    box-sizing: border-box;
    z-index: 100;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }
  .onscreen-keyboard .row {
    display: flex;
    width: 100%;
    flex: 1;
    gap: 4px;
    margin-bottom: 4px;
  }
  .onscreen-keyboard .key {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.05s ease;
    top: 0;
    -webkit-tap-highlight-color: transparent;
    /* Prevent shrinking */
    flex-shrink: 0;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      sans-serif;
  }

  /* Key Pressed State (via JS class) */
  .onscreen-keyboard .key.pressed {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    top: 5px;
    transform: scale(0.98);
  }
  .onscreen-keyboard .row.r0 .key.pressed {
    background: rgba(255, 215, 0, 0.3);
  }
  .onscreen-keyboard .key.special {
    background: rgba(255, 90, 120, 0.25);
    font-size: 1.1rem;
    flex: 1.5;
    min-width: 45px;
  }
  .onscreen-keyboard .key.special.pressed {
    background: rgba(255, 90, 120, 0.4);
  }
  .onscreen-keyboard .row.r0 .key {
    background: rgba(255, 215, 0, 0.15);
    color: var(--neon-gold);
  }
  .onscreen-keyboard .row.r0 .key:last-child {
    background: rgba(0, 243, 255, 0.2);
    color: var(--neon-blue);
    flex: 1.5;
    font-size: 1rem;
  }
  .onscreen-keyboard .row.r0 .key:last-child.pressed {
    background: rgba(0, 243, 255, 0.35);
  }

  /* Result container adjustments */
  .results-container {
    flex-direction: column;
    height: 55vh;
  }
  .stat-badge {
    min-width: 60px;
    padding: 5px 10px;
  }
  .stat-val {
    font-size: 1.1rem;
  }
  #end-screen button {
    margin-bottom: 20px;
    flex-shrink: 0;
  }
}

/* =========================================
   9. COMPACT MODE (iPhone SE, Mini)
   ========================================= */
@media screen and (max-height: 750px), screen and (max-width: 380px) {
  #game-area {
    top: 60px !important;
    height: calc(50% - 60px) !important;
    gap: 15px !important;
  }
  .majong-tile {
    width: 60px !important;
    height: 80px !important;
    font-size: 2.8rem !important;
    border-radius: 6px !important;
    box-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 3px 3px 0 var(--felt-dark) !important;
  }
  .mobile-input-display {
    padding: 4px !important;
    font-size: 1.1rem !important;
    min-height: 1.4em !important;
  }
  #timer-container {
    bottom: 42% !important; /* Matches the compact keyboard height */
  }
  .onscreen-keyboard {
    height: 42% !important;
    padding-bottom: 2px !important;
  }
  .onscreen-keyboard .key {
    border-radius: 4px !important;
    font-size: 1.2rem !important;
    margin-bottom: 2px !important;
  }
  #ui-layer {
    top: 5px !important;
    left: 10px !important;
    right: 10px !important;
  }
  .score-box,
  .timer-box {
    font-size: 1rem !important;
  }
  #streak-wrapper {
    top: 40px !important;
    transform: translateX(-50%) scale(0.8) !important;
  }
}

/* =========================================
   10. ANIMATIONS
   ========================================= */
.particle {
  position: absolute;
  pointer-events: none;
  z-index: 100;
}

@keyframes shake-error {
  0%,
  100% {
    transform: rotateX(10deg) translateX(0);
  }
  25% {
    transform: rotateX(10deg) translateX(-10px);
  }
  75% {
    transform: rotateX(10deg) translateX(10px);
  }
}
.shake-effect {
  animation: shake-error 0.4s ease-in-out;
  filter: grayscale(0.8);
}

@keyframes shatter {
  0% {
    transform: rotateX(10deg) scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  100% {
    transform: rotateX(-20deg) scale(0.8);
    opacity: 0;
    filter: brightness(0);
  }
}
.explode-effect {
  animation: shatter 0.2s forwards ease-out;
}

/* Progressive Shake Levels */
@keyframes shake-1 {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(1px, 1px);
  }
  75% {
    transform: translate(-1px, -1px);
  }
}
@keyframes shake-2 {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-2px, 1px);
  }
  75% {
    transform: translate(2px, -1px);
  }
}
@keyframes shake-3 {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(3px, -2px);
  }
  75% {
    transform: translate(-3px, 2px);
  }
}
@keyframes shake-4 {
  0% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-4px, -3px);
  }
  30% {
    transform: translate(4px, 3px);
  }
  50% {
    transform: translate(-4px, 3px);
  }
  70% {
    transform: translate(4px, -3px);
  }
  90% {
    transform: translate(-2px, 2px);
  }
}
.shake-lvl-1 {
  animation: shake-1 0.2s infinite linear;
}
.shake-lvl-2 {
  animation: shake-2 0.1s infinite linear;
}
.shake-lvl-3 {
  animation: shake-3 0.05s infinite linear;
}
.shake-lvl-4 {
  animation: shake-4 0.05s infinite linear;
}
