* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(to bottom right, #0f172a, #1e293b, #0f172a);
  color: white;
  min-height: 100vh;
  padding: 0;
}

.site-header {
  background-color: #111827;
  padding: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.125rem;
}

.header-link:hover {
  opacity: 0.8;
}

.header-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 1rem 1rem 1rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
  padding-top: 2rem;
}

.header h1 {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.header p {
  color: #94a3b8;
  font-size: 1.125rem;
}

.main-card {
  background: #1e293b;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.dice-container {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dice {
  width: 6rem;
  height: 6rem;
  background: white;
  color: #0f172a;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.875rem;
  font-weight: bold;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  transition: all 0.3s;
}

.dice.bouncing {
  animation: bounce 0.5s infinite;
}

.dice.confirmed {
  box-shadow: 0 0 0 4px #22c55e;
  transform: scale(1.05);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.dice-labels {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
}

.dice-label {
  width: 6rem;
}

.status-text {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #cbd5e1;
  font-size: 1.125rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.result-card {
  text-align: center;
  margin-bottom: 2rem;
  background: linear-gradient(to right, #334155, #475569);
  border-radius: 0.75rem;
  padding: 1.5rem;
  animation: fadeIn 0.5s;
  position: relative;
  transition: all 0.3s;
}

.result-card.new-unlock {
  animation: newUnlockCard 1s ease-out, fadeIn 0.5s;
  background: linear-gradient(45deg, #1e293b, #0f172a, #1e293b);
  background-size: 200% 200%;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5), 0 0 60px rgba(139, 92, 246, 0.3);
}

@keyframes newUnlockCard {
  0% { 
    transform: scale(0.9);
    box-shadow: 0 0 0px rgba(59, 130, 246, 0);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.8), 0 0 100px rgba(139, 92, 246, 0.6);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5), 0 0 60px rgba(139, 92, 246, 0.3);
  }
}

.new-badge {
  display: inline-block;
  background: linear-gradient(45deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ef4444);
  background-size: 300% 300%;
  color: white;
  font-weight: bold;
  font-size: 1.25rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
  animation: newBadgeAnimation 2s ease-in-out infinite, gradientShift 3s ease infinite;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.4), 0 0 60px rgba(239, 68, 68, 0.2);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  transform-origin: center;
}

@keyframes newBadgeAnimation {
  0%, 100% { 
    transform: scale(1) rotate(0deg); 
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.4);
  }
  25% { 
    transform: scale(1.2) rotate(-5deg); 
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.8), 0 0 60px rgba(245, 158, 11, 0.6);
  }
  50% { 
    transform: scale(1.1) rotate(5deg); 
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.8), 0 0 70px rgba(16, 185, 129, 0.6);
  }
  75% { 
    transform: scale(1.15) rotate(-3deg); 
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8), 0 0 60px rgba(59, 130, 246, 0.6);
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-label {
  font-size: 0.875rem;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.result-position {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
}

.result-score {
  font-size: 1.25rem;
  color: #cbd5e1;
}

.rank-gold { color: #eab308; }
.rank-orange { color: #f97316; }
.rank-blue { color: #3b82f6; }
.rank-green { color: #22c55e; }
.rank-gray { color: #9ca3af; }

.button-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(to right, #2563eb, #1d4ed8);
  color: white;
  font-weight: bold;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  background: linear-gradient(to right, #1d4ed8, #1e40af);
  transform: scale(1.05);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.share-btn {
  background: linear-gradient(to right, #16a34a, #15803d);
}

button.share-btn:hover {
  background: linear-gradient(to right, #15803d, #166534);
}

.history-card {
  background: #1e293b;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.history-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.history-item {
  background: #334155;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-position {
  font-weight: bold;
  font-size: 1.125rem;
}

.history-score {
  color: #cbd5e1;
}

.rules-card {
  background: #1e293b;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  font-size: 0.875rem;
  color: #cbd5e1;
}

.rules-card h3 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
  color: white;
}

.rules-card h4 {
  font-weight: bold;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: white;
}

.rules-card ul {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.rules-card li {
  margin-bottom: 0.5rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: 0.75rem;
}

.collection-card {
  background: #1e293b;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.collection-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.stats-container {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.completion-rate,
.total-points {
  font-size: 1.125rem;
  color: #cbd5e1;
  font-weight: bold;
}

.completion-rate span:last-child {
  color: #22c55e;
}

.total-points span:last-child {
  color: #f59e0b;
}

.position-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.position-item {
  background: #334155;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.position-item.locked {
  opacity: 0.4;
  color: #64748b;
}

.position-item.unlocked {
  border-color: #22c55e;
  background: linear-gradient(135deg, #334155, #1e293b);
}

.position-item.unlocked .position-abbr {
  color: #22c55e;
}

.position-item.unlocked .position-name {
  color: #fff;
  font-weight: bold;
}

.position-abbr {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: #94a3b8;
}

.position-name {
  font-size: 0.75rem;
  color: #64748b;
}

.position-rank {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.position-stats {
  font-size: 0.7rem;
  color: #3b82f6;
  margin-top: 0.25rem;
}

.position-date {
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 0.125rem;
}

.hidden {
  display: none;
}