/* Base Styles */
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f4f8;
  color: #333;
  margin: 0;
  text-align: center;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Header Section */
header {
  width: 100%;
  max-width: 1200px;
  margin-bottom: 30px;
}

/* Main Content */
.main-content {
  width: 100%;
  max-width: 1200px;
  flex: 1;
}

.intro-text {
  max-width: 700px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

/* Actions Section */
.actions-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.action-container { margin: 10px; text-align: center; }

.action-btn {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: transform 0.8s ease;
  transform-style: preserve-3d;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.result { margin-top: 10px; }
.result-text { font-size: 20px; margin-top: 5px; }

/* Coin styles */
#coin-animation { display: none; }
#coin-btn { border-radius: 50%; background: linear-gradient(145deg, #ffd700, #e5c100); }

/* Dice styles */
#dice-animation { display: none; }
#dice-btn {
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 2px solid #e0e0e0;
  color: #333;
  border-radius: 15px;
  position: relative;
  perspective: 500px;
}

/* RPS button */
#rps-btn {
  padding: 0;
  width: 150px;
  height: 150px;
  background: linear-gradient(145deg, #6a9be6, #4a7abc);
}

/* Animation containers */
.coin-container,
.dice-container,
#rps-animation {
  width: 100px;
  height: 100px;
  perspective: 1000px;
  margin: 0 auto;
}

.coin, .dice {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.2s ease-out;
}

.coin.flipping { animation: flipCoin 0.8s linear infinite; }
.dice.rolling { animation: rollDice 0.8s linear infinite; }

@keyframes flipCoin {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(1800deg); }
}

@keyframes rollDice {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

.coin-face, .dice-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.coin-face.tails { transform: rotateY(180deg); }
.action-btn.flip { transform: rotateY(1800deg); }
.action-btn.roll { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }

/* Dice dots */
#dice-btn::before, #dice-btn::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: #333;
  border-radius: 50%;
}

#dice-btn::before { top: 30px; left: 30px; }
#dice-btn::after { bottom: 30px; right: 30px; }

/* Additional Tools Section */
.additional-tools {
  background-color: #fff;
  border-radius: 10px;
  padding: 30px;
  margin: 0 auto 40px;
  max-width: 900px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
  margin-bottom: 40px;
}

.tool-card {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.tool-card h3 {
  margin-top: 0;
  color: #4361ee;
}

.tool-card p {
  margin-bottom: 15px;
  font-size: 14px;
  color: #6c757d;
}

.tool-link {
  display: inline-block;
  padding: 8px 16px;
  background-color: #4361ee;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.tool-link:hover {
  background-color: #3a56d4;
}

/* All Tools Section */
.all-tools-heading {
  margin-top: 50px;
  border-top: 1px solid #e0e0e0;
  padding-top: 30px;
  color: #333;
  font-size: 26px;
}

.tools-section {
  margin-bottom: 40px;
}

.category-title {
  color: #333;
  font-size: 22px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
  text-align: left;
}

.tools-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.tool-item-card {
  display: flex;
  align-items: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 10px;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  border: 1px solid #e0e0e0;
}

.tool-item-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
  border-color: #4361ee;
}

.tool-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  margin-right: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  background-color: #f0f0f0;
  flex-shrink: 0;
}

.tool-item-content {
  flex: 1;
  text-align: left;
}

.tool-item-card h4 {
  margin: 0 0 5px 0;
  color: #4361ee;
  font-size: 16px;
}

.tool-item-card p {
  margin: 0;
  font-size: 14px;
  color: #6c757d;
}

/* Tool icon specific styles */
.number-icon {
  background-color: #e3f2fd;
  color: #1976d2;
}

.dice-icon {
  background-color: #e8f5e9;
  color: #388e3c;
  font-size: 26px;
}

.raffle-icon, .coin-icon, .fantasy-icon, .pet-icon, 
.quote-icon, .isbn-icon, .music-icon, .counter-icon,
.email-icon, .password-icon, .address-icon {
  background-color: #fff;
  font-size: 24px;
}

.yesno-icon {
  background-color: #fff3e0;
  color: #e65100;
}

.letter-icon {
  background-color: #e8eaf6;
  color: #3949ab;
}

.word-icon {
  background-color: #f3e5f5;
  color: #7b1fa2;
  font-size: 16px;
}

.barcode-icon {
  background-color: #263238;
  color: #fff;
  letter-spacing: -3px;
}

.color-icon {
  border: 1px solid #ddd;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tools-card-grid {
    grid-template-columns: 1fr;
  }
  
  .tool-item-card {
    padding: 12px;
  }
  
  .tool-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* Footer */
footer {
  width: 100%;
  max-width: 1200px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 14px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-links {
  margin: 15px 0;
}

.footer-links a {
  color: #4361ee;
  text-decoration: none;
  margin: 0 10px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #3a56d4;
  text-decoration: underline;
}

/* Breadcrumb Navigation */
.breadcrumb {
  background-color: #f8f9fa;
  border-radius: 4px;
  padding: 10px 15px;
  margin-bottom: 20px;
  font-size: 14px;
  text-align: left;
  width: 100%;
  max-width: 1200px;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: inline;
}

.breadcrumb li+li:before {
  content: "›";
  padding: 0 8px;
  color: #6c757d;
}

.breadcrumb a {
  color: #4361ee;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .active {
  color: #6c757d;
}

/* Lazy Loading */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazy-load.loaded {
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .additional-tools {
    padding: 20px;
  }
}