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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

/* Header */
header {
  background: linear-gradient(135deg, #6c3ce0, #3b82f6, #06b6d4);
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10%, 10%); }
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  position: relative;
}

.header-logo {
  height: 120px;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.3));
}

.header-text {
  text-align: left;
}

.header-text h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-text p {
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

@media (max-width: 600px) {
  .header-brand { flex-direction: column; gap: 0.75rem; }
  .header-logo { height: 80px; }
  .header-text { text-align: center; }
  .header-text h1 { font-size: 1.8rem; }
}

nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  position: relative;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1.5rem;
  border-radius: 2rem;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
  font-weight: 500;
}

nav a:hover, nav a.active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.6);
}

/* Main content */
main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Cards */
.card {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 60, 224, 0.15);
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #b0b0c0;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #12121f;
  border: 1px solid #3a3a5a;
  border-radius: 0.5rem;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #6c3ce0;
  box-shadow: 0 0 0 3px rgba(108, 60, 224, 0.2);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #6c3ce0, #3b82f6);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(108, 60, 224, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-redeem {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.btn-redeem:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-redeem:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Points display */
.points-banner {
  display: none;
  background: linear-gradient(135deg, #1a1a2e, #2a1a4e);
  border: 1px solid #6c3ce0;
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.points-banner.visible {
  display: block;
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.points-banner .points-number {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #ef4444, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pointsPulse 2s ease-in-out infinite;
}

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

.points-banner .points-label {
  font-size: 0.9rem;
  color: #a0a0b0;
  margin-top: 0.25rem;
}

.points-earned {
  display: inline-block;
  background: #059669;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Solutions */
#solutions-container {
  display: none;
}

#solutions-container.visible {
  display: block;
  animation: slideDown 0.5s ease;
}

.solution-card {
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.solution-card .solution-rank {
  position: absolute;
  top: -0.75rem;
  left: 1rem;
  background: linear-gradient(135deg, #6c3ce0, #3b82f6);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.solution-card h3 {
  margin-bottom: 0.75rem;
  color: #e0e0f0;
  padding-left: 1.5rem;
}

.solution-card .difficulty {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.difficulty-easy { background: #065f46; color: #6ee7b7; }
.difficulty-medium { background: #78350f; color: #fbbf24; }
.difficulty-advanced { background: #7f1d1d; color: #fca5a5; }

.solution-card ol {
  padding-left: 1.5rem;
  line-height: 1.8;
  color: #b0b0c0;
}

.solution-card ol li {
  margin-bottom: 0.25rem;
}

/* Loading spinner */
.loading {
  display: none;
  text-align: center;
  padding: 2rem;
}

.loading.visible {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #2a2a4a;
  border-top-color: #6c3ce0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: #a0a0b0;
  font-size: 0.95rem;
}

/* Store page */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.merch-card {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.merch-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(108, 60, 224, 0.15);
}

.merch-card .merch-emoji {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.merch-card h3 {
  color: #e0e0f0;
  margin-bottom: 0.5rem;
}

.merch-card .merch-points {
  color: #f59e0b;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Balance checker */
.balance-section {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

.balance-section input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: #12121f;
  border: 1px solid #3a3a5a;
  border-radius: 0.5rem;
  color: #e0e0e0;
  font-size: 1rem;
}

.balance-section input:focus {
  outline: none;
  border-color: #6c3ce0;
}

.balance-section .btn {
  white-space: nowrap;
}

/* Notification toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  color: white;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 1000;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { background: #059669; }
.toast-error { background: #dc2626; }

/* History */
.history-item {
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.history-item .history-date {
  font-size: 0.8rem;
  color: #707080;
}

.history-item .history-problem {
  margin-top: 0.25rem;
  color: #c0c0d0;
}

/* Responsive */
@media (max-width: 600px) {
  header h1 { font-size: 2rem; }
  main { padding: 0 1rem; }
  .store-grid { grid-template-columns: 1fr; }
  nav { flex-direction: column; align-items: center; gap: 0.75rem; }
}
