:root {
  --primary: #ff6b81;
  --primary-light: #ff8fa3;
  --primary-dark: #e94560;
  --secondary: #4ecca3;
  --secondary-light: #6ff5c8;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --text-light: #eee;
  --text-muted: #aaa;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text-light);
  min-height: 100vh;
  overflow: hidden;
  touch-action: none;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(22, 33, 62, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

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

.logo-icon {
  font-size: 24px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.logo h1 {
  font-size: 20px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Card Stack */
.card-stack-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.card-stack {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 480px;
  perspective: 1000px;
}

.card {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  transition: transform 0.1s ease-out, box-shadow 0.3s ease;
  will-change: transform;
  touch-action: none;
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  transition: none;
}

.card.swipe-left {
  animation: swipeLeft 0.5s forwards;
}

.card.swipe-right {
  animation: swipeRight 0.5s forwards;
}

.card.bounce-back {
  animation: bounceBack 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes swipeLeft {
  0% { transform: translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateX(-150%) rotate(-30deg); opacity: 0; }
}

@keyframes swipeRight {
  0% { transform: translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateX(150%) rotate(30deg); opacity: 0; }
}

@keyframes bounceBack {
  0% { transform: translateX(var(--drag-x)) rotate(var(--drag-rotate)); }
  50% { transform: translateX(calc(var(--drag-x) * 0.3)) rotate(calc(var(--drag-rotate) * 0.3)); }
  100% { transform: translateX(0) rotate(0); }
}

.card-image {
  width: 100%;
  height: 70%;
  object-fit: cover;
  pointer-events: none;
}

.card-info {
  padding: 16px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-card) 20%);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.card-name {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-age {
  color: var(--text-muted);
  font-size: 16px;
}

.card-bio {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  padding: 4px 10px;
  background: rgba(255, 107, 129, 0.2);
  border: 1px solid rgba(255, 107, 129, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--primary-light);
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.card-overlay.show {
  opacity: 1;
}

.overlay-badge {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 24px;
  font-weight: bold;
  transform: rotate(-15deg);
}

.overlay-badge.like {
  background: rgba(78, 204, 163, 0.8);
  border: 3px solid var(--secondary);
  color: white;
}

.overlay-badge.skip {
  background: rgba(233, 69, 96, 0.8);
  border: 3px solid var(--primary-dark);
  color: white;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: rgba(22, 33, 62, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
  transform: scale(1.1);
}

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

.btn-skip {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: white;
}

.btn-rewind {
  background: linear-gradient(135deg, #ffd93d, #f9c846);
  color: #333;
  width: 48px;
  height: 48px;
}

.btn-like {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  color: white;
}

.btn-superlike {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  color: white;
  width: 48px;
  height: 48px;
}

.btn-boost {
  background: linear-gradient(135deg, #a29bfe, #6c5ce7);
  color: white;
  width: 48px;
  height: 48px;
}

/* Buttons */
.btn-primary, .btn-secondary {
  padding: 12px 24px;
  border-radius: 25px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 107, 129, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Profile Modal */
.profile-modal {
  width: 400px;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-modal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.profile-modal-info h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.profile-modal-age {
  color: var(--text-muted);
}

.profile-modal-body {
  padding: 20px;
}

.profile-section {
  margin-bottom: 20px;
}

.profile-section h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--primary-light);
}

.profile-section p {
  color: var(--text-muted);
  line-height: 1.6;
}

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

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  color: var(--text-muted);
}

.info-value {
  font-size: 14px;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.photo-gallery img:hover {
  transform: scale(1.05);
}

/* Match Modal */
.match-modal {
  width: 360px;
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.match-animation {
  margin-bottom: 20px;
}

.hearts-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.heart {
  font-size: 32px;
  animation: heartBeat 1.5s infinite;
}

.heart:nth-child(2) {
  animation-delay: 0.2s;
}

.heart:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
}

.match-title {
  font-size: 28px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.match-subtitle {
  color: var(--text-muted);
}

.match-avatars {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 24px 0;
}

.match-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.match-heart {
  font-size: 32px;
  animation: pulse 1s infinite;
}

.match-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Matches Modal */
.matches-modal {
  width: 400px;
  max-height: 80vh;
}

.matches-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.matches-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.match-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.match-item-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.match-item-info {
  flex: 1;
}

.match-item-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.match-item-bio {
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
  .card-stack {
    height: 420px;
  }
  
  .profile-modal, .match-modal, .matches-modal {
    width: 95%;
  }
  
  .action-btn {
    width: 50px;
    height: 50px;
  }
  
  .btn-rewind, .btn-superlike, .btn-boost {
    width: 44px;
    height: 44px;
  }
}
