/* =============================================
   SINHALA KEYBOARD APP — Premium Dark UI
   ============================================= */

:root {
  --bg-primary: #070714;
  --bg-secondary: #0f0c29;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(147, 51, 234, 0.4);

  --accent-purple: #a855f7;
  --accent-violet: #7c3aed;
  --accent-cyan: #22d3ee;
  --accent-pink: #ec4899;
  --accent-gold: #fbbf24;

  --text-primary: #f0f0ff;
  --text-secondary: rgba(240, 240, 255, 0.6);
  --text-muted: rgba(240, 240, 255, 0.35);

  --key-bg: rgba(255, 255, 255, 0.07);
  --key-bg-active: rgba(147, 51, 234, 0.5);
  --key-border: rgba(255, 255, 255, 0.12);
  --key-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-main: 'Inter', sans-serif;
  --font-si: 'Noto Sans Sinhala', sans-serif;

  --transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: all 0.15s ease;
}

/* ── RESET & BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── ANIMATED BG PARTICLES ── */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float-up var(--dur, 8s) var(--delay, 0s) infinite ease-in-out;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.2;
  }

  100% {
    opacity: 0;
    transform: translateY(-20vh) scale(1.5) rotate(360deg);
  }
}

/* ── HEADER ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(7, 7, 20, 0.85);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-image {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.logo-title {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--accent-purple);
}

.logo-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.lang-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-btn {
  padding: 8px 18px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.15);
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-purple));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

/* ── MAIN CONTENT ── */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── HERO ── */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ── DUAL PANEL ── */
.dual-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 40px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition-fast);
  backdrop-filter: blur(10px);
}

.panel-english {
  border-color: rgba(34, 211, 238, 0.25);
}

.panel-english:hover {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.08);
}

.panel-sinhala {
  border-color: rgba(168, 85, 247, 0.3);
}

.panel-sinhala:hover {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.12);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-icon {
  font-size: 1.1rem;
}

.panel-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  flex: 1;
}

.panel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-badge.sinhala {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple);
}

.panel-text {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
  min-height: 60px;
}

.panel-text.sinhala-font {
  font-family: var(--font-si);
  font-size: 1.55rem;
}

.panel-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
}

.arrow-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse-arrow 2s infinite ease-in-out;
}

@keyframes pulse-arrow {

  0%,
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }

  50% {
    transform: translateX(6px) scale(1.1);
    opacity: 0.7;
  }
}

/* ── KEYBOARD ── */
.keyboard-section {
  margin-bottom: 60px;
}

.keyboard-wrapper {
  background-color: rgba(10, 8, 30, 0.9);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(168, 85, 247, 0.1) inset;
  backdrop-filter: blur(20px);
  transition: background-image 0.3s ease;
}

/* Top Bar */
.keyboard-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(168, 85, 247, 0.1);
  border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.active-lang-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-purple);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: blink 1.5s infinite ease-in-out;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

.suggestion-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.suggestion-chip {
  padding: 4px 14px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-si);
}

.suggestion-chip:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--accent-purple);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.topbar-icon-btn:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--accent-purple);
  transform: scale(1.1);
}

/* Input Row */
.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.main-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1.05rem;
  line-height: 1.6;
  resize: none;
  caret-color: var(--accent-purple);
}

.main-textarea::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  margin-top: 2px;
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  transform: scale(1.1) rotate(90deg);
}

/* Key Rows */
.keyboard-keys {
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.key {
  position: relative;
  min-width: 36px;
  height: 46px;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  box-shadow: var(--key-shadow);
  flex: 1;
  max-width: 48px;
}

.key:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--accent-purple);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3);
  z-index: 2;
}

.key:active,
.key.pressed {
  background: var(--key-bg-active);
  transform: translateY(1px) scale(0.96);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.08s ease;
}

.key-si {
  font-family: var(--font-si);
  font-size: 0.65rem;
  color: var(--accent-purple);
  font-weight: 600;
  line-height: 1;
  margin-top: 1px;
}

.key-wide {
  flex: 1.6;
  max-width: 70px;
  font-size: 0.8rem;
}

.key-space {
  flex: 4;
  max-width: 280px;
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.key-emoji {
  flex: 1;
  max-width: 48px;
  font-size: 1.1rem;
}

/* ── REFERENCE CHART ── */
.reference-section {
  margin-bottom: 60px;
}

.section-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.chart-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  transition: var(--transition);
  cursor: default;
}

.chart-item:hover {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.1);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.2);
}

.chart-en {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 6px;
}

.chart-si {
  font-family: var(--font-si);
  font-size: 1.6rem;
  color: var(--text-primary);
  display: block;
  line-height: 1.2;
}

.chart-phonetic {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* ── FEATURES ── */
.features-section {
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--border-glow);
  background: rgba(168, 85, 247, 0.07);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(168, 85, 247, 0.15);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── EMOJI PANEL ── */
.emoji-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: min(500px, 100%);
  background: rgba(15, 12, 41, 0.97);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(30px);
  box-shadow: 0 -10px 60px rgba(0, 0, 0, 0.5);
}

.emoji-panel.open {
  transform: translateX(-50%) translateY(0);
}

.emoji-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.emoji-panel-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.emoji-panel-header button:hover {
  color: var(--text-primary);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-btn {
  font-size: 1.5rem;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: center;
}

.emoji-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.2);
}

/* ── SETTINGS OVERLAY ── */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(6px);
}

.settings-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.settings-panel {
  background: rgba(15, 12, 41, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: min(420px, 90vw);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-overlay.open .settings-panel {
  transform: scale(1);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.settings-header button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.settings-header button:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.settings-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row label:first-child {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.theme-options {
  display: flex;
  gap: 8px;
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.theme-swatch:hover {
  transform: scale(1.15);
}

.theme-swatch.active {
  border-color: var(--accent-purple);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #c0392b;
  border-radius: 100px;
  transition: background 0.3s ease, border-color 0.3s ease;
  border: 1px solid #e74c3c;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.toggle input:checked+.toggle-slider {
  background: #27ae60;
  border-color: #2ecc71;
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(22px);
  background: #fff;
}

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .dual-panel {
    grid-template-columns: 1fr;
  }

  .panel-divider {
    width: auto;
  }

  .arrow-icon {
    transform: rotate(90deg);
  }

  @keyframes pulse-arrow {

    0%,
    100% {
      transform: rotate(90deg) translateX(0);
    }

    50% {
      transform: rotate(90deg) translateX(6px);
    }
  }

  .key {
    min-width: 28px;
    height: 44px;
    font-size: 0.78rem;
  }

  .key-wide {
    max-width: 54px;
  }

  .key-space {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    justify-content: center;
  }

  .key {
    min-width: 24px;
    height: 40px;
    font-size: 0.7rem;
  }

  .key-si {
    display: none;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.4);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* ── SELECTION ── */
::selection {
  background: rgba(168, 85, 247, 0.3);
  color: var(--text-primary);
}

/* ── RIPPLE ANIMATION ── */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }

  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.5);
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  animation: ripple 0.5s linear;
  pointer-events: none;
}

/* ── SEASONAL & EVENT EFFECTS ── */
.seasonal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Crucial for not blocking clicks */
  z-index: 10;
  overflow: hidden;
  border-radius: inherit;
}

.falling-item {
  position: absolute;
  top: -30px;
  font-size: 1.5rem;
  animation: fall linear infinite;
  pointer-events: none;
  opacity: 0.8;
  z-index: 10;
  user-select: none;
}

@keyframes fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translateY(400px) rotate(360deg);
    opacity: 0;
  }
}

.lion-border-active {
  position: relative;
}

.lion-border-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid #ff9900;
  border-radius: inherit;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  animation: borderDraw 4s infinite;
}

@keyframes borderDraw {
  0% {
    opacity: 0;
    border-width: 0px;
  }

  20% {
    opacity: 1;
    border-width: 3px;
  }

  80% {
    opacity: 1;
    border-width: 3px;
  }

  100% {
    opacity: 0;
    border-width: 0px;
  }
}

.lion-runner {
  position: absolute;
  font-size: 1.5rem;
  z-index: 12;
  pointer-events: none;
  animation: runAround 6s linear infinite;
}

@keyframes runAround {
  0% {
    top: -10px;
    left: -10px;
    transform: scaleX(1);
  }

  25% {
    top: -10px;
    left: calc(100% - 15px);
    transform: scaleX(1);
  }

  26% {
    transform: scaleX(-1);
  }

  50% {
    top: calc(100% - 15px);
    left: calc(100% - 15px);
    transform: scaleX(-1);
  }

  75% {
    top: calc(100% - 15px);
    left: -10px;
    transform: scaleX(-1);
  }

  76% {
    transform: scaleX(1);
  }

  100% {
    top: -10px;
    left: -10px;
    transform: scaleX(1);
  }
}

/* ══════════════════════════════════════════════════════════
   ── LIQUID GLASS KEY STYLE (iPhone / iOS 26 style) ──
   Toggle via .liquid-glass class added to .key elements
   ══════════════════════════════════════════════════════════ */

/* Base liquid glass key */
.key.liquid-glass {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom-color: rgba(255, 255, 255, 0.15);
  border-right-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px) saturate(1.9) brightness(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.9) brightness(1.1);
  box-shadow:
    /* Inner top-left specular highlight */
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 1px 0 0 rgba(255, 255, 255, 0.25),
    /* Outer depth shadow */
    0 6px 20px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.3),
    /* Subtle purple glow */
    0 0 0 0.5px rgba(168, 85, 247, 0.15);
  position: relative;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.2s ease;
}

/* Rainbow specular shimmer stripe at top of the key */
.key.liquid-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.28) 0%,
      rgba(255, 255, 255, 0.10) 40%,
      transparent 100%);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

/* Iridescent / rainbow edge shimmer */
.key.liquid-glass::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
      rgba(168, 85, 247, 0.18) 0%,
      rgba(34, 211, 238, 0.10) 25%,
      rgba(236, 72, 153, 0.08) 50%,
      rgba(251, 191, 36, 0.06) 75%,
      transparent 100%);
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Make text sit above pseudo-elements */
.key.liquid-glass>* {
  position: relative;
  z-index: 2;
}

/* Hover: shimmer appears + slight lift */
.key.liquid-glass:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-3px) scale(1.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 1px 0 0 rgba(255, 255, 255, 0.35),
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(168, 85, 247, 0.35);
}

.key.liquid-glass:hover::after {
  opacity: 1;
}

/* Active / pressed: glass squishes inward */
.key.liquid-glass:active,
.key.liquid-glass.pressed {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(1px) scale(0.95);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.3),
    0 0 12px rgba(168, 85, 247, 0.2);
  transition: all 0.08s ease;
}

/* Special action keys (space, enter, backspace, shift) get a slightly tinted glass */
.key.liquid-glass.key-wide,
.key.liquid-glass.key-space {
  background: rgba(147, 51, 234, 0.18);
  border-color: rgba(168, 85, 247, 0.45);
}

.key.liquid-glass.key-wide:hover,
.key.liquid-glass.key-space:hover {
  background: rgba(147, 51, 234, 0.28);
  border-color: rgba(168, 85, 247, 0.7);
}

/* Number Row */
.key-row-num {
  display: none;
}

.key-row-num.visible {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.key.key-num {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
  max-width: 44px;
}

/* Settings section label */
.setting-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-purple);
  padding: 4px 0 0;
  margin-bottom: -8px;
}

/* Background image button inside settings */
.settings-bg-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.settings-bg-btn:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: var(--accent-purple);
  color: var(--text-primary);
}