@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #121420;
  --accent-pink: #ff007f;
  --accent-blue: #00f0ff;
  --accent-purple: #9d4edd;
  --text-main: #f8f9fa;
  --text-muted: #8e94a5;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-glow: rgba(0, 240, 255, 0.15);
  --active-glow: rgba(255, 0, 127, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  
  /* Bloqueia seleção e cópia de texto na tela para melhor UX mobile */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Background Aurora Effects */
body::before, body::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.4;
  pointer-events: none;
}

body::before {
  top: -50px;
  left: -50px;
  background: var(--accent-pink);
}

body::after {
  bottom: -50px;
  right: -50px;
  background: var(--accent-blue);
}

header {
  padding: 24px 20px 12px;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 11, 16, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 20px;
}

/* Quick Bar / Stop Button */
.control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  gap: 10px;
}

.btn-stop {
  flex: 1.2;
  background: linear-gradient(135deg, var(--accent-pink), #e0006c);
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-stop:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(255, 0, 127, 0.2);
}

.btn-boost {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-boost.boost-level-1 {
  background: linear-gradient(135deg, var(--accent-purple), #7b2cbf);
  border-color: var(--accent-purple);
  box-shadow: 0 4px 12px rgba(157, 78, 221, 0.3);
}

.btn-boost.boost-level-2 {
  background: linear-gradient(135deg, #ff9e00, #ff6000);
  border-color: #ff9e00;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 158, 0, 0.4);
  animation: pulse-glow-boost 1s infinite alternate;
}

@keyframes pulse-glow-boost {
  from { box-shadow: 0 0 10px rgba(255, 158, 0, 0.3); }
  to { box-shadow: 0 0 20px rgba(255, 158, 0, 0.6); }
}

.btn-boost:active {
  transform: scale(0.95);
}

.btn-action {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-action:active {
  background: rgba(255, 255, 255, 0.1);
}

/* Meme Grid */
main {
  flex: 1;
  padding: 10px 20px 40px;
}

.meme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

/* Meme Card / Button */
.meme-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.meme-card:active {
  transform: scale(0.95);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px var(--glass-glow);
}

.meme-card.playing {
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px var(--active-glow);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 8px rgba(255, 0, 127, 0.2); }
  50% { box-shadow: 0 0 15px rgba(255, 0, 127, 0.5); }
  100% { box-shadow: 0 0 8px rgba(255, 0, 127, 0.2); }
}

.image-container {
  width: 100%;
  aspect-ratio: 1.2; /* Ligeiramente retangular para otimizar espaço vertical */
  border-radius: 8px;
  overflow: hidden;
  background: #171926;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meme-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meme-emoji-fallback {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.meme-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 100%;
  margin-top: 2px;
}

.btn-edit-card {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  font-size: 0.65rem;
  opacity: 0.6;
}

.btn-edit-card:active {
  transform: scale(0.9);
  background: var(--accent-purple);
}

/* Modal de Customização */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: flex-end; /* Mobile friendly bottom sheet look */
}

.modal.active {
  display: flex;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content {
  background: var(--bg-secondary);
  width: 100%;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px;
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

input[type="text"] {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  
  /* Permite seleção de texto nos inputs para que o usuário consiga digitar e editar */
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

input[type="text"]:focus {
  border-color: var(--accent-blue);
}

.emoji-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.emoji-option {
  font-size: 1.8rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s;
}

.emoji-option:active, .emoji-option.selected {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-blue);
  transform: scale(1.1);
}

.audio-preview-section {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.02);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  margin-bottom: 20px;
}

.btn-preview-play {
  background: var(--accent-blue);
  border: none;
  color: var(--bg-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-cancel {
  flex: 1;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-save {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-blue), #00b0ff);
  border: none;
  color: var(--bg-primary);
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
}

/* Install PWA Prompt Banner */
.install-banner {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--bg-secondary), #171926);
  border: 1px solid var(--accent-blue);
  border-radius: 16px;
  padding: 16px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0, 240, 255, 0.15);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.install-banner-text {
  flex: 1;
}

.install-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.install-banner-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-install {
  background: var(--accent-blue);
  color: var(--bg-primary);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-close-banner {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
