.tool-container {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tool-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.4rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.tool-box {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.tool-box.hidden {
  display: none;
}

/* ================== Real Dice Styling ================== */
.dice-wrapper {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 600px;
}

.dice-face {
  width: 110px;
  height: 110px;
  background: #f8fafc;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.9), inset 0 -4px 6px rgba(0, 0, 0, 0.15);
  border: 2px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 14px;
  box-sizing: border-box;
  transition: transform 0.2s ease;
}

.dice-dot {
  width: 18px;
  height: 18px;
  background: #1e293b;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6);
}

.dice-dot.center-red {
  background: #ef4444;
  width: 24px;
  height: 24px;
}

.rolling {
  animation: diceRoll 0.6s ease-in-out infinite alternate;
}

@keyframes diceRoll {
  0% { transform: rotate(-25deg) scale(1.1) rotateX(20deg); }
  50% { transform: rotate(15deg) scale(0.95) rotateY(30deg); }
  100% { transform: rotate(30deg) scale(1.1) rotateX(-20deg); }
}

/* ================== Real Coin Styling ================== */
.coin-wrapper {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 800px;
}

.coin-disc {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.4s ease;
}

.coin-disc.heads {
  background: radial-gradient(circle at 35% 35%, #fef08a, #eab308, #ca8a04);
  border: 4px solid #fef9c3;
}

.coin-disc.tails {
  background: radial-gradient(circle at 35% 35%, #e2e8f0, #94a3b8, #64748b);
  border: 4px solid #f8fafc;
}

.coin-inner {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.coin-symbol {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 2px;
}

.coin-text {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.flipping {
  animation: coinFlipAnim 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes coinFlipAnim {
  0% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(900deg) scale(1.3) translateY(-30px); }
  100% { transform: rotateY(1800deg) scale(1) translateY(0); }
}

/* ================== Controls & Result ================== */
.action-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.9rem 2.2rem;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.action-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.result-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================== Mobile Responsiveness (360px ~ 480px) ================== */
@media (max-width: 640px) {
  .tool-container {
    padding: 1.25rem 0.75rem 2.5rem;
  }

  .tool-header {
    margin-bottom: 1.25rem;
  }

  .tool-header h2 {
    font-size: 1.5rem;
  }

  .tool-header p {
    font-size: 0.88rem;
  }

  .tab-buttons {
    width: 100%;
    margin-bottom: 1.25rem;
  }

  .tab-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tool-box {
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  .action-btn {
    min-height: 48px;
    width: 100%;
    max-width: 280px;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .result-text {
    font-size: 1.15rem;
    text-align: center;
  }
}

@media (max-width: 375px) {
  .tool-box {
    padding: 1.5rem 0.75rem;
  }

  .dice-face {
    width: 95px;
    height: 95px;
    padding: 10px;
  }

  .dice-dot {
    width: 15px;
    height: 15px;
  }

  .dice-dot.center-red {
    width: 20px;
    height: 20px;
  }

  .coin-disc {
    width: 100px;
    height: 100px;
  }

  .coin-inner {
    width: 80px;
    height: 80px;
  }

  .coin-symbol {
    font-size: 2rem;
  }
}

